@flamingo-stack/openframe-frontend-core 0.0.210-snapshot.20260528032637 → 0.0.210

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 (72) hide show
  1. package/dist/{chunk-P5EE2VJX.cjs → chunk-6RZYJICV.cjs} +1 -1
  2. package/dist/chunk-6RZYJICV.cjs.map +1 -0
  3. package/dist/{chunk-ZG2YY5E7.js → chunk-7L4DWM7P.js} +1 -1
  4. package/dist/chunk-7L4DWM7P.js.map +1 -0
  5. package/dist/{chunk-QKFBZLIR.js → chunk-ATEUJQKU.js} +2 -2
  6. package/dist/{chunk-VTUIMMHO.cjs → chunk-MDTIOPVS.cjs} +24 -24
  7. package/dist/{chunk-VTUIMMHO.cjs.map → chunk-MDTIOPVS.cjs.map} +1 -1
  8. package/dist/{chunk-3E5ANY55.js → chunk-R5RNRH62.js} +5 -14
  9. package/dist/chunk-R5RNRH62.js.map +1 -0
  10. package/dist/{chunk-WI76ZUBE.cjs → chunk-TWKPYZNQ.cjs} +17 -26
  11. package/dist/chunk-TWKPYZNQ.cjs.map +1 -0
  12. package/dist/{chunk-ZFBLC5GV.cjs → chunk-VBFOCTMD.cjs} +17 -17
  13. package/dist/{chunk-ZFBLC5GV.cjs.map → chunk-VBFOCTMD.cjs.map} +1 -1
  14. package/dist/{chunk-5BNWGK6D.js → chunk-WJBPLMBX.js} +2 -2
  15. package/dist/components/chat/hooks/use-chat-identity.d.ts +3 -3
  16. package/dist/components/chat/hooks/use-chat-identity.d.ts.map +1 -1
  17. package/dist/components/chat/index.cjs +3 -3
  18. package/dist/components/chat/index.js +2 -2
  19. package/dist/components/contact/index.cjs +4 -4
  20. package/dist/components/contact/index.js +3 -3
  21. package/dist/components/features/index.cjs +3 -3
  22. package/dist/components/features/index.js +2 -2
  23. package/dist/components/footer-waitlist-button.d.ts +2 -21
  24. package/dist/components/footer-waitlist-button.d.ts.map +1 -1
  25. package/dist/components/index.cjs +91 -87
  26. package/dist/components/index.cjs.map +1 -1
  27. package/dist/components/index.js +16 -12
  28. package/dist/components/index.js.map +1 -1
  29. package/dist/components/navigation/index.cjs +3 -3
  30. package/dist/components/navigation/index.js +2 -2
  31. package/dist/components/navigation/sticky-section-nav.d.ts.map +1 -1
  32. package/dist/components/tickets/help-center-card.d.ts.map +1 -1
  33. package/dist/components/tickets/index.cjs +98 -139
  34. package/dist/components/tickets/index.cjs.map +1 -1
  35. package/dist/components/tickets/index.js +54 -95
  36. package/dist/components/tickets/index.js.map +1 -1
  37. package/dist/components/tickets/ticket-row.d.ts.map +1 -1
  38. package/dist/components/ui/index.cjs +3 -3
  39. package/dist/components/ui/index.js +2 -2
  40. package/dist/contexts/chat-runtime-context.d.ts +3 -6
  41. package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
  42. package/dist/contexts/index.cjs +2 -2
  43. package/dist/contexts/index.js +1 -1
  44. package/dist/index.cjs +3 -5
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.js +2 -4
  47. package/dist/utils/index.cjs +0 -10
  48. package/dist/utils/index.cjs.map +1 -1
  49. package/dist/utils/index.d.ts +0 -1
  50. package/dist/utils/index.d.ts.map +1 -1
  51. package/dist/utils/index.js +1 -10
  52. package/dist/utils/index.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/components/chat/hooks/use-chat-identity.ts +7 -8
  55. package/src/components/footer-waitlist-button.tsx +16 -33
  56. package/src/components/navigation/sticky-section-nav.tsx +4 -6
  57. package/src/components/tickets/help-center-card.tsx +1 -55
  58. package/src/components/tickets/help-center-list.tsx +1 -9
  59. package/src/components/tickets/ticket-detail-drawer.tsx +4 -19
  60. package/src/components/tickets/ticket-row.tsx +19 -30
  61. package/src/contexts/chat-runtime-context.tsx +3 -6
  62. package/src/stories/EmbeddableChat.stories.tsx +1 -1
  63. package/src/utils/index.ts +0 -12
  64. package/dist/chunk-3E5ANY55.js.map +0 -1
  65. package/dist/chunk-P5EE2VJX.cjs.map +0 -1
  66. package/dist/chunk-WI76ZUBE.cjs.map +0 -1
  67. package/dist/chunk-ZG2YY5E7.js.map +0 -1
  68. package/dist/utils/scroll-into-view.d.ts +0 -63
  69. package/dist/utils/scroll-into-view.d.ts.map +0 -1
  70. package/src/utils/scroll-into-view.ts +0 -74
  71. /package/dist/{chunk-QKFBZLIR.js.map → chunk-ATEUJQKU.js.map} +0 -0
  72. /package/dist/{chunk-5BNWGK6D.js.map → chunk-WJBPLMBX.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/contexts/chat-runtime-context.tsx"],"sourcesContent":["'use client'\n\n/**\n * Chat runtime context — single seam for embedding the chat panel in a\n * different host (e.g. user1.openframe.ai reverse-proxying API calls\n * under /api/mingo-guide/* to hub.openframe.ai/api/*).\n *\n * Three concerns, one context:\n * 1. API endpoints: chatStreamUrl / approvalToolUrl / commandsUrl /\n * buildListUrl + attachment endpoints + chat-identity. The chat\n * reads them from runtime; hub vs embedded app supply different\n * strings via different providers.\n * 2. Navigation mode + callbacks: 'host' or 'embed' mode. Host wires\n * its own router/docNav via the optional `navigate` callback\n * (plain function, NOT a hook); embed forces new-tab via\n * `defaultContentOrigin` + lib's `resolveExternalNavigation`.\n * 3. Identity context: only `source` (required for localStorage\n * namespacing). The display identity (greeting first-name etc.)\n * comes from the server via `useChatIdentity()` — never injected\n * client-side, so it always matches the server-resolved auth.\n *\n * Sibling of EndpointsRuntimeContext (announcement bar, contact form,\n * access codes). Each runtime stays an independent React context so\n * embedders can opt into either feature without forcing the other.\n *\n * IMPORTANT for embedders: memoize the value passed to\n * `<ChatRuntimeContext.Provider value={...}>` (e.g. via React.useMemo).\n * Every change to its reference identity invalidates downstream\n * `useMemo` consumers (the chat input's slash-commands binding,\n * useNavLink's embed-resolution memo, useDocChat's streamFn factory).\n * The hub's `<HubRuntimeProvider>` already memoizes correctly with\n * stable deps. Embedded apps that build the value inline on each render\n * will pay an avoidable re-render cost across the entire chat tree.\n */\n\nimport { createContext, useContext, type ReactNode } from 'react'\n\n/**\n * Runtime config consumed by the chat panel.\n */\nexport interface ChatRuntime {\n endpoints: {\n /** POST streaming chat. Hub: '/api/docs/chat'. */\n chatStreamUrl: string\n /** POST agent approve/reject. Hub: '/api/chat/agent/confirm-tool'. */\n approvalToolUrl: string\n /** GET slash-command catalog. Hub: '/api/docs/commands'. */\n commandsUrl: string\n /** Build entity-card list URL for a content type + ids. Hub delegates\n * to the rag-table-config registry; embedded app provides its own\n * per-type URL builder against the reverse proxy. Returns null when\n * the type has no list endpoint (caller skips rendering). */\n buildListUrl: (type: string, ids: string[]) => string | null\n /** Chat-attachment endpoints — added for the v2 attachment feature.\n *\n * Three concerns:\n * - `attachmentUploadUrl` — POSTed by the chat-attachment hook\n * to mint a Supabase signed-upload-URL + HMAC view token.\n * - `attachmentViewUrlPrefix` — embedded in markdown URLs the\n * chat hosts in user message bubbles (`![]()` / `[Attached]`).\n * Stored in chat history; chosen at SEND time. In host mode the\n * relative `/api/storage/view/chat-attachments/` is sufficient\n * (same-origin); embedders supply an absolute hub URL so the\n * browser can fetch cross-origin.\n * - `identityUrl` — GET endpoint the `useChatIdentity` hook\n * hits to learn the `{authTier, source, attachmentsEnabled}`\n * capability bag for the current session. Used beyond chat\n * (tickets / contact form / any embedded surface that needs\n * to identify the proxied customer), so the name has no\n * \"chat\" prefix even though the consuming hook still does. */\n attachmentUploadUrl: string\n attachmentViewUrlPrefix: string\n identityUrl: string\n /** Optional URL prefix for the image proxy (`<prefix>?url=<external>`).\n * When unset, lib's `getProxiedImageUrl` returns the original URL\n * unchanged. Hub default: '/api/image-proxy'. Embedders that don't\n * host an image-proxy route leave this undefined → images load\n * directly cross-origin (CORS-permitting). */\n imageProxyUrlPrefix?: string\n /** Optional list of hostnames that should bypass the image proxy\n * (rendered direct). Hub uses ['openmsp.ai']; embedders typically\n * leave it unset. Matches the `skipDomains` parameter of\n * `getProxiedImageUrl`. */\n imageProxySkipDomains?: string[]\n }\n navigation: {\n /** ONE knob, two behaviors:\n * - 'host' = use the host page's existing click-routing untouched.\n * The chat panel calls `navigate?.()` for in-app routing.\n * - 'embed' = guest inside another app: short-circuit at the top\n * of click handlers to force new-tab + absolutize via\n * resolveExternalNavigation. */\n mode: 'host' | 'embed'\n /** Embed-only fallback origin for relative URLs whose target platform\n * can't be inferred. Used by resolveExternalNavigation when\n * `targetPlatform` is null — without this, a relative `/foo` href would\n * window.open against the embedder's origin, which is WRONG.\n * Set to your content host (e.g. 'https://hub.openframe.ai').\n * Required by the embedded app whenever mode='embed'. */\n defaultContentOrigin?: string\n /** Override for opening external URLs. MUST BE SYNCHRONOUS —\n * Safari/Firefox block popups opened outside a direct user gesture.\n * Default: window.open(href, '_blank', 'noopener,noreferrer'). */\n openExternal?: (href: string) => void\n /** Optional in-app navigation callback (host-mode only).\n * Returns `true` if the host handled the click in-app\n * (router.push + docNav.navigate); returns `false`, `undefined`,\n * or `void` → lib falls back to window.location.assign(href).\n * Hub wires this via HubRuntimeProvider's HubNavigationWiring;\n * embedders not in Next.js leave it undefined. */\n navigate?: (input: { href: string; path?: string | null; targetPlatform?: string | null }) => boolean | void\n /** Optional new-tab decision callback. Returns true → lib opens in\n * new tab; false → same tab via `navigate`. Hub wires the existing\n * `decideNewTab` logic from use-nav-link.tsx (re-imports the pure\n * helper from lib). Embedders may omit; lib defaults to:\n * same-origin/same-platform → same tab, else new tab. */\n decideNewTab?: (args: { href: string; targetPlatform?: string | null }) => boolean\n }\n /** Chat source identifier — REQUIRED. Used for localStorage\n * namespacing (`mingo-chat-<source>-v1`). Hub sets via\n * `currentPlatform()`; embedders set explicitly.\n * `useEmbeddedChat()` throws if source is empty/missing. */\n source: string\n // NOTE: No `user` field. The chat's display identity (greeting\n // first-name, etc.) comes from the SERVER-resolved auth via\n // `useChatIdentity()` — the same identity the server uses to\n // authorize requests. Letting embedders pass a client-side `user`\n // would let it desync from the actual auth tier, causing greetings\n // like \"Hey Bob\" while the server treats the session as\n // alice@example.com. Single source of truth: the server.\n}\n\nexport const ChatRuntimeContext = createContext<ChatRuntime | null>(null)\n\n/**\n * Returns the active runtime, or null when no provider is mounted.\n * NULL is a first-class value — it signals \"no chat runtime configured.\"\n * Optional consumers fall back to no-op behavior; strict consumers\n * use `useRequiredChatRuntime` (below).\n */\nexport function useChatRuntime(): ChatRuntime | null {\n return useContext(ChatRuntimeContext)\n}\n\n/**\n * Strict variant used INSIDE the chat panel. Throws if no provider.\n * The hub guarantees one exists by mounting `<HubRuntimeProvider>` at\n * root; the embedded app mounts its own `<ChatRuntimeContext.Provider>`\n * at the tree root. In Jest / Storybook tests that render chat\n * internals directly, wrap with `<HubRuntimeProvider>` (hub defaults)\n * or supply `<ChatRuntimeContext.Provider value={mockedRuntime}>`.\n */\nexport function useRequiredChatRuntime(): ChatRuntime {\n const v = useContext(ChatRuntimeContext)\n if (!v) {\n throw new Error(\n '[chat-runtime] hook called outside a <ChatRuntimeContext.Provider>. ' +\n 'The hub mounts <HubRuntimeProvider> at root — this only fires when ' +\n 'chat internals are rendered above the provider tree. ' +\n 'Fix: ensure the rendering subtree descends from the runtime provider. ' +\n 'In tests/Storybook: wrap with <HubRuntimeProvider> or supply ' +\n 'a <ChatRuntimeContext.Provider value={mockedRuntime}>.',\n )\n }\n return v\n}\n"],"mappings":";;;AAmCA,SAAS,eAAe,kBAAkC;AAiGnD,IAAM,qBAAqB,cAAkC,IAAI;AAQjE,SAAS,iBAAqC;AACnD,SAAO,WAAW,kBAAkB;AACtC;AAUO,SAAS,yBAAsC;AACpD,QAAM,IAAI,WAAW,kBAAkB;AACvC,MAAI,CAAC,GAAG;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAMF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,63 +0,0 @@
1
- /**
2
- * `scrollElementIntoView` — canonical "smooth scroll element to top
3
- * of viewport, account for sticky chrome, optionally adjust for
4
- * known layout shifts" helper.
5
- *
6
- * Before this util existed, ~3 different call sites in the lib + hub
7
- * had the same 5-line snippet copy-pasted with subtle differences:
8
- *
9
- * - `useUnifiedNav` same-URL re-scroll branch (hub)
10
- * - `<HelpCenterCard>` click-to-expand (lib, with cross-row
11
- * layout-shift adjustment)
12
- * - Future ticket-row / docs anchor scrolls
13
- *
14
- * The canonical pattern is `window.scrollTo({top, behavior:'smooth'})`
15
- * with a pre-computed pixel target — NOT `element.scrollIntoView()`.
16
- * Pre-computing the target lets the browser run a clean uninterrupted
17
- * smooth animation to a fixed pixel value. `scrollIntoView` re-targets
18
- * continuously as the page layout shifts during the animation, which
19
- * causes visible jitter when content above the target is also moving
20
- * (a sibling collapsing, an async image loading, …).
21
- *
22
- * The `adjustTargetY` callback is the escape hatch for cases where
23
- * the consumer KNOWS about an upcoming layout shift and can compute
24
- * the correct FINAL target before the animation starts. Example: in
25
- * `HelpCenterCard`, clicking row B while row A above is currently
26
- * expanded — A's drawer collapses simultaneously with B's expansion,
27
- * shifting B's tile up by A's drawer height. The consumer passes
28
- * `adjustTargetY: raw => raw - getAboveDrawerHeight()` and the
29
- * browser smooth-scrolls to the post-collapse position directly.
30
- */
31
- export interface ScrollElementIntoViewOptions {
32
- /** Pixels to subtract from the target element's `top` so it lands
33
- * BELOW sticky chrome. Defaults to 0. Pass `96` (matches
34
- * `scroll-mt-24`) for the standard hub header offset. */
35
- headerOffset?: number;
36
- /** Scroll animation style. Defaults to `'smooth'`. Use `'instant'`
37
- * for imperative jumps where animation would feel laggy (deep
38
- * link land, programmatic focus moves). */
39
- behavior?: ScrollBehavior;
40
- /** Optional adjustment applied to the computed pixel target. The
41
- * callback receives the "raw" Y (`element.top + scrollY -
42
- * headerOffset`) and returns the FINAL pixel target. Use this
43
- * when the caller knows about a layout shift that will happen
44
- * between the call and the animation completing — the browser's
45
- * smooth-scroll commits to a single pixel value, so providing the
46
- * post-shift target up front lands the element correctly even as
47
- * content above it moves. */
48
- adjustTargetY?: (rawTargetY: number) => number;
49
- }
50
- /**
51
- * Scroll the page so `target` lands at the top of the viewport,
52
- * accounting for sticky chrome via `headerOffset`. Returns void; the
53
- * scroll runs async via the browser's smooth-scroll engine.
54
- *
55
- * Accepts:
56
- * - `HTMLElement` — direct reference (most common from `useRef`).
57
- * - `null` / `undefined` — no-op so callers can pass refs without
58
- * defensive branching.
59
- *
60
- * SSR-safe: short-circuits when `window` is undefined.
61
- */
62
- export declare function scrollElementIntoView(target: HTMLElement | null | undefined, options?: ScrollElementIntoViewOptions): void;
63
- //# sourceMappingURL=scroll-into-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scroll-into-view.d.ts","sourceRoot":"","sources":["../../src/utils/scroll-into-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,WAAW,4BAA4B;IAC3C;;8DAE0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;gDAE4C;IAC5C,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB;;;;;;;kCAO8B;IAC9B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAA;CAC/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,GAAE,4BAAiC,GACzC,IAAI,CAON"}
@@ -1,74 +0,0 @@
1
- /**
2
- * `scrollElementIntoView` — canonical "smooth scroll element to top
3
- * of viewport, account for sticky chrome, optionally adjust for
4
- * known layout shifts" helper.
5
- *
6
- * Before this util existed, ~3 different call sites in the lib + hub
7
- * had the same 5-line snippet copy-pasted with subtle differences:
8
- *
9
- * - `useUnifiedNav` same-URL re-scroll branch (hub)
10
- * - `<HelpCenterCard>` click-to-expand (lib, with cross-row
11
- * layout-shift adjustment)
12
- * - Future ticket-row / docs anchor scrolls
13
- *
14
- * The canonical pattern is `window.scrollTo({top, behavior:'smooth'})`
15
- * with a pre-computed pixel target — NOT `element.scrollIntoView()`.
16
- * Pre-computing the target lets the browser run a clean uninterrupted
17
- * smooth animation to a fixed pixel value. `scrollIntoView` re-targets
18
- * continuously as the page layout shifts during the animation, which
19
- * causes visible jitter when content above the target is also moving
20
- * (a sibling collapsing, an async image loading, …).
21
- *
22
- * The `adjustTargetY` callback is the escape hatch for cases where
23
- * the consumer KNOWS about an upcoming layout shift and can compute
24
- * the correct FINAL target before the animation starts. Example: in
25
- * `HelpCenterCard`, clicking row B while row A above is currently
26
- * expanded — A's drawer collapses simultaneously with B's expansion,
27
- * shifting B's tile up by A's drawer height. The consumer passes
28
- * `adjustTargetY: raw => raw - getAboveDrawerHeight()` and the
29
- * browser smooth-scrolls to the post-collapse position directly.
30
- */
31
-
32
- export interface ScrollElementIntoViewOptions {
33
- /** Pixels to subtract from the target element's `top` so it lands
34
- * BELOW sticky chrome. Defaults to 0. Pass `96` (matches
35
- * `scroll-mt-24`) for the standard hub header offset. */
36
- headerOffset?: number
37
- /** Scroll animation style. Defaults to `'smooth'`. Use `'instant'`
38
- * for imperative jumps where animation would feel laggy (deep
39
- * link land, programmatic focus moves). */
40
- behavior?: ScrollBehavior
41
- /** Optional adjustment applied to the computed pixel target. The
42
- * callback receives the "raw" Y (`element.top + scrollY -
43
- * headerOffset`) and returns the FINAL pixel target. Use this
44
- * when the caller knows about a layout shift that will happen
45
- * between the call and the animation completing — the browser's
46
- * smooth-scroll commits to a single pixel value, so providing the
47
- * post-shift target up front lands the element correctly even as
48
- * content above it moves. */
49
- adjustTargetY?: (rawTargetY: number) => number
50
- }
51
-
52
- /**
53
- * Scroll the page so `target` lands at the top of the viewport,
54
- * accounting for sticky chrome via `headerOffset`. Returns void; the
55
- * scroll runs async via the browser's smooth-scroll engine.
56
- *
57
- * Accepts:
58
- * - `HTMLElement` — direct reference (most common from `useRef`).
59
- * - `null` / `undefined` — no-op so callers can pass refs without
60
- * defensive branching.
61
- *
62
- * SSR-safe: short-circuits when `window` is undefined.
63
- */
64
- export function scrollElementIntoView(
65
- target: HTMLElement | null | undefined,
66
- options: ScrollElementIntoViewOptions = {},
67
- ): void {
68
- if (typeof window === 'undefined' || !target) return
69
- const { headerOffset = 0, behavior = 'smooth', adjustTargetY } = options
70
- const rawTargetY =
71
- target.getBoundingClientRect().top + window.scrollY - headerOffset
72
- const finalY = adjustTargetY ? adjustTargetY(rawTargetY) : rawTargetY
73
- window.scrollTo({ top: Math.max(0, finalY), behavior })
74
- }