@smart-cloud/ai-kit-ui 1.5.2 → 1.5.4
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.
- package/dist/ShadowBoundary.d.ts +1 -1
- package/dist/ai-feature/AiFeatureBorder.d.ts +1 -1
- package/dist/ai-feature/ProofreadDiff.d.ts +1 -1
- package/dist/ai-kit-ui.css +31 -4
- package/dist/errorHandling.d.ts +21 -0
- package/dist/index.cjs +9 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -9
- package/dist/useAiRun.d.ts +2 -0
- package/package.json +40 -19
- package/src/ai-chatbot/AiChatbot.tsx +6 -2
- package/src/ai-feature/AiFeature.tsx +38 -23
- package/src/doc-search/DocSearch.tsx +44 -27
- package/src/errorHandling.ts +258 -0
- package/src/i18n/en.ts +15 -0
- package/src/i18n/hu.ts +15 -0
- package/src/index.tsx +1 -0
- package/src/styles/ai-kit-ui.css +31 -4
- package/src/useAiRun.ts +23 -29
- package/tests/error-handling.test.ts +82 -0
package/dist/ShadowBoundary.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export type ShadowBoundaryProps = {
|
|
|
26
26
|
shadowRoot: ShadowRoot;
|
|
27
27
|
}) => React.ReactNode;
|
|
28
28
|
};
|
|
29
|
-
export declare function ShadowBoundary({ stylesheets, children, rootElementId, mode, overlayRootId, setHost, }: ShadowBoundaryProps): import("react
|
|
29
|
+
export declare function ShadowBoundary({ stylesheets, children, rootElementId, mode, overlayRootId, setHost, }: ShadowBoundaryProps): import("react").JSX.Element;
|
|
@@ -10,4 +10,4 @@ export type ProofreadDiffProps = {
|
|
|
10
10
|
original: string;
|
|
11
11
|
corrections: Correction[];
|
|
12
12
|
};
|
|
13
|
-
export declare function ProofreadDiff({ original, corrections }: ProofreadDiffProps): import("react
|
|
13
|
+
export declare function ProofreadDiff({ original, corrections }: ProofreadDiffProps): import("react").JSX.Element;
|
package/dist/ai-kit-ui.css
CHANGED
|
@@ -49,6 +49,11 @@
|
|
|
49
49
|
/* Useful “bridge” vars */
|
|
50
50
|
--ai-kit-button-padding-x: var(--button-padding-x, 12px);
|
|
51
51
|
--ai-kit-input-padding-x: var(--input-padding-x, 12px);
|
|
52
|
+
--ai-kit-action-transition:
|
|
53
|
+
background-color 160ms ease, border-color 160ms ease, color 160ms ease,
|
|
54
|
+
box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
|
|
55
|
+
--ai-kit-action-focus-ring: var(--mantine-primary-color-filled, #1c7ed6);
|
|
56
|
+
--ai-kit-action-disabled-opacity: 0.6;
|
|
52
57
|
|
|
53
58
|
/* ---------------------------
|
|
54
59
|
1) Semantic color tokens
|
|
@@ -359,6 +364,31 @@
|
|
|
359
364
|
min-width: var(--ai-kit-actions-button-min-width, 140px);
|
|
360
365
|
}
|
|
361
366
|
|
|
367
|
+
/* Leave action colors to Mantine's resolved primary palette and the shared
|
|
368
|
+
WP Suite Theme CSS; this layer only standardizes interaction states. */
|
|
369
|
+
.ai-feature-root .mantine-Button-root,
|
|
370
|
+
.doc-search-root .mantine-Button-root,
|
|
371
|
+
.ai-docs-ask .mantine-Button-root,
|
|
372
|
+
.ai-docs-ask .mantine-ActionIcon-root {
|
|
373
|
+
transition: var(--ai-kit-action-transition);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.ai-feature-root .mantine-Button-root:focus-visible,
|
|
377
|
+
.doc-search-root .mantine-Button-root:focus-visible,
|
|
378
|
+
.ai-docs-ask .mantine-Button-root:focus-visible,
|
|
379
|
+
.ai-docs-ask .mantine-ActionIcon-root:focus-visible {
|
|
380
|
+
outline: 2px solid var(--ai-kit-action-focus-ring);
|
|
381
|
+
outline-offset: 2px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.ai-feature-root .mantine-Button-root:disabled,
|
|
385
|
+
.doc-search-root .mantine-Button-root:disabled,
|
|
386
|
+
.ai-docs-ask .mantine-Button-root:disabled,
|
|
387
|
+
.ai-docs-ask .mantine-ActionIcon-root:disabled {
|
|
388
|
+
cursor: not-allowed;
|
|
389
|
+
opacity: var(--ai-kit-action-disabled-opacity);
|
|
390
|
+
}
|
|
391
|
+
|
|
362
392
|
@media (max-width: var(--ai-kit-actions-breakpoint, 520px)) {
|
|
363
393
|
.ai-kit-actions {
|
|
364
394
|
flex-direction: column;
|
|
@@ -463,10 +493,7 @@
|
|
|
463
493
|
gap: 2px;
|
|
464
494
|
|
|
465
495
|
box-shadow: var(--ai-kit-launcher-shadow);
|
|
466
|
-
transition:
|
|
467
|
-
transform 0.2s ease,
|
|
468
|
-
box-shadow 0.2s ease,
|
|
469
|
-
background 0.2s ease;
|
|
496
|
+
transition: var(--ai-kit-action-transition);
|
|
470
497
|
|
|
471
498
|
padding: var(--ai-kit-space-3);
|
|
472
499
|
pointer-events: auto;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type AiRunErrorKind = "cancelled" | "human-verification" | "authorization" | "throttled" | "validation" | "network" | "server" | "general";
|
|
2
|
+
export type AiRunErrorDetails = {
|
|
3
|
+
kind: AiRunErrorKind;
|
|
4
|
+
status?: number;
|
|
5
|
+
code?: string;
|
|
6
|
+
safeMessage?: string;
|
|
7
|
+
requestId?: string;
|
|
8
|
+
};
|
|
9
|
+
export type AiRunErrorFeedback = {
|
|
10
|
+
message: string | null;
|
|
11
|
+
details: AiRunErrorDetails | null;
|
|
12
|
+
};
|
|
13
|
+
export declare function isAiRunAbort(error: unknown): boolean;
|
|
14
|
+
export declare function normalizeAiRunError(error: unknown): AiRunErrorDetails;
|
|
15
|
+
export declare function getAiRunErrorMessage(details: AiRunErrorDetails, translate?: (message: string) => string): string;
|
|
16
|
+
export declare function clearAiRunErrorFeedback(): AiRunErrorFeedback;
|
|
17
|
+
export declare function createAiRunErrorFeedback(error: unknown, translate?: (message: string) => string): AiRunErrorFeedback;
|
|
18
|
+
export declare class AiRunError extends Error {
|
|
19
|
+
readonly details: AiRunErrorDetails;
|
|
20
|
+
constructor(details: AiRunErrorDetails, message?: string, options?: ErrorOptions);
|
|
21
|
+
}
|