@flamingo-stack/openframe-frontend-core 0.0.674 → 0.0.675-snapshot.20260928180045
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-RSOBME56.js → chunk-2GL6DFLV.js} +2 -2
- package/dist/{chunk-PP3N5MN4.cjs → chunk-42GR6UIH.cjs} +3 -3
- package/dist/{chunk-PP3N5MN4.cjs.map → chunk-42GR6UIH.cjs.map} +1 -1
- package/dist/{chunk-N6CI2E7D.cjs → chunk-5X4JS67G.cjs} +3 -3
- package/dist/{chunk-N6CI2E7D.cjs.map → chunk-5X4JS67G.cjs.map} +1 -1
- package/dist/{chunk-EGQOPBXC.cjs → chunk-BVYZHKF6.cjs} +3 -3
- package/dist/{chunk-EGQOPBXC.cjs.map → chunk-BVYZHKF6.cjs.map} +1 -1
- package/dist/{chunk-FUEAXTZE.cjs → chunk-C4YD5MZV.cjs} +4 -4
- package/dist/{chunk-FUEAXTZE.cjs.map → chunk-C4YD5MZV.cjs.map} +1 -1
- package/dist/{chunk-YVJDVVHY.js → chunk-CXE6WTBZ.js} +5 -2
- package/dist/{chunk-YVJDVVHY.js.map → chunk-CXE6WTBZ.js.map} +1 -1
- package/dist/{chunk-QZMKKQQN.cjs → chunk-D3LFYXUM.cjs} +13 -13
- package/dist/{chunk-QZMKKQQN.cjs.map → chunk-D3LFYXUM.cjs.map} +1 -1
- package/dist/{chunk-MRT6DZG5.cjs → chunk-GU5JW5MX.cjs} +36 -36
- package/dist/{chunk-MRT6DZG5.cjs.map → chunk-GU5JW5MX.cjs.map} +1 -1
- package/dist/{chunk-XBNO42PI.js → chunk-HDNMMUGV.js} +2 -2
- package/dist/{chunk-7F73YNDS.cjs → chunk-HQ2ZYL3V.cjs} +4 -4
- package/dist/{chunk-7F73YNDS.cjs.map → chunk-HQ2ZYL3V.cjs.map} +1 -1
- package/dist/{chunk-UIQQBZLU.cjs → chunk-I3QQALKQ.cjs} +33 -33
- package/dist/{chunk-UIQQBZLU.cjs.map → chunk-I3QQALKQ.cjs.map} +1 -1
- package/dist/{chunk-XYZQXHAX.js → chunk-J24SZNH4.js} +4 -4
- package/dist/{chunk-CHKIZRUP.cjs → chunk-JB4ZALJS.cjs} +18 -18
- package/dist/{chunk-CHKIZRUP.cjs.map → chunk-JB4ZALJS.cjs.map} +1 -1
- package/dist/{chunk-M76D6OJZ.js → chunk-KB7YLZAC.js} +5 -5
- package/dist/{chunk-OAQROGFN.cjs → chunk-KFWDLZGL.cjs} +51 -51
- package/dist/{chunk-OAQROGFN.cjs.map → chunk-KFWDLZGL.cjs.map} +1 -1
- package/dist/{chunk-GJTLUW2H.js → chunk-LD76LMKM.js} +2 -2
- package/dist/{chunk-UYPICURQ.js → chunk-LPEFFJXX.js} +2 -2
- package/dist/{chunk-TWQWCOJ7.cjs → chunk-N24SOKQI.cjs} +17 -17
- package/dist/{chunk-TWQWCOJ7.cjs.map → chunk-N24SOKQI.cjs.map} +1 -1
- package/dist/{chunk-PXWMRXVI.js → chunk-OS3NLEV5.js} +5 -5
- package/dist/{chunk-BQICLH4C.js → chunk-PARUDSVT.js} +4 -4
- package/dist/{chunk-QO4RASGC.js → chunk-PSF37OWZ.js} +2 -2
- package/dist/{chunk-TECYEWVQ.js → chunk-Q3MTPDK4.js} +2 -2
- package/dist/{chunk-MMOXFVQN.js → chunk-SYTU64CK.js} +2 -2
- package/dist/{chunk-G7HMYIDN.js → chunk-TS4HBJNA.js} +2 -2
- package/dist/{chunk-EJZV4QGU.cjs → chunk-VZMST7BD.cjs} +111 -108
- package/dist/chunk-VZMST7BD.cjs.map +1 -0
- package/dist/{chunk-HN7KNVKL.cjs → chunk-WYACK3N7.cjs} +3 -3
- package/dist/{chunk-HN7KNVKL.cjs.map → chunk-WYACK3N7.cjs.map} +1 -1
- package/dist/{chunk-L7PO6NSD.cjs → chunk-XJMADFIK.cjs} +10 -10
- package/dist/{chunk-L7PO6NSD.cjs.map → chunk-XJMADFIK.cjs.map} +1 -1
- package/dist/{chunk-NRHEKFPG.js → chunk-ZI3E5SSW.js} +2 -2
- package/dist/{chunk-4Q6P3VHS.cjs → chunk-ZYVMSJFU.cjs} +17 -17
- package/dist/{chunk-4Q6P3VHS.cjs.map → chunk-ZYVMSJFU.cjs.map} +1 -1
- package/dist/{chunk-EPKQTPNJ.js → chunk-ZZOZZJPK.js} +3 -3
- package/dist/components/case-studies/index.cjs +11 -11
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/features/walkthrough-video.d.ts +6 -0
- package/dist/components/features/walkthrough-video.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +49 -49
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +31 -31
- package/dist/components/index.js +12 -12
- package/dist/components/meeting-scheduler/index.cjs +21 -21
- package/dist/components/meeting-scheduler/index.js +1 -1
- package/dist/components/navigation/index.cjs +5 -5
- package/dist/components/navigation/index.js +4 -4
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +2 -2
- package/dist/components/ui/index.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-message-in-app-links.test.tsx +114 -0
- package/src/components/features/__tests__/walkthrough-video-autoplay-card.test.tsx +89 -0
- package/src/components/features/walkthrough-video.tsx +12 -1
- package/dist/chunk-EJZV4QGU.cjs.map +0 -1
- /package/dist/{chunk-RSOBME56.js.map → chunk-2GL6DFLV.js.map} +0 -0
- /package/dist/{chunk-XBNO42PI.js.map → chunk-HDNMMUGV.js.map} +0 -0
- /package/dist/{chunk-XYZQXHAX.js.map → chunk-J24SZNH4.js.map} +0 -0
- /package/dist/{chunk-M76D6OJZ.js.map → chunk-KB7YLZAC.js.map} +0 -0
- /package/dist/{chunk-GJTLUW2H.js.map → chunk-LD76LMKM.js.map} +0 -0
- /package/dist/{chunk-UYPICURQ.js.map → chunk-LPEFFJXX.js.map} +0 -0
- /package/dist/{chunk-PXWMRXVI.js.map → chunk-OS3NLEV5.js.map} +0 -0
- /package/dist/{chunk-BQICLH4C.js.map → chunk-PARUDSVT.js.map} +0 -0
- /package/dist/{chunk-QO4RASGC.js.map → chunk-PSF37OWZ.js.map} +0 -0
- /package/dist/{chunk-TECYEWVQ.js.map → chunk-Q3MTPDK4.js.map} +0 -0
- /package/dist/{chunk-MMOXFVQN.js.map → chunk-SYTU64CK.js.map} +0 -0
- /package/dist/{chunk-G7HMYIDN.js.map → chunk-TS4HBJNA.js.map} +0 -0
- /package/dist/{chunk-NRHEKFPG.js.map → chunk-ZI3E5SSW.js.map} +0 -0
- /package/dist/{chunk-EPKQTPNJ.js.map → chunk-ZZOZZJPK.js.map} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REGRESSION: an app-screen link in a chat answer must open IN the app.
|
|
3
|
+
*
|
|
4
|
+
* The hub writes the screens of the app the chat is embedded in as
|
|
5
|
+
* ROOT-RELATIVE markdown links (`[Devices](/devices)`). A host-mode runtime
|
|
6
|
+
* (the OpenFrame app) must open each one in the same tab through its own
|
|
7
|
+
* `navigate` — a router push, no reload, no second tab.
|
|
8
|
+
*
|
|
9
|
+
* The same link written ABSOLUTE, even to the page's own origin, opens a new
|
|
10
|
+
* tab: the new-tab rule is textual (`isCrossOriginUrl`), which is why the hub
|
|
11
|
+
* writes these links relative. The contrast case pins that, so a change on
|
|
12
|
+
* either side of the contract shows up here.
|
|
13
|
+
*
|
|
14
|
+
* This drives the real bubble, the real markdown engine and the real anchor
|
|
15
|
+
* (`NavLinkAnchorViaRuntime`), with the runtime wired the way the OpenFrame
|
|
16
|
+
* app wires it (`navigate` router-pushes a same-origin href; `decideNewTab`
|
|
17
|
+
* is the lib rule with no target platform).
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
21
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
22
|
+
import { type ChatRuntime, ChatRuntimeContext } from '../../../contexts/chat-runtime-context';
|
|
23
|
+
import { ChatMessageEnhanced } from '../chat-message-enhanced';
|
|
24
|
+
import { NavLinkAnchorViaRuntime } from '../nav-link-anchor-via-runtime';
|
|
25
|
+
import { stripSameOriginToPath } from '../utils/chat-nav-resolution';
|
|
26
|
+
import { decideNewTab } from '../utils/decide-new-tab';
|
|
27
|
+
import { isCrossOriginUrl } from '../utils/is-cross-origin-url';
|
|
28
|
+
|
|
29
|
+
const routerPush = vi.fn<(path: string) => void>();
|
|
30
|
+
|
|
31
|
+
vi.mock('../../../embed-shims/next-navigation', () => ({
|
|
32
|
+
usePathname: () => '/dashboard',
|
|
33
|
+
useRouter: () => ({ back: vi.fn(), prefetch: vi.fn(), push: routerPush, replace: vi.fn() }),
|
|
34
|
+
useSearchParams: () => new URLSearchParams(),
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
/** jsdom's own origin — `location.origin` is undefined there, `location.href` is not. */
|
|
38
|
+
const ORIGIN = new URL(window.location.href).origin;
|
|
39
|
+
|
|
40
|
+
const ANSWER = [
|
|
41
|
+
'Get the install command from [Devices → Add Device](/devices/new): pick the customer and the platform.',
|
|
42
|
+
'',
|
|
43
|
+
'Then go to [Devices](/devices) and check the **Status** column. For a searchable log of all activity, use [Logs](/logs-page).',
|
|
44
|
+
].join('\n');
|
|
45
|
+
|
|
46
|
+
const openExternal = vi.fn<(href: string) => void>();
|
|
47
|
+
const windowOpen = vi.spyOn(window, 'open').mockImplementation(() => null);
|
|
48
|
+
|
|
49
|
+
const runtime = {
|
|
50
|
+
endpoints: { chatStreamUrl: '/content/api/docs/chat' },
|
|
51
|
+
navigation: {
|
|
52
|
+
decideNewTab: ({ href }: { href: string }) =>
|
|
53
|
+
decideNewTab({ currentSource: 'openframe', href, targetPlatform: null }),
|
|
54
|
+
mode: 'host',
|
|
55
|
+
navigate: ({ href }: { href: string }) => {
|
|
56
|
+
if (isCrossOriginUrl(href)) return false;
|
|
57
|
+
routerPush(stripSameOriginToPath(href));
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
openExternal,
|
|
61
|
+
},
|
|
62
|
+
source: 'openframe',
|
|
63
|
+
} as unknown as ChatRuntime;
|
|
64
|
+
|
|
65
|
+
function renderAnswer(text: string) {
|
|
66
|
+
return render(
|
|
67
|
+
<ChatRuntimeContext.Provider value={runtime}>
|
|
68
|
+
<ChatMessageEnhanced
|
|
69
|
+
NavLinkAnchor={NavLinkAnchorViaRuntime}
|
|
70
|
+
content={[{ text, type: 'text' }]}
|
|
71
|
+
renderEntityCard={() => null}
|
|
72
|
+
role="assistant"
|
|
73
|
+
/>
|
|
74
|
+
</ChatRuntimeContext.Provider>,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
routerPush.mockClear();
|
|
80
|
+
openExternal.mockClear();
|
|
81
|
+
windowOpen.mockClear();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('ChatMessageEnhanced — in-app screen links', () => {
|
|
85
|
+
it('opens every root-relative screen link in the same tab through the host router', () => {
|
|
86
|
+
renderAnswer(ANSWER);
|
|
87
|
+
const anchors = screen.getAllByRole('link');
|
|
88
|
+
|
|
89
|
+
expect(anchors.map(a => [a.textContent, a.getAttribute('href'), a.getAttribute('target')])).toEqual([
|
|
90
|
+
['Devices → Add Device', '/devices/new', null],
|
|
91
|
+
['Devices', '/devices', null],
|
|
92
|
+
['Logs', '/logs-page', null],
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
for (const anchor of anchors) fireEvent.click(anchor, { button: 0 });
|
|
96
|
+
|
|
97
|
+
expect(routerPush.mock.calls.map(call => call[0])).toEqual(['/devices/new', '/devices', '/logs-page']);
|
|
98
|
+
expect(openExternal).not.toHaveBeenCalled();
|
|
99
|
+
expect(windowOpen).not.toHaveBeenCalled();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('opens the same link written absolute in a new tab, even on the page origin', () => {
|
|
103
|
+
renderAnswer(ANSWER.replace(/\]\(\//g, `](${ORIGIN}/`));
|
|
104
|
+
const anchor = screen.getByRole('link', { name: 'Devices → Add Device' });
|
|
105
|
+
|
|
106
|
+
expect(anchor.getAttribute('href')).toBe(`${ORIGIN}/devices/new`);
|
|
107
|
+
expect(anchor.getAttribute('target')).toBe('_blank');
|
|
108
|
+
|
|
109
|
+
fireEvent.click(anchor, { button: 0 });
|
|
110
|
+
|
|
111
|
+
expect(openExternal).toHaveBeenCalledWith(`${ORIGIN}/devices/new`);
|
|
112
|
+
expect(routerPush).not.toHaveBeenCalled();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `autoPlayCard` on the inline walkthrough card: the card mounts its player in
|
|
3
|
+
* resume mode from 0, muted and autoplaying, instead of waiting for a hover.
|
|
4
|
+
*/
|
|
5
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
6
|
+
import type { Ref } from 'react';
|
|
7
|
+
import { useImperativeHandle, useRef } from 'react';
|
|
8
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
9
|
+
|
|
10
|
+
import { InlineWalkthroughVideo } from '../walkthrough-video';
|
|
11
|
+
|
|
12
|
+
interface Construction {
|
|
13
|
+
role: string;
|
|
14
|
+
startTime: number | undefined;
|
|
15
|
+
autoPlay: boolean | undefined;
|
|
16
|
+
startMuted: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const constructions: Construction[] = [];
|
|
20
|
+
|
|
21
|
+
vi.mock('../video', () => {
|
|
22
|
+
const FakeVideo = (props: Record<string, unknown>) => {
|
|
23
|
+
const role =
|
|
24
|
+
props.layout === 'wide'
|
|
25
|
+
? 'theater'
|
|
26
|
+
: props.firstFrameOnly
|
|
27
|
+
? 'facade'
|
|
28
|
+
: props.startTime !== undefined
|
|
29
|
+
? 'resume'
|
|
30
|
+
: 'preview';
|
|
31
|
+
const first = useRef(true);
|
|
32
|
+
if (first.current) {
|
|
33
|
+
first.current = false;
|
|
34
|
+
if (role !== 'facade') {
|
|
35
|
+
constructions.push({
|
|
36
|
+
role,
|
|
37
|
+
startTime: props.startTime as number | undefined,
|
|
38
|
+
autoPlay: props.autoPlay as boolean | undefined,
|
|
39
|
+
startMuted: props.startMuted as boolean | undefined,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
useImperativeHandle(
|
|
44
|
+
props.playerHandleRef as Ref<unknown>,
|
|
45
|
+
() => ({
|
|
46
|
+
getCurrentTime: () => 0,
|
|
47
|
+
getDuration: () => 600,
|
|
48
|
+
getPaused: () => false,
|
|
49
|
+
getMuted: () => true,
|
|
50
|
+
play: () => Promise.resolve(),
|
|
51
|
+
pause: () => {},
|
|
52
|
+
setMuted: () => {},
|
|
53
|
+
}),
|
|
54
|
+
[],
|
|
55
|
+
);
|
|
56
|
+
return <div data-role={role} />;
|
|
57
|
+
};
|
|
58
|
+
return { Video: FakeVideo };
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const FILE_VIDEO = { id: 'v1', mainVideoUrl: 'https://example.com/a.m3u8', posterUrl: null, title: 'Demo' };
|
|
62
|
+
const YOUTUBE_VIDEO = { id: 'v2', youtubeUrl: 'https://youtu.be/dQw4w9WgXcQ', posterUrl: null, title: 'Demo' };
|
|
63
|
+
|
|
64
|
+
describe('walkthrough-video: autoPlayCard', () => {
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
constructions.length = 0;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// The card appears after the mount gate (an effect), so every assertion waits
|
|
70
|
+
// for it: `findByRole` is what tells "not yet" apart from "never".
|
|
71
|
+
it('mounts the card player in resume mode: from 0, muted, autoplaying', async () => {
|
|
72
|
+
render(<InlineWalkthroughVideo video={FILE_VIDEO} autoPlayCard />);
|
|
73
|
+
await waitFor(() =>
|
|
74
|
+
expect(constructions).toEqual([{ role: 'resume', startTime: 0, autoPlay: true, startMuted: true }]),
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('without it the card waits for a hover', async () => {
|
|
79
|
+
render(<InlineWalkthroughVideo video={FILE_VIDEO} />);
|
|
80
|
+
await screen.findByRole('button', { name: /Play Demo Video/ });
|
|
81
|
+
expect(constructions.filter(c => c.role === 'resume')).toEqual([]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('a YouTube card never plays inline', async () => {
|
|
85
|
+
render(<InlineWalkthroughVideo video={YOUTUBE_VIDEO} autoPlayCard />);
|
|
86
|
+
await screen.findByRole('button', { name: /Play Demo Video/ });
|
|
87
|
+
expect(constructions.filter(c => c.role === 'resume')).toEqual([]);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -129,6 +129,12 @@ interface WalkthroughVideoBaseProps {
|
|
|
129
129
|
* SSR-safe: the server renders closed, and the theater lives in a portal,
|
|
130
130
|
* so the hydrated (non-portal) markup is identical either way. */
|
|
131
131
|
deepLinkParam?: string;
|
|
132
|
+
/** Start the card playing on mount, muted, with the unmute glyph up — the
|
|
133
|
+
* muted-autoplay pattern, for a page whose point IS the clip (an onboarding
|
|
134
|
+
* hero). The card behaves as after a muted theater close: the clip runs in
|
|
135
|
+
* the card, a click opens the theater from the current time. File videos
|
|
136
|
+
* only; a YouTube card never plays inline. */
|
|
137
|
+
autoPlayCard?: boolean;
|
|
132
138
|
label?: string;
|
|
133
139
|
className?: string;
|
|
134
140
|
}
|
|
@@ -199,6 +205,7 @@ function WalkthroughVideo({
|
|
|
199
205
|
defaultOpen,
|
|
200
206
|
defaultOpenPaused,
|
|
201
207
|
deepLinkParam = WALKTHROUGH_OPEN_QUERY_PARAM,
|
|
208
|
+
autoPlayCard = false,
|
|
202
209
|
label = 'Play Demo Video',
|
|
203
210
|
placement,
|
|
204
211
|
// Keeps the FLOATING card off the critical path. The inline preset passes 0:
|
|
@@ -313,7 +320,11 @@ function WalkthroughVideo({
|
|
|
313
320
|
const endedLatchRef = useRef(false);
|
|
314
321
|
|
|
315
322
|
const [hovered, setHovered] = useState(false);
|
|
316
|
-
|
|
323
|
+
// `autoPlayCard` seeds the same state a muted theater close leaves behind, so
|
|
324
|
+
// the card starts in resume mode with nothing else to special-case.
|
|
325
|
+
const [handoff, setHandoff] = useState<Handoff | null>(() =>
|
|
326
|
+
autoPlayCard && !video?.youtubeUrl ? { time: 0, muted: true, playing: true } : null,
|
|
327
|
+
);
|
|
317
328
|
const [suspended, setSuspended] = useState(false);
|
|
318
329
|
const [theaterStart, setTheaterStart] = useState<{ time: number; muted: boolean }>({ time: 0, muted: false });
|
|
319
330
|
const [footerObservation, setFooterObservation] = useState<{ key: string; hidden: boolean } | null>(null);
|