- typed client and useFaq/useFaqApi (SSR, faq:<slug>:<locale> key, server and public bases, x-forwarded-for forwarded also on cached renders) - FaqBlock, FaqList and FaqItem: native details, exclusive and openFirst, server-sanitized description and answers, nothing or #fallback on 404, error or no items - FAQ tokens and base CSS with the .faq-html rules, README - node client tests and a playground SSR smoke against a fixture API
21 lines
432 B
TypeScript
21 lines
432 B
TypeScript
// The response shape of GET /_faq/api/v1/faqs/{slug}?locale=xx (the FAQ
|
|
// plugin's public API). description and every answer are HTML the server
|
|
// sanitized on output; questions are plain text.
|
|
|
|
export interface FaqItem {
|
|
question: string
|
|
answer: string
|
|
}
|
|
|
|
export interface Faq {
|
|
name: string
|
|
slug: string
|
|
locale: string
|
|
description: string | null
|
|
content: FaqItem[]
|
|
}
|
|
|
|
export interface FaqEnvelope {
|
|
data: Faq
|
|
}
|