// In an app: import { setupLinkCard } from '@aparte/plugin-cards/link';
const { setupLinkCard } = window.apartePlugins.cards.link;
// A card shows only http(s) pictures: these are served by this site, which its image
// policy lets load. Without it they wait behind "Show images", as any picture would.
window.aparte.aparteGlobalConfig.setImagePolicy(['self']);
const picture = (name) => new URL('/demo-pictures/' + name + '.svg', location.href).href;
setupLinkCard({ tool: 'unfurl', variant: 'quote' });
document.querySelector('aparte-chat-bubble').setSegments([{
id: 's1', type: 'tool_call', status: 'resolved',
toolCall: { id: 'c-s1', name: 'unfurl', input: { url: 'https://journal.example.org/notes/read-the-weather' } },
structuredResult: {
url: 'https://journal.example.org/notes/read-the-weather', siteName: 'The Journal', type: 'article', themeColor: '#1b8aa6',
image: picture('coast'), author: 'C. Marchetti', publishedAt: Date.now() - 3 * 86400000,
title: 'Read the weather, not the JSON', description: 'Why the first card every chat ships is the forecast.',
},
}]);