@flamingo-stack/openframe-frontend-core 0.0.810 → 0.0.811

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 (115) hide show
  1. package/dist/{case-study-card-MEWJNF4N.cjs → case-study-card-AMINZROX.cjs} +5 -5
  2. package/dist/{chunk-FRS2VO22.cjs → chunk-243TS7YL.cjs} +38 -38
  3. package/dist/{chunk-GAHXURKJ.cjs → chunk-5QLDHPPU.cjs} +2 -2
  4. package/dist/{chunk-MAQFG62O.cjs → chunk-66J7ZSI5.cjs} +34 -34
  5. package/dist/{chunk-RKNCNL6K.cjs → chunk-6GT3ZL27.cjs} +28 -28
  6. package/dist/{chunk-PRCGRDHV.cjs → chunk-7Y6M4FW4.cjs} +5 -5
  7. package/dist/{chunk-TOWVMBAP.cjs → chunk-ACCZCRXT.cjs} +14 -14
  8. package/dist/{chunk-VXAKQRV7.cjs → chunk-APOMNC7H.cjs} +5 -5
  9. package/dist/{chunk-3FBXQSSC.cjs → chunk-CB77J5L7.cjs} +858 -664
  10. package/dist/{chunk-VHX4A4SA.cjs → chunk-CC3Q3MQG.cjs} +2 -2
  11. package/dist/{chunk-TOTR2WMH.cjs → chunk-CJ7W2SY4.cjs} +8 -8
  12. package/dist/{chunk-CZWQCYKV.cjs → chunk-CLU2KJFB.cjs} +3 -3
  13. package/dist/{chunk-OJZBZH56.cjs → chunk-CNTBGJA7.cjs} +3 -3
  14. package/dist/{chunk-F26COFTW.cjs → chunk-CPP2APON.cjs} +89 -89
  15. package/dist/{chunk-TT64NRFU.cjs → chunk-ERLMCSGF.cjs} +3 -3
  16. package/dist/{chunk-RPBOWCME.cjs → chunk-FK2WFU7R.cjs} +17 -17
  17. package/dist/{chunk-7PNRXJX2.cjs → chunk-FX35L4Y6.cjs} +3 -3
  18. package/dist/{chunk-5GJM7VRR.cjs → chunk-GI3MMBP3.cjs} +91 -26
  19. package/dist/{chunk-EKDLVUEA.cjs → chunk-GU3GJ5DH.cjs} +48 -48
  20. package/dist/{chunk-X2JSCOOR.cjs → chunk-IQLXO6EI.cjs} +97 -97
  21. package/dist/{chunk-J4QORJMC.cjs → chunk-J6C7F63P.cjs} +113 -113
  22. package/dist/{chunk-PIKHEBG5.cjs → chunk-JNWJB4Z5.cjs} +52 -52
  23. package/dist/{chunk-5MTYKS2Q.cjs → chunk-KVDUWXVZ.cjs} +4 -4
  24. package/dist/{chunk-V4FXUIMH.cjs → chunk-LC65AC6M.cjs} +4 -4
  25. package/dist/{chunk-FCFYZIOY.cjs → chunk-MDBOYMCW.cjs} +22 -22
  26. package/dist/{chunk-AQXKXZWB.cjs → chunk-MG3HJIGG.cjs} +4 -4
  27. package/dist/{chunk-KVJKKVB3.cjs → chunk-NZSWROGM.cjs} +7 -7
  28. package/dist/{chunk-B6DIM5JG.cjs → chunk-O32RLIN4.cjs} +6 -6
  29. package/dist/{chunk-2C63MX75.cjs → chunk-O4MEG2ZS.cjs} +21 -21
  30. package/dist/{chunk-4W77VLQV.cjs → chunk-OQDPZOGC.cjs} +6 -6
  31. package/dist/{chunk-ZXBRPQND.cjs → chunk-PCVY63WQ.cjs} +17 -17
  32. package/dist/{chunk-ML3DG4SS.cjs → chunk-PMOMZSCX.cjs} +5 -5
  33. package/dist/{chunk-TUZV2ZQY.cjs → chunk-Q7QYAINS.cjs} +2 -2
  34. package/dist/{chunk-ETI7OMPU.cjs → chunk-R55KNVPR.cjs} +71 -71
  35. package/dist/{chunk-NG3RKTQU.cjs → chunk-SFUNXMY3.cjs} +8 -8
  36. package/dist/{chunk-GG36TCKP.cjs → chunk-TKK66KHU.cjs} +6 -6
  37. package/dist/{chunk-TGOJHOQR.cjs → chunk-U2MHQBL4.cjs} +3 -3
  38. package/dist/{chunk-I3RJLXEL.cjs → chunk-UP3TLY2V.cjs} +131 -131
  39. package/dist/{chunk-CLMUD56S.cjs → chunk-VXMPVDOS.cjs} +26 -26
  40. package/dist/{chunk-MSAXZRXZ.cjs → chunk-WX5WDSKV.cjs} +583 -582
  41. package/dist/{chunk-R2ABQG2T.cjs → chunk-XLEWM5X5.cjs} +53 -53
  42. package/dist/{chunk-SZHDXXMK.cjs → chunk-YSDB6HGQ.cjs} +3 -3
  43. package/dist/{chunk-JLKGLPDC.cjs → chunk-ZW25QUJK.cjs} +16 -16
  44. package/dist/{chunk-FLW2VL5W.cjs → chunk-ZZO3FGPM.cjs} +24 -24
  45. package/dist/{cloud-tenants-QTASS5KP.cjs → cloud-tenants-XGGQG7SO.cjs} +24 -24
  46. package/dist/components/case-studies/index.cjs +40 -40
  47. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  48. package/dist/components/chat/entity-cards/dispatch.js +4 -1
  49. package/dist/components/chat/index.cjs +18 -18
  50. package/dist/components/contact/index.cjs +25 -25
  51. package/dist/components/docs/index.cjs +28 -28
  52. package/dist/components/embeds/index.cjs +25 -25
  53. package/dist/components/faq/index.cjs +26 -26
  54. package/dist/components/features/index.cjs +24 -24
  55. package/dist/components/help-center-pages/index.cjs +129 -129
  56. package/dist/components/index.cjs +89 -89
  57. package/dist/components/meeting-scheduler/index.cjs +93 -93
  58. package/dist/components/navigation/index.cjs +27 -27
  59. package/dist/components/onboarding-guides/index.cjs +27 -27
  60. package/dist/components/product-demo/index.cjs +35 -35
  61. package/dist/components/related-content/index.cjs +14 -14
  62. package/dist/components/tickets/index.cjs +31 -31
  63. package/dist/components/ui/index.cjs +24 -24
  64. package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
  65. package/dist/components/ui/markdown/base-components.js +6 -7
  66. package/dist/components/ui/markdown/engine.d.ts +7 -0
  67. package/dist/components/ui/markdown/engine.d.ts.map +1 -1
  68. package/dist/components/ui/markdown/engine.js +12 -3
  69. package/dist/components/ui/markdown/external-media-notice.d.ts +33 -0
  70. package/dist/components/ui/markdown/external-media-notice.d.ts.map +1 -0
  71. package/dist/components/ui/markdown/external-media-notice.js +56 -0
  72. package/dist/components/ui/markdown/mermaid-diagram.d.ts +24 -2
  73. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -1
  74. package/dist/components/ui/markdown/mermaid-diagram.js +66 -6
  75. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +4 -4
  76. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -1
  77. package/dist/components/ui/markdown/rich/rich-markdown-renderer.js +2 -1
  78. package/dist/components/ui/markdown/sanitize.d.ts +28 -3
  79. package/dist/components/ui/markdown/sanitize.d.ts.map +1 -1
  80. package/dist/components/ui/markdown/sanitize.js +84 -12
  81. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +3 -2
  82. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -1
  83. package/dist/{devices-KPMQI57Y.cjs → devices-H5Y4DBVC.cjs} +25 -25
  84. package/dist/{embeddable-chat-LB7NDFVQ.cjs → embeddable-chat-77ZOLCCK.cjs} +88 -88
  85. package/dist/hooks/index.cjs +10 -10
  86. package/dist/index.cjs +29 -29
  87. package/dist/{knowledge-JWGBY3ZJ.cjs → knowledge-MGH65HXM.cjs} +25 -25
  88. package/dist/{logs-QENTXKWY.cjs → logs-OL7ETVK6.cjs} +32 -32
  89. package/dist/{policies-2HXFZ2EL.cjs → policies-BCECWQ3F.cjs} +28 -28
  90. package/dist/{remote-session-LMUFV2RZ.cjs → remote-session-HML4UF7W.cjs} +11 -11
  91. package/dist/{scripts-TMXULK6L.cjs → scripts-XCD6V2JB.cjs} +31 -31
  92. package/dist/{software-update-H2LAEWDN.cjs → software-update-U5ESXRG5.cjs} +28 -28
  93. package/dist/{tickets-board-QF5JNSH2.cjs → tickets-board-EICQ5VLE.cjs} +14 -14
  94. package/dist/utils/app-origins.d.ts +41 -0
  95. package/dist/utils/app-origins.d.ts.map +1 -0
  96. package/dist/utils/app-origins.js +51 -0
  97. package/dist/utils/embed-auth-adapter-registry.d.ts +7 -0
  98. package/dist/utils/embed-auth-adapter-registry.d.ts.map +1 -0
  99. package/dist/utils/embed-auth-adapter-registry.js +34 -0
  100. package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
  101. package/dist/utils/embed-authed-fetch.js +6 -19
  102. package/dist/utils/index.cjs +28 -12
  103. package/dist/{video-file-player-2FMFCGXE.cjs → video-file-player-4QMVTOBE.cjs} +3 -3
  104. package/package.json +1 -1
  105. package/src/components/chat/entity-cards/dispatch.tsx +12 -1
  106. package/src/components/ui/markdown/base-components.tsx +6 -7
  107. package/src/components/ui/markdown/engine.tsx +29 -5
  108. package/src/components/ui/markdown/external-media-notice.tsx +84 -0
  109. package/src/components/ui/markdown/mermaid-diagram.tsx +107 -5
  110. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +11 -5
  111. package/src/components/ui/markdown/sanitize.ts +162 -15
  112. package/src/components/ui/markdown/simple-markdown-renderer.tsx +6 -2
  113. package/src/utils/app-origins.ts +95 -0
  114. package/src/utils/embed-auth-adapter-registry.ts +49 -0
  115. package/src/utils/embed-authed-fetch.ts +7 -35
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
 
4
- var _chunk7PNRXJX2cjs = require('./chunk-7PNRXJX2.cjs');
4
+ var _chunkFX35L4Y6cjs = require('./chunk-FX35L4Y6.cjs');
5
5
 
6
6
 
7
7
 
@@ -131,7 +131,7 @@ async function validateAccessCode(email, code, endpoints) {
131
131
  });
132
132
  if (!response.ok) {
133
133
  const failure = await response.json().catch(() => null);
134
- throw new Error(_chunk7PNRXJX2cjs.apiErrorMessage.call(void 0, failure, "Validation request failed"));
134
+ throw new Error(_chunkFX35L4Y6cjs.apiErrorMessage.call(void 0, failure, "Validation request failed"));
135
135
  }
136
136
  return await response.json();
137
137
  } catch (error) {
@@ -152,7 +152,7 @@ async function consumeAccessCode(email, code, endpoints) {
152
152
  });
153
153
  if (!response.ok) {
154
154
  const failure = await response.json().catch(() => null);
155
- throw new Error(_chunk7PNRXJX2cjs.apiErrorMessage.call(void 0, failure, "Consumption request failed"));
155
+ throw new Error(_chunkFX35L4Y6cjs.apiErrorMessage.call(void 0, failure, "Consumption request failed"));
156
156
  }
157
157
  return await response.json();
158
158
  } catch (error) {
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
 
4
- var _chunkJ4QORJMCcjs = require('./chunk-J4QORJMC.cjs');
4
+ var _chunkJ6C7F63Pcjs = require('./chunk-J6C7F63P.cjs');
5
5
 
6
6
 
7
- var _chunkKVJKKVB3cjs = require('./chunk-KVJKKVB3.cjs');
7
+ var _chunkNZSWROGMcjs = require('./chunk-NZSWROGM.cjs');
8
8
 
9
9
 
10
10
 
@@ -14,7 +14,7 @@ var _chunkKVJKKVB3cjs = require('./chunk-KVJKKVB3.cjs');
14
14
 
15
15
 
16
16
 
17
- var _chunkOJZBZH56cjs = require('./chunk-OJZBZH56.cjs');
17
+ var _chunkCNTBGJA7cjs = require('./chunk-CNTBGJA7.cjs');
18
18
 
19
19
 
20
20
 
@@ -76,7 +76,7 @@ function HorizontalSectionNav({
76
76
  className: _chunk7JWFMAQBcjs.cn.call(void 0, HORIZONTAL_NAV_CLASS, STICKY_SECTION_NAV_HEIGHT_CLASS, className),
77
77
  children: [
78
78
  brand && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: HORIZONTAL_BRAND_CLASS, children: brand }),
79
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKVJKKVB3cjs.ScrollShadow, { axis: "horizontal", className: "min-w-0 flex-1", scrollClassName: HORIZONTAL_ROW_CLASS, children: sections.map((section) => {
79
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNZSWROGMcjs.ScrollShadow, { axis: "horizontal", className: "min-w-0 flex-1", scrollClassName: HORIZONTAL_ROW_CLASS, children: sections.map((section) => {
80
80
  const active = activeSection === section.id;
81
81
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
82
82
  _chunkV45KLJQPcjs.next_link_default,
@@ -230,7 +230,7 @@ function useSectionNavigation(sections, options) {
230
230
  if (!targetElement) return;
231
231
  isScrollingFromClick.current = true;
232
232
  setActiveSection(sectionId);
233
- _chunkOJZBZH56cjs.scrollElementIntoView.call(void 0, targetElement, { headerOffset: offset });
233
+ _chunkCNTBGJA7cjs.scrollElementIntoView.call(void 0, targetElement, { headerOffset: offset });
234
234
  setTimeout(() => {
235
235
  isScrollingFromClick.current = false;
236
236
  }, 500);
@@ -283,13 +283,13 @@ var SCROLL_OFFSET = 100;
283
283
  var ID_SEPARATOR = "\n";
284
284
  var LINE_TOLERANCE_PX = 1;
285
285
  function currentHashId() {
286
- return _chunkOJZBZH56cjs.normalizeHashFragment.call(void 0, window.location.hash).slice(1);
286
+ return _chunkCNTBGJA7cjs.normalizeHashFragment.call(void 0, window.location.hash).slice(1);
287
287
  }
288
288
  function activeChildAnchor(section) {
289
- return _nullishCoalesce(_optionalChain([section, 'access', _10 => _10.querySelector, 'call', _11 => _11(`[${_chunkOJZBZH56cjs.ACTIVE_ANCHOR_ATTRIBUTE}][id]`), 'optionalAccess', _12 => _12.id]), () => ( null));
289
+ return _nullishCoalesce(_optionalChain([section, 'access', _10 => _10.querySelector, 'call', _11 => _11(`[${_chunkCNTBGJA7cjs.ACTIVE_ANCHOR_ATTRIBUTE}][id]`), 'optionalAccess', _12 => _12.id]), () => ( null));
290
290
  }
291
291
  function hashIsWithin(section) {
292
- return section.contains(_chunkOJZBZH56cjs.getHashTargetElement.call(void 0, currentHashId()));
292
+ return section.contains(_chunkCNTBGJA7cjs.getHashTargetElement.call(void 0, currentHashId()));
293
293
  }
294
294
  function hashForSection(sectionId) {
295
295
  const section = document.getElementById(sectionId);
@@ -297,7 +297,7 @@ function hashForSection(sectionId) {
297
297
  return _nullishCoalesce(activeChildAnchor(section), () => ( (hashIsWithin(section) ? currentHashId() : sectionId)));
298
298
  }
299
299
  function resolveScroller(firstSection) {
300
- const container = firstSection ? _chunkOJZBZH56cjs.getScrollableAncestor.call(void 0, firstSection) : null;
300
+ const container = firstSection ? _chunkCNTBGJA7cjs.getScrollableAncestor.call(void 0, firstSection) : null;
301
301
  if (container) {
302
302
  return {
303
303
  target: container,
@@ -327,8 +327,8 @@ function useScrollSpy(sections, options = {}) {
327
327
  if (!targetElement) return;
328
328
  isScrollingFromClick.current = true;
329
329
  setActiveSection(sectionId);
330
- if (syncHash) _chunkOJZBZH56cjs.replaceLocationHash.call(void 0, _nullishCoalesce(activeChildAnchor(targetElement), () => ( sectionId)));
331
- _chunkOJZBZH56cjs.scrollElementIntoView.call(void 0, targetElement, { headerOffset });
330
+ if (syncHash) _chunkCNTBGJA7cjs.replaceLocationHash.call(void 0, _nullishCoalesce(activeChildAnchor(targetElement), () => ( sectionId)));
331
+ _chunkCNTBGJA7cjs.scrollElementIntoView.call(void 0, targetElement, { headerOffset });
332
332
  setTimeout(() => {
333
333
  isScrollingFromClick.current = false;
334
334
  }, 800);
@@ -344,7 +344,7 @@ function useScrollSpy(sections, options = {}) {
344
344
  const scrollTop = scroller.scrollTop();
345
345
  const viewportTop = scroller.viewportTop();
346
346
  const sectionTop = (element) => element.getBoundingClientRect().top - viewportTop + scrollTop;
347
- const reached = (element) => scrollTop + Math.max(headerOffset, _chunkOJZBZH56cjs.declaredScrollMarginTop.call(void 0, element)) + LINE_TOLERANCE_PX >= sectionTop(element);
347
+ const reached = (element) => scrollTop + Math.max(headerOffset, _chunkCNTBGJA7cjs.declaredScrollMarginTop.call(void 0, element)) + LINE_TOLERANCE_PX >= sectionTop(element);
348
348
  const first = document.getElementById(_nullishCoalesce(sectionIds[0], () => ( "")));
349
349
  let currentSection = _nullishCoalesce(sectionIds[0], () => ( ""));
350
350
  const scrollHeight = scroller.scrollHeight();
@@ -367,16 +367,16 @@ function useScrollSpy(sections, options = {}) {
367
367
  setActiveSection((prev) => prev !== active ? active : prev);
368
368
  if (!syncHash) return;
369
369
  if (fromScroll) {
370
- _chunkOJZBZH56cjs.replaceLocationHash.call(void 0, isAboveFirst ? null : hashForSection(currentSection));
370
+ _chunkCNTBGJA7cjs.replaceLocationHash.call(void 0, isAboveFirst ? null : hashForSection(currentSection));
371
371
  return;
372
372
  }
373
- if (restoredChecked.current || !_chunkOJZBZH56cjs.isScrollSyncedHash.call(void 0, )) return;
374
- const target = _chunkOJZBZH56cjs.getHashTargetElement.call(void 0, currentHashId());
373
+ if (restoredChecked.current || !_chunkCNTBGJA7cjs.isScrollSyncedHash.call(void 0, )) return;
374
+ const target = _chunkCNTBGJA7cjs.getHashTargetElement.call(void 0, currentHashId());
375
375
  const tracked = sectionIds.some((id) => _nullishCoalesce(_optionalChain([document, 'access', _17 => _17.getElementById, 'call', _18 => _18(id), 'optionalAccess', _19 => _19.contains, 'call', _20 => _20(target)]), () => ( false)));
376
376
  if (!target || !tracked) return;
377
377
  restoredChecked.current = true;
378
378
  const section = isAboveFirst ? null : document.getElementById(currentSection);
379
- if (!_optionalChain([section, 'optionalAccess', _21 => _21.contains, 'call', _22 => _22(target)])) _chunkOJZBZH56cjs.scrollElementIntoView.call(void 0, target, { headerOffset, behavior: "instant" });
379
+ if (!_optionalChain([section, 'optionalAccess', _21 => _21.contains, 'call', _22 => _22(target)])) _chunkCNTBGJA7cjs.scrollElementIntoView.call(void 0, target, { headerOffset, behavior: "instant" });
380
380
  };
381
381
  let scrollTimer;
382
382
  const throttledScroll = () => {
@@ -396,7 +396,7 @@ function useScrollSpy(sections, options = {}) {
396
396
  // src/components/navigation/multi-level-navigation.tsx
397
397
  var _lucidereact = require('lucide-react');
398
398
 
399
- var DEFAULT_FOLDER_INDEX_FILE2 = _chunkJ4QORJMCcjs.DEFAULT_FOLDER_INDEX_FILE;
399
+ var DEFAULT_FOLDER_INDEX_FILE2 = _chunkJ6C7F63Pcjs.DEFAULT_FOLDER_INDEX_FILE;
400
400
  var NAV_LIST_CLASS = "space-y-2";
401
401
  var NAV_ITEM_CLASS = "space-y-1";
402
402
  var NAV_ROW_FRAME_CLASS = "relative w-full rounded-lg border transition-all duration-150";
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk5GJM7VRRcjs = require('./chunk-5GJM7VRR.cjs');
5
+ var _chunkGI3MMBP3cjs = require('./chunk-GI3MMBP3.cjs');
6
6
 
7
7
  // src/utils/common.ts
8
8
  var _clsx = require('clsx');
@@ -69,9 +69,9 @@ var _reactquery = require('@tanstack/react-query');
69
69
 
70
70
  // src/utils/embed-content-fetch.ts
71
71
  var contentFetch = (input, init) => {
72
- if (!_chunk5GJM7VRRcjs.hasEmbedAuthAdapter.call(void 0, )) return fetch(input, init);
72
+ if (!_chunkGI3MMBP3cjs.hasEmbedAuthAdapter.call(void 0, )) return fetch(input, init);
73
73
  const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
74
- return _chunk5GJM7VRRcjs.embedAuthedFetch.call(void 0, url, init);
74
+ return _chunkGI3MMBP3cjs.embedAuthedFetch.call(void 0, url, init);
75
75
  };
76
76
 
77
77
  // src/hooks/use-agent-identities.ts
@@ -145,15 +145,84 @@ function applyProxyAuth(url, baseHeaders = { "Content-Type": "application/json"
145
145
  return { url, headers };
146
146
  }
147
147
 
148
- // src/utils/embed-authed-fetch.ts
148
+ // src/utils/embed-auth-adapter-registry.ts
149
149
  var ADAPTER_GLOBAL_KEY = "__embedAuthedFetchAdapter__";
150
- function getRegisteredAuthAdapter() {
150
+ var LISTENERS_GLOBAL_KEY = "__embedAuthedFetchAdapterListeners__";
151
+ function listeners() {
152
+ const slots = globalThis;
153
+ let set = slots[LISTENERS_GLOBAL_KEY];
154
+ if (!set) {
155
+ set = /* @__PURE__ */ new Set();
156
+ slots[LISTENERS_GLOBAL_KEY] = set;
157
+ }
158
+ return set;
159
+ }
160
+ function readRegisteredAdapter() {
151
161
  if (typeof globalThis === "undefined") return null;
152
162
  return _nullishCoalesce(globalThis[ADAPTER_GLOBAL_KEY], () => ( null));
153
163
  }
154
- function storeRegisteredAuthAdapter(adapter2) {
164
+ function writeRegisteredAdapter(adapter2) {
155
165
  if (typeof globalThis === "undefined") return;
156
166
  globalThis[ADAPTER_GLOBAL_KEY] = adapter2;
167
+ for (const listener of [...listeners()]) listener();
168
+ }
169
+ function subscribeRegisteredAdapter(listener) {
170
+ if (typeof globalThis === "undefined") return () => {
171
+ };
172
+ const set = listeners();
173
+ set.add(listener);
174
+ return () => {
175
+ set.delete(listener);
176
+ };
177
+ }
178
+
179
+ // src/utils/app-origins.ts
180
+ var SERVER_APP_ORIGINS = Object.freeze({ pageUrl: null, allowedOrigins: Object.freeze([]) });
181
+ var SERVER_PAGE_URL = "http://app.invalid/";
182
+ var snapshot = SERVER_APP_ORIGINS;
183
+ function readAppOrigins() {
184
+ if (typeof window === "undefined") return SERVER_APP_ORIGINS;
185
+ let pageUrl;
186
+ try {
187
+ pageUrl = new URL("/", window.location.href).href;
188
+ } catch (e3) {
189
+ return SERVER_APP_ORIGINS;
190
+ }
191
+ const allowedOrigins = _nullishCoalesce(_optionalChain([readRegisteredAdapter, 'call', _11 => _11(), 'optionalAccess', _12 => _12.allowedOrigins]), () => ( []));
192
+ if (snapshot.pageUrl !== pageUrl || snapshot.allowedOrigins.length !== allowedOrigins.length || snapshot.allowedOrigins.some((origin, i) => origin !== allowedOrigins[i])) {
193
+ snapshot = { pageUrl, allowedOrigins: [...allowedOrigins] };
194
+ }
195
+ return snapshot;
196
+ }
197
+ var subscribeAppOrigins = subscribeRegisteredAdapter;
198
+ function resolveAppOriginUrl(url, origins = readAppOrigins()) {
199
+ let page;
200
+ let target;
201
+ try {
202
+ page = new URL(_nullishCoalesce(origins.pageUrl, () => ( SERVER_PAGE_URL)));
203
+ target = new URL(url, page);
204
+ } catch (e4) {
205
+ return null;
206
+ }
207
+ if (target.protocol === page.protocol && target.host === page.host) return target;
208
+ if (target.protocol !== "http:" && target.protocol !== "https:") return null;
209
+ return origins.allowedOrigins.includes(target.origin) ? target : null;
210
+ }
211
+ function isAppOriginUrl(url, origins) {
212
+ return resolveAppOriginUrl(url, origins) !== null;
213
+ }
214
+ function absoluteHttpUrl(url, origins = readAppOrigins()) {
215
+ try {
216
+ const resolved = new URL(url.trim(), _nullishCoalesce(origins.pageUrl, () => ( SERVER_PAGE_URL)));
217
+ return resolved.protocol === "http:" || resolved.protocol === "https:" ? resolved.href : null;
218
+ } catch (e5) {
219
+ return null;
220
+ }
221
+ }
222
+
223
+ // src/utils/embed-authed-fetch.ts
224
+ function getRegisteredAuthAdapter() {
225
+ return readRegisteredAdapter();
157
226
  }
158
227
  function setEmbedAuthAdapter(adapter2) {
159
228
  if (adapter2 && getRegisteredAuthAdapter() && process.env.NODE_ENV !== "production") {
@@ -161,30 +230,21 @@ function setEmbedAuthAdapter(adapter2) {
161
230
  "[setEmbedAuthAdapter] overwriting a previously-registered auth adapter. Two chat-runtime providers should not coexist \u2014 verify mount order and pass `null` from the unmounting provider."
162
231
  );
163
232
  }
164
- storeRegisteredAuthAdapter(adapter2);
233
+ writeRegisteredAdapter(adapter2);
165
234
  }
166
235
  function hasEmbedAuthAdapter() {
167
236
  return getRegisteredAuthAdapter() !== null;
168
237
  }
169
238
  function subscribeEmbedCredentialChange(listener) {
170
- return _nullishCoalesce(_optionalChain([getRegisteredAuthAdapter, 'call', _11 => _11(), 'optionalAccess', _12 => _12.subscribe, 'optionalCall', _13 => _13(listener)]), () => ( (() => {
239
+ return _nullishCoalesce(_optionalChain([getRegisteredAuthAdapter, 'call', _13 => _13(), 'optionalAccess', _14 => _14.subscribe, 'optionalCall', _15 => _15(listener)]), () => ( (() => {
171
240
  })));
172
241
  }
173
242
  function needsBearerAssetFetch(url) {
174
243
  if (typeof window === "undefined") return false;
175
244
  const adapter2 = getRegisteredAuthAdapter();
176
- if (!adapter2 || _optionalChain([adapter2, 'access', _14 => _14.getHeaders, 'optionalCall', _15 => _15(), 'access', _16 => _16.Authorization]) === void 0) return false;
177
- let target;
178
- let pageOrigin;
179
- try {
180
- target = new URL(url, window.location.href);
181
- pageOrigin = new URL(window.location.href).origin;
182
- } catch (e3) {
183
- return false;
184
- }
185
- if (target.protocol !== "http:" && target.protocol !== "https:") return false;
186
- if (target.origin === pageOrigin) return true;
187
- return _nullishCoalesce(_optionalChain([adapter2, 'access', _17 => _17.allowedOrigins, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19(target.origin)]), () => ( false));
245
+ if (!adapter2 || _optionalChain([adapter2, 'access', _16 => _16.getHeaders, 'optionalCall', _17 => _17(), 'access', _18 => _18.Authorization]) === void 0) return false;
246
+ const target = resolveAppOriginUrl(url);
247
+ return target !== null && (target.protocol === "http:" || target.protocol === "https:");
188
248
  }
189
249
  function embedAuthedFetch(url, init = {}) {
190
250
  assertSameOrigin(url);
@@ -216,7 +276,7 @@ function setInFlightRefresh(refresh) {
216
276
  }
217
277
  function dedupedRefresh() {
218
278
  const adapter2 = getRegisteredAuthAdapter();
219
- const refresh = _optionalChain([adapter2, 'optionalAccess', _20 => _20.refresh, 'optionalAccess', _21 => _21.bind, 'call', _22 => _22(adapter2)]);
279
+ const refresh = _optionalChain([adapter2, 'optionalAccess', _19 => _19.refresh, 'optionalAccess', _20 => _20.bind, 'call', _21 => _21(adapter2)]);
220
280
  if (!refresh) return Promise.resolve(false);
221
281
  let inFlightRefresh = getInFlightRefresh();
222
282
  if (!inFlightRefresh) {
@@ -229,14 +289,14 @@ function dedupedRefresh() {
229
289
  }
230
290
  async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
231
291
  const adapter2 = getRegisteredAuthAdapter();
232
- await _optionalChain([adapter2, 'optionalAccess', _23 => _23.beforeRequest, 'optionalCall', _24 => _24()]);
292
+ await _optionalChain([adapter2, 'optionalAccess', _22 => _22.beforeRequest, 'optionalCall', _23 => _23()]);
233
293
  const { url: authedUrl, headers } = applyProxyAuth(url, { ...baseHeaders });
234
- if (_optionalChain([adapter2, 'optionalAccess', _25 => _25.getHeaders])) {
294
+ if (_optionalChain([adapter2, 'optionalAccess', _24 => _24.getHeaders])) {
235
295
  for (const [k, v] of Object.entries(adapter2.getHeaders())) {
236
296
  if (v !== void 0) headers[k] = v;
237
297
  }
238
298
  }
239
- const credentials = _nullishCoalesce(_nullishCoalesce(_optionalChain([adapter2, 'optionalAccess', _26 => _26.credentials]), () => ( init.credentials)), () => ( "same-origin"));
299
+ const credentials = _nullishCoalesce(_nullishCoalesce(_optionalChain([adapter2, 'optionalAccess', _25 => _25.credentials]), () => ( init.credentials)), () => ( "same-origin"));
240
300
  const response = await fetch(authedUrl, {
241
301
  ...init,
242
302
  headers,
@@ -247,8 +307,8 @@ async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
247
307
  // `SameSite=None` must be configured server-side for that to work).
248
308
  credentials
249
309
  });
250
- await _optionalChain([adapter2, 'optionalAccess', _27 => _27.onResponse, 'optionalCall', _28 => _28(response)]);
251
- if (response.status === 401 && !isRetry && _optionalChain([adapter2, 'optionalAccess', _29 => _29.refresh])) {
310
+ await _optionalChain([adapter2, 'optionalAccess', _26 => _26.onResponse, 'optionalCall', _27 => _27(response)]);
311
+ if (response.status === 401 && !isRetry && _optionalChain([adapter2, 'optionalAccess', _28 => _28.refresh])) {
252
312
  const refreshed = await dedupedRefresh();
253
313
  if (refreshed) {
254
314
  return fetchWithRefresh(url, init, baseHeaders, true);
@@ -263,7 +323,7 @@ function assertSameOrigin(url) {
263
323
  try {
264
324
  target = new URL(url, window.location.href);
265
325
  pageOrigin = new URL(window.location.href).origin;
266
- } catch (e4) {
326
+ } catch (e6) {
267
327
  throw new Error(`embedAuthedFetch: refusing to fetch malformed URL (${JSON.stringify(url)})`);
268
328
  }
269
329
  if (target.protocol !== "http:" && target.protocol !== "https:") {
@@ -272,7 +332,7 @@ function assertSameOrigin(url) {
272
332
  );
273
333
  }
274
334
  if (target.origin !== pageOrigin) {
275
- if (_optionalChain([getRegisteredAuthAdapter, 'call', _30 => _30(), 'optionalAccess', _31 => _31.allowedOrigins, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33(target.origin)])) {
335
+ if (_optionalChain([getRegisteredAuthAdapter, 'call', _29 => _29(), 'optionalAccess', _30 => _30.allowedOrigins, 'optionalAccess', _31 => _31.includes, 'call', _32 => _32(target.origin)])) {
276
336
  return;
277
337
  }
278
338
  if (process.env.NODE_ENV !== "production") {
@@ -301,4 +361,9 @@ function assertSameOrigin(url) {
301
361
 
302
362
 
303
363
 
304
- exports.createLocalStorageAdapter = createLocalStorageAdapter; exports.getAppType = getAppType; exports.EMBED_PROXY_OPTIONAL_HEADERS = EMBED_PROXY_OPTIONAL_HEADERS; exports.getEmbedProxyAuth = getEmbedProxyAuth; exports.getPersistedProxyEmail = getPersistedProxyEmail; exports.setEmbedProxyAuth = setEmbedProxyAuth; exports.clearEmbedProxyAuth = clearEmbedProxyAuth; exports.applyProxyAuth = applyProxyAuth; exports.setEmbedAuthAdapter = setEmbedAuthAdapter; exports.hasEmbedAuthAdapter = hasEmbedAuthAdapter; exports.subscribeEmbedCredentialChange = subscribeEmbedCredentialChange; exports.needsBearerAssetFetch = needsBearerAssetFetch; exports.embedAuthedFetch = embedAuthedFetch;
364
+
365
+
366
+
367
+
368
+
369
+ exports.createLocalStorageAdapter = createLocalStorageAdapter; exports.SERVER_APP_ORIGINS = SERVER_APP_ORIGINS; exports.readAppOrigins = readAppOrigins; exports.subscribeAppOrigins = subscribeAppOrigins; exports.isAppOriginUrl = isAppOriginUrl; exports.absoluteHttpUrl = absoluteHttpUrl; exports.getAppType = getAppType; exports.EMBED_PROXY_OPTIONAL_HEADERS = EMBED_PROXY_OPTIONAL_HEADERS; exports.getEmbedProxyAuth = getEmbedProxyAuth; exports.getPersistedProxyEmail = getPersistedProxyEmail; exports.setEmbedProxyAuth = setEmbedProxyAuth; exports.clearEmbedProxyAuth = clearEmbedProxyAuth; exports.applyProxyAuth = applyProxyAuth; exports.setEmbedAuthAdapter = setEmbedAuthAdapter; exports.hasEmbedAuthAdapter = hasEmbedAuthAdapter; exports.subscribeEmbedCredentialChange = subscribeEmbedCredentialChange; exports.needsBearerAssetFetch = needsBearerAssetFetch; exports.embedAuthedFetch = embedAuthedFetch;