// 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: 'find_places', currencySymbol: '€', variant: 'compact' });
document.querySelector('aparte-chat-bubble').setSegments([{
id: 's1', type: 'tool_call', status: 'resolved',
toolCall: { id: 'c-s1', name: 'find_places', input: { query: 'dinner', near: 'Vieux-Lille' } },
structuredResult: {
title: 'Dinner near the old town',
places: [
{ 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'] },
{ name: 'Café Lumière', category: 'Café', image: picture('store-cafe'), rating: 4.4, reviewCount: 532, priceLevel: 1,
distance: 600, address: '3 place du Concert, Lille', hours: week('07:30', '19:00'), tags: ['Brunch', 'Wi-Fi'] },
{ name: 'Maison Brunel', category: 'Bakery', image: picture('store-bakery'), rating: 4.8, reviewCount: 2210, priceLevel: 1,
distance: 900, address: '41 rue Royale, Lille', hours: week('07:00', '20:00', ['sun']), tags: ['Sourdough'] },
],
},
}]);