import { html, LitElement, nothing, TemplateResult } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import { SearchServiceInterface } from '../src/search-service-interface'; import { SearchResponse } from '../src/responses/search-response'; import { ExtraInfo } from '../src/responses/extra-info'; @customElement('item-detail-query') export class ItemDetailQuery extends LitElement { @property({ type: Object }) searchService?: SearchServiceInterface; @state() isSearching = false; @state() response?: SearchResponse; @state() error?: Error; private get itemResults(): ExtraInfo | null | undefined { return this.response?.response.extraInfo; } render(): TemplateResult { return html`
${this.isSearching ? html`Searching...
` : nothing} ${this.itemResults ? html`${JSON.stringify(this.itemResults, null, 2)}
`
: nothing}
${this.error
? html`
${this.error}
`
: nothing}
`;
}
async search(event: Event): Promise