@flamingo-stack/openframe-frontend-core 0.0.216 → 0.0.217-snapshot.20260601151546
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/{chunk-2V4SACHE.js → chunk-EKBM4FHK.js} +2 -2
- package/dist/{chunk-VC3ND5RB.js → chunk-EWA2NFUR.js} +2 -2
- package/dist/{chunk-IH76P5R6.cjs → chunk-FZZBCRID.cjs} +8 -86
- package/dist/chunk-FZZBCRID.cjs.map +1 -0
- package/dist/{chunk-K4DFAVSO.cjs → chunk-GE64T3JT.cjs} +9 -9
- package/dist/{chunk-K4DFAVSO.cjs.map → chunk-GE64T3JT.cjs.map} +1 -1
- package/dist/{chunk-ZGTDUPTW.cjs → chunk-L5RSJE2I.cjs} +2318 -1136
- package/dist/chunk-L5RSJE2I.cjs.map +1 -0
- package/dist/{chunk-QTKU6ULP.js → chunk-OHOUSDAY.js} +2 -2
- package/dist/{chunk-572WQWIX.cjs → chunk-S4SVD5JI.cjs} +9 -9
- package/dist/{chunk-572WQWIX.cjs.map → chunk-S4SVD5JI.cjs.map} +1 -1
- package/dist/{chunk-GVNQAGXB.js → chunk-SWIR5EB2.js} +3 -81
- package/dist/chunk-SWIR5EB2.js.map +1 -0
- package/dist/{chunk-SMCG2CCC.cjs → chunk-TCJ5B2ZD.cjs} +24 -24
- package/dist/{chunk-SMCG2CCC.cjs.map → chunk-TCJ5B2ZD.cjs.map} +1 -1
- package/dist/{chunk-CDLYRFDE.js → chunk-V5JY5RSY.js} +5710 -4528
- package/dist/chunk-V5JY5RSY.js.map +1 -0
- package/dist/components/chat/chat-attachment-bar.d.ts +13 -2
- package/dist/components/chat/chat-attachment-bar.d.ts.map +1 -1
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-message-row.d.ts +25 -0
- package/dist/components/chat/chat-message-row.d.ts.map +1 -0
- package/dist/components/chat/embeddable-chat.d.ts +13 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +104 -10
- package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-slash-commands.d.ts +6 -0
- package/dist/components/chat/hooks/use-slash-commands.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-unified-chat.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +6 -2
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +5 -1
- package/dist/components/chat/types/component.types.d.ts +8 -1
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/types/unified-chat-state.types.d.ts +81 -0
- package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/form.d.ts +1 -1
- package/dist/components/form.d.ts.map +1 -1
- package/dist/components/index.cjs +78 -52
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +31 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/app-header.d.ts +7 -0
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-layout-drawer.d.ts +65 -0
- package/dist/components/navigation/app-layout-drawer.d.ts.map +1 -0
- package/dist/components/navigation/app-layout.d.ts +9 -1
- package/dist/components/navigation/app-layout.d.ts.map +1 -1
- package/dist/components/navigation/header-mingo-button.d.ts +21 -0
- package/dist/components/navigation/header-mingo-button.d.ts.map +1 -0
- package/dist/components/navigation/index.cjs +24 -2
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.d.ts +5 -1
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +23 -1
- package/dist/components/onboarding-guides/index.cjs +18 -18
- package/dist/components/onboarding-guides/index.js +3 -3
- package/dist/components/shared/dev-section/dev-card-row.d.ts +5 -45
- package/dist/components/shared/dev-section/dev-card-row.d.ts.map +1 -1
- package/dist/components/shared/legal-document/use-legal-docs.d.ts.map +1 -1
- package/dist/components/tickets/help-center-card.d.ts.map +1 -1
- package/dist/components/tickets/help-center-list.d.ts.map +1 -1
- package/dist/components/tickets/hooks/use-ticket-engagements.d.ts +9 -1
- package/dist/components/tickets/hooks/use-ticket-engagements.d.ts.map +1 -1
- package/dist/components/tickets/hooks/use-tickets-list.d.ts +7 -0
- package/dist/components/tickets/hooks/use-tickets-list.d.ts.map +1 -1
- package/dist/components/tickets/index.cjs +309 -256
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.d.ts +1 -0
- package/dist/components/tickets/index.d.ts.map +1 -1
- package/dist/components/tickets/index.js +376 -323
- package/dist/components/tickets/index.js.map +1 -1
- package/dist/components/tickets/ticket-detail-drawer.d.ts.map +1 -1
- package/dist/components/tickets/ticket-reply-composer.d.ts +33 -0
- package/dist/components/tickets/ticket-reply-composer.d.ts.map +1 -0
- package/dist/components/tickets/types.d.ts +13 -0
- package/dist/components/tickets/types.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +6 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +5 -1
- package/dist/components/ui/ticket-attachments-list.d.ts +5 -1
- package/dist/components/ui/ticket-attachments-list.d.ts.map +1 -1
- package/dist/index.cjs +30 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -1
- package/dist/utils/embed-authed-fetch.d.ts +80 -0
- package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
- package/dist/utils/index.cjs +129 -9
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +129 -10
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/scroll-into-view.d.ts +43 -48
- package/dist/utils/scroll-into-view.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/chat/chat-attachment-bar.tsx +58 -22
- package/src/components/chat/chat-input.tsx +68 -29
- package/src/components/chat/chat-message-row.tsx +124 -0
- package/src/components/chat/embeddable-chat.tsx +154 -37
- package/src/components/chat/hooks/use-nats-chat-adapter.ts +601 -23
- package/src/components/chat/hooks/use-slash-commands.ts +10 -1
- package/src/components/chat/hooks/use-sse-chat-adapter.ts +45 -0
- package/src/components/chat/hooks/use-unified-chat.ts +59 -0
- package/src/components/chat/index.ts +1 -0
- package/src/components/chat/types/component.types.ts +8 -1
- package/src/components/chat/types/unified-chat-state.types.ts +116 -0
- package/src/components/navigation/app-header.tsx +23 -0
- package/src/components/navigation/app-layout-drawer.tsx +620 -0
- package/src/components/navigation/app-layout.tsx +65 -26
- package/src/components/navigation/header-mingo-button.tsx +58 -0
- package/src/components/navigation/index.ts +17 -1
- package/src/components/shared/dev-section/dev-card-row.tsx +5 -183
- package/src/components/shared/legal-document/use-legal-docs.ts +5 -1
- package/src/components/tickets/help-center-card.tsx +26 -29
- package/src/components/tickets/help-center-list.tsx +57 -10
- package/src/components/tickets/hooks/use-ticket-engagements.ts +41 -5
- package/src/components/tickets/hooks/use-tickets-list.ts +13 -0
- package/src/components/tickets/index.ts +4 -0
- package/src/components/tickets/ticket-detail-drawer.tsx +144 -200
- package/src/components/tickets/ticket-reply-composer.tsx +195 -0
- package/src/components/tickets/types.ts +14 -0
- package/src/components/ui/ticket-attachments-list.tsx +26 -8
- package/src/stories/AppLayoutDrawer.stories.tsx +228 -0
- package/src/styles/app-globals.css +13 -0
- package/src/utils/.embed-authed-fetch.md +7 -0
- package/src/utils/__tests__/embed-authed-fetch.test.ts +103 -1
- package/src/utils/embed-authed-fetch.ts +247 -7
- package/src/utils/index.ts +5 -1
- package/src/utils/scroll-into-view.ts +127 -53
- package/dist/chunk-CDLYRFDE.js.map +0 -1
- package/dist/chunk-GVNQAGXB.js.map +0 -1
- package/dist/chunk-IH76P5R6.cjs.map +0 -1
- package/dist/chunk-ZGTDUPTW.cjs.map +0 -1
- /package/dist/{chunk-2V4SACHE.js.map → chunk-EKBM4FHK.js.map} +0 -0
- /package/dist/{chunk-VC3ND5RB.js.map → chunk-EWA2NFUR.js.map} +0 -0
- /package/dist/{chunk-QTKU6ULP.js.map → chunk-OHOUSDAY.js.map} +0 -0
package/dist/utils/index.cjs
CHANGED
|
@@ -2599,6 +2599,23 @@ function applyProxyAuth(url, baseHeaders = { "Content-Type": "application/json"
|
|
|
2599
2599
|
}
|
|
2600
2600
|
|
|
2601
2601
|
// src/utils/embed-authed-fetch.ts
|
|
2602
|
+
var ADAPTER_GLOBAL_KEY = "__embedAuthedFetchAdapter__";
|
|
2603
|
+
function getRegisteredAuthAdapter() {
|
|
2604
|
+
if (typeof globalThis === "undefined") return null;
|
|
2605
|
+
return globalThis[ADAPTER_GLOBAL_KEY] ?? null;
|
|
2606
|
+
}
|
|
2607
|
+
function storeRegisteredAuthAdapter(adapter2) {
|
|
2608
|
+
if (typeof globalThis === "undefined") return;
|
|
2609
|
+
globalThis[ADAPTER_GLOBAL_KEY] = adapter2;
|
|
2610
|
+
}
|
|
2611
|
+
function setEmbedAuthAdapter(adapter2) {
|
|
2612
|
+
if (adapter2 && getRegisteredAuthAdapter() && process.env.NODE_ENV !== "production") {
|
|
2613
|
+
console.warn(
|
|
2614
|
+
"[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."
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2617
|
+
storeRegisteredAuthAdapter(adapter2);
|
|
2618
|
+
}
|
|
2602
2619
|
function embedAuthedFetch(url, init = {}) {
|
|
2603
2620
|
assertSameOrigin(url);
|
|
2604
2621
|
let baseHeaders;
|
|
@@ -2616,14 +2633,55 @@ function embedAuthedFetch(url, init = {}) {
|
|
|
2616
2633
|
Object.assign(baseHeaders, init.headers);
|
|
2617
2634
|
}
|
|
2618
2635
|
}
|
|
2619
|
-
|
|
2620
|
-
|
|
2636
|
+
return fetchWithRefresh(url, init, baseHeaders, false);
|
|
2637
|
+
}
|
|
2638
|
+
var IN_FLIGHT_REFRESH_GLOBAL_KEY = "__embedAuthedFetchInFlightRefresh__";
|
|
2639
|
+
function getInFlightRefresh() {
|
|
2640
|
+
if (typeof globalThis === "undefined") return null;
|
|
2641
|
+
return globalThis[IN_FLIGHT_REFRESH_GLOBAL_KEY] ?? null;
|
|
2642
|
+
}
|
|
2643
|
+
function setInFlightRefresh(refresh) {
|
|
2644
|
+
if (typeof globalThis === "undefined") return;
|
|
2645
|
+
globalThis[IN_FLIGHT_REFRESH_GLOBAL_KEY] = refresh;
|
|
2646
|
+
}
|
|
2647
|
+
function dedupedRefresh() {
|
|
2648
|
+
const adapter2 = getRegisteredAuthAdapter();
|
|
2649
|
+
if (!adapter2?.refresh) return Promise.resolve(false);
|
|
2650
|
+
let inFlightRefresh = getInFlightRefresh();
|
|
2651
|
+
if (!inFlightRefresh) {
|
|
2652
|
+
inFlightRefresh = Promise.resolve().then(() => adapter2.refresh()).catch(() => false).finally(() => {
|
|
2653
|
+
setInFlightRefresh(null);
|
|
2654
|
+
});
|
|
2655
|
+
setInFlightRefresh(inFlightRefresh);
|
|
2656
|
+
}
|
|
2657
|
+
return inFlightRefresh;
|
|
2658
|
+
}
|
|
2659
|
+
async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
|
|
2660
|
+
const { url: authedUrl, headers } = applyProxyAuth(url, { ...baseHeaders });
|
|
2661
|
+
const adapter2 = getRegisteredAuthAdapter();
|
|
2662
|
+
if (adapter2?.getHeaders) {
|
|
2663
|
+
for (const [k, v] of Object.entries(adapter2.getHeaders())) {
|
|
2664
|
+
if (v !== void 0) headers[k] = v;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
const credentials = adapter2?.credentials ?? init.credentials ?? "same-origin";
|
|
2668
|
+
const response = await fetch(authedUrl, {
|
|
2621
2669
|
...init,
|
|
2622
2670
|
headers,
|
|
2623
|
-
//
|
|
2624
|
-
//
|
|
2625
|
-
credentials:
|
|
2671
|
+
// Default `same-origin` carries Supabase cookies for the MPH proxy-
|
|
2672
|
+
// auth model. Hosts on different origins (openframe-frontend ↔
|
|
2673
|
+
// openframe gateway) register `credentials: 'include'` via the
|
|
2674
|
+
// adapter to make their own cookies travel cross-origin (CORS +
|
|
2675
|
+
// `SameSite=None` must be configured server-side for that to work).
|
|
2676
|
+
credentials
|
|
2626
2677
|
});
|
|
2678
|
+
if (response.status === 401 && !isRetry && adapter2?.refresh) {
|
|
2679
|
+
const refreshed = await dedupedRefresh();
|
|
2680
|
+
if (refreshed) {
|
|
2681
|
+
return fetchWithRefresh(url, init, baseHeaders, true);
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
return response;
|
|
2627
2685
|
}
|
|
2628
2686
|
function assertSameOrigin(url) {
|
|
2629
2687
|
if (typeof window === "undefined") return;
|
|
@@ -2641,6 +2699,12 @@ function assertSameOrigin(url) {
|
|
|
2641
2699
|
);
|
|
2642
2700
|
}
|
|
2643
2701
|
if (target.origin !== pageOrigin) {
|
|
2702
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2703
|
+
console.warn(
|
|
2704
|
+
`[embedAuthedFetch] cross-origin fetch to ${target.origin} allowed in dev (NODE_ENV !== 'production'). Production builds will reject this \u2014 wire a same-origin proxy before shipping.`
|
|
2705
|
+
);
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2644
2708
|
throw new Error(
|
|
2645
2709
|
`embedAuthedFetch: refusing cross-origin fetch to ${target.origin} \u2014 pass a relative /api/* path instead`
|
|
2646
2710
|
);
|
|
@@ -3076,12 +3140,67 @@ var OPENFRAME_DEV_SECTIONS = {
|
|
|
3076
3140
|
};
|
|
3077
3141
|
|
|
3078
3142
|
// src/utils/scroll-into-view.ts
|
|
3143
|
+
var activeRaf = 0;
|
|
3144
|
+
var teardownActive = null;
|
|
3145
|
+
function cancelActiveScroll() {
|
|
3146
|
+
if (activeRaf) {
|
|
3147
|
+
cancelAnimationFrame(activeRaf);
|
|
3148
|
+
activeRaf = 0;
|
|
3149
|
+
}
|
|
3150
|
+
if (teardownActive) {
|
|
3151
|
+
teardownActive();
|
|
3152
|
+
teardownActive = null;
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
var easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
|
|
3079
3156
|
function scrollElementIntoView(target, options = {}) {
|
|
3080
3157
|
if (typeof window === "undefined" || !target) return;
|
|
3081
|
-
const { headerOffset = 0, behavior = "smooth", adjustTargetY } = options;
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3084
|
-
|
|
3158
|
+
const { headerOffset = 0, behavior = "smooth", adjustTargetY, durationMs = 320 } = options;
|
|
3159
|
+
const computeTarget = () => {
|
|
3160
|
+
const raw = target.getBoundingClientRect().top + window.scrollY - headerOffset;
|
|
3161
|
+
const adjusted = adjustTargetY ? adjustTargetY(raw) : raw;
|
|
3162
|
+
const maxScroll = Math.max(
|
|
3163
|
+
0,
|
|
3164
|
+
document.documentElement.scrollHeight - window.innerHeight
|
|
3165
|
+
);
|
|
3166
|
+
return Math.min(Math.max(0, adjusted), maxScroll);
|
|
3167
|
+
};
|
|
3168
|
+
cancelActiveScroll();
|
|
3169
|
+
const prefersReduced = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3170
|
+
if (behavior === "instant" || behavior === "auto" || prefersReduced) {
|
|
3171
|
+
window.scrollTo(0, computeTarget());
|
|
3172
|
+
return;
|
|
3173
|
+
}
|
|
3174
|
+
let startY = null;
|
|
3175
|
+
let startTime = 0;
|
|
3176
|
+
const onUserGesture = () => cancelActiveScroll();
|
|
3177
|
+
window.addEventListener("wheel", onUserGesture, { passive: true });
|
|
3178
|
+
window.addEventListener("touchmove", onUserGesture, { passive: true });
|
|
3179
|
+
teardownActive = () => {
|
|
3180
|
+
window.removeEventListener("wheel", onUserGesture);
|
|
3181
|
+
window.removeEventListener("touchmove", onUserGesture);
|
|
3182
|
+
};
|
|
3183
|
+
const step = (now) => {
|
|
3184
|
+
if (startY === null) {
|
|
3185
|
+
startY = window.scrollY;
|
|
3186
|
+
startTime = now;
|
|
3187
|
+
}
|
|
3188
|
+
const targetY = computeTarget();
|
|
3189
|
+
const t = Math.min(1, (now - startTime) / durationMs);
|
|
3190
|
+
const y = startY + (targetY - startY) * easeOutCubic(t);
|
|
3191
|
+
window.scrollTo(0, y);
|
|
3192
|
+
if (t < 1) {
|
|
3193
|
+
activeRaf = requestAnimationFrame(step);
|
|
3194
|
+
} else {
|
|
3195
|
+
window.scrollTo(0, computeTarget());
|
|
3196
|
+
activeRaf = 0;
|
|
3197
|
+
if (teardownActive) {
|
|
3198
|
+
teardownActive();
|
|
3199
|
+
teardownActive = null;
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
activeRaf = requestAnimationFrame(step);
|
|
3085
3204
|
}
|
|
3086
3205
|
|
|
3087
3206
|
exports.ANTHROPIC_SUPPORTED_IMAGE_MIME = ANTHROPIC_SUPPORTED_IMAGE_MIME;
|
|
@@ -3236,6 +3355,7 @@ exports.platformSlogans = platformSlogans;
|
|
|
3236
3355
|
exports.readLeadingDecisionFrame = readLeadingDecisionFrame;
|
|
3237
3356
|
exports.sanitizeTitleForChat = sanitizeTitleForChat;
|
|
3238
3357
|
exports.scrollElementIntoView = scrollElementIntoView;
|
|
3358
|
+
exports.setEmbedAuthAdapter = setEmbedAuthAdapter;
|
|
3239
3359
|
exports.setEmbedProxyAuth = setEmbedProxyAuth;
|
|
3240
3360
|
exports.shouldProxyImage = shouldProxyImage;
|
|
3241
3361
|
exports.stripChatAttachmentMarkdown = stripChatAttachmentMarkdown;
|