@flamingo-stack/openframe-frontend-core 0.0.809 → 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.
- package/dist/{case-study-card-MEWJNF4N.cjs → case-study-card-AMINZROX.cjs} +5 -5
- package/dist/{chunk-FRS2VO22.cjs → chunk-243TS7YL.cjs} +38 -38
- package/dist/{chunk-GAHXURKJ.cjs → chunk-5QLDHPPU.cjs} +2 -2
- package/dist/{chunk-WDL3GFH2.cjs → chunk-66J7ZSI5.cjs} +34 -34
- package/dist/{chunk-VKAFZCFV.cjs → chunk-6GT3ZL27.cjs} +28 -28
- package/dist/{chunk-PRCGRDHV.cjs → chunk-7Y6M4FW4.cjs} +5 -5
- package/dist/{chunk-TOWVMBAP.cjs → chunk-ACCZCRXT.cjs} +14 -14
- package/dist/{chunk-VXAKQRV7.cjs → chunk-APOMNC7H.cjs} +5 -5
- package/dist/{chunk-KS5V55HN.cjs → chunk-CB77J5L7.cjs} +864 -670
- package/dist/{chunk-VHX4A4SA.cjs → chunk-CC3Q3MQG.cjs} +2 -2
- package/dist/{chunk-WV44WJKR.cjs → chunk-CJ7W2SY4.cjs} +8 -8
- package/dist/{chunk-DDFT6VQ3.cjs → chunk-CLU2KJFB.cjs} +3 -3
- package/dist/{chunk-OJZBZH56.cjs → chunk-CNTBGJA7.cjs} +3 -3
- package/dist/{chunk-Q3C6UJJ7.cjs → chunk-CPP2APON.cjs} +89 -89
- package/dist/{chunk-TT64NRFU.cjs → chunk-ERLMCSGF.cjs} +3 -3
- package/dist/{chunk-5UTJARDM.cjs → chunk-FK2WFU7R.cjs} +17 -17
- package/dist/{chunk-7PNRXJX2.cjs → chunk-FX35L4Y6.cjs} +3 -3
- package/dist/{chunk-5GJM7VRR.cjs → chunk-GI3MMBP3.cjs} +91 -26
- package/dist/{chunk-AZJYMTBS.cjs → chunk-GU3GJ5DH.cjs} +50 -50
- package/dist/{chunk-VUKN6KEE.cjs → chunk-IQLXO6EI.cjs} +97 -97
- package/dist/{chunk-BT53NHR7.cjs → chunk-J6C7F63P.cjs} +120 -120
- package/dist/{chunk-PIKHEBG5.cjs → chunk-JNWJB4Z5.cjs} +52 -52
- package/dist/{chunk-5MTYKS2Q.cjs → chunk-KVDUWXVZ.cjs} +4 -4
- package/dist/{chunk-V4FXUIMH.cjs → chunk-LC65AC6M.cjs} +4 -4
- package/dist/{chunk-RZNRKWG5.cjs → chunk-MDBOYMCW.cjs} +22 -22
- package/dist/{chunk-AQXKXZWB.cjs → chunk-MG3HJIGG.cjs} +4 -4
- package/dist/{chunk-KVJKKVB3.cjs → chunk-NZSWROGM.cjs} +7 -7
- package/dist/{chunk-OAJ3AL4V.cjs → chunk-O32RLIN4.cjs} +6 -6
- package/dist/{chunk-ZAXGW4KT.cjs → chunk-O4MEG2ZS.cjs} +21 -21
- package/dist/{chunk-4W77VLQV.cjs → chunk-OQDPZOGC.cjs} +6 -6
- package/dist/{chunk-LUICXMHC.cjs → chunk-PCVY63WQ.cjs} +17 -17
- package/dist/{chunk-ML3DG4SS.cjs → chunk-PMOMZSCX.cjs} +5 -5
- package/dist/{chunk-TUZV2ZQY.cjs → chunk-Q7QYAINS.cjs} +2 -2
- package/dist/{chunk-KHKPLOU4.cjs → chunk-QDB2JO55.cjs} +144 -36
- package/dist/{chunk-KCB72H7A.cjs → chunk-R55KNVPR.cjs} +71 -71
- package/dist/{chunk-NG3RKTQU.cjs → chunk-SFUNXMY3.cjs} +8 -8
- package/dist/{chunk-3B76QFXV.cjs → chunk-TKK66KHU.cjs} +6 -6
- package/dist/{chunk-TGOJHOQR.cjs → chunk-U2MHQBL4.cjs} +3 -3
- package/dist/{chunk-I3RJLXEL.cjs → chunk-UP3TLY2V.cjs} +131 -131
- package/dist/{chunk-KITOT3DS.cjs → chunk-VXMPVDOS.cjs} +26 -26
- package/dist/{chunk-UVLTUSH3.cjs → chunk-WX5WDSKV.cjs} +583 -582
- package/dist/{chunk-OFGYPMTE.cjs → chunk-XLEWM5X5.cjs} +53 -53
- package/dist/{chunk-SZHDXXMK.cjs → chunk-YSDB6HGQ.cjs} +3 -3
- package/dist/{chunk-JLKGLPDC.cjs → chunk-ZW25QUJK.cjs} +16 -16
- package/dist/{chunk-FLW2VL5W.cjs → chunk-ZZO3FGPM.cjs} +24 -24
- package/dist/{cloud-tenants-DJAA23GR.cjs → cloud-tenants-XGGQG7SO.cjs} +25 -25
- package/dist/components/case-studies/index.cjs +41 -41
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +4 -1
- package/dist/components/chat/hooks/use-jetstream-dialog-subscription.js +1 -1
- package/dist/components/chat/hooks/use-nats-dialog-subscription.js +1 -1
- package/dist/components/chat/index.cjs +19 -19
- package/dist/components/chat/types/api.types.d.ts +8 -4
- package/dist/components/chat/types/api.types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +26 -26
- package/dist/components/docs/index.cjs +29 -29
- package/dist/components/embeds/index.cjs +26 -26
- package/dist/components/faq/index.cjs +27 -27
- package/dist/components/features/index.cjs +25 -25
- package/dist/components/help-center-pages/index.cjs +130 -130
- package/dist/components/index.cjs +90 -90
- package/dist/components/meeting-scheduler/index.cjs +94 -94
- package/dist/components/navigation/index.cjs +28 -28
- package/dist/components/onboarding-guides/index.cjs +28 -28
- package/dist/components/product-demo/index.cjs +36 -36
- package/dist/components/related-content/index.cjs +14 -14
- package/dist/components/tickets/index.cjs +32 -32
- package/dist/components/ui/index.cjs +25 -25
- package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
- package/dist/components/ui/markdown/base-components.js +6 -7
- package/dist/components/ui/markdown/engine.d.ts +7 -0
- package/dist/components/ui/markdown/engine.d.ts.map +1 -1
- package/dist/components/ui/markdown/engine.js +12 -3
- package/dist/components/ui/markdown/external-media-notice.d.ts +33 -0
- package/dist/components/ui/markdown/external-media-notice.d.ts.map +1 -0
- package/dist/components/ui/markdown/external-media-notice.js +56 -0
- package/dist/components/ui/markdown/mermaid-diagram.d.ts +24 -2
- package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -1
- package/dist/components/ui/markdown/mermaid-diagram.js +66 -6
- package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +4 -4
- package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -1
- package/dist/components/ui/markdown/rich/rich-markdown-renderer.js +2 -1
- package/dist/components/ui/markdown/sanitize.d.ts +28 -3
- package/dist/components/ui/markdown/sanitize.d.ts.map +1 -1
- package/dist/components/ui/markdown/sanitize.js +84 -12
- package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +3 -2
- package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -1
- package/dist/{devices-AIDQW4HB.cjs → devices-H5Y4DBVC.cjs} +26 -26
- package/dist/{embeddable-chat-XT6GMSBX.cjs → embeddable-chat-77ZOLCCK.cjs} +89 -89
- package/dist/hooks/index.cjs +11 -11
- package/dist/index.cjs +30 -30
- package/dist/{knowledge-JWCFM3GO.cjs → knowledge-MGH65HXM.cjs} +26 -26
- package/dist/{logs-ZNIXPJXA.cjs → logs-OL7ETVK6.cjs} +33 -33
- package/dist/nats/index.cjs +2 -2
- package/dist/nats/nats-provider.d.ts +9 -3
- package/dist/nats/nats-provider.d.ts.map +1 -1
- package/dist/nats/nats-provider.js +7 -3
- package/dist/nats/shared-connection.d.ts +44 -1
- package/dist/nats/shared-connection.d.ts.map +1 -1
- package/dist/nats/shared-connection.js +126 -22
- package/dist/{policies-Z4NGPLA2.cjs → policies-BCECWQ3F.cjs} +29 -29
- package/dist/{remote-session-LMUFV2RZ.cjs → remote-session-HML4UF7W.cjs} +11 -11
- package/dist/{scripts-G4Y5SPOW.cjs → scripts-XCD6V2JB.cjs} +32 -32
- package/dist/{software-update-VAOKDA76.cjs → software-update-U5ESXRG5.cjs} +29 -29
- package/dist/{tickets-board-QF5JNSH2.cjs → tickets-board-EICQ5VLE.cjs} +14 -14
- package/dist/utils/app-origins.d.ts +41 -0
- package/dist/utils/app-origins.d.ts.map +1 -0
- package/dist/utils/app-origins.js +51 -0
- package/dist/utils/embed-auth-adapter-registry.d.ts +7 -0
- package/dist/utils/embed-auth-adapter-registry.d.ts.map +1 -0
- package/dist/utils/embed-auth-adapter-registry.js +34 -0
- package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
- package/dist/utils/embed-authed-fetch.js +6 -19
- package/dist/utils/index.cjs +28 -12
- package/dist/{video-file-player-2FMFCGXE.cjs → video-file-player-4QMVTOBE.cjs} +3 -3
- package/package.json +1 -1
- package/src/components/chat/entity-cards/dispatch.tsx +12 -1
- package/src/components/chat/hooks/use-jetstream-dialog-subscription.ts +1 -1
- package/src/components/chat/hooks/use-nats-dialog-subscription.ts +1 -1
- package/src/components/chat/types/api.types.ts +8 -4
- package/src/components/ui/markdown/base-components.tsx +6 -7
- package/src/components/ui/markdown/engine.tsx +29 -5
- package/src/components/ui/markdown/external-media-notice.tsx +84 -0
- package/src/components/ui/markdown/mermaid-diagram.tsx +107 -5
- package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +11 -5
- package/src/components/ui/markdown/sanitize.ts +162 -15
- package/src/components/ui/markdown/simple-markdown-renderer.tsx +6 -2
- package/src/nats/nats-provider.tsx +15 -4
- package/src/nats/shared-connection.ts +199 -25
- package/src/utils/app-origins.ts +95 -0
- package/src/utils/embed-auth-adapter-registry.ts +49 -0
- 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
|
|
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(
|
|
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(
|
|
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
|
|
4
|
+
var _chunkJ6C7F63Pcjs = require('./chunk-J6C7F63P.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
|
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(`[${
|
|
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(
|
|
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 ?
|
|
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)
|
|
331
|
-
|
|
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,
|
|
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
|
-
|
|
370
|
+
_chunkCNTBGJA7cjs.replaceLocationHash.call(void 0, isAboveFirst ? null : hashForSection(currentSection));
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
if (restoredChecked.current || !
|
|
374
|
-
const target =
|
|
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)]))
|
|
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 =
|
|
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
|
|
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 (!
|
|
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
|
|
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-
|
|
148
|
+
// src/utils/embed-auth-adapter-registry.ts
|
|
149
149
|
var ADAPTER_GLOBAL_KEY = "__embedAuthedFetchAdapter__";
|
|
150
|
-
|
|
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
|
|
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
|
-
|
|
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',
|
|
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',
|
|
177
|
-
|
|
178
|
-
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
251
|
-
if (response.status === 401 && !isRetry && _optionalChain([adapter2, 'optionalAccess',
|
|
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 (
|
|
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',
|
|
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
|
-
|
|
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;
|