@webority/support-react 0.149.0 → 0.150.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 +213 -83
  16. package/dist/types/agent/context.d.ts +36 -65
  17. package/dist/types/agent/labels.d.ts +80 -79
  18. package/dist/types/client.d.ts +242 -167
  19. package/dist/types/components/AttachmentField.d.ts +5 -11
  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 +12 -16
  23. package/dist/types/components/RatingPanel.d.ts +13 -14
  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 +30 -49
  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 +9 -8
@@ -1,35 +1,23 @@
1
+ import type { HelpArticleSummary, HelpCentreClient, HelpCentreSettings } from "./client.ts";
1
2
  /**
2
3
  * The help centre's settings, its article list and its search, for one client. Search is asked only
3
4
  * when the settings say the server offers it and the words are at least two characters long.
4
- *
5
- * @param {import('./client.js').HelpCentreClient} client
6
- * @returns {{
7
- * settings: { data: import('./client.js').HelpCentreSettings|null, loading: boolean, error: any, reload: () => void },
8
- * articles: {
9
- * items: import('./client.js').HelpArticleSummary[], page: number, pageSize: number, totalCount: number, totalPages: number,
10
- * loading: boolean, error: any, setPage: (page: number) => void, setPageSize: (size: number) => void, reload: () => void
11
- * },
12
- * search: {
13
- * enabled: boolean, query: string, setQuery: (query: string) => void, active: boolean,
14
- * results: import('./client.js').HelpArticleSummary[], loading: boolean, error: any, reload: () => void
15
- * }
16
- * }}
17
5
  */
18
- export declare function useHelpCentre(client: import('./client.js').HelpCentreClient): {
6
+ export declare function useHelpCentre(client: HelpCentreClient): {
19
7
  settings: {
20
- data: import('./client.js').HelpCentreSettings | null;
8
+ data: HelpCentreSettings | null;
21
9
  loading: boolean;
22
- error: any;
10
+ error: unknown;
23
11
  reload: () => void;
24
12
  };
25
13
  articles: {
26
- items: import('./client.js').HelpArticleSummary[];
14
+ items: readonly HelpArticleSummary[];
27
15
  page: number;
28
16
  pageSize: number;
29
17
  totalCount: number;
30
18
  totalPages: number;
31
19
  loading: boolean;
32
- error: any;
20
+ error: unknown;
33
21
  setPage: (page: number) => void;
34
22
  setPageSize: (size: number) => void;
35
23
  reload: () => void;
@@ -39,9 +27,9 @@ export declare function useHelpCentre(client: import('./client.js').HelpCentreCl
39
27
  query: string;
40
28
  setQuery: (query: string) => void;
41
29
  active: boolean;
42
- results: import('./client.js').HelpArticleSummary[];
30
+ results: readonly HelpArticleSummary[];
43
31
  loading: boolean;
44
- error: any;
32
+ error: unknown;
45
33
  reload: () => void;
46
34
  };
47
35
  };
@@ -1,15 +1,18 @@
1
- export { createSupportAgentClient } from "./agent/client.js";
2
- export { useSupportAgentClient, useSupportAgentLabels, useSupportAgentRenderTime, useSupportAgentSettings, useSupportAgents, useSupportAgentTicket, useSupportAgentTimeZone, useSupportQueue, useSupportQueueCounts, } from "./agent/context.js";
3
- export { default as SupportAgentProvider } from "./agent/SupportAgentProvider.jsx";
4
- export { default as SupportAgentTicket } from "./agent/SupportAgentTicket.jsx";
5
- export { default as SupportQueue } from "./agent/SupportQueue.jsx";
6
- export { createSupportClient, SupportApiError } from "./client.js";
7
- export { useSupportClient, useSupportConfig, useSupportTicket, useSupportTicketCounts, useSupportTickets } from "./context.js";
8
- export { createHelpCentreClient } from "./helpCentre/client.js";
9
- export { default as HelpArticle } from "./helpCentre/HelpArticle.jsx";
10
- export { default as HelpCentre } from "./helpCentre/HelpCentre.jsx";
11
- export { useHelpCentre } from "./helpCentre/useHelpCentre.js";
12
- export { default as ReportIssue } from "./ReportIssue.jsx";
13
- export { default as SupportCenter } from "./SupportCenter.jsx";
14
- export { default as SupportContact } from "./SupportContact.jsx";
15
- export { default as SupportProvider } from "./SupportProvider.jsx";
1
+ export type { AgentAssignment, AgentAttachment, AgentAttachmentKind, AgentCategoryChange, AgentFieldSource, AgentLabelledValue, AgentMessage, AgentMessageAuthorKind, AgentMessageChannel, AgentPage, AgentPriorityChange, AgentQueueCounts, AgentQueueView, AgentReplyInput, AgentSatisfaction, AgentSavedReply, AgentScreenRecommendation, AgentSettings, AgentStatusChange, AgentTicket, AgentTicketLink, AgentTicketListQuery, AgentTicketPage, AgentTicketPriority, AgentTicketQueueItem, AgentTicketStatus, AgentUser, SupportAgentClient, } from "./agent/client.ts";
2
+ export { createSupportAgentClient } from "./agent/client.ts";
3
+ export { useSupportAgentClient, useSupportAgentLabels, useSupportAgentRenderTime, useSupportAgentSettings, useSupportAgentStatusTone, useSupportAgents, useSupportAgentTicket, useSupportAgentTimeZone, useSupportQueue, useSupportQueueCounts, } from "./agent/context.ts";
4
+ export { default as SupportAgentProvider } from "./agent/SupportAgentProvider.tsx";
5
+ export { default as SupportAgentTicket } from "./agent/SupportAgentTicket.tsx";
6
+ export { default as SupportQueue } from "./agent/SupportQueue.tsx";
7
+ export type { NewTicketInput, RatingInput, ReplyInput, SupportAttachment, SupportAttachmentKind, SupportClient, SupportConfig, SupportContactQueue, SupportCustomerStatus, SupportFieldSource, SupportHttp, SupportMessage, SupportMessageAuthorKind, SupportMessageChannel, SupportSatisfaction, SupportScreenRecommendation, SupportSuggestedArticle, SupportTicket, SupportTicketLink, SupportTicketPriority, SupportTicketSummary, TicketCounts, TicketListQuery, TicketPage, TicketStatus, } from "./client.ts";
8
+ export { createSupportClient, SupportApiError } from "./client.ts";
9
+ export { useSupportClient, useSupportConfig, useSupportTicket, useSupportTicketCounts, useSupportTickets } from "./context.ts";
10
+ export type { HelpArticle as HelpArticleContent, HelpArticlePage, HelpArticleSummary, HelpCentreClient, HelpCentreHttp, HelpCentreSettings, } from "./helpCentre/client.ts";
11
+ export { createHelpCentreClient } from "./helpCentre/client.ts";
12
+ export { default as HelpArticle, type HelpArticleProps } from "./helpCentre/HelpArticle.tsx";
13
+ export { default as HelpCentre, type HelpCentreProps } from "./helpCentre/HelpCentre.tsx";
14
+ export { useHelpCentre } from "./helpCentre/useHelpCentre.ts";
15
+ export { default as ReportIssue, type ReportIssueProps } from "./ReportIssue.tsx";
16
+ export { default as SupportCenter, type SupportCenterProps, type SupportCenterStatus } from "./SupportCenter.tsx";
17
+ export { default as SupportContact, type SupportContactProps } from "./SupportContact.tsx";
18
+ export { default as SupportProvider, type SupportProviderProps } from "./SupportProvider.tsx";
@@ -1,11 +1,11 @@
1
- export declare function fillLabel(template: any, values: any): string;
1
+ export declare function fillLabel(template: string, values: Record<string, unknown>): string;
2
2
  /** Strings several support components share. Scope name: shared. */
3
3
  export declare const SHARED_LABELS: {
4
- offline: string;
5
- attachOne: string;
6
- attachMany: string;
7
- typeNotAccepted: string;
8
- tooLarge: string;
9
- thisFile: string;
10
- alreadyAttached: string;
4
+ readonly offline: "We could not reach support. Check your connection and try again.";
5
+ readonly attachOne: "You can attach one file.";
6
+ readonly attachMany: "You can attach up to {count} files.";
7
+ readonly typeNotAccepted: "{name} is a file type we cannot accept.";
8
+ readonly tooLarge: "{name} is larger than {size}.";
9
+ readonly thisFile: "This file";
10
+ readonly alreadyAttached: "{name} is already attached.";
11
11
  };
@@ -3,9 +3,9 @@
3
3
  * the server sent a real code; no response gets the offline sentence; anything else (a code
4
4
  * the client could not read, or an error thrown in the page) gets the screen's own fallback.
5
5
  *
6
- * @param {unknown} err
7
- * @param {string} fallback
8
- * @param {string} [offline] The sentence for a network failure.
9
- * @returns {string}
6
+ * @param err
7
+ * @param fallback
8
+ * @param offline The sentence for a network failure.
9
+ * @returns
10
10
  */
11
11
  export declare function supportErrorText(err: unknown, fallback: string, offline?: string): string;
@@ -1,35 +1,50 @@
1
- import { SHARED_LABELS } from "../labels.js";
1
+ import { SHARED_LABELS } from "../labels.ts";
2
+ interface AttachmentConfig {
3
+ maxAttachmentBytes?: number;
4
+ maxAttachmentsPerMessage?: number;
5
+ allowedContentTypes?: readonly string[];
6
+ }
7
+ interface PasteItem {
8
+ kind: string;
9
+ type: string;
10
+ getAsFile(): File | null;
11
+ }
12
+ interface PasteData {
13
+ items: Iterable<PasteItem> | ArrayLike<PasteItem>;
14
+ }
2
15
  /**
3
16
  * The `accept` attribute for a file input, from the config's allowed content types. An empty
4
17
  * list means any type, so this returns "" rather than undefined: undefined would let the field
5
18
  * fall back to its own images-only default.
6
19
  *
7
- * @param {{ allowedContentTypes?: string[] }|null|undefined} config
8
- * @returns {string}
20
+ * @param config
21
+ * @returns
22
+ */
23
+ export declare function acceptOf(config: AttachmentConfig | null | undefined): string;
24
+ /**
25
+ * The Files a multiple file field reports. Its value is always a list of Files here, so anything
26
+ * else is a wiring error and throws rather than being dropped.
27
+ *
28
+ * @param value
29
+ * @returns
9
30
  */
10
- export declare function acceptOf(config: {
11
- allowedContentTypes?: string[];
12
- } | null | undefined): string;
31
+ export declare function filesOf(value: unknown): File[];
13
32
  /**
14
33
  * Checks files against the config before anything uploads. Returns the first problem as a
15
34
  * sentence for the person, or null when every file can go.
16
35
  *
17
- * @param {Blob[]} files Every file on the message, screenshots included.
18
- * @param {{ maxAttachmentBytes?: number, maxAttachmentsPerMessage?: number, allowedContentTypes?: string[] }|null|undefined} config
19
- * @param {typeof SHARED_LABELS} [labels]
20
- * @returns {string|null}
36
+ * @param files Every file on the message, screenshots included.
37
+ * @param config
38
+ * @param labels
39
+ * @returns
21
40
  */
22
- export declare function validateAttachments(files: Blob[], config: {
23
- maxAttachmentBytes?: number;
24
- maxAttachmentsPerMessage?: number;
25
- allowedContentTypes?: string[];
26
- } | null | undefined, labels?: typeof SHARED_LABELS): string | null;
41
+ export declare function validateAttachments(files: File[] | null | undefined, config: AttachmentConfig | null | undefined, labels?: typeof SHARED_LABELS): string | null;
27
42
  /**
28
43
  * The same file picked twice has the same name, size and modified time. A pasted image is a new
29
44
  * File each time, so pasting twice keeps both.
30
45
  *
31
- * @param {Blob & { name: string, lastModified?: number }} f
32
- * @returns {string}
46
+ * @param f
47
+ * @returns
33
48
  */
34
49
  export declare function fileIdOf(f: Blob & {
35
50
  name: string;
@@ -40,26 +55,23 @@ export declare function fileIdOf(f: Blob & {
40
55
  * pick, is skipped; the picks past the limit are left out. Returns the files to keep and the one
41
56
  * sentence to show about what was skipped or what is wrong, or "" when nothing is.
42
57
  *
43
- * @param {File[]} current
44
- * @param {File[]} picked
45
- * @param {{ maxAttachmentBytes?: number, maxAttachmentsPerMessage?: number, allowedContentTypes?: string[] }|null|undefined} config
46
- * @param {typeof SHARED_LABELS} [labels]
47
- * @returns {{ files: File[], notice: string }}
58
+ * @param current
59
+ * @param picked
60
+ * @param config
61
+ * @param labels
62
+ * @returns
48
63
  */
49
- export declare function mergeAttachments(current: File[], picked: File[], config: {
50
- maxAttachmentBytes?: number;
51
- maxAttachmentsPerMessage?: number;
52
- allowedContentTypes?: string[];
53
- } | null | undefined, labels?: typeof SHARED_LABELS): {
64
+ export declare function mergeAttachments(current: File[], picked: File[], config: AttachmentConfig | null | undefined, labels?: typeof SHARED_LABELS): {
54
65
  files: File[];
55
66
  notice: string;
56
67
  };
57
68
  /**
58
69
  * Image files from a paste event, named so they read well on the ticket.
59
70
  *
60
- * @param {ClipboardEvent|{ clipboardData?: DataTransfer|null }} event
61
- * @returns {File[]}
71
+ * @param event
72
+ * @returns
62
73
  */
63
- export declare function imagesFromPaste(event: ClipboardEvent | {
64
- clipboardData?: DataTransfer | null;
74
+ export declare function imagesFromPaste(event: {
75
+ clipboardData?: PasteData | null;
65
76
  }): File[];
77
+ export {};
@@ -1,6 +1,11 @@
1
1
  /**
2
- * @param {string} status The ticket's status as the API sends it.
3
- * @param {Record<string, string>} [overrides] Tone per status that replaces the built-in tone for that status.
4
- * @returns {string}
2
+ * @param status The ticket's status as the API sends it.
3
+ * @param overrides Tone per status that replaces the built-in tone for that status.
4
+ * @returns
5
5
  */
6
6
  export declare function statusTone(status: string, overrides?: Record<string, string>): string;
7
+ /**
8
+ * @param priority The ticket's priority as the API sends it.
9
+ * @returns
10
+ */
11
+ export declare function priorityTone(priority: string): string;
@@ -4,8 +4,8 @@
4
4
  * has no space, and the cut end loses trailing spaces and the characters `,;:.-`. The limit is the
5
5
  * smaller of `maxLength` and 80.
6
6
  *
7
- * @param {string} message
8
- * @param {number} maxLength
9
- * @returns {string} The subject, or "" when the message has no text.
7
+ * @param message
8
+ * @param maxLength
9
+ * @returns The subject, or "" when the message has no text.
10
10
  */
11
11
  export declare function subjectFromMessage(message: string, maxLength: number): string;
@@ -1,20 +1,20 @@
1
1
  /** The query parameter a support email links with to open one ticket. */
2
2
  export declare const TICKET_PARAM = "ticket";
3
3
  /**
4
- * @returns {string|null} The ticket id in the current address, if any.
4
+ * @returns The ticket id in the current address, if any.
5
5
  */
6
6
  export declare function ticketFromLocation(): string | null;
7
7
  /**
8
8
  * The current page's address with the ticket parameter set, or removed when `id` is empty.
9
9
  *
10
- * @param {string|null|undefined} id
11
- * @returns {string}
10
+ * @param id
11
+ * @returns
12
12
  */
13
13
  export declare function ticketHref(id: string | null | undefined): string;
14
14
  /**
15
15
  * Records the open ticket in the address without a navigation, keeping the router's own history
16
16
  * state, so a refresh or a shared link lands on the same ticket.
17
17
  *
18
- * @param {string|null|undefined} id
18
+ * @param id
19
19
  */
20
20
  export declare function replaceTicketInLocation(id: string | null | undefined): void;
@@ -3,8 +3,8 @@
3
3
  * per pause in typing instead of once per key.
4
4
  *
5
5
  * @template T
6
- * @param {T} value
7
- * @param {number} delayMs
8
- * @returns {T}
6
+ * @param value
7
+ * @param delayMs
8
+ * @returns
9
9
  */
10
10
  export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/support-react",
3
- "version": "0.149.0",
3
+ "version": "0.150.0",
4
4
  "description": "Webority customer support for React portals: ticket centre, help centre with articles and search, report-an-issue with an optional page screenshot, and support contact details, built on @webority/ui-react.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "sideEffects": false,
29
29
  "peerDependencies": {
30
- "@webority/ui-elements": "0.149.0",
31
- "@webority/ui-react": "0.149.0",
30
+ "@webority/ui-elements": "0.150.0",
31
+ "@webority/ui-react": "0.150.0",
32
32
  "bootstrap": "5.3.8",
33
33
  "react": "^19.0.0",
34
34
  "react-bootstrap": "^2.10.0",
@@ -39,12 +39,12 @@
39
39
  "@testing-library/jest-dom": "7.0.1",
40
40
  "@testing-library/react": "^16.3.0",
41
41
  "@testing-library/user-event": "^14.6.1",
42
- "@types/react": "^19.2.17",
42
+ "@types/react": "^19.3.0",
43
43
  "@vitejs/plugin-react": "^6.0.1",
44
44
  "@vitest/coverage-v8": "5.1.0",
45
- "@webority/canvas-kit": "0.149.0",
46
- "@webority/ui-elements": "0.149.0",
47
- "@webority/ui-react": "0.149.0",
45
+ "@webority/canvas-kit": "0.150.0",
46
+ "@webority/ui-elements": "0.150.0",
47
+ "@webority/ui-react": "0.150.0",
48
48
  "bootstrap": "5.3.8",
49
49
  "jsdom": "30.1.1",
50
50
  "react": "^19.3.1",
@@ -58,7 +58,8 @@
58
58
  "html-to-image": "^1.11.13"
59
59
  },
60
60
  "scripts": {
61
- "build": "vite build && tsc -p tsconfig.json && node ../canvas-kit/dist/cli.js guidance --config canvas-kit.json --out dist/guidance.json",
61
+ "build": "tsc -p tsconfig.json && vite build && tsc -p tsconfig.build.json && node ../canvas-kit/dist/cli.js guidance --config canvas-kit.json --out dist/guidance.json",
62
+ "typecheck": "tsc -p tsconfig.json",
62
63
  "test": "vitest run",
63
64
  "test:watch": "vitest",
64
65
  "test:coverage": "vitest run --coverage"