// In an app: import { setupOrderCard } from '@aparte/plugin-cards/order';
const { setupOrderCard } = window.apartePlugins.cards.order;
// A hotel's dates are days, not midnights: the card counts the nights between them.
const day = (n) => new Date(Date.now() + n * 86400000).toISOString().slice(0, 10);
setupOrderCard({ tool: 'book_room', variant: 'confirmation' });
document.querySelector('aparte-chat-bubble').setSegments([{
id: 's1', type: 'tool_call', status: 'resolved',
toolCall: { id: 'c-s1', name: 'book_room', input: { hotel: 'Hôtel des Arts', nights: 3 } },
structuredResult: {
kind: 'booking', title: 'Hôtel des Arts', reference: 'HDA-7Q2M', status: 'confirmed', currency: 'EUR',
booking: { start: day(14), end: day(17), location: '24 rue de Paris, Lille', guests: 2 },
facts: [{ label: 'Room', value: 'Deluxe double, courtyard side' }, { label: 'Breakfast', value: 'Included' }],
total: 486, payment: 'Paid at the hotel',
},
}]);