// In an app: import { setupPlaceCard } from '@aparte/plugin-cards/place';
const { setupPlaceCard } = window.apartePlugins.cards.place;
// 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;
// Opening hours for every day but the ones listed.
const week = (open, close, closed = []) => ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
.filter((day) => !closed.includes(day)).map((day) => ({ day, open, close }));
setupPlaceCard({ tool: 'get_place', currencySymbol: '€', variant: 'detail' });
document.querySelector('aparte-chat-bubble').setSegments([{
id: 's1', type: 'tool_call', status: 'resolved',
toolCall: { id: 'c-s1', name: 'get_place', input: { name: 'Le Comptoir des Halles' } },
structuredResult: { name: 'Le Comptoir des Halles', category: 'Bistro', image: picture('store-bistro'), rating: 4.6, reviewCount: 1284,
priceLevel: 2, distance: 350, address: '12 rue de la Halle, Lille', coordinates: { lat: 50.6405, lng: 3.0614 },
website: 'https://bistro.example.com', hours: week('12:00', '23:30', ['mon']), tags: ['Terrace', 'Natural wine'] },
}]);