@civic/auth 0.9.0-beta.1 → 0.9.0-beta.2

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 (45) hide show
  1. package/dist/reactjs/core/GlobalAuthManager.d.ts.map +1 -1
  2. package/dist/reactjs/core/GlobalAuthManager.js +2 -1
  3. package/dist/reactjs/core/GlobalAuthManager.js.map +1 -1
  4. package/dist/reactjs/providers/CivicAuthContext.d.ts.map +1 -1
  5. package/dist/reactjs/providers/CivicAuthContext.js +2 -1
  6. package/dist/reactjs/providers/CivicAuthContext.js.map +1 -1
  7. package/dist/server/ServerAuthenticationResolver.d.ts.map +1 -1
  8. package/dist/server/ServerAuthenticationResolver.js +4 -0
  9. package/dist/server/ServerAuthenticationResolver.js.map +1 -1
  10. package/dist/server/config.d.ts +11 -3
  11. package/dist/server/config.d.ts.map +1 -1
  12. package/dist/server/config.js.map +1 -1
  13. package/dist/server/login.d.ts.map +1 -1
  14. package/dist/server/login.js +5 -0
  15. package/dist/server/login.js.map +1 -1
  16. package/dist/server/logout.d.ts.map +1 -1
  17. package/dist/server/logout.js +5 -0
  18. package/dist/server/logout.js.map +1 -1
  19. package/dist/server/session.d.ts.map +1 -1
  20. package/dist/server/session.js +4 -0
  21. package/dist/server/session.js.map +1 -1
  22. package/dist/shared/lib/AuthenticationRefresherImpl.d.ts.map +1 -1
  23. package/dist/shared/lib/AuthenticationRefresherImpl.js +4 -0
  24. package/dist/shared/lib/AuthenticationRefresherImpl.js.map +1 -1
  25. package/dist/shared/version.d.ts +1 -1
  26. package/dist/shared/version.js +1 -1
  27. package/dist/shared/version.js.map +1 -1
  28. package/dist/vanillajs/auth/CivicAuth.d.ts.map +1 -1
  29. package/dist/vanillajs/auth/CivicAuth.js +35 -9
  30. package/dist/vanillajs/auth/CivicAuth.js.map +1 -1
  31. package/dist/vanillajs/auth/config/ConfigProcessor.js +1 -1
  32. package/dist/vanillajs/auth/config/ConfigProcessor.js.map +1 -1
  33. package/dist/vanillajs/auth/types/AuthTypes.d.ts +33 -13
  34. package/dist/vanillajs/auth/types/AuthTypes.d.ts.map +1 -1
  35. package/dist/vanillajs/auth/types/AuthTypes.js +2 -1
  36. package/dist/vanillajs/auth/types/AuthTypes.js.map +1 -1
  37. package/dist/vanillajs/iframe/IframeManager.d.ts +4 -0
  38. package/dist/vanillajs/iframe/IframeManager.d.ts.map +1 -1
  39. package/dist/vanillajs/iframe/IframeManager.js +20 -7
  40. package/dist/vanillajs/iframe/IframeManager.js.map +1 -1
  41. package/dist/vanillajs/iframe/IframeResizer.d.ts +4 -1
  42. package/dist/vanillajs/iframe/IframeResizer.d.ts.map +1 -1
  43. package/dist/vanillajs/iframe/IframeResizer.js +30 -1
  44. package/dist/vanillajs/iframe/IframeResizer.js.map +1 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"IframeManager.d.ts","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeManager.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAW;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAA2B;IACvE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAe;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA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AEG;IACH,OAAO,CAAC,0BAA0B;IAMlC;;OAEG;IACI,iBAAiB,IAAI,OAAO;IAInC;;OAEG;IACI,eAAe,IAAI,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;;OAGG;IACI,oBAAoB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI;IAI/C,gCAAgC,IAAI,IAAI;CAgDhD"}
@@ -144,7 +144,7 @@ export class IframeManager {
144
144
  this.setupEmbeddedIframeForPreload();
145
145
  }
146
146
  // Initialize resizer - this will handle all the message-based resizing
147
- this.resizer = new CivicIframeResizer(this.iframe, this.container);
147
+ this.resizer = new CivicIframeResizer(this.iframe, this.container, () => this.isShimmerActive());
148
148
  // Mark as preloaded
149
149
  this.isPreloaded = true;
150
150
  this.preloadUrl = url;
@@ -224,7 +224,7 @@ export class IframeManager {
224
224
  this.setupEmbeddedIframe();
225
225
  }
226
226
  // Initialize resizer - this will handle all the message-based resizing
227
- this.resizer = new CivicIframeResizer(this.iframe, this.container);
227
+ this.resizer = new CivicIframeResizer(this.iframe, this.container, () => this.isShimmerActive());
228
228
  return this.iframe;
229
229
  }
230
230
  /**
@@ -309,7 +309,11 @@ export class IframeManager {
309
309
  // wait a bit to ensure any initial loading is complete
310
310
  // to give the login-app time to send any post message signals
311
311
  setTimeout(() => {
312
+ // Mark iframe as loaded FIRST to disable shimmer blocking
312
313
  this.markIframeAsLoaded();
314
+ // Replay any blocked resize messages now that shimmer is inactive
315
+ this.resizer?.replayBlockedMessages();
316
+ this.resizer?.resize();
313
317
  }, WAIT_FOR_LOGIN_APP_BROWSER_DETECTION_TIMEOUT);
314
318
  }
315
319
  }
@@ -507,14 +511,17 @@ export class IframeManager {
507
511
  }
508
512
  hideShimmerLoader() {
509
513
  if (this.shimmerLoader && this.shimmerLoader.parentNode) {
514
+ // Store reference for cleanup
515
+ const shimmerElement = this.shimmerLoader;
516
+ // Clear reference immediately to allow resize operations
517
+ this.shimmerLoader = null;
510
518
  // Add fade-out transition before removing
511
- this.shimmerLoader.style.opacity = "0";
512
- this.shimmerLoader.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;
519
+ shimmerElement.style.opacity = "0";
520
+ shimmerElement.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;
513
521
  // Remove after transition completes
514
522
  setTimeout(() => {
515
- if (this.shimmerLoader && this.shimmerLoader.parentNode) {
516
- this.shimmerLoader.parentNode.removeChild(this.shimmerLoader);
517
- this.shimmerLoader = null;
523
+ if (shimmerElement && shimmerElement.parentNode) {
524
+ shimmerElement.parentNode.removeChild(shimmerElement);
518
525
  }
519
526
  }, parseInt(IframeManager.TRANSITION_DURATION));
520
527
  }
@@ -773,6 +780,12 @@ export class IframeManager {
773
780
  getPreloadedUrl() {
774
781
  return this.preloadUrl;
775
782
  }
783
+ /**
784
+ * Check if shimmer loader is currently active/showing
785
+ */
786
+ isShimmerActive() {
787
+ return !this.isIframeLoaded || !!this.shimmerLoader;
788
+ }
776
789
  /**
777
790
  * Update the onClose handler for the iframe manager
778
791
  * This is useful when transitioning from preload to active authentication
@@ -1 +1 @@
1
- {"version":3,"file":"IframeManager.js","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,4CAA4C,EAAE,MAAM,gBAAgB,CAAC;AAW9E;;;GAGG;AACH,MAAM,OAAO,aAAa;IACxB,0CAA0C;IAClC,MAAM,CAAU,aAAa,GAAG,MAAM,CAAC;IACvC,MAAM,CAAU,WAAW,GAAG,OAAO,CAAC,CAAC,QAAQ;IAC/C,MAAM,CAAU,oBAAoB,GAAG,uBAAuB,CAAC;IAC/D,MAAM,CAAU,mBA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AI,CACd,mFAAmF,CACpF,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,cAAc,CAAC;QAEhE,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;YAErD,yBAAyB;YACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO,CAAC,EAAE,GAAG,8BAA8B,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG;;;;;;;;;;;;yBAYL,aAAa,CAAC,aAAa;;;OAG7C,CAAC;YAEF,gCAAgC;YAChC,aAAa,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;YAC1C,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAEnC,yBAAyB;YACzB,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;oBACvB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC1C,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACvD,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,qBAAqB;YAE9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC","sourcesContent":["import { CivicIframeResizer } from \"./IframeResizer.js\";\nimport {\n createIframeShimmerLoader,\n createCloseButton,\n} from \"../ui/LoadingComponents.js\";\nimport { createLogger } from \"../utils/logger.js\";\nimport { WAIT_FOR_LOGIN_APP_BROWSER_DETECTION_TIMEOUT } from \"@/constants.js\";\n\nexport interface IframeConfig {\n container: HTMLElement;\n displayMode: \"embedded\" | \"modal\";\n width?: string;\n height?: string;\n iframeId?: string;\n onClose?: () => void;\n}\n\n/**\n * IframeManager - Manages iframe visual presentation and DOM lifecycle\n * Handles styling, positioning, UI components, and iframe element creation/cleanup\n */\nexport class IframeManager {\n // Constants for styling and configuration\n private static readonly MODAL_Z_INDEX = \"1050\";\n private static readonly MODAL_WIDTH = \"20rem\"; // 320px\n private static readonly MODAL_BACKDROP_COLOR = \"rgba(17, 24, 39, 0.5)\";\n private static readonly MODAL_BACKDROP_BLUR = \"blur(4px)\";\n private static readonly BORDER_RADIUS = \"24px\";\n private static readonly TRANSITION_DURATION = \"250ms\";\n private static readonly MODAL_MIN_HEIGHT = \"26px\";\n private static readonly EMBEDDED_MIN_HEIGHT = \"225px\";\n private static readonly IFRAME_READY_DELAY = 100; // ms\n\n private iframe: HTMLIFrameElement | null = null;\n private container: HTMLElement;\n private resizer: CivicIframeResizer | null = null;\n private displayMode: \"embedded\" | \"modal\";\n private keydownHandler?: (event: KeyboardEvent) => void;\n private clickHandler?: (event: MouseEvent) => void;\n private iframeId: string;\n private onClose?: () => void;\n private shimmerLoader: HTMLElement | null = null;\n private closeButton: HTMLButtonElement | null = null;\n private isIframeLoaded = false;\n private iframeReadyMessageListener?: (event: MessageEvent) => void;\n private logger: ReturnType<typeof createLogger>;\n // Store references to wrapper elements for styling control\n private contentWrapper: HTMLElement | null = null;\n private iframeWrapper: HTMLElement | null = null;\n // Preloading support\n private isPreloaded = false;\n private preloadUrl: string | null = null;\n public static browserCorsFailsSilentlyUrl: string | null = null;\n\n public static handleBrowserCorsFailsSilently(url: string): void {\n // Store the URL that caused CORS failure for later reference\n IframeManager.browserCorsFailsSilentlyUrl = url;\n }\n\n constructor(config: IframeConfig) {\n // we aren't going to render the iframe if the browser fails silently as we're redirecting\n\n this.container = config.container;\n this.displayMode = config.displayMode;\n this.iframeId = config.iframeId || \"civic-auth-iframe\";\n this.onClose = config.onClose;\n this.logger = createLogger(\"iframe\");\n this.initializeContainer(config);\n this.setupKeyboardHandlers();\n }\n\n private initializeContainer(config: IframeConfig): void {\n if (this.displayMode === \"modal\") {\n this.applyModalStyles();\n return;\n }\n\n // Embedded mode\n this.container.style.position = \"relative\";\n this.container.style.width = config.width || \"auto\";\n this.container.style.height = config.height || \"auto\";\n this.container.style.backgroundColor = \"white\";\n this.container.style.borderRadius = IframeManager.BORDER_RADIUS;\n this.container.style.overflow = \"hidden\";\n this.container.style.transition = \"all 0.5s ease-in-out\";\n }\n\n /**\n * Applies modal backdrop styles to create a full-screen overlay\n * Uses !important to override any existing styles\n */\n private applyModalStyles(): void {\n const modalStyles = {\n position: \"fixed\",\n left: \"0\",\n top: \"0\",\n width: \"100vw\",\n height: \"100vh\",\n \"z-index\": IframeManager.MODAL_Z_INDEX,\n display: \"flex\",\n \"align-items\": \"center\",\n \"justify-content\": \"center\",\n \"background-color\": IframeManager.MODAL_BACKDROP_COLOR,\n \"backdrop-filter\": IframeManager.MODAL_BACKDROP_BLUR,\n opacity: \"1\",\n transition: `opacity ${IframeManager.TRANSITION_DURATION} ease`,\n // Reset any conflicting styles that might prevent modal from working\n margin: \"0\",\n padding: \"0\",\n border: \"none\",\n \"border-radius\": \"0\",\n \"min-height\": \"100vh\",\n };\n\n Object.entries(modalStyles).forEach(([property, value]) => {\n this.container.style.setProperty(property, value, \"important\");\n });\n }\n\n private setupKeyboardHandlers(): void {\n if (this.displayMode === \"modal\") {\n this.keydownHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n this.onClose?.();\n }\n };\n window.addEventListener(\"keydown\", this.keydownHandler);\n }\n }\n\n /**\n * Preloads an iframe in the background for instant display later\n * The iframe is created but kept completely hidden and non-interactable\n */\n public preloadIframe(url: string): HTMLIFrameElement {\n this.logger.debug(\"Preloading iframe in background\", { url });\n\n // Clean up any existing iframe content, but preserve container styles for modal mode\n this.cleanupIframeOnly();\n\n // Create new iframe for preloading\n this.iframe = document.createElement(\"iframe\");\n this.iframe.id = this.iframeId;\n this.iframe.src = url;\n this.iframe.setAttribute(\"data-testid\", \"civic-auth-iframe-with-resizer\");\n\n // Apply base iframe styles but keep it completely hidden for preloading\n this.applyIframeStyles();\n\n // Make iframe completely invisible and non-interactable during preload\n this.iframe.style.display = \"none\";\n this.iframe.style.visibility = \"hidden\";\n this.iframe.style.pointerEvents = \"none\";\n this.iframe.style.position = \"absolute\";\n this.iframe.style.left = \"-9999px\";\n this.iframe.style.top = \"-9999px\";\n\n // Add attributes that prevent scrollbars\n this.setIframeAttributes();\n\n // Add CSS to prevent scrollbars\n this.addScrollbarHidingStyles();\n\n // Set up message listener for iframe ready events (more reliable than onload)\n this.setupIframeMessageListener();\n\n // Set up iframe onload handler\n this.setupIframeOnloadHandler();\n\n // For preloading, we need to add the iframe to the DOM but keep it hidden\n // Create a minimal container structure without showing it\n if (this.displayMode === \"modal\") {\n this.setupModalIframeForPreload();\n } else {\n this.setupEmbeddedIframeForPreload();\n }\n\n // Initialize resizer - this will handle all the message-based resizing\n this.resizer = new CivicIframeResizer(this.iframe, this.container);\n\n // Mark as preloaded\n this.isPreloaded = true;\n this.preloadUrl = url;\n\n // Keep the container hidden during preload\n this.hide();\n\n this.logger.debug(\"Iframe preloaded successfully\", { url });\n return this.iframe;\n }\n\n public createIframe(url: string): HTMLIFrameElement {\n // If we have a preloaded iframe, show it instantly (even if URL differs)\n // URLs may differ due to fresh PKCE challenges and other dynamic parameters\n if (this.isPreloaded && this.iframe) {\n this.logger.debug(\"Using preloaded iframe for instant display\", {\n preloadedUrl: this.preloadUrl,\n requestedUrl: url,\n urlsMatch: this.preloadUrl === url,\n });\n\n // Don't change iframe.src for preloaded iframes - use them as-is to avoid reload\n // The preloaded authentication flow will work perfectly without URL changes\n this.logger.debug(\"Using preloaded iframe without reload\", {\n preloadedUrl: this.preloadUrl,\n requestedUrl: url,\n action: \"skipping_url_change_to_prevent_reload\",\n });\n\n // Make the preloaded iframe visible and interactable\n this.iframe.style.display = \"block\";\n this.iframe.style.visibility = \"visible\";\n this.iframe.style.pointerEvents = \"auto\";\n this.iframe.style.position = \"relative\";\n this.iframe.style.left = \"0\";\n this.iframe.style.top = \"0\";\n\n // Show the wrappers that were hidden during preload\n if (this.displayMode === \"modal\") {\n if (this.contentWrapper) {\n this.contentWrapper.style.display = \"block\";\n // Apply modal visual styling that was skipped during preload\n this.applyModalVisualStyling();\n\n // Set up modal behaviors (backdrop click, etc.)\n this.setupModalBehaviors();\n }\n } else {\n if (this.iframeWrapper) {\n this.iframeWrapper.style.display = \"block\";\n // Apply wrapper styling that was skipped during preload\n this.applyIframeWrapperStyling();\n }\n }\n\n // Show the container\n this.show();\n\n // Reset preload state since we're now showing the iframe\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n return this.iframe;\n }\n\n // Clean up any existing iframe content, but preserve container styles for modal mode\n this.cleanupIframeOnly();\n\n // Create new iframe\n this.iframe = document.createElement(\"iframe\");\n this.iframe.id = this.iframeId;\n this.iframe.src = url;\n this.iframe.setAttribute(\"data-testid\", \"civic-auth-iframe-with-resizer\");\n\n // Apply iframe styles\n this.applyIframeStyles();\n\n // Add attributes that prevent scrollbars\n this.setIframeAttributes();\n\n // Add CSS to prevent scrollbars\n this.addScrollbarHidingStyles();\n\n // Set up message listener for iframe ready events (more reliable than onload)\n this.setupIframeMessageListener();\n\n // Set up iframe onload handler\n this.setupIframeOnloadHandler();\n\n if (this.displayMode === \"modal\") {\n this.setupModalIframe();\n } else {\n this.setupEmbeddedIframe();\n }\n\n // Initialize resizer - this will handle all the message-based resizing\n this.resizer = new CivicIframeResizer(this.iframe, this.container);\n\n return this.iframe;\n }\n\n /**\n * Applies base styles to the iframe element\n */\n private applyIframeStyles(): void {\n if (!this.iframe) return;\n\n const baseStyles = {\n border: \"none\",\n display: \"block\",\n pointerEvents: \"auto\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n opacity: \"0\",\n transition: `opacity ${IframeManager.TRANSITION_DURATION} ease, height ${IframeManager.TRANSITION_DURATION} ease`,\n };\n\n Object.entries(baseStyles).forEach(([property, value]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required to handle dynamic CSS property assignment since CSSStyleDeclaration type doesn't fully capture all possible properties\n this.iframe!.style[property as any] = value;\n });\n\n // Set initial height based on display mode\n if (this.displayMode === \"modal\") {\n this.iframe!.style.height = IframeManager.MODAL_MIN_HEIGHT;\n this.iframe!.style.minHeight = IframeManager.MODAL_MIN_HEIGHT;\n } else {\n this.iframe!.style.height = \"auto\";\n this.iframe!.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT; // Embedded mode minimum\n }\n }\n\n /**\n * Sets iframe attributes to prevent scrollbars\n */\n private setIframeAttributes(): void {\n if (!this.iframe) return;\n\n this.iframe.setAttribute(\"scrolling\", \"no\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.setAttribute(\"seamless\", \"seamless\");\n this.iframe.setAttribute(\n \"allow\",\n \"camera; screen-wake-lock; publickey-credentials-get *; publickey-credentials-create *\",\n );\n this.iframe.setAttribute(\"allowFullScreen\", \"true\");\n\n // Add additional CSS to prevent scrollbars\n this.iframe.style.cssText +=\n \"; -ms-overflow-style: none; scrollbar-width: none;\";\n }\n\n /**\n * Adds CSS styles to hide scrollbars across different browsers\n */\n private addScrollbarHidingStyles(): void {\n const iframeStyle = document.createElement(\"style\");\n iframeStyle.textContent = `\n iframe[id=\"${this.iframeId}\"] {\n -webkit-overflow-scrolling: touch !important;\n }\n iframe[id=\"${this.iframeId}\"]::webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n document.head.appendChild(iframeStyle);\n }\n\n /**\n * Sets up the message listener for iframe ready events\n */\n private setupIframeMessageListener(): void {\n this.iframeReadyMessageListener = (event: MessageEvent) => {\n try {\n // Only handle messages from our iframe\n if (\n !this.iframe?.contentWindow ||\n event.source !== this.iframe.contentWindow\n ) {\n return;\n }\n\n const message = event.data;\n\n // Handle ready message from iframe resizer\n if (message.type === \"civic-iframe-ready\") {\n this.logger.debug(\"Iframe content is ready - hiding shimmer loader\");\n // wait a bit to ensure any initial loading is complete\n // to give the login-app time to send any post message signals\n setTimeout(() => {\n this.markIframeAsLoaded();\n }, WAIT_FOR_LOGIN_APP_BROWSER_DETECTION_TIMEOUT);\n }\n } catch (error) {\n this.logger.debug(\"Error processing iframe ready message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.iframeReadyMessageListener);\n }\n\n /**\n * Sets up the iframe onload handler with CSS injection\n */\n private setupIframeOnloadHandler(): void {\n if (!this.iframe) return;\n\n this.iframe.onload = () => {\n // Use a small delay to allow ready message to arrive first\n setTimeout(() => {\n if (!this.isIframeLoaded) {\n this.logger.debug(\n \"Iframe onload fired - hiding shimmer loader (fallback)\",\n );\n this.markIframeAsLoaded();\n }\n }, IframeManager.IFRAME_READY_DELAY);\n\n try {\n const iframeDoc =\n this.iframe?.contentDocument || this.iframe?.contentWindow?.document;\n if (iframeDoc && iframeDoc.head) {\n const style = iframeDoc.createElement(\"style\");\n style.textContent = `\n html, body {\n overflow: hidden !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n -ms-overflow-style: none !important;\n scrollbar-width: none !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n body::-webkit-scrollbar {\n display: none !important;\n }\n * {\n box-sizing: border-box !important;\n }\n `;\n iframeDoc.head.appendChild(style);\n }\n } catch (error) {\n this.logger.debug(\n \"Could not inject CSS into iframe (likely cross-origin):\",\n error,\n );\n }\n };\n }\n\n /**\n * Sets up the iframe for modal display mode during preload\n * Creates the structure but keeps everything hidden\n */\n private setupModalIframeForPreload(): void {\n if (!this.iframe) return;\n\n // Create content wrapper for modal but keep it hidden\n this.contentWrapper = document.createElement(\"div\");\n this.contentWrapper.style.position = \"relative\";\n this.contentWrapper.style.overflow = \"hidden\";\n this.contentWrapper.style.width = IframeManager.MODAL_WIDTH;\n this.contentWrapper.style.display = \"none\"; // Keep hidden during preload\n\n // Create inner iframe wrapper\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = `all ${IframeManager.TRANSITION_DURATION} ease`;\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.MODAL_MIN_HEIGHT;\n\n // Add iframe to wrapper, then wrapper to content, then content to container\n this.iframeWrapper.appendChild(this.iframe);\n this.contentWrapper.appendChild(this.iframeWrapper);\n this.container.appendChild(this.contentWrapper);\n }\n\n /**\n * Sets up the iframe for embedded display mode during preload\n * Creates the structure but keeps everything hidden\n */\n private setupEmbeddedIframeForPreload(): void {\n if (!this.iframe) return;\n\n // Create wrapper but keep it hidden\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = \"all 0.5s ease-in-out\";\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT;\n this.iframeWrapper.style.display = \"none\"; // Keep hidden during preload\n\n // Add iframe to wrapper, then wrapper to container\n this.iframeWrapper.appendChild(this.iframe);\n this.container.appendChild(this.iframeWrapper);\n }\n\n /**\n * Sets up the iframe for modal display mode\n */\n private setupModalIframe(): void {\n if (!this.iframe) return;\n\n // Ensure modal is visible (in case it was hidden by cleanup)\n this.container.style.setProperty(\"display\", \"flex\", \"important\");\n\n // Create content wrapper for modal\n this.contentWrapper = document.createElement(\"div\");\n this.contentWrapper.style.position = \"relative\";\n this.contentWrapper.style.overflow = \"hidden\";\n this.contentWrapper.style.width = IframeManager.MODAL_WIDTH; // 320px like React version\n\n // Apply initial visual styling\n this.applyModalVisualStyling();\n\n // Create inner iframe wrapper to match React structure\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = `all ${IframeManager.TRANSITION_DURATION} ease`;\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.MODAL_MIN_HEIGHT; // Start small for modal mode\n\n // Apply initial wrapper styling\n this.applyIframeWrapperStyling();\n\n // Add shimmer loader for modal mode\n this.showShimmerLoader(this.iframeWrapper, \"white\");\n\n // Add iframe to wrapper, then wrapper to content, then content to container\n this.iframeWrapper.appendChild(this.iframe);\n this.contentWrapper.appendChild(this.iframeWrapper);\n this.container.appendChild(this.contentWrapper);\n\n this.setupModalBehaviors();\n }\n\n /**\n * Sets up modal-specific behaviors like click handlers and close button\n */\n private setupModalBehaviors(): void {\n if (!this.contentWrapper) return;\n\n // Stop propagation on content wrapper to prevent backdrop clicks\n this.contentWrapper.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // Add close button for modal mode (initially hidden if not loaded)\n if (this.onClose && !this.closeButton) {\n this.closeButton = createCloseButton(this.onClose);\n // Show close button immediately if iframe is already loaded, otherwise keep hidden\n this.closeButton.style.opacity = this.isIframeLoaded ? \"1\" : \"0\";\n this.contentWrapper.appendChild(this.closeButton);\n }\n\n // Add click-to-close functionality after content is added\n if (!this.clickHandler) {\n this.clickHandler = (e: MouseEvent) => {\n if (e.target === this.container) {\n // Only close if clicking the backdrop, not the iframe content\n this.onClose?.();\n }\n };\n this.container.addEventListener(\"click\", this.clickHandler);\n }\n }\n\n /**\n * Sets up the iframe for embedded display mode\n */\n private setupEmbeddedIframe(): void {\n if (!this.iframe) return;\n\n // Embedded mode - create wrapper with border radius and overflow hidden\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = \"all 0.5s ease-in-out\";\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT; // Embedded mode minimum\n\n // Apply initial wrapper styling\n this.applyIframeWrapperStyling();\n\n // Add shimmer loader for embedded mode with max width\n this.showShimmerLoader(\n this.iframeWrapper,\n \"white\",\n IframeManager.MODAL_WIDTH,\n );\n\n // Add iframe to wrapper, then wrapper to container\n this.iframeWrapper.appendChild(this.iframe);\n this.container.appendChild(this.iframeWrapper);\n }\n\n private showShimmerLoader(\n parentElement: HTMLElement,\n backgroundColor = \"white\",\n maxWidth?: string,\n ): void {\n if (!this.isIframeLoaded && !this.shimmerLoader) {\n this.shimmerLoader = createIframeShimmerLoader(backgroundColor, maxWidth);\n parentElement.appendChild(this.shimmerLoader);\n }\n }\n\n private hideShimmerLoader(): void {\n if (this.shimmerLoader && this.shimmerLoader.parentNode) {\n // Add fade-out transition before removing\n this.shimmerLoader.style.opacity = \"0\";\n this.shimmerLoader.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;\n // Remove after transition completes\n setTimeout(() => {\n if (this.shimmerLoader && this.shimmerLoader.parentNode) {\n this.shimmerLoader.parentNode.removeChild(this.shimmerLoader);\n this.shimmerLoader = null;\n }\n }, parseInt(IframeManager.TRANSITION_DURATION));\n }\n }\n\n private markIframeAsLoaded(): void {\n if (IframeManager.browserCorsFailsSilentlyUrl) {\n return;\n }\n if (!this.isIframeLoaded) {\n this.isIframeLoaded = true;\n this.hideShimmerLoader();\n this.updateWrapperForLoadedContent();\n }\n }\n\n private updateWrapperForLoadedContent(): void {\n // Fade in the iframe\n if (this.iframe) {\n this.iframe.style.opacity = \"1\";\n }\n\n // Show close button for modal mode when content is loaded\n if (this.displayMode === \"modal\" && this.closeButton) {\n this.closeButton.style.opacity = \"1\";\n }\n\n // Find the iframe wrapper and update its styles for loaded content\n const iframeWrapper = this.iframe?.parentElement;\n if (iframeWrapper) {\n // Remove minimum height constraints to allow natural sizing\n if (this.displayMode === \"modal\") {\n iframeWrapper.style.minHeight = \"auto\";\n } else {\n // For embedded mode, keep some minimum but allow natural growth\n iframeWrapper.style.minHeight = \"auto\";\n }\n\n // Add border radius transition for loaded state (matching React implementation)\n iframeWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n }\n }\n\n public hide(): void {\n if (this.displayMode === \"modal\") {\n // Hide immediately without transition\n this.container.style.transition = \"none\";\n this.container.style.opacity = \"0\";\n }\n this.container.style.display = \"none\";\n }\n\n public show(): void {\n if (this.displayMode === \"modal\") {\n // Show immediately, then fade in\n this.container.style.display = \"flex\";\n this.container.style.opacity = \"0\";\n this.container.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;\n\n // Use setTimeout to ensure display change takes effect before opacity transition\n setTimeout(() => {\n this.container.style.opacity = \"1\";\n }, 10);\n } else {\n // For embedded mode, just show immediately\n this.container.style.display = \"block\";\n this.container.style.opacity = \"1\";\n }\n }\n\n private cleanupIframeOnly(): void {\n if (this.resizer) {\n this.resizer.cleanup();\n this.resizer = null;\n }\n\n // Clean up shimmer loader\n this.hideShimmerLoader();\n\n // Clean up close button\n if (this.closeButton && this.closeButton.parentNode) {\n this.closeButton.parentNode.removeChild(this.closeButton);\n this.closeButton = null;\n }\n\n // Clean up message listener\n if (this.iframeReadyMessageListener) {\n window.removeEventListener(\"message\", this.iframeReadyMessageListener);\n this.iframeReadyMessageListener = undefined;\n }\n\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Reset loading state\n this.isIframeLoaded = false;\n\n // Reset preload state\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n // Clear wrapper references\n this.contentWrapper = null;\n this.iframeWrapper = null;\n\n // Clear container content but DON'T reset styles for modal mode\n this.container.innerHTML = \"\";\n }\n\n public cleanup(): void {\n if (this.resizer) {\n this.resizer.cleanup();\n this.resizer = null;\n }\n\n // Clean up shimmer loader\n this.hideShimmerLoader();\n\n // Clean up close button\n if (this.closeButton && this.closeButton.parentNode) {\n this.closeButton.parentNode.removeChild(this.closeButton);\n this.closeButton = null;\n }\n\n // Clean up message listener\n if (this.iframeReadyMessageListener) {\n window.removeEventListener(\"message\", this.iframeReadyMessageListener);\n this.iframeReadyMessageListener = undefined;\n }\n\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Reset loading state\n this.isIframeLoaded = false;\n\n // Reset preload state\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n // Remove keyboard event listener\n if (this.keydownHandler) {\n window.removeEventListener(\"keydown\", this.keydownHandler);\n this.keydownHandler = undefined;\n }\n\n // Remove click event listener\n if (this.clickHandler) {\n this.container.removeEventListener(\"click\", this.clickHandler);\n this.clickHandler = undefined;\n }\n\n // Clear wrapper references\n this.contentWrapper = null;\n this.iframeWrapper = null;\n\n // Clear container content and reset styles\n this.container.innerHTML = \"\";\n\n if (this.displayMode === \"modal\") {\n // Reset all modal-specific styles to ensure clean state\n this.resetModalStyles();\n }\n }\n\n /**\n * Resets all modal-specific styles by removing CSS properties that were set with !important\n */\n private resetModalStyles(): void {\n const modalStyleProperties = [\n \"position\",\n \"left\",\n \"top\",\n \"width\",\n \"height\",\n \"z-index\",\n \"display\",\n \"align-items\",\n \"justify-content\",\n \"background-color\",\n \"backdrop-filter\",\n \"opacity\",\n \"transition\",\n \"margin\",\n \"padding\",\n \"border\",\n \"border-radius\",\n \"min-height\",\n ];\n\n modalStyleProperties.forEach((property) => {\n this.container.style.removeProperty(property);\n });\n }\n\n public resize(): void {\n if (this.resizer) {\n this.resizer.resize();\n }\n }\n\n /**\n * Force show the shimmer loader and hide iframe content\n * Used when we want to mask non-login content\n */\n public forceShowLoader(): void {\n // Reset loading state to show shimmer\n this.isIframeLoaded = false;\n\n // Hide iframe content\n if (this.iframe) {\n this.iframe.style.opacity = \"0\";\n }\n\n // Hide close button\n if (this.displayMode === \"modal\" && this.closeButton) {\n this.closeButton.style.opacity = \"0\";\n }\n\n // Hide visual decorations (borders, shadows) when masking content\n if (this.displayMode === \"modal\") {\n this.removeModalVisualStyling();\n }\n this.removeIframeWrapperStyling();\n\n // Show shimmer loader\n if (this.iframeWrapper && !this.shimmerLoader) {\n this.showShimmerLoader(\n this.iframeWrapper,\n \"white\",\n this.displayMode === \"embedded\" ? IframeManager.MODAL_WIDTH : undefined,\n );\n }\n }\n\n /**\n * Force hide the shimmer loader and show iframe content\n * Used when we want to show the login app\n */\n public forceHideLoader(): void {\n // Restore visual decorations when showing content\n if (this.displayMode === \"modal\") {\n this.applyModalVisualStyling();\n }\n this.applyIframeWrapperStyling();\n\n this.markIframeAsLoaded();\n }\n\n /**\n * Applies visual styling (borders, shadows) to modal content wrapper\n */\n private applyModalVisualStyling(): void {\n if (!this.contentWrapper) return;\n\n this.contentWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n this.contentWrapper.style.boxShadow =\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\";\n }\n\n /**\n * Removes visual styling (borders, shadows) from modal content wrapper\n */\n private removeModalVisualStyling(): void {\n if (!this.contentWrapper) return;\n\n this.contentWrapper.style.borderRadius = \"0\";\n this.contentWrapper.style.boxShadow = \"none\";\n }\n\n /**\n * Applies visual styling (borders) to iframe wrapper\n */\n private applyIframeWrapperStyling(): void {\n if (!this.iframeWrapper) return;\n\n this.iframeWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n }\n\n /**\n * Removes visual styling (borders) from iframe wrapper\n */\n private removeIframeWrapperStyling(): void {\n if (!this.iframeWrapper) return;\n\n this.iframeWrapper.style.borderRadius = \"0\";\n }\n\n /**\n * Check if an iframe is currently preloaded\n */\n public isIframePreloaded(): boolean {\n return this.isPreloaded;\n }\n\n /**\n * Get the URL of the preloaded iframe\n */\n public getPreloadedUrl(): string | null {\n return this.preloadUrl;\n }\n\n /**\n * Update the onClose handler for the iframe manager\n * This is useful when transitioning from preload to active authentication\n */\n public updateOnCloseHandler(onClose: () => void): void {\n this.onClose = onClose;\n }\n\n public showSubtlePopupFallbackIndicator(): void {\n if (!this.iframeWrapper && !this.contentWrapper) {\n this.logger.warn(\n \"Cannot show popup fallback indicator, no iframe wrapper or content wrapper found.\",\n );\n return;\n }\n\n const targetElement = this.iframeWrapper || this.contentWrapper;\n\n if (targetElement) {\n this.logger.debug(\"Showing popup fallback overlay.\");\n\n // Create overlay element\n const overlay = document.createElement(\"div\");\n overlay.id = \"civic-popup-fallback-overlay\";\n overlay.style.cssText = `\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n border-radius: ${IframeManager.BORDER_RADIUS};\n backdrop-filter: blur(.4px);\n opacity: 1;\n `;\n\n // Add overlay to target element\n targetElement.style.position = \"relative\";\n targetElement.appendChild(overlay);\n\n // Remove overlay quickly\n setTimeout(() => {\n if (overlay.parentNode) {\n overlay.parentNode.removeChild(overlay);\n }\n this.logger.debug(\"Popup fallback overlay removed.\");\n }, 500); // Remove after 500ms\n\n this.logger.debug(\"Popup fallback overlay displayed.\");\n }\n }\n}\n"]}
1
+ {"version":3,"file":"IframeManager.js","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,4CAA4C,EAAE,MAAM,gBAAgB,CAAC;AAW9E;;;GAGG;AACH,MAAM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OAAO,CAAC,CAAC;gBAC1C,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACvD,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,qBAAqB;YAE9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;IACH,CAAC","sourcesContent":["import { CivicIframeResizer } from \"./IframeResizer.js\";\nimport {\n createIframeShimmerLoader,\n createCloseButton,\n} from \"../ui/LoadingComponents.js\";\nimport { createLogger } from \"../utils/logger.js\";\nimport { WAIT_FOR_LOGIN_APP_BROWSER_DETECTION_TIMEOUT } from \"@/constants.js\";\n\nexport interface IframeConfig {\n container: HTMLElement;\n displayMode: \"embedded\" | \"modal\";\n width?: string;\n height?: string;\n iframeId?: string;\n onClose?: () => void;\n}\n\n/**\n * IframeManager - Manages iframe visual presentation and DOM lifecycle\n * Handles styling, positioning, UI components, and iframe element creation/cleanup\n */\nexport class IframeManager {\n // Constants for styling and configuration\n private static readonly MODAL_Z_INDEX = \"1050\";\n private static readonly MODAL_WIDTH = \"20rem\"; // 320px\n private static readonly MODAL_BACKDROP_COLOR = \"rgba(17, 24, 39, 0.5)\";\n private static readonly MODAL_BACKDROP_BLUR = \"blur(4px)\";\n private static readonly BORDER_RADIUS = \"24px\";\n private static readonly TRANSITION_DURATION = \"250ms\";\n private static readonly MODAL_MIN_HEIGHT = \"26px\";\n private static readonly EMBEDDED_MIN_HEIGHT = \"225px\";\n private static readonly IFRAME_READY_DELAY = 100; // ms\n\n private iframe: HTMLIFrameElement | null = null;\n private container: HTMLElement;\n private resizer: CivicIframeResizer | null = null;\n private displayMode: \"embedded\" | \"modal\";\n private keydownHandler?: (event: KeyboardEvent) => void;\n private clickHandler?: (event: MouseEvent) => void;\n private iframeId: string;\n private onClose?: () => void;\n private shimmerLoader: HTMLElement | null = null;\n private closeButton: HTMLButtonElement | null = null;\n private isIframeLoaded = false;\n private iframeReadyMessageListener?: (event: MessageEvent) => void;\n private logger: ReturnType<typeof createLogger>;\n // Store references to wrapper elements for styling control\n private contentWrapper: HTMLElement | null = null;\n private iframeWrapper: HTMLElement | null = null;\n // Preloading support\n private isPreloaded = false;\n private preloadUrl: string | null = null;\n public static browserCorsFailsSilentlyUrl: string | null = null;\n\n public static handleBrowserCorsFailsSilently(url: string): void {\n // Store the URL that caused CORS failure for later reference\n IframeManager.browserCorsFailsSilentlyUrl = url;\n }\n\n constructor(config: IframeConfig) {\n // we aren't going to render the iframe if the browser fails silently as we're redirecting\n\n this.container = config.container;\n this.displayMode = config.displayMode;\n this.iframeId = config.iframeId || \"civic-auth-iframe\";\n this.onClose = config.onClose;\n this.logger = createLogger(\"iframe\");\n this.initializeContainer(config);\n this.setupKeyboardHandlers();\n }\n\n private initializeContainer(config: IframeConfig): void {\n if (this.displayMode === \"modal\") {\n this.applyModalStyles();\n return;\n }\n\n // Embedded mode\n this.container.style.position = \"relative\";\n this.container.style.width = config.width || \"auto\";\n this.container.style.height = config.height || \"auto\";\n this.container.style.backgroundColor = \"white\";\n this.container.style.borderRadius = IframeManager.BORDER_RADIUS;\n this.container.style.overflow = \"hidden\";\n this.container.style.transition = \"all 0.5s ease-in-out\";\n }\n\n /**\n * Applies modal backdrop styles to create a full-screen overlay\n * Uses !important to override any existing styles\n */\n private applyModalStyles(): void {\n const modalStyles = {\n position: \"fixed\",\n left: \"0\",\n top: \"0\",\n width: \"100vw\",\n height: \"100vh\",\n \"z-index\": IframeManager.MODAL_Z_INDEX,\n display: \"flex\",\n \"align-items\": \"center\",\n \"justify-content\": \"center\",\n \"background-color\": IframeManager.MODAL_BACKDROP_COLOR,\n \"backdrop-filter\": IframeManager.MODAL_BACKDROP_BLUR,\n opacity: \"1\",\n transition: `opacity ${IframeManager.TRANSITION_DURATION} ease`,\n // Reset any conflicting styles that might prevent modal from working\n margin: \"0\",\n padding: \"0\",\n border: \"none\",\n \"border-radius\": \"0\",\n \"min-height\": \"100vh\",\n };\n\n Object.entries(modalStyles).forEach(([property, value]) => {\n this.container.style.setProperty(property, value, \"important\");\n });\n }\n\n private setupKeyboardHandlers(): void {\n if (this.displayMode === \"modal\") {\n this.keydownHandler = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n this.onClose?.();\n }\n };\n window.addEventListener(\"keydown\", this.keydownHandler);\n }\n }\n\n /**\n * Preloads an iframe in the background for instant display later\n * The iframe is created but kept completely hidden and non-interactable\n */\n public preloadIframe(url: string): HTMLIFrameElement {\n this.logger.debug(\"Preloading iframe in background\", { url });\n\n // Clean up any existing iframe content, but preserve container styles for modal mode\n this.cleanupIframeOnly();\n\n // Create new iframe for preloading\n this.iframe = document.createElement(\"iframe\");\n this.iframe.id = this.iframeId;\n this.iframe.src = url;\n this.iframe.setAttribute(\"data-testid\", \"civic-auth-iframe-with-resizer\");\n\n // Apply base iframe styles but keep it completely hidden for preloading\n this.applyIframeStyles();\n\n // Make iframe completely invisible and non-interactable during preload\n this.iframe.style.display = \"none\";\n this.iframe.style.visibility = \"hidden\";\n this.iframe.style.pointerEvents = \"none\";\n this.iframe.style.position = \"absolute\";\n this.iframe.style.left = \"-9999px\";\n this.iframe.style.top = \"-9999px\";\n\n // Add attributes that prevent scrollbars\n this.setIframeAttributes();\n\n // Add CSS to prevent scrollbars\n this.addScrollbarHidingStyles();\n\n // Set up message listener for iframe ready events (more reliable than onload)\n this.setupIframeMessageListener();\n\n // Set up iframe onload handler\n this.setupIframeOnloadHandler();\n\n // For preloading, we need to add the iframe to the DOM but keep it hidden\n // Create a minimal container structure without showing it\n if (this.displayMode === \"modal\") {\n this.setupModalIframeForPreload();\n } else {\n this.setupEmbeddedIframeForPreload();\n }\n\n // Initialize resizer - this will handle all the message-based resizing\n this.resizer = new CivicIframeResizer(this.iframe, this.container, () =>\n this.isShimmerActive(),\n );\n\n // Mark as preloaded\n this.isPreloaded = true;\n this.preloadUrl = url;\n\n // Keep the container hidden during preload\n this.hide();\n\n this.logger.debug(\"Iframe preloaded successfully\", { url });\n return this.iframe;\n }\n\n public createIframe(url: string): HTMLIFrameElement {\n // If we have a preloaded iframe, show it instantly (even if URL differs)\n // URLs may differ due to fresh PKCE challenges and other dynamic parameters\n if (this.isPreloaded && this.iframe) {\n this.logger.debug(\"Using preloaded iframe for instant display\", {\n preloadedUrl: this.preloadUrl,\n requestedUrl: url,\n urlsMatch: this.preloadUrl === url,\n });\n\n // Don't change iframe.src for preloaded iframes - use them as-is to avoid reload\n // The preloaded authentication flow will work perfectly without URL changes\n this.logger.debug(\"Using preloaded iframe without reload\", {\n preloadedUrl: this.preloadUrl,\n requestedUrl: url,\n action: \"skipping_url_change_to_prevent_reload\",\n });\n\n // Make the preloaded iframe visible and interactable\n this.iframe.style.display = \"block\";\n this.iframe.style.visibility = \"visible\";\n this.iframe.style.pointerEvents = \"auto\";\n this.iframe.style.position = \"relative\";\n this.iframe.style.left = \"0\";\n this.iframe.style.top = \"0\";\n\n // Show the wrappers that were hidden during preload\n if (this.displayMode === \"modal\") {\n if (this.contentWrapper) {\n this.contentWrapper.style.display = \"block\";\n // Apply modal visual styling that was skipped during preload\n this.applyModalVisualStyling();\n\n // Set up modal behaviors (backdrop click, etc.)\n this.setupModalBehaviors();\n }\n } else {\n if (this.iframeWrapper) {\n this.iframeWrapper.style.display = \"block\";\n // Apply wrapper styling that was skipped during preload\n this.applyIframeWrapperStyling();\n }\n }\n\n // Show the container\n this.show();\n\n // Reset preload state since we're now showing the iframe\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n return this.iframe;\n }\n\n // Clean up any existing iframe content, but preserve container styles for modal mode\n this.cleanupIframeOnly();\n\n // Create new iframe\n this.iframe = document.createElement(\"iframe\");\n this.iframe.id = this.iframeId;\n this.iframe.src = url;\n this.iframe.setAttribute(\"data-testid\", \"civic-auth-iframe-with-resizer\");\n\n // Apply iframe styles\n this.applyIframeStyles();\n\n // Add attributes that prevent scrollbars\n this.setIframeAttributes();\n\n // Add CSS to prevent scrollbars\n this.addScrollbarHidingStyles();\n\n // Set up message listener for iframe ready events (more reliable than onload)\n this.setupIframeMessageListener();\n\n // Set up iframe onload handler\n this.setupIframeOnloadHandler();\n\n if (this.displayMode === \"modal\") {\n this.setupModalIframe();\n } else {\n this.setupEmbeddedIframe();\n }\n\n // Initialize resizer - this will handle all the message-based resizing\n this.resizer = new CivicIframeResizer(this.iframe, this.container, () =>\n this.isShimmerActive(),\n );\n\n return this.iframe;\n }\n\n /**\n * Applies base styles to the iframe element\n */\n private applyIframeStyles(): void {\n if (!this.iframe) return;\n\n const baseStyles = {\n border: \"none\",\n display: \"block\",\n pointerEvents: \"auto\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n opacity: \"0\",\n transition: `opacity ${IframeManager.TRANSITION_DURATION} ease, height ${IframeManager.TRANSITION_DURATION} ease`,\n };\n\n Object.entries(baseStyles).forEach(([property, value]) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required to handle dynamic CSS property assignment since CSSStyleDeclaration type doesn't fully capture all possible properties\n this.iframe!.style[property as any] = value;\n });\n\n // Set initial height based on display mode\n if (this.displayMode === \"modal\") {\n this.iframe!.style.height = IframeManager.MODAL_MIN_HEIGHT;\n this.iframe!.style.minHeight = IframeManager.MODAL_MIN_HEIGHT;\n } else {\n this.iframe!.style.height = \"auto\";\n this.iframe!.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT; // Embedded mode minimum\n }\n }\n\n /**\n * Sets iframe attributes to prevent scrollbars\n */\n private setIframeAttributes(): void {\n if (!this.iframe) return;\n\n this.iframe.setAttribute(\"scrolling\", \"no\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.setAttribute(\"seamless\", \"seamless\");\n this.iframe.setAttribute(\n \"allow\",\n \"camera; screen-wake-lock; publickey-credentials-get *; publickey-credentials-create *\",\n );\n this.iframe.setAttribute(\"allowFullScreen\", \"true\");\n\n // Add additional CSS to prevent scrollbars\n this.iframe.style.cssText +=\n \"; -ms-overflow-style: none; scrollbar-width: none;\";\n }\n\n /**\n * Adds CSS styles to hide scrollbars across different browsers\n */\n private addScrollbarHidingStyles(): void {\n const iframeStyle = document.createElement(\"style\");\n iframeStyle.textContent = `\n iframe[id=\"${this.iframeId}\"] {\n -webkit-overflow-scrolling: touch !important;\n }\n iframe[id=\"${this.iframeId}\"]::webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n document.head.appendChild(iframeStyle);\n }\n\n /**\n * Sets up the message listener for iframe ready events\n */\n private setupIframeMessageListener(): void {\n this.iframeReadyMessageListener = (event: MessageEvent) => {\n try {\n // Only handle messages from our iframe\n if (\n !this.iframe?.contentWindow ||\n event.source !== this.iframe.contentWindow\n ) {\n return;\n }\n\n const message = event.data;\n\n // Handle ready message from iframe resizer\n if (message.type === \"civic-iframe-ready\") {\n this.logger.debug(\"Iframe content is ready - hiding shimmer loader\");\n // wait a bit to ensure any initial loading is complete\n // to give the login-app time to send any post message signals\n setTimeout(() => {\n // Mark iframe as loaded FIRST to disable shimmer blocking\n this.markIframeAsLoaded();\n\n // Replay any blocked resize messages now that shimmer is inactive\n this.resizer?.replayBlockedMessages();\n this.resizer?.resize();\n }, WAIT_FOR_LOGIN_APP_BROWSER_DETECTION_TIMEOUT);\n }\n } catch (error) {\n this.logger.debug(\"Error processing iframe ready message:\", error);\n }\n };\n\n window.addEventListener(\"message\", this.iframeReadyMessageListener);\n }\n\n /**\n * Sets up the iframe onload handler with CSS injection\n */\n private setupIframeOnloadHandler(): void {\n if (!this.iframe) return;\n\n this.iframe.onload = () => {\n // Use a small delay to allow ready message to arrive first\n setTimeout(() => {\n if (!this.isIframeLoaded) {\n this.logger.debug(\n \"Iframe onload fired - hiding shimmer loader (fallback)\",\n );\n this.markIframeAsLoaded();\n }\n }, IframeManager.IFRAME_READY_DELAY);\n\n try {\n const iframeDoc =\n this.iframe?.contentDocument || this.iframe?.contentWindow?.document;\n if (iframeDoc && iframeDoc.head) {\n const style = iframeDoc.createElement(\"style\");\n style.textContent = `\n html, body {\n overflow: hidden !important;\n overflow-x: hidden !important;\n overflow-y: hidden !important;\n -ms-overflow-style: none !important;\n scrollbar-width: none !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n body::-webkit-scrollbar {\n display: none !important;\n }\n * {\n box-sizing: border-box !important;\n }\n `;\n iframeDoc.head.appendChild(style);\n }\n } catch (error) {\n this.logger.debug(\n \"Could not inject CSS into iframe (likely cross-origin):\",\n error,\n );\n }\n };\n }\n\n /**\n * Sets up the iframe for modal display mode during preload\n * Creates the structure but keeps everything hidden\n */\n private setupModalIframeForPreload(): void {\n if (!this.iframe) return;\n\n // Create content wrapper for modal but keep it hidden\n this.contentWrapper = document.createElement(\"div\");\n this.contentWrapper.style.position = \"relative\";\n this.contentWrapper.style.overflow = \"hidden\";\n this.contentWrapper.style.width = IframeManager.MODAL_WIDTH;\n this.contentWrapper.style.display = \"none\"; // Keep hidden during preload\n\n // Create inner iframe wrapper\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = `all ${IframeManager.TRANSITION_DURATION} ease`;\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.MODAL_MIN_HEIGHT;\n\n // Add iframe to wrapper, then wrapper to content, then content to container\n this.iframeWrapper.appendChild(this.iframe);\n this.contentWrapper.appendChild(this.iframeWrapper);\n this.container.appendChild(this.contentWrapper);\n }\n\n /**\n * Sets up the iframe for embedded display mode during preload\n * Creates the structure but keeps everything hidden\n */\n private setupEmbeddedIframeForPreload(): void {\n if (!this.iframe) return;\n\n // Create wrapper but keep it hidden\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = \"all 0.5s ease-in-out\";\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT;\n this.iframeWrapper.style.display = \"none\"; // Keep hidden during preload\n\n // Add iframe to wrapper, then wrapper to container\n this.iframeWrapper.appendChild(this.iframe);\n this.container.appendChild(this.iframeWrapper);\n }\n\n /**\n * Sets up the iframe for modal display mode\n */\n private setupModalIframe(): void {\n if (!this.iframe) return;\n\n // Ensure modal is visible (in case it was hidden by cleanup)\n this.container.style.setProperty(\"display\", \"flex\", \"important\");\n\n // Create content wrapper for modal\n this.contentWrapper = document.createElement(\"div\");\n this.contentWrapper.style.position = \"relative\";\n this.contentWrapper.style.overflow = \"hidden\";\n this.contentWrapper.style.width = IframeManager.MODAL_WIDTH; // 320px like React version\n\n // Apply initial visual styling\n this.applyModalVisualStyling();\n\n // Create inner iframe wrapper to match React structure\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = `all ${IframeManager.TRANSITION_DURATION} ease`;\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.MODAL_MIN_HEIGHT; // Start small for modal mode\n\n // Apply initial wrapper styling\n this.applyIframeWrapperStyling();\n\n // Add shimmer loader for modal mode\n this.showShimmerLoader(this.iframeWrapper, \"white\");\n\n // Add iframe to wrapper, then wrapper to content, then content to container\n this.iframeWrapper.appendChild(this.iframe);\n this.contentWrapper.appendChild(this.iframeWrapper);\n this.container.appendChild(this.contentWrapper);\n\n this.setupModalBehaviors();\n }\n\n /**\n * Sets up modal-specific behaviors like click handlers and close button\n */\n private setupModalBehaviors(): void {\n if (!this.contentWrapper) return;\n\n // Stop propagation on content wrapper to prevent backdrop clicks\n this.contentWrapper.addEventListener(\"click\", (e) => {\n e.stopPropagation();\n });\n\n // Add close button for modal mode (initially hidden if not loaded)\n if (this.onClose && !this.closeButton) {\n this.closeButton = createCloseButton(this.onClose);\n // Show close button immediately if iframe is already loaded, otherwise keep hidden\n this.closeButton.style.opacity = this.isIframeLoaded ? \"1\" : \"0\";\n this.contentWrapper.appendChild(this.closeButton);\n }\n\n // Add click-to-close functionality after content is added\n if (!this.clickHandler) {\n this.clickHandler = (e: MouseEvent) => {\n if (e.target === this.container) {\n // Only close if clicking the backdrop, not the iframe content\n this.onClose?.();\n }\n };\n this.container.addEventListener(\"click\", this.clickHandler);\n }\n }\n\n /**\n * Sets up the iframe for embedded display mode\n */\n private setupEmbeddedIframe(): void {\n if (!this.iframe) return;\n\n // Embedded mode - create wrapper with border radius and overflow hidden\n this.iframeWrapper = document.createElement(\"div\");\n this.iframeWrapper.style.position = \"relative\";\n this.iframeWrapper.style.overflow = \"hidden\";\n this.iframeWrapper.style.overflowX = \"hidden\";\n this.iframeWrapper.style.overflowY = \"hidden\";\n this.iframeWrapper.style.transition = \"all 0.5s ease-in-out\";\n this.iframeWrapper.style.width = \"100%\";\n this.iframeWrapper.style.height = \"auto\";\n this.iframeWrapper.style.minHeight = IframeManager.EMBEDDED_MIN_HEIGHT; // Embedded mode minimum\n\n // Apply initial wrapper styling\n this.applyIframeWrapperStyling();\n\n // Add shimmer loader for embedded mode with max width\n this.showShimmerLoader(\n this.iframeWrapper,\n \"white\",\n IframeManager.MODAL_WIDTH,\n );\n\n // Add iframe to wrapper, then wrapper to container\n this.iframeWrapper.appendChild(this.iframe);\n this.container.appendChild(this.iframeWrapper);\n }\n\n private showShimmerLoader(\n parentElement: HTMLElement,\n backgroundColor = \"white\",\n maxWidth?: string,\n ): void {\n if (!this.isIframeLoaded && !this.shimmerLoader) {\n this.shimmerLoader = createIframeShimmerLoader(backgroundColor, maxWidth);\n parentElement.appendChild(this.shimmerLoader);\n }\n }\n\n private hideShimmerLoader(): void {\n if (this.shimmerLoader && this.shimmerLoader.parentNode) {\n // Store reference for cleanup\n const shimmerElement = this.shimmerLoader;\n\n // Clear reference immediately to allow resize operations\n this.shimmerLoader = null;\n\n // Add fade-out transition before removing\n shimmerElement.style.opacity = \"0\";\n shimmerElement.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;\n\n // Remove after transition completes\n setTimeout(() => {\n if (shimmerElement && shimmerElement.parentNode) {\n shimmerElement.parentNode.removeChild(shimmerElement);\n }\n }, parseInt(IframeManager.TRANSITION_DURATION));\n }\n }\n\n private markIframeAsLoaded(): void {\n if (IframeManager.browserCorsFailsSilentlyUrl) {\n return;\n }\n if (!this.isIframeLoaded) {\n this.isIframeLoaded = true;\n this.hideShimmerLoader();\n this.updateWrapperForLoadedContent();\n }\n }\n\n private updateWrapperForLoadedContent(): void {\n // Fade in the iframe\n if (this.iframe) {\n this.iframe.style.opacity = \"1\";\n }\n\n // Show close button for modal mode when content is loaded\n if (this.displayMode === \"modal\" && this.closeButton) {\n this.closeButton.style.opacity = \"1\";\n }\n\n // Find the iframe wrapper and update its styles for loaded content\n const iframeWrapper = this.iframe?.parentElement;\n if (iframeWrapper) {\n // Remove minimum height constraints to allow natural sizing\n if (this.displayMode === \"modal\") {\n iframeWrapper.style.minHeight = \"auto\";\n } else {\n // For embedded mode, keep some minimum but allow natural growth\n iframeWrapper.style.minHeight = \"auto\";\n }\n\n // Add border radius transition for loaded state (matching React implementation)\n iframeWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n }\n }\n\n public hide(): void {\n if (this.displayMode === \"modal\") {\n // Hide immediately without transition\n this.container.style.transition = \"none\";\n this.container.style.opacity = \"0\";\n }\n this.container.style.display = \"none\";\n }\n\n public show(): void {\n if (this.displayMode === \"modal\") {\n // Show immediately, then fade in\n this.container.style.display = \"flex\";\n this.container.style.opacity = \"0\";\n this.container.style.transition = `opacity ${IframeManager.TRANSITION_DURATION} ease`;\n\n // Use setTimeout to ensure display change takes effect before opacity transition\n setTimeout(() => {\n this.container.style.opacity = \"1\";\n }, 10);\n } else {\n // For embedded mode, just show immediately\n this.container.style.display = \"block\";\n this.container.style.opacity = \"1\";\n }\n }\n\n private cleanupIframeOnly(): void {\n if (this.resizer) {\n this.resizer.cleanup();\n this.resizer = null;\n }\n\n // Clean up shimmer loader\n this.hideShimmerLoader();\n\n // Clean up close button\n if (this.closeButton && this.closeButton.parentNode) {\n this.closeButton.parentNode.removeChild(this.closeButton);\n this.closeButton = null;\n }\n\n // Clean up message listener\n if (this.iframeReadyMessageListener) {\n window.removeEventListener(\"message\", this.iframeReadyMessageListener);\n this.iframeReadyMessageListener = undefined;\n }\n\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Reset loading state\n this.isIframeLoaded = false;\n\n // Reset preload state\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n // Clear wrapper references\n this.contentWrapper = null;\n this.iframeWrapper = null;\n\n // Clear container content but DON'T reset styles for modal mode\n this.container.innerHTML = \"\";\n }\n\n public cleanup(): void {\n if (this.resizer) {\n this.resizer.cleanup();\n this.resizer = null;\n }\n\n // Clean up shimmer loader\n this.hideShimmerLoader();\n\n // Clean up close button\n if (this.closeButton && this.closeButton.parentNode) {\n this.closeButton.parentNode.removeChild(this.closeButton);\n this.closeButton = null;\n }\n\n // Clean up message listener\n if (this.iframeReadyMessageListener) {\n window.removeEventListener(\"message\", this.iframeReadyMessageListener);\n this.iframeReadyMessageListener = undefined;\n }\n\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Reset loading state\n this.isIframeLoaded = false;\n\n // Reset preload state\n this.isPreloaded = false;\n this.preloadUrl = null;\n\n // Remove keyboard event listener\n if (this.keydownHandler) {\n window.removeEventListener(\"keydown\", this.keydownHandler);\n this.keydownHandler = undefined;\n }\n\n // Remove click event listener\n if (this.clickHandler) {\n this.container.removeEventListener(\"click\", this.clickHandler);\n this.clickHandler = undefined;\n }\n\n // Clear wrapper references\n this.contentWrapper = null;\n this.iframeWrapper = null;\n\n // Clear container content and reset styles\n this.container.innerHTML = \"\";\n\n if (this.displayMode === \"modal\") {\n // Reset all modal-specific styles to ensure clean state\n this.resetModalStyles();\n }\n }\n\n /**\n * Resets all modal-specific styles by removing CSS properties that were set with !important\n */\n private resetModalStyles(): void {\n const modalStyleProperties = [\n \"position\",\n \"left\",\n \"top\",\n \"width\",\n \"height\",\n \"z-index\",\n \"display\",\n \"align-items\",\n \"justify-content\",\n \"background-color\",\n \"backdrop-filter\",\n \"opacity\",\n \"transition\",\n \"margin\",\n \"padding\",\n \"border\",\n \"border-radius\",\n \"min-height\",\n ];\n\n modalStyleProperties.forEach((property) => {\n this.container.style.removeProperty(property);\n });\n }\n\n public resize(): void {\n if (this.resizer) {\n this.resizer.resize();\n }\n }\n\n /**\n * Force show the shimmer loader and hide iframe content\n * Used when we want to mask non-login content\n */\n public forceShowLoader(): void {\n // Reset loading state to show shimmer\n this.isIframeLoaded = false;\n\n // Hide iframe content\n if (this.iframe) {\n this.iframe.style.opacity = \"0\";\n }\n\n // Hide close button\n if (this.displayMode === \"modal\" && this.closeButton) {\n this.closeButton.style.opacity = \"0\";\n }\n\n // Hide visual decorations (borders, shadows) when masking content\n if (this.displayMode === \"modal\") {\n this.removeModalVisualStyling();\n }\n this.removeIframeWrapperStyling();\n\n // Show shimmer loader\n if (this.iframeWrapper && !this.shimmerLoader) {\n this.showShimmerLoader(\n this.iframeWrapper,\n \"white\",\n this.displayMode === \"embedded\" ? IframeManager.MODAL_WIDTH : undefined,\n );\n }\n }\n\n /**\n * Force hide the shimmer loader and show iframe content\n * Used when we want to show the login app\n */\n public forceHideLoader(): void {\n // Restore visual decorations when showing content\n if (this.displayMode === \"modal\") {\n this.applyModalVisualStyling();\n }\n this.applyIframeWrapperStyling();\n\n this.markIframeAsLoaded();\n }\n\n /**\n * Applies visual styling (borders, shadows) to modal content wrapper\n */\n private applyModalVisualStyling(): void {\n if (!this.contentWrapper) return;\n\n this.contentWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n this.contentWrapper.style.boxShadow =\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\";\n }\n\n /**\n * Removes visual styling (borders, shadows) from modal content wrapper\n */\n private removeModalVisualStyling(): void {\n if (!this.contentWrapper) return;\n\n this.contentWrapper.style.borderRadius = \"0\";\n this.contentWrapper.style.boxShadow = \"none\";\n }\n\n /**\n * Applies visual styling (borders) to iframe wrapper\n */\n private applyIframeWrapperStyling(): void {\n if (!this.iframeWrapper) return;\n\n this.iframeWrapper.style.borderRadius = IframeManager.BORDER_RADIUS;\n }\n\n /**\n * Removes visual styling (borders) from iframe wrapper\n */\n private removeIframeWrapperStyling(): void {\n if (!this.iframeWrapper) return;\n\n this.iframeWrapper.style.borderRadius = \"0\";\n }\n\n /**\n * Check if an iframe is currently preloaded\n */\n public isIframePreloaded(): boolean {\n return this.isPreloaded;\n }\n\n /**\n * Get the URL of the preloaded iframe\n */\n public getPreloadedUrl(): string | null {\n return this.preloadUrl;\n }\n\n /**\n * Check if shimmer loader is currently active/showing\n */\n private isShimmerActive(): boolean {\n return !this.isIframeLoaded || !!this.shimmerLoader;\n }\n\n /**\n * Update the onClose handler for the iframe manager\n * This is useful when transitioning from preload to active authentication\n */\n public updateOnCloseHandler(onClose: () => void): void {\n this.onClose = onClose;\n }\n\n public showSubtlePopupFallbackIndicator(): void {\n if (!this.iframeWrapper && !this.contentWrapper) {\n this.logger.warn(\n \"Cannot show popup fallback indicator, no iframe wrapper or content wrapper found.\",\n );\n return;\n }\n\n const targetElement = this.iframeWrapper || this.contentWrapper;\n\n if (targetElement) {\n this.logger.debug(\"Showing popup fallback overlay.\");\n\n // Create overlay element\n const overlay = document.createElement(\"div\");\n overlay.id = \"civic-popup-fallback-overlay\";\n overlay.style.cssText = `\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n border-radius: ${IframeManager.BORDER_RADIUS};\n backdrop-filter: blur(.4px);\n opacity: 1;\n `;\n\n // Add overlay to target element\n targetElement.style.position = \"relative\";\n targetElement.appendChild(overlay);\n\n // Remove overlay quickly\n setTimeout(() => {\n if (overlay.parentNode) {\n overlay.parentNode.removeChild(overlay);\n }\n this.logger.debug(\"Popup fallback overlay removed.\");\n }, 500); // Remove after 500ms\n\n this.logger.debug(\"Popup fallback overlay displayed.\");\n }\n }\n}\n"]}
@@ -4,12 +4,15 @@ export declare class CivicIframeResizer {
4
4
  private logger;
5
5
  private messageListener;
6
6
  private requestSizeTimeouts;
7
- constructor(iframe: HTMLIFrameElement, container: HTMLElement);
7
+ private isShimmerActiveCallback?;
8
+ private blockedResizeMessages;
9
+ constructor(iframe: HTMLIFrameElement, container: HTMLElement, isShimmerActiveCallback?: () => boolean);
8
10
  private initializeResizer;
9
11
  private handleMessage;
10
12
  private requestSizeFromChild;
11
13
  private resizeIframe;
12
14
  cleanup(): void;
13
15
  resize(): void;
16
+ replayBlockedMessages(): void;
14
17
  }
15
18
  //# sourceMappingURL=IframeResizer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IframeResizer.d.ts","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeResizer.ts"],"names":[],"mappings":"AAeA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAAgD;IACvE,OAAO,CAAC,mBAAmB,CAAgB;gBAE/B,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW;IAQ7D,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,YAAY;IAyCb,OAAO,IAAI,IAAI;IAef,MAAM,IAAI,IAAI;CAItB"}
1
+ {"version":3,"file":"IframeResizer.d.ts","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeResizer.ts"],"names":[],"mappings":"AAeA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAAgD;IACvE,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,uBAAuB,CAAC,CAAgB;IAChD,OAAO,CAAC,qBAAqB,CAAuB;gBAGlD,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,WAAW,EACtB,uBAAuB,CAAC,EAAE,MAAM,OAAO;IAUzC,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,YAAY;IAyDb,OAAO,IAAI,IAAI;IAef,MAAM,IAAI,IAAI;IAKd,qBAAqB,IAAI,IAAI;CAgBrC"}
@@ -11,9 +11,12 @@ export class CivicIframeResizer {
11
11
  logger;
12
12
  messageListener = null;
13
13
  requestSizeTimeouts = [];
14
- constructor(iframe, container) {
14
+ isShimmerActiveCallback;
15
+ blockedResizeMessages = [];
16
+ constructor(iframe, container, isShimmerActiveCallback) {
15
17
  this.iframe = iframe;
16
18
  this.container = container;
19
+ this.isShimmerActiveCallback = isShimmerActiveCallback;
17
20
  this.logger = createLogger("iframe");
18
21
  this.initializeResizer();
19
22
  }
@@ -75,6 +78,19 @@ export class CivicIframeResizer {
75
78
  }
76
79
  }
77
80
  resizeIframe(height, animationDuration) {
81
+ // Skip resizing if shimmer is currently active, but store the message for later
82
+ if (this.isShimmerActiveCallback?.()) {
83
+ this.logger.debug("Skipping iframe resize - shimmer is active");
84
+ // Store the blocked message for later replay
85
+ const blockedMessage = {
86
+ type: MessageType.RESIZE,
87
+ height,
88
+ suggestedAnimationDuration: animationDuration,
89
+ };
90
+ // Replace any existing blocked message (keep only the latest)
91
+ this.blockedResizeMessages = [blockedMessage];
92
+ return;
93
+ }
78
94
  // Ensure minimum height
79
95
  const minHeight = 200;
80
96
  const finalHeight = Math.max(height, minHeight);
@@ -123,5 +139,18 @@ export class CivicIframeResizer {
123
139
  // Request size from child iframe
124
140
  this.requestSizeFromChild();
125
141
  }
142
+ replayBlockedMessages() {
143
+ if (this.blockedResizeMessages.length > 0) {
144
+ // Process all blocked messages
145
+ this.blockedResizeMessages.forEach((message) => {
146
+ if (message.type === MessageType.RESIZE &&
147
+ typeof message.height === "number") {
148
+ this.resizeIframe(message.height, message.suggestedAnimationDuration);
149
+ }
150
+ });
151
+ // Clear the blocked messages
152
+ this.blockedResizeMessages = [];
153
+ }
154
+ }
126
155
  }
127
156
  //# sourceMappingURL=IframeResizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IframeResizer.js","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeResizer.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,6CAA8B,CAAA;IAC9B,2CAA4B,CAAA;AAC9B,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AASD,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAoB;IAC1B,SAAS,CAAc;IACvB,MAAM,CAAkC;IACxC,eAAe,GAA2C,IAAI,CAAC;IAC/D,mBAAmB,GAAa,EAAE,CAAC;IAE3C,YAAY,MAAyB,EAAE,SAAsB;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MA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AAC,SAAS,GAAG,QAAQ,CAAC;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,0EAA0E,EAC1E,KAAK,CACN,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,WAAW,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YAC5D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC;QAED,6BAA6B;QAC7B,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC7C,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAChC,CAAC;IAEM,MAAM;QACX,iCAAiC;QACjC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Message types for communication between parent and child\nimport { createLogger } from \"../utils/logger.js\";\n\nenum MessageType {\n RESIZE = \"civic-iframe-resize\",\n READY = \"civic-iframe-ready\",\n}\n\ninterface IframeMessage {\n type: MessageType;\n height?: number;\n messageCount?: number;\n suggestedAnimationDuration?: number;\n}\n\nexport class CivicIframeResizer {\n private iframe: HTMLIFrameElement;\n private container: HTMLElement;\n private logger: ReturnType<typeof createLogger>;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n private requestSizeTimeouts: number[] = [];\n\n constructor(iframe: HTMLIFrameElement, container: HTMLElement) {\n this.iframe = iframe;\n this.container = container;\n this.logger = createLogger(\"iframe\");\n\n this.initializeResizer();\n }\n\n private initializeResizer(): void {\n this.logger.debug(\"Initializing Civic iframe resizer\");\n\n // Set up message listener for iframe resize messages\n this.messageListener = (event: MessageEvent) => {\n this.handleMessage(event);\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Request size from child iframe after it loads\n this.iframe.addEventListener(\"load\", () => {\n this.logger.debug(\"Iframe loaded, requesting size from child\");\n this.requestSizeFromChild();\n\n // Schedule multiple size requests to ensure we get the correct height\n const intervals = [100, 500, 1000, 2000, 3000];\n intervals.forEach((interval) => {\n const timeoutId = window.setTimeout(() => {\n this.requestSizeFromChild();\n }, interval);\n this.requestSizeTimeouts.push(timeoutId);\n });\n });\n }\n\n private handleMessage(event: MessageEvent): void {\n try {\n const message = event.data as IframeMessage;\n\n // Only handle messages from our iframe\n if (\n !this.iframe.contentWindow ||\n event.source !== this.iframe.contentWindow\n ) {\n return;\n }\n\n this.logger.debug(\"Received message from iframe:\", message);\n\n // Handle ready message\n if (message.type === MessageType.READY) {\n this.logger.debug(\"Iframe child is ready\");\n this.requestSizeFromChild();\n }\n\n // Handle resize message\n if (\n message.type === MessageType.RESIZE &&\n typeof message.height === \"number\"\n ) {\n this.logger.debug(\"Resizing iframe to height:\", message.height);\n this.resizeIframe(message.height, message.suggestedAnimationDuration);\n }\n } catch (error) {\n this.logger.debug(\"Error processing iframe message:\", error);\n }\n }\n\n private requestSizeFromChild(): void {\n if (this.iframe.contentWindow) {\n try {\n this.logger.debug(\"Requesting size from iframe child\");\n this.iframe.contentWindow.postMessage({ type: \"request-size\" }, \"*\");\n } catch (error) {\n this.logger.debug(\"Error requesting size from iframe:\", error);\n }\n }\n }\n\n private resizeIframe(height: number, animationDuration?: number): void {\n // Ensure minimum height\n const minHeight = 200;\n const finalHeight = Math.max(height, minHeight);\n\n // Apply height to iframe and ensure no overflow\n this.iframe.style.height = `${finalHeight}px`;\n this.iframe.style.maxHeight = `${finalHeight}px`;\n this.iframe.style.overflow = \"hidden\";\n this.iframe.style.overflowX = \"hidden\";\n this.iframe.style.overflowY = \"hidden\";\n\n // Apply transition if animation duration is suggested\n if (animationDuration) {\n this.iframe.style.transition = `height ${animationDuration}ms ease`;\n }\n\n // Try to inject additional CSS to prevent scrollbars after resize\n try {\n const iframeDoc =\n this.iframe.contentDocument || this.iframe.contentWindow?.document;\n if (iframeDoc && iframeDoc.body) {\n iframeDoc.body.style.overflow = \"hidden\";\n iframeDoc.body.style.overflowX = \"hidden\";\n iframeDoc.body.style.overflowY = \"hidden\";\n if (iframeDoc.documentElement) {\n iframeDoc.documentElement.style.overflow = \"hidden\";\n iframeDoc.documentElement.style.overflowX = \"hidden\";\n iframeDoc.documentElement.style.overflowY = \"hidden\";\n }\n }\n } catch (error) {\n this.logger.debug(\n \"Could not apply overflow styles to iframe content (likely cross-origin):\",\n error,\n );\n }\n\n this.logger.debug(`Iframe resized to ${finalHeight}px`);\n }\n\n public cleanup(): void {\n this.logger.debug(\"Cleaning up iframe resizer\");\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n\n // Clear any pending timeouts\n this.requestSizeTimeouts.forEach((timeoutId) => {\n window.clearTimeout(timeoutId);\n });\n this.requestSizeTimeouts = [];\n }\n\n public resize(): void {\n // Request size from child iframe\n this.requestSizeFromChild();\n }\n}\n"]}
1
+ {"version":3,"file":"IframeResizer.js","sourceRoot":"","sources":["../../../src/vanillajs/iframe/IframeResizer.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,6CAA8B,CAAA;IAC9B,2CAA4B,CAAA;AAC9B,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AASD,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAoB;IAC1B,SAAS,CAAc;IACvB,MAAM,CAAkC;IACxC,eAAe,GAA2C,IAAI,CAAC;IAC/D,mBAAmB,GAAa,EAAE,CAAC;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AAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAChC,CAAC;IAEM,MAAM;QACX,iCAAiC;QACjC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAEM,qBAAqB;QAC1B,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,+BAA+B;YAC/B,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC7C,IACE,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM;oBACnC,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAClC,CAAC;oBACD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;gBACxE,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,6BAA6B;YAC7B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Message types for communication between parent and child\nimport { createLogger } from \"../utils/logger.js\";\n\nenum MessageType {\n RESIZE = \"civic-iframe-resize\",\n READY = \"civic-iframe-ready\",\n}\n\ninterface IframeMessage {\n type: MessageType;\n height?: number;\n messageCount?: number;\n suggestedAnimationDuration?: number;\n}\n\nexport class CivicIframeResizer {\n private iframe: HTMLIFrameElement;\n private container: HTMLElement;\n private logger: ReturnType<typeof createLogger>;\n private messageListener: ((event: MessageEvent) => void) | null = null;\n private requestSizeTimeouts: number[] = [];\n private isShimmerActiveCallback?: () => boolean;\n private blockedResizeMessages: IframeMessage[] = [];\n\n constructor(\n iframe: HTMLIFrameElement,\n container: HTMLElement,\n isShimmerActiveCallback?: () => boolean,\n ) {\n this.iframe = iframe;\n this.container = container;\n this.isShimmerActiveCallback = isShimmerActiveCallback;\n this.logger = createLogger(\"iframe\");\n\n this.initializeResizer();\n }\n\n private initializeResizer(): void {\n this.logger.debug(\"Initializing Civic iframe resizer\");\n\n // Set up message listener for iframe resize messages\n this.messageListener = (event: MessageEvent) => {\n this.handleMessage(event);\n };\n\n window.addEventListener(\"message\", this.messageListener);\n\n // Request size from child iframe after it loads\n this.iframe.addEventListener(\"load\", () => {\n this.logger.debug(\"Iframe loaded, requesting size from child\");\n this.requestSizeFromChild();\n\n // Schedule multiple size requests to ensure we get the correct height\n const intervals = [100, 500, 1000, 2000, 3000];\n intervals.forEach((interval) => {\n const timeoutId = window.setTimeout(() => {\n this.requestSizeFromChild();\n }, interval);\n this.requestSizeTimeouts.push(timeoutId);\n });\n });\n }\n\n private handleMessage(event: MessageEvent): void {\n try {\n const message = event.data as IframeMessage;\n\n // Only handle messages from our iframe\n if (\n !this.iframe.contentWindow ||\n event.source !== this.iframe.contentWindow\n ) {\n return;\n }\n\n this.logger.debug(\"Received message from iframe:\", message);\n\n // Handle ready message\n if (message.type === MessageType.READY) {\n this.logger.debug(\"Iframe child is ready\");\n this.requestSizeFromChild();\n }\n\n // Handle resize message\n if (\n message.type === MessageType.RESIZE &&\n typeof message.height === \"number\"\n ) {\n this.logger.debug(\"Resizing iframe to height:\", message.height);\n this.resizeIframe(message.height, message.suggestedAnimationDuration);\n }\n } catch (error) {\n this.logger.debug(\"Error processing iframe message:\", error);\n }\n }\n\n private requestSizeFromChild(): void {\n if (this.iframe.contentWindow) {\n try {\n this.logger.debug(\"Requesting size from iframe child\");\n this.iframe.contentWindow.postMessage({ type: \"request-size\" }, \"*\");\n } catch (error) {\n this.logger.debug(\"Error requesting size from iframe:\", error);\n }\n }\n }\n\n private resizeIframe(height: number, animationDuration?: number): void {\n // Skip resizing if shimmer is currently active, but store the message for later\n if (this.isShimmerActiveCallback?.()) {\n this.logger.debug(\"Skipping iframe resize - shimmer is active\");\n\n // Store the blocked message for later replay\n const blockedMessage: IframeMessage = {\n type: MessageType.RESIZE,\n height,\n suggestedAnimationDuration: animationDuration,\n };\n\n // Replace any existing blocked message (keep only the latest)\n this.blockedResizeMessages = [blockedMessage];\n return;\n }\n\n // Ensure minimum height\n const minHeight = 200;\n const finalHeight = Math.max(height, minHeight);\n\n // Apply height to iframe and ensure no overflow\n this.iframe.style.height = `${finalHeight}px`;\n this.iframe.style.maxHeight = `${finalHeight}px`;\n this.iframe.style.overflow = \"hidden\";\n this.iframe.style.overflowX = \"hidden\";\n this.iframe.style.overflowY = \"hidden\";\n\n // Apply transition if animation duration is suggested\n if (animationDuration) {\n this.iframe.style.transition = `height ${animationDuration}ms ease`;\n }\n\n // Try to inject additional CSS to prevent scrollbars after resize\n try {\n const iframeDoc =\n this.iframe.contentDocument || this.iframe.contentWindow?.document;\n if (iframeDoc && iframeDoc.body) {\n iframeDoc.body.style.overflow = \"hidden\";\n iframeDoc.body.style.overflowX = \"hidden\";\n iframeDoc.body.style.overflowY = \"hidden\";\n if (iframeDoc.documentElement) {\n iframeDoc.documentElement.style.overflow = \"hidden\";\n iframeDoc.documentElement.style.overflowX = \"hidden\";\n iframeDoc.documentElement.style.overflowY = \"hidden\";\n }\n }\n } catch (error) {\n this.logger.debug(\n \"Could not apply overflow styles to iframe content (likely cross-origin):\",\n error,\n );\n }\n\n this.logger.debug(`Iframe resized to ${finalHeight}px`);\n }\n\n public cleanup(): void {\n this.logger.debug(\"Cleaning up iframe resizer\");\n\n if (this.messageListener) {\n window.removeEventListener(\"message\", this.messageListener);\n this.messageListener = null;\n }\n\n // Clear any pending timeouts\n this.requestSizeTimeouts.forEach((timeoutId) => {\n window.clearTimeout(timeoutId);\n });\n this.requestSizeTimeouts = [];\n }\n\n public resize(): void {\n // Request size from child iframe\n this.requestSizeFromChild();\n }\n\n public replayBlockedMessages(): void {\n if (this.blockedResizeMessages.length > 0) {\n // Process all blocked messages\n this.blockedResizeMessages.forEach((message) => {\n if (\n message.type === MessageType.RESIZE &&\n typeof message.height === \"number\"\n ) {\n this.resizeIframe(message.height, message.suggestedAnimationDuration);\n }\n });\n\n // Clear the blocked messages\n this.blockedResizeMessages = [];\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civic/auth",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.9.0-beta.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",