sunpeak 0.13.6 → 0.13.7

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 (95) hide show
  1. package/dist/chatgpt/conversation.d.ts +1 -7
  2. package/dist/chatgpt/iframe-resource.d.ts +7 -8
  3. package/dist/chatgpt/index.cjs +2 -1
  4. package/dist/chatgpt/index.cjs.map +1 -1
  5. package/dist/chatgpt/index.d.ts +1 -1
  6. package/dist/chatgpt/index.js +4 -3
  7. package/dist/chatgpt/mcp-app-host.d.ts +5 -0
  8. package/dist/{index-B_In_BWg.cjs → index-B9MMk69u.cjs} +57 -56
  9. package/dist/index-B9MMk69u.cjs.map +1 -0
  10. package/dist/{index-CkEAx7FS.js → index-DqOCq5r8.js} +56 -55
  11. package/dist/index-DqOCq5r8.js.map +1 -0
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.js +2 -2
  14. package/package.json +1 -1
  15. package/template/dist/albums/albums.json +1 -1
  16. package/template/dist/carousel/carousel.json +1 -1
  17. package/template/dist/map/map.json +1 -1
  18. package/template/dist/review/review.json +1 -1
  19. package/template/node_modules/.vite/deps/_metadata.json +25 -25
  20. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  21. package/dist/index-B_In_BWg.cjs.map +0 -1
  22. package/dist/index-CkEAx7FS.js.map +0 -1
  23. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps.js +0 -0
  24. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps.js.map +0 -0
  25. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps_app-bridge.js +0 -0
  26. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps_app-bridge.js.map +0 -0
  27. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps_react.js +3 -3
  28. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@modelcontextprotocol_ext-apps_react.js.map +0 -0
  29. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Avatar.js +0 -0
  30. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Avatar.js.map +0 -0
  31. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Button.js +0 -0
  32. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Button.js.map +0 -0
  33. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Checkbox.js +1 -1
  34. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Checkbox.js.map +0 -0
  35. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Icon.js +0 -0
  36. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Icon.js.map +0 -0
  37. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Input.js +0 -0
  38. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Input.js.map +0 -0
  39. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_SegmentedControl.js +1 -1
  40. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_SegmentedControl.js.map +0 -0
  41. package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Select.js +1 -1
  42. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Select.js.map +0 -0
  43. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Textarea.js +0 -0
  44. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_components_Textarea.js.map +0 -0
  45. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_theme.js +0 -0
  46. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/@openai_apps-sdk-ui_theme.js.map +0 -0
  47. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-3FUH6LFP.js +0 -0
  48. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-3FUH6LFP.js.map +0 -0
  49. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-4EQ7FTMQ.js +0 -0
  50. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-4EQ7FTMQ.js.map +0 -0
  51. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-4WVD247F.js +0 -0
  52. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-4WVD247F.js.map +0 -0
  53. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-ABGJ7IDC.js +0 -0
  54. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-ABGJ7IDC.js.map +0 -0
  55. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-DP4XHQAG.js +0 -0
  56. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-DP4XHQAG.js.map +0 -0
  57. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-EGRHWZRV.js +0 -0
  58. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-EGRHWZRV.js.map +0 -0
  59. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-EHI2XMPP.js +0 -0
  60. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-EHI2XMPP.js.map +0 -0
  61. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-JWMBYPFX.js +0 -0
  62. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-JWMBYPFX.js.map +0 -0
  63. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-PZDCUP6P.js +0 -0
  64. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-PZDCUP6P.js.map +0 -0
  65. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-Q2RBUOJ3.js +0 -0
  66. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-Q2RBUOJ3.js.map +0 -0
  67. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-SPDZ46BB.js +0 -0
  68. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-SPDZ46BB.js.map +0 -0
  69. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-WEIC4XKX.js +0 -0
  70. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-WEIC4XKX.js.map +0 -0
  71. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-WSHFT23M.js +0 -0
  72. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-WSHFT23M.js.map +0 -0
  73. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-XQARMNNG.js +0 -0
  74. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/chunk-XQARMNNG.js.map +0 -0
  75. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/clsx.js +0 -0
  76. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/clsx.js.map +0 -0
  77. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/embla-carousel-react.js +0 -0
  78. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/embla-carousel-react.js.map +0 -0
  79. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/embla-carousel-wheel-gestures.js +0 -0
  80. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/embla-carousel-wheel-gestures.js.map +0 -0
  81. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/mapbox-gl.js +0 -0
  82. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/mapbox-gl.js.map +0 -0
  83. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/package.json +0 -0
  84. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react-dom.js +0 -0
  85. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react-dom.js.map +0 -0
  86. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react-dom_client.js +0 -0
  87. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react-dom_client.js.map +0 -0
  88. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react.js +0 -0
  89. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react.js.map +0 -0
  90. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react_jsx-dev-runtime.js +0 -0
  91. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react_jsx-dev-runtime.js.map +0 -0
  92. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react_jsx-runtime.js +0 -0
  93. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/react_jsx-runtime.js.map +0 -0
  94. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/tailwind-merge.js +0 -0
  95. /package/template/node_modules/.vite-mcp/{deps_temp_170f8fb8 → deps_temp_78ab0da5}/tailwind-merge.js.map +0 -0
@@ -7527,8 +7527,7 @@ function Conversation({
7527
7527
  onRequestDisplayMode,
7528
7528
  appName = "Sunpeak",
7529
7529
  appIcon,
7530
- userMessage = "What have you got for me today?",
7531
- isTransitioning = false
7530
+ userMessage = "What have you got for me today?"
7532
7531
  }) {
7533
7532
  const isDesktop = platform2 === "desktop";
7534
7533
  const containerWidth = screenWidth === "full" ? "100%" : `${SCREEN_WIDTHS[screenWidth]}px`;
@@ -7650,12 +7649,6 @@ function Conversation({
7650
7649
  "div",
7651
7650
  {
7652
7651
  className: isPip ? "h-full w-full max-w-full overflow-auto bg-white dark:bg-[#212121]" : isFullscreen ? "h-full w-full max-w-full overflow-auto bg-surface" : "h-full w-full max-w-full bg-transparent",
7653
- style: {
7654
- opacity: isTransitioning ? 0 : 1,
7655
- // Only animate the reveal — the hide must be instant
7656
- // to prevent old content from being visible in the new layout.
7657
- transition: isTransitioning ? "none" : "opacity 100ms"
7658
- },
7659
7652
  children
7660
7653
  }
7661
7654
  )
@@ -14053,10 +14046,12 @@ class McpAppHost {
14053
14046
  _contentWindow = null;
14054
14047
  _fenceId = 0;
14055
14048
  _fenceCleanup = null;
14049
+ _prevDisplayMode;
14056
14050
  _pendingToolInput = null;
14057
14051
  _pendingToolResult = null;
14058
14052
  constructor(options = {}) {
14059
14053
  this.options = options;
14054
+ this._prevDisplayMode = options.hostContext?.displayMode;
14060
14055
  this.bridge = new j_(null, HOST_INFO, HOST_CAPABILITIES, {
14061
14056
  hostContext: options.hostContext
14062
14057
  });
@@ -14191,9 +14186,19 @@ class McpAppHost {
14191
14186
  }
14192
14187
  /**
14193
14188
  * Update the host context and notify the connected app.
14189
+ * Automatically detects display mode changes and waits for the iframe
14190
+ * to commit its DOM before firing onDisplayModeReady.
14194
14191
  */
14195
14192
  setHostContext(context) {
14196
14193
  this.bridge.setHostContext(context);
14194
+ const currentMode = context.displayMode;
14195
+ if (currentMode && currentMode !== this._prevDisplayMode) {
14196
+ this._prevDisplayMode = currentMode;
14197
+ const mode = currentMode;
14198
+ this.waitForPaint().then(() => {
14199
+ this.options.onDisplayModeReady?.(mode);
14200
+ });
14201
+ }
14197
14202
  }
14198
14203
  /**
14199
14204
  * Send tool input to the app.
@@ -14252,7 +14257,6 @@ class McpAppHost {
14252
14257
  }
14253
14258
  await this.bridge.close();
14254
14259
  this._initialized = false;
14255
- this._contentWindow = null;
14256
14260
  }
14257
14261
  /**
14258
14262
  * Debug: Inject state directly into the app's useAppState hook.
@@ -14309,6 +14313,11 @@ function isAllowedUrl(src) {
14309
14313
  return false;
14310
14314
  }
14311
14315
  }
14316
+ function extractResourceCSP(resource) {
14317
+ const meta = resource._meta;
14318
+ const ui2 = meta?.ui;
14319
+ return ui2?.csp;
14320
+ }
14312
14321
  const SDK_RESOURCE_DOMAINS = ["https://cdn.openai.com"];
14313
14322
  function isValidCspSource(source) {
14314
14323
  if (!source || /[\s;,']/.test(source) || source === "*") return false;
@@ -14363,6 +14372,23 @@ function generateCSP(csp, scriptSrc) {
14363
14372
  directives.push(`media-src ${resourceList}`);
14364
14373
  return directives.join("; ");
14365
14374
  }
14375
+ const PAINT_FENCE_SCRIPT = `window.addEventListener("message",function(e){
14376
+ if(e.data&&e.data.method==="sunpeak/fence"){
14377
+ var fid=e.data.params&&e.data.params.fenceId;
14378
+ requestAnimationFrame(function(){
14379
+ e.source.postMessage({jsonrpc:"2.0",method:"sunpeak/fence-ack",params:{fenceId:fid}},"*");
14380
+ });}});`;
14381
+ function injectPaintFence(iframe) {
14382
+ try {
14383
+ const doc = iframe.contentDocument;
14384
+ if (!doc || doc.querySelector("script[data-sunpeak-fence]")) return;
14385
+ const script = doc.createElement("script");
14386
+ script.setAttribute("data-sunpeak-fence", "");
14387
+ script.textContent = PAINT_FENCE_SCRIPT;
14388
+ doc.head.appendChild(script);
14389
+ } catch {
14390
+ }
14391
+ }
14366
14392
  function generateScriptHtml(scriptSrc, theme, cspPolicy) {
14367
14393
  const safeScriptSrc = escapeHtml(scriptSrc);
14368
14394
  const safeCsp = escapeHtml(cspPolicy);
@@ -14387,19 +14413,7 @@ function generateScriptHtml(scriptSrc, theme, cspPolicy) {
14387
14413
  color-scheme: dark light;
14388
14414
  }
14389
14415
  </style>
14390
- <script>
14391
- // Paint fence responder — allows the host to wait for this iframe to
14392
- // process pending messages and commit DOM updates before revealing content.
14393
- // Formatted as JSON-RPC 2.0 notifications to avoid PostMessageTransport parse errors.
14394
- window.addEventListener("message",function(e){
14395
- if(e.data&&e.data.method==="sunpeak/fence"){
14396
- var fid=e.data.params&&e.data.params.fenceId;
14397
- requestAnimationFrame(function(){
14398
- e.source.postMessage({jsonrpc:"2.0",method:"sunpeak/fence-ack",params:{fenceId:fid}},"*");
14399
- });
14400
- }
14401
- });
14402
- <\/script>
14416
+ <script>${PAINT_FENCE_SCRIPT}<\/script>
14403
14417
  </head>
14404
14418
  <body>
14405
14419
  <div id="root"></div>
@@ -14417,14 +14431,13 @@ function IframeResource({
14417
14431
  csp,
14418
14432
  className,
14419
14433
  style,
14420
- onDisplayModeReady,
14421
14434
  debugInjectState
14422
14435
  }) {
14423
14436
  const iframeRef = useRef(null);
14424
14437
  const hostRef = useRef(null);
14425
- const prevDisplayModeRef = useRef(hostContext?.displayMode);
14426
- const onDisplayModeReadyRef = useRef(onDisplayModeReady);
14427
- onDisplayModeReadyRef.current = onDisplayModeReady;
14438
+ const [readyDisplayMode, setReadyDisplayMode] = useState(
14439
+ hostContext?.displayMode
14440
+ );
14428
14441
  const resourceUrl = src ?? scriptSrc;
14429
14442
  const hasReceivedSizeRef = useRef(false);
14430
14443
  const host = useMemo(
@@ -14437,7 +14450,8 @@ function IframeResource({
14437
14450
  hasReceivedSizeRef.current = true;
14438
14451
  iframeRef.current.style.height = `${params.height}px`;
14439
14452
  }
14440
- }
14453
+ },
14454
+ onDisplayModeReady: (mode) => setReadyDisplayMode(mode)
14441
14455
  }),
14442
14456
  // eslint-disable-next-line react-hooks/exhaustive-deps
14443
14457
  []
@@ -14454,22 +14468,13 @@ function IframeResource({
14454
14468
  [host]
14455
14469
  );
14456
14470
  const handleLoad = useCallback(() => {
14457
- if (toolInput) host.sendToolInput(toolInput);
14458
- if (toolResult) host.sendToolResult(toolResult);
14459
- }, [host, toolInput, toolResult]);
14471
+ if (src && iframeRef.current) {
14472
+ injectPaintFence(iframeRef.current);
14473
+ }
14474
+ }, [src]);
14460
14475
  useEffect(() => {
14461
14476
  if (hostContext) {
14462
14477
  host.setHostContext(hostContext);
14463
- const currentMode = hostContext.displayMode;
14464
- if (currentMode !== prevDisplayModeRef.current) {
14465
- prevDisplayModeRef.current = currentMode;
14466
- if (currentMode) {
14467
- const mode = currentMode;
14468
- host.waitForPaint().then(() => {
14469
- onDisplayModeReadyRef.current?.(mode);
14470
- });
14471
- }
14472
- }
14473
14478
  }
14474
14479
  }, [host, hostContext]);
14475
14480
  useEffect(() => {
@@ -14505,6 +14510,7 @@ function IframeResource({
14505
14510
  const theme = hostContext?.theme ?? "dark";
14506
14511
  return generateScriptHtml(absoluteScriptSrc, theme, cspPolicy);
14507
14512
  }, [scriptSrc, isValidUrl, csp, hostContext?.theme]);
14513
+ const isTransitioning = hostContext?.displayMode !== readyDisplayMode;
14508
14514
  if (src) {
14509
14515
  if (!isValidUrl) {
14510
14516
  console.error("[IframeResource] URL not allowed:", src);
@@ -14528,6 +14534,10 @@ function IframeResource({
14528
14534
  // Start with minHeight to prevent collapse, but allow auto-resize to set actual height.
14529
14535
  // Don't use height: 100% as it requires explicit height in parent chain.
14530
14536
  minHeight: "200px",
14537
+ // Hide during display mode transitions; reveal with a short fade once
14538
+ // the iframe has committed its DOM for the new mode.
14539
+ opacity: isTransitioning ? 0 : 1,
14540
+ transition: isTransitioning ? "none" : "opacity 100ms",
14531
14541
  ...style
14532
14542
  },
14533
14543
  title: "Resource Preview",
@@ -14551,6 +14561,8 @@ function IframeResource({
14551
14561
  // Start with minHeight to prevent collapse, but allow auto-resize to set actual height.
14552
14562
  // Don't use height: 100% as it requires explicit height in parent chain.
14553
14563
  minHeight: "200px",
14564
+ opacity: isTransitioning ? 0 : 1,
14565
+ transition: isTransitioning ? "none" : "opacity 100ms",
14554
14566
  ...style
14555
14567
  },
14556
14568
  title: "Resource Preview",
@@ -14676,12 +14688,6 @@ function ChatGPTSimulator({
14676
14688
  _setDisplayMode(mode);
14677
14689
  }
14678
14690
  };
14679
- const [readyDisplayMode, setReadyDisplayMode] = useState(
14680
- urlParams.displayMode ?? DEFAULT_DISPLAY_MODE
14681
- );
14682
- const handleDisplayModeReady = useCallback((mode) => {
14683
- setReadyDisplayMode(mode);
14684
- }, []);
14685
14691
  const hostContext = useMemo(
14686
14692
  () => ({
14687
14693
  theme,
@@ -14772,11 +14778,7 @@ function ChatGPTSimulator({
14772
14778
  }, [toolResult, modelContext]);
14773
14779
  const resourceUrl = selectedSim?.resourceUrl;
14774
14780
  const resourceScript = selectedSim?.resourceScript;
14775
- const resourceMeta = selectedSim?.resource._meta;
14776
- const resourceUi = resourceMeta?.ui;
14777
- const csp = resourceUi?.csp;
14778
- const hasIframeContent = !!(resourceUrl || resourceScript);
14779
- const isTransitioning = hasIframeContent && displayMode !== readyDisplayMode;
14781
+ const csp = selectedSim ? extractResourceCSP(selectedSim.resource) : void 0;
14780
14782
  let content;
14781
14783
  if (resourceUrl) {
14782
14784
  content = /* @__PURE__ */ jsx(
@@ -14790,7 +14792,6 @@ function ChatGPTSimulator({
14790
14792
  onDisplayModeChange: handleDisplayModeChange,
14791
14793
  onUpdateModelContext: handleUpdateModelContext
14792
14794
  },
14793
- onDisplayModeReady: handleDisplayModeReady,
14794
14795
  debugInjectState: modelContext,
14795
14796
  className: "h-full w-full"
14796
14797
  }
@@ -14808,7 +14809,6 @@ function ChatGPTSimulator({
14808
14809
  onDisplayModeChange: handleDisplayModeChange,
14809
14810
  onUpdateModelContext: handleUpdateModelContext
14810
14811
  },
14811
- onDisplayModeReady: handleDisplayModeReady,
14812
14812
  debugInjectState: modelContext,
14813
14813
  className: "h-full w-full"
14814
14814
  }
@@ -15034,7 +15034,6 @@ function ChatGPTSimulator({
15034
15034
  appName,
15035
15035
  appIcon,
15036
15036
  userMessage: selectedSim?.userMessage,
15037
- isTransitioning,
15038
15037
  children: content
15039
15038
  },
15040
15039
  selectedSimulationName
@@ -15095,6 +15094,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
15095
15094
  buildSimulations,
15096
15095
  createResourceExports,
15097
15096
  createSimulatorUrl,
15097
+ extractResourceCSP,
15098
15098
  extractResourceKey,
15099
15099
  extractSimulationKey,
15100
15100
  extractSimulationName,
@@ -15114,7 +15114,8 @@ export {
15114
15114
  ThemeProvider as T,
15115
15115
  createSimulatorUrl as a,
15116
15116
  clsx as c,
15117
+ extractResourceCSP as e,
15117
15118
  index as i,
15118
15119
  useThemeContext as u
15119
15120
  };
15120
- //# sourceMappingURL=index-CkEAx7FS.js.map
15121
+ //# sourceMappingURL=index-DqOCq5r8.js.map