@webority/support-react 0.149.0 → 0.152.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +0 -6
  2. package/dist/guidance.json +1 -1
  3. package/dist/support-react.js +1 -1
  4. package/dist/types/ReportIssue.d.ts +23 -24
  5. package/dist/types/ReportIssue.meta.d.ts +2 -54
  6. package/dist/types/SupportCenter.d.ts +17 -18
  7. package/dist/types/SupportCenter.meta.d.ts +2 -58
  8. package/dist/types/SupportContact.d.ts +4 -6
  9. package/dist/types/SupportContact.meta.d.ts +2 -25
  10. package/dist/types/SupportProvider.d.ts +16 -16
  11. package/dist/types/agent/SupportAgentProvider.d.ts +14 -12
  12. package/dist/types/agent/SupportAgentTicket.d.ts +6 -7
  13. package/dist/types/agent/SupportQueue.d.ts +18 -18
  14. package/dist/types/agent/SupportQueue.meta.d.ts +1 -1
  15. package/dist/types/agent/client.d.ts +228 -98
  16. package/dist/types/agent/context.d.ts +37 -66
  17. package/dist/types/agent/labels.d.ts +80 -79
  18. package/dist/types/client.d.ts +241 -174
  19. package/dist/types/components/AttachmentField.d.ts +7 -13
  20. package/dist/types/components/AttachmentThumb.d.ts +6 -12
  21. package/dist/types/components/MessageThread.d.ts +6 -13
  22. package/dist/types/components/NewTicketModal.d.ts +14 -18
  23. package/dist/types/components/RatingPanel.d.ts +14 -15
  24. package/dist/types/components/ReplyBox.d.ts +11 -11
  25. package/dist/types/components/SuggestedAnswers.d.ts +6 -9
  26. package/dist/types/components/SupportTime.d.ts +8 -10
  27. package/dist/types/components/TicketDetail.d.ts +11 -12
  28. package/dist/types/components/TicketForm.d.ts +31 -39
  29. package/dist/types/components/TicketList.d.ts +31 -25
  30. package/dist/types/context.d.ts +32 -51
  31. package/dist/types/helpCentre/HelpArticle.d.ts +11 -9
  32. package/dist/types/helpCentre/HelpArticle.meta.d.ts +2 -34
  33. package/dist/types/helpCentre/HelpCentre.d.ts +11 -9
  34. package/dist/types/helpCentre/HelpCentre.meta.d.ts +2 -33
  35. package/dist/types/helpCentre/client.d.ts +25 -59
  36. package/dist/types/helpCentre/labels.d.ts +19 -19
  37. package/dist/types/helpCentre/useHelpCentre.d.ts +8 -20
  38. package/dist/types/index.d.ts +18 -15
  39. package/dist/types/labels.d.ts +8 -8
  40. package/dist/types/lib/errors.d.ts +4 -4
  41. package/dist/types/lib/files.d.ts +43 -31
  42. package/dist/types/lib/status.d.ts +8 -3
  43. package/dist/types/lib/subject.d.ts +3 -3
  44. package/dist/types/lib/url.d.ts +4 -4
  45. package/dist/types/lib/useDebouncedValue.d.ts +3 -3
  46. package/package.json +10 -10
@@ -1,13 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import type { SupportSuggestedArticle } from "../client.ts";
3
+ export interface SuggestedAnswersProps {
4
+ items: readonly SupportSuggestedArticle[];
5
+ }
1
6
  /**
2
7
  * Known answers shown under the subject of a new ticket. Plain text only: titles and summaries
3
8
  * come from the support team's notes and render as text, never as markup.
4
- *
5
- * @param {object} props
6
- * @param {{ title: string, summary: string }[]} props.items
7
9
  */
8
- export default function SuggestedAnswers({ items }: {
9
- items: {
10
- title: string;
11
- summary: string;
12
- }[];
13
- }): import("react").JSX.Element | null;
10
+ export default function SuggestedAnswers({ items }: SuggestedAnswersProps): ReactNode;
@@ -1,13 +1,11 @@
1
- /**
2
- * A ticket or message time: the product's renderTime when the provider has one, otherwise the built-in date and time.
3
- *
4
- * @param {object} props
5
- * @param {string} props.iso
6
- * @param {string} [props.className]
7
- * @param {boolean} [props.withZone=false] Append the zone's short name ("IST"), so the time reads with its zone. Ignored when renderTime is set.
8
- */
9
- export default function SupportTime({ iso, className, withZone }: {
1
+ import type { ReactNode } from "react";
2
+ export interface SupportTimeProps {
10
3
  iso: string;
11
4
  className?: string;
5
+ /** Append the zone's short name ("IST"), so the time reads with its zone. Ignored when renderTime is set. */
12
6
  withZone?: boolean;
13
- }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
7
+ }
8
+ /**
9
+ * A ticket or message time: the product's renderTime when the provider has one, otherwise the built-in date and time.
10
+ */
11
+ export default function SupportTime({ iso, className, withZone }: SupportTimeProps): ReactNode;
@@ -1,16 +1,15 @@
1
- /**
2
- * One ticket: its description, the replies with the reply box at their foot, the details, and what
3
- * the customer can do next.
4
- *
5
- * @param {object} props
6
- * @param {string} props.ticketId
7
- * @param {() => void} props.onBack Return to the ticket list.
8
- * @param {() => void} [props.onChanged] The ticket changed (reply, reopen, rating), so a list can refresh.
9
- * @param {(ticketId: string) => void} [props.onOpenTicket] Open another of the customer's tickets (the one this was merged into, or one merged into it).
10
- */
11
- export default function TicketDetail({ ticketId, onBack, onChanged, onOpenTicket }: {
1
+ import { type ReactNode } from "react";
2
+ export interface TicketDetailProps {
12
3
  ticketId: string;
4
+ /** Return to the ticket list. */
13
5
  onBack: () => void;
6
+ /** The ticket changed (reply, reopen, rating), so a list can refresh. */
14
7
  onChanged?: () => void;
8
+ /** Open another of the customer's tickets (the one this was merged into, or one merged into it). */
15
9
  onOpenTicket?: (ticketId: string) => void;
16
- }): import("react").JSX.Element;
10
+ }
11
+ /**
12
+ * One ticket: its description, the replies with the reply box at their foot, the details, and what
13
+ * the customer can do next.
14
+ */
15
+ export default function TicketDetail({ ticketId, onBack, onChanged, onOpenTicket }: TicketDetailProps): ReactNode;
@@ -1,44 +1,36 @@
1
+ import { type ReactNode } from "react";
2
+ import type { SupportConfig } from "../client.ts";
3
+ export interface TicketFormValues {
4
+ category: string;
5
+ subject: string;
6
+ body: string;
7
+ files: File[];
8
+ }
9
+ export interface TicketFormProps {
10
+ /** The form's id, for a submit button outside it. */
11
+ id: string;
12
+ /** The support config: categories, text limits and attachment limits. */
13
+ config: SupportConfig | null | undefined;
14
+ /** Preselected when the config lists it. */
15
+ defaultCategory?: string | undefined;
16
+ /**
17
+ * Values to start from, so a form that unmounts and mounts again (a dialog hidden for a page capture)
18
+ * keeps what was typed.
19
+ */
20
+ initialValues?: TicketFormValues | null;
21
+ /** Called with every change, and once on mount; pass a stable function. */
22
+ onValuesChange?: (values: TicketFormValues) => void;
23
+ /** Files that ride along from elsewhere (a page capture), counted against the limits. */
24
+ extraFiles?: File[];
25
+ /** Rejects with a SupportApiError on failure. */
26
+ onSubmit: (values: TicketFormValues) => Promise<unknown>;
27
+ onBusyChange?: (busy: boolean) => void;
28
+ /** Shown above the attachments, such as a capture preview. */
29
+ children?: ReactNode;
30
+ }
1
31
  /**
2
32
  * The fields of a new ticket: message, subject, category and attachments. The subject follows the
3
33
  * message until the person types in it. Validates against the support config before anything
4
34
  * uploads. The submit button lives outside (a modal footer), tied to this form by `id`.
5
- *
6
- * @param {object} props
7
- * @param {string} props.id The form's id, for a submit button outside it.
8
- * @param {any} props.config The support config: categories, text limits and attachment limits.
9
- * @param {string} [props.defaultCategory] Preselected when the config lists it.
10
- * @param {{ category: string, subject: string, body: string, files: File[] }} [props.initialValues] Values to start from,
11
- * so a form that unmounts and mounts again (a dialog hidden for a page capture) keeps what was typed.
12
- * @param {(values: { category: string, subject: string, body: string, files: File[] }) => void} [props.onValuesChange]
13
- * Called with every change, and once on mount; pass a stable function.
14
- * @param {Blob[]} [props.extraFiles] Files that ride along from elsewhere (a page capture), counted against the limits.
15
- * @param {(values: { category: string, subject: string, body: string, files: File[] }) => Promise<unknown>} props.onSubmit Rejects with a SupportApiError on failure.
16
- * @param {(busy: boolean) => void} [props.onBusyChange]
17
- * @param {import('react').ReactNode} [props.children] Shown above the attachments, such as a capture preview.
18
35
  */
19
- export default function TicketForm({ id, config, defaultCategory, initialValues, onValuesChange, extraFiles, onSubmit, onBusyChange, children, }: {
20
- id: string;
21
- config: any;
22
- defaultCategory?: string;
23
- initialValues?: {
24
- category: string;
25
- subject: string;
26
- body: string;
27
- files: File[];
28
- };
29
- onValuesChange?: (values: {
30
- category: string;
31
- subject: string;
32
- body: string;
33
- files: File[];
34
- }) => void;
35
- extraFiles?: Blob[];
36
- onSubmit: (values: {
37
- category: string;
38
- subject: string;
39
- body: string;
40
- files: File[];
41
- }) => Promise<unknown>;
42
- onBusyChange?: (busy: boolean) => void;
43
- children?: import('react').ReactNode;
44
- }): import("react").JSX.Element;
36
+ export default function TicketForm({ id, config, defaultCategory, initialValues, onValuesChange, extraFiles, onSubmit, onBusyChange, children, }: TicketFormProps): ReactNode;
@@ -1,31 +1,19 @@
1
- /**
2
- * One page of the customer's tickets with status tabs and a search box. Filtering, search and
3
- * paging all happen on the server; this only shows what it is given.
4
- *
5
- * @param {object} props
6
- * @param {any[]} props.tickets The current page.
7
- * @param {boolean} props.loading
8
- * @param {any} [props.error]
9
- * @param {() => void} props.onRetry
10
- * @param {(id: string) => void} props.onOpen
11
- * @param {string} props.status A status tab key.
12
- * @param {(status: string) => void} props.onStatusChange
13
- * @param {"tabs"|"select"|"none"} [props.statusFilter="tabs"] Tabs, a Status select, or no control.
14
- * @param {import('../client.js').TicketCounts|null} [props.counts] Labels the tabs and the select once loaded.
15
- * @param {string} props.search What is in the search box.
16
- * @param {(search: string) => void} props.onSearchChange
17
- * @param {{ page: number, totalPages: number, pageSize: number, total: number, setPage: (page: number) => void, setPageSize: (size: number) => void }} props.pagination
18
- */
19
- export default function TicketList({ tickets, loading, error, onRetry, onOpen, status, onStatusChange, statusFilter, counts, search, onSearchChange, pagination, }: {
20
- tickets: any[];
1
+ import { type ReactElement } from "react";
2
+ import type { SupportCustomerStatus, SupportTicketSummary, TicketCounts } from "../client.ts";
3
+ /** One row of the customer's ticket list, as the server's list endpoint sends it. */
4
+ export type TicketRow = SupportTicketSummary;
5
+ /** The status the list is filtered to: one of the customer's statuses, or "all". */
6
+ export type TicketStatusFilter = "all" | SupportCustomerStatus;
7
+ export interface TicketListProps {
8
+ tickets: readonly TicketRow[];
21
9
  loading: boolean;
22
- error?: any;
10
+ error?: unknown;
23
11
  onRetry: () => void;
24
12
  onOpen: (id: string) => void;
25
- status: string;
26
- onStatusChange: (status: string) => void;
13
+ status: TicketStatusFilter;
14
+ onStatusChange: (status: TicketStatusFilter) => void;
27
15
  statusFilter?: "tabs" | "select" | "none";
28
- counts?: import('../client.js').TicketCounts | null;
16
+ counts?: TicketCounts | null;
29
17
  search: string;
30
18
  onSearchChange: (search: string) => void;
31
19
  pagination: {
@@ -36,4 +24,22 @@ export default function TicketList({ tickets, loading, error, onRetry, onOpen, s
36
24
  setPage: (page: number) => void;
37
25
  setPageSize: (size: number) => void;
38
26
  };
39
- }): import("react").JSX.Element;
27
+ }
28
+ /**
29
+ * One page of the customer's tickets with status tabs and a search box. Filtering, search and
30
+ * paging all happen on the server; this only shows what it is given.
31
+ *
32
+ * @param props.tickets The current page.
33
+ * @param props.loading
34
+ * @param props.error
35
+ * @param props.onRetry
36
+ * @param props.onOpen
37
+ * @param props.status A status tab key.
38
+ * @param props.onStatusChange
39
+ * @param props.statusFilter Tabs, a Status select, or no control.
40
+ * @param props.counts Labels the tabs and the select once loaded.
41
+ * @param props.search What is in the search box.
42
+ * @param props.onSearchChange
43
+ * @param props.pagination
44
+ */
45
+ export default function TicketList({ tickets, loading, error, onRetry, onOpen, status, onStatusChange, statusFilter, counts, search, onSearchChange, pagination, }: TicketListProps): ReactElement;
@@ -1,94 +1,75 @@
1
- /** @type {import('react').Context<{ client: import('./client.js').SupportClient, loadConfig: (fresh?: boolean) => Promise<any>, timeZone: string, renderTime?: (iso: string) => import('react').ReactNode, statusTones?: Record<string, string>, labels?: Record<string, Record<string, string>> } | null>} */
2
- export declare const SupportContext: import('react').Context<{
3
- client: import('./client.js').SupportClient;
4
- loadConfig: (fresh?: boolean) => Promise<any>;
1
+ import { type ReactNode } from "react";
2
+ import { type RatingInput, type ReplyInput, type SupportClient, type SupportConfig, type SupportTicket, type SupportTicketSummary, type TicketCounts, type TicketListQuery } from "./client.ts";
3
+ export interface SupportContextValue {
4
+ client: SupportClient;
5
+ loadConfig: (fresh?: boolean) => Promise<SupportConfig>;
5
6
  timeZone: string;
6
- renderTime?: (iso: string) => import('react').ReactNode;
7
- statusTones?: Record<string, string>;
8
- labels?: Record<string, Record<string, string>>;
9
- } | null>;
7
+ renderTime?: ((iso: string) => ReactNode) | undefined;
8
+ statusTones?: Record<string, string> | undefined;
9
+ labels?: Record<string, Record<string, string>> | undefined;
10
+ }
11
+ export declare const SupportContext: import("react").Context<SupportContextValue | null>;
10
12
  /**
11
13
  * The support client the nearest SupportProvider holds.
12
- *
13
- * @returns {import('./client.js').SupportClient}
14
14
  */
15
- export declare function useSupportClient(): import('./client.js').SupportClient;
15
+ export declare function useSupportClient(): SupportClient;
16
16
  /**
17
17
  * The IANA time zone the nearest SupportProvider shows times in.
18
- *
19
- * @returns {string}
20
18
  */
21
19
  export declare function useSupportTimeZone(): string;
22
20
  /**
23
21
  * The product's own time renderer the nearest SupportProvider holds, or null for the built-in one.
24
- *
25
- * @returns {((iso: string) => import('react').ReactNode)|null}
26
22
  */
27
- export declare function useSupportRenderTime(): ((iso: string) => import('react').ReactNode) | null;
23
+ export declare function useSupportRenderTime(): ((iso: string) => ReactNode) | null;
28
24
  /**
29
25
  * The tone of a ticket status's pill: the nearest SupportProvider's statusTones over the built-in tones.
30
- *
31
- * @returns {(status: string) => string}
32
26
  */
33
27
  export declare function useSupportStatusTone(): (status: string) => string;
34
- export declare function useSupportLabels(scope: any, defaults: any): any;
28
+ export declare function useSupportLabels<T extends Record<string, string>>(scope: string, defaults: T): T;
35
29
  /**
36
30
  * What the customer may send and how to reach support. Loaded once per provider and shared.
37
- *
38
- * @returns {{ config: any, loading: boolean, error: any, reload: () => void }}
39
31
  */
40
32
  export declare function useSupportConfig(): {
41
- config: any;
33
+ config: SupportConfig | null;
42
34
  loading: boolean;
43
- error: any;
35
+ error: unknown;
44
36
  reload: () => void;
45
37
  };
46
38
  /**
47
39
  * One page of the signed-in customer's tickets, filtered and searched on the server. Loads again
48
40
  * whenever any part of the query changes; an answer for a query that has since moved on is dropped.
49
- *
50
- * @param {import('./client.js').TicketListQuery} [query]
51
- * @returns {{ tickets: any[], totalCount: number, totalPages: number, loading: boolean, error: any, reload: () => void }}
52
41
  */
53
- export declare function useSupportTickets(query?: import('./client.js').TicketListQuery): {
54
- tickets: any[];
42
+ export declare function useSupportTickets(query?: TicketListQuery): {
43
+ tickets: readonly SupportTicketSummary[];
55
44
  totalCount: number;
56
45
  totalPages: number;
57
46
  loading: boolean;
58
- error: any;
47
+ error: unknown;
59
48
  reload: () => void;
60
49
  };
61
50
  /**
62
51
  * How many of the signed-in customer's tickets are in each status, for labelling status tabs.
63
- *
64
- * @returns {{ counts: import('./client.js').TicketCounts|null, loading: boolean, error: any, reload: () => void }}
65
52
  */
66
53
  export declare function useSupportTicketCounts(): {
67
- counts: import('./client.js').TicketCounts | null;
54
+ counts: TicketCounts | null;
68
55
  loading: boolean;
69
- error: any;
56
+ error: unknown;
70
57
  reload: () => void;
71
58
  };
59
+ export interface SupportTicketActions {
60
+ ticket: SupportTicket | null;
61
+ loading: boolean;
62
+ error: unknown;
63
+ reload: () => void;
64
+ reply: (input: ReplyInput) => Promise<SupportTicket>;
65
+ reopen: () => Promise<SupportTicket>;
66
+ cancel: () => Promise<SupportTicket>;
67
+ rate: (input: RatingInput) => Promise<SupportTicket>;
68
+ }
72
69
  /**
73
70
  * One ticket with its thread, plus the actions a customer can take on it. Each action returns
74
71
  * the updated ticket and replaces the one held here.
75
72
  *
76
- * @param {string|null|undefined} id The ticket's id; nothing loads while it is empty.
77
- * @returns {{
78
- * ticket: any, loading: boolean, error: any, reload: () => void,
79
- * reply: (input: import('./client.js').ReplyInput) => Promise<any>,
80
- * reopen: () => Promise<any>,
81
- * cancel: () => Promise<any>,
82
- * rate: (input: import('./client.js').RatingInput) => Promise<any>
83
- * }}
73
+ * @param id The ticket's id; nothing loads while it is empty.
84
74
  */
85
- export declare function useSupportTicket(id: string | null | undefined): {
86
- ticket: any;
87
- loading: boolean;
88
- error: any;
89
- reload: () => void;
90
- reply: (input: import('./client.js').ReplyInput) => Promise<any>;
91
- reopen: () => Promise<any>;
92
- cancel: () => Promise<any>;
93
- rate: (input: import('./client.js').RatingInput) => Promise<any>;
94
- };
75
+ export declare function useSupportTicket(id: string | null | undefined): SupportTicketActions;
@@ -1,16 +1,18 @@
1
+ import type { ReactElement } from "react";
2
+ import type { HelpCentreClient } from "./client.ts";
3
+ export interface HelpArticleProps {
4
+ client: HelpCentreClient;
5
+ slug: string;
6
+ onBack?: () => void;
7
+ }
1
8
  /**
2
9
  * One published help article: its title, its dates and its Markdown body, with a back action when
3
10
  * `onBack` is given. The body renders as Markdown only; HTML in it shows as text. The Published line
4
11
  * is left out when the article has no publish date.
5
12
  * Needs a SupportProvider above it for its labels and times.
6
13
  *
7
- * @param {object} props
8
- * @param {import('./client.js').HelpCentreClient} props.client
9
- * @param {string} props.slug
10
- * @param {() => void} [props.onBack]
14
+ * @param props.client
15
+ * @param props.slug
16
+ * @param props.onBack
11
17
  */
12
- export default function HelpArticle({ client, slug, onBack }: {
13
- client: import('./client.js').HelpCentreClient;
14
- slug: string;
15
- onBack?: () => void;
16
- }): import("react").JSX.Element;
18
+ export default function HelpArticle({ client, slug, onBack }: HelpArticleProps): ReactElement;
@@ -1,34 +1,2 @@
1
- export declare const meta: {
2
- readonly name: "HelpArticle";
3
- readonly marker: null;
4
- readonly platforms: readonly ["web"];
5
- readonly acceptsChildren: false;
6
- readonly props: {
7
- readonly client: {
8
- readonly type: "object";
9
- readonly required: true;
10
- readonly description: "The help centre client from createHelpCentreClient, bound to the product's API prefix.";
11
- };
12
- readonly slug: {
13
- readonly type: "string";
14
- readonly required: true;
15
- readonly description: "The article's slug, as the help centre list gives it.";
16
- };
17
- readonly onBack: {
18
- readonly type: "any";
19
- readonly description: "Called by the back action. Left out, the article has no back action.";
20
- };
21
- };
22
- readonly omit: readonly [];
23
- readonly examples: readonly [];
24
- readonly usage: {
25
- readonly when: readonly ["A customer has opened one help article and needs to read it."];
26
- readonly whenNot: readonly [{
27
- readonly text: "The customer needs to contact support about their own account.";
28
- readonly instead: "SupportCenter";
29
- }];
30
- readonly do: readonly [];
31
- readonly dont: readonly [];
32
- readonly a11y: readonly ["The article title is a heading, and its dates are read as times.", "A missing article shows a message instead of an empty page."];
33
- };
34
- };
1
+ import { type ComponentMeta } from "@webority/canvas-kit/meta";
2
+ export declare const meta: ComponentMeta;
@@ -1,16 +1,18 @@
1
+ import { type ReactElement } from "react";
2
+ import type { HelpCentreClient } from "./client.ts";
3
+ export interface HelpCentreProps {
4
+ client: HelpCentreClient;
5
+ onOpen?: (slug: string) => void;
6
+ linkTo?: (slug: string) => string;
7
+ }
1
8
  /**
2
9
  * The public help centre: the published articles, one page at a time, and a search box when the
3
10
  * server offers search. A row opens its article through `onOpen(slug)`, or through the href `linkTo(slug)`
4
11
  * gives for a router link (a modified click then keeps the link's own new-tab behaviour).
5
12
  * Needs a SupportProvider above it for its labels and times.
6
13
  *
7
- * @param {object} props
8
- * @param {import('./client.js').HelpCentreClient} props.client
9
- * @param {(slug: string) => void} [props.onOpen]
10
- * @param {(slug: string) => string} [props.linkTo]
14
+ * @param props.client
15
+ * @param props.onOpen
16
+ * @param props.linkTo
11
17
  */
12
- export default function HelpCentre({ client, onOpen, linkTo }: {
13
- client: import('./client.js').HelpCentreClient;
14
- onOpen?: (slug: string) => void;
15
- linkTo?: (slug: string) => string;
16
- }): import("react").JSX.Element;
18
+ export default function HelpCentre({ client, onOpen, linkTo }: HelpCentreProps): ReactElement;
@@ -1,33 +1,2 @@
1
- export declare const meta: {
2
- readonly name: "HelpCentre";
3
- readonly marker: null;
4
- readonly platforms: readonly ["web"];
5
- readonly acceptsChildren: false;
6
- readonly props: {
7
- readonly client: {
8
- readonly type: "object";
9
- readonly required: true;
10
- readonly description: "The help centre client from createHelpCentreClient, bound to the product's API prefix.";
11
- };
12
- readonly onOpen: {
13
- readonly type: "any";
14
- readonly description: "Called with an article's slug when a row opens it in place. Left out, the row is a plain button.";
15
- };
16
- readonly linkTo: {
17
- readonly type: "any";
18
- readonly description: "Called with an article's slug and returns the href of its page, for a router link that keeps new-tab clicks.";
19
- };
20
- };
21
- readonly omit: readonly [];
22
- readonly examples: readonly [];
23
- readonly usage: {
24
- readonly when: readonly ["A customer or visitor needs answers from the support team's published help articles.", "The product offers search over those articles and the customer wants to find one by words."];
25
- readonly whenNot: readonly [{
26
- readonly text: "The customer needs to raise or follow their own ticket.";
27
- readonly instead: "SupportCenter";
28
- }];
29
- readonly do: readonly [];
30
- readonly dont: readonly [];
31
- readonly a11y: readonly ["The page is a section labelled by its Help centre heading.", "The search box is labelled and appears only when the server offers search.", "Each article is a button or a link named by its title."];
32
- };
33
- };
1
+ import { type ComponentMeta } from "@webority/canvas-kit/meta";
2
+ export declare const meta: ComponentMeta;
@@ -1,37 +1,40 @@
1
- export type HelpCentreHttp = {
1
+ /**
2
+ * An axios-like HTTP client.
3
+ */
4
+ export interface HelpCentreHttp {
2
5
  get: (url: string, config?: object) => Promise<{
3
- data: any;
6
+ data: unknown;
4
7
  }>;
5
- };
6
- export type HelpArticleSummary = {
8
+ }
9
+ /** One published article in a list or a search. C# record Webority.Support.SupportArticleSummary. */
10
+ export interface HelpArticleSummary {
7
11
  id: string;
8
12
  slug: string;
9
13
  title: string;
10
14
  summary: string;
11
15
  publishedDateTimeUtc: string | null;
12
16
  updatedDateTimeUtc: string;
13
- };
17
+ }
18
+ /** One published article with its Markdown body. C# record Webority.Support.SupportArticleView. */
14
19
  export type HelpArticle = HelpArticleSummary & {
15
20
  bodyMarkdown: string;
16
21
  };
17
- export type HelpArticlePage = {
18
- items: HelpArticleSummary[];
22
+ /** One page of published articles. C# record Webority.Support.SupportPage of SupportArticleSummary. */
23
+ export interface HelpArticlePage {
24
+ items: readonly HelpArticleSummary[];
19
25
  page: number;
20
26
  pageSize: number;
21
27
  totalCount: number;
22
28
  totalPages: number;
23
- };
24
- export type HelpCentreSettings = {
25
- /**
26
- * The help centre's home page.
27
- */
29
+ }
30
+ /** C# record Webority.Support.SupportHelpCentreSettingsView. */
31
+ export interface HelpCentreSettings {
32
+ /** The help centre's home page. */
28
33
  publicUrl: string;
29
- /**
30
- * False when the server has no search; search is then never asked.
31
- */
34
+ /** False when the server has no search; search is then never asked. */
32
35
  searchAvailable: boolean;
33
- };
34
- export type HelpCentreClient = {
36
+ }
37
+ export interface HelpCentreClient {
35
38
  settings: (options?: {
36
39
  signal?: AbortSignal;
37
40
  }) => Promise<HelpCentreSettings>;
@@ -46,51 +49,14 @@ export type HelpCentreClient = {
46
49
  }) => Promise<HelpArticle>;
47
50
  search: (q: string, options?: {
48
51
  signal?: AbortSignal;
49
- }) => Promise<HelpArticleSummary[]>;
50
- };
51
- /**
52
- * @typedef {object} HelpCentreHttp An axios-like HTTP client.
53
- * @property {(url: string, config?: object) => Promise<{ data: any }>} get
54
- */
55
- /**
56
- * @typedef {object} HelpArticleSummary
57
- * @property {string} id
58
- * @property {string} slug
59
- * @property {string} title
60
- * @property {string} summary
61
- * @property {string|null} publishedDateTimeUtc
62
- * @property {string} updatedDateTimeUtc
63
- */
64
- /**
65
- * @typedef {HelpArticleSummary & { bodyMarkdown: string }} HelpArticle
66
- */
67
- /**
68
- * @typedef {object} HelpArticlePage
69
- * @property {HelpArticleSummary[]} items
70
- * @property {number} page
71
- * @property {number} pageSize
72
- * @property {number} totalCount
73
- * @property {number} totalPages
74
- */
75
- /**
76
- * @typedef {object} HelpCentreSettings
77
- * @property {string} publicUrl The help centre's home page.
78
- * @property {boolean} searchAvailable False when the server has no search; search is then never asked.
79
- */
80
- /**
81
- * @typedef {object} HelpCentreClient
82
- * @property {(options?: { signal?: AbortSignal }) => Promise<HelpCentreSettings>} settings
83
- * @property {(query?: { page?: number, pageSize?: number }, options?: { signal?: AbortSignal }) => Promise<HelpArticlePage>} list
84
- * @property {(slug: string, options?: { signal?: AbortSignal }) => Promise<HelpArticle>} get
85
- * @property {(q: string, options?: { signal?: AbortSignal }) => Promise<HelpArticleSummary[]>} search
86
- */
52
+ }) => Promise<readonly HelpArticleSummary[]>;
53
+ }
87
54
  /**
88
55
  * Binds the help-centre HTTP contract under a prefix the host chooses.
89
56
  *
90
- * @param {object} options
91
- * @param {string} options.baseUrl The prefix the API maps the help-centre endpoints under, such as "/api/help".
92
- * @param {HelpCentreHttp} options.http
93
- * @returns {HelpCentreClient}
57
+ * @param options
58
+ * @param options.baseUrl The prefix the API maps the help-centre endpoints under, such as "/api/help".
59
+ * @param options.http
94
60
  */
95
61
  export declare function createHelpCentreClient({ baseUrl, http }: {
96
62
  baseUrl: string;
@@ -1,23 +1,23 @@
1
1
  export declare const HELP_CENTRE_LABELS: {
2
- heading: string;
3
- searchPlaceholder: string;
4
- searchLabel: string;
5
- tableLabel: string;
6
- columnArticle: string;
7
- columnUpdated: string;
8
- listError: string;
9
- settingsError: string;
10
- retry: string;
11
- emptyTitle: string;
12
- emptyText: string;
13
- noMatchTitle: string;
14
- noMatchText: string;
2
+ readonly heading: "Help centre";
3
+ readonly searchPlaceholder: "Search help articles";
4
+ readonly searchLabel: "Search help articles";
5
+ readonly tableLabel: "Help articles";
6
+ readonly columnArticle: "Article";
7
+ readonly columnUpdated: "Last updated";
8
+ readonly listError: "We could not load the help articles.";
9
+ readonly settingsError: "We could not load the help centre.";
10
+ readonly retry: "Try again";
11
+ readonly emptyTitle: "No articles yet";
12
+ readonly emptyText: "Help articles from the support team show here.";
13
+ readonly noMatchTitle: "No articles match";
14
+ readonly noMatchText: "Try other words.";
15
15
  };
16
16
  export declare const HELP_ARTICLE_LABELS: {
17
- back: string;
18
- published: string;
19
- updated: string;
20
- loadError: string;
21
- notFoundTitle: string;
22
- retry: string;
17
+ readonly back: "Back to help";
18
+ readonly published: "Published {date}";
19
+ readonly updated: "Updated {date}";
20
+ readonly loadError: "We could not load this article.";
21
+ readonly notFoundTitle: "This article could not be found.";
22
+ readonly retry: "Try again";
23
23
  };