@waniwani/sdk 0.12.13 → 0.12.14-beta.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.
- package/dist/chat/embed.js +102 -102
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/index.d.ts +105 -0
- package/dist/chat/index.js +7 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/legacy/index.d.ts +83 -0
- package/dist/legacy/index.js +13 -13
- package/dist/legacy/index.js.map +1 -1
- package/package.json +1 -1
package/dist/chat/index.d.ts
CHANGED
|
@@ -3,6 +3,84 @@ import * as ai from 'ai';
|
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ContentBlock } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Chat widget translation types.
|
|
8
|
+
*
|
|
9
|
+
* The English catalog is the source of truth — its shape is inferred and
|
|
10
|
+
* every other locale must match it exactly (enforced by `ExactShape`).
|
|
11
|
+
* Add a key in `en.ts` and TypeScript will flag the missing key in `fr.ts`
|
|
12
|
+
* / `es.ts`.
|
|
13
|
+
*/
|
|
14
|
+
declare const SUPPORTED_LOCALES: readonly ["en", "fr", "es"];
|
|
15
|
+
type Locale = (typeof SUPPORTED_LOCALES)[number];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* English catalog. Source of truth — every other locale must mirror this
|
|
19
|
+
* shape exactly (the `Messages` type is inferred from here).
|
|
20
|
+
*/
|
|
21
|
+
interface Messages {
|
|
22
|
+
promptInput: {
|
|
23
|
+
placeholder: string;
|
|
24
|
+
uploadFiles: string;
|
|
25
|
+
stop: string;
|
|
26
|
+
submit: string;
|
|
27
|
+
removeAttachments: string;
|
|
28
|
+
};
|
|
29
|
+
workingIndicator: {
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
reasoning: {
|
|
33
|
+
thinking: string;
|
|
34
|
+
thoughtBrief: string;
|
|
35
|
+
thoughtForSeconds: (count: number) => string;
|
|
36
|
+
};
|
|
37
|
+
tool: {
|
|
38
|
+
copy: string;
|
|
39
|
+
copied: string;
|
|
40
|
+
request: string;
|
|
41
|
+
response: string;
|
|
42
|
+
error: string;
|
|
43
|
+
};
|
|
44
|
+
attachments: {
|
|
45
|
+
attachmentFallback: string;
|
|
46
|
+
fileFallback: string;
|
|
47
|
+
};
|
|
48
|
+
threadMenu: {
|
|
49
|
+
newChat: string;
|
|
50
|
+
threadHistory: string;
|
|
51
|
+
deleteThread: string;
|
|
52
|
+
noPreviousChats: string;
|
|
53
|
+
hiddenThreads: (count: number) => string;
|
|
54
|
+
};
|
|
55
|
+
chatQueue: {
|
|
56
|
+
attachmentFallback: string;
|
|
57
|
+
removeFromQueue: string;
|
|
58
|
+
queued: (count: number) => string;
|
|
59
|
+
};
|
|
60
|
+
poweredBy: {
|
|
61
|
+
label: string;
|
|
62
|
+
};
|
|
63
|
+
aiDisclaimer: {
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
exportSession: {
|
|
67
|
+
saving: string;
|
|
68
|
+
saved: string;
|
|
69
|
+
error: string;
|
|
70
|
+
export: string;
|
|
71
|
+
tooltip: string;
|
|
72
|
+
};
|
|
73
|
+
widgetErrorBoundary: {
|
|
74
|
+
failedToLoad: string;
|
|
75
|
+
retry: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends object ? {
|
|
80
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
81
|
+
} : T;
|
|
82
|
+
type MessageOverrides = DeepPartial<Messages>;
|
|
83
|
+
|
|
6
84
|
/**
|
|
7
85
|
* Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
|
|
8
86
|
* and switches at runtime without re-rendering.
|
|
@@ -176,6 +254,22 @@ interface ChatBaseProps {
|
|
|
176
254
|
* Pass a string to override the wording, or `false` to hide it entirely.
|
|
177
255
|
*/
|
|
178
256
|
disclaimer?: string | false;
|
|
257
|
+
/**
|
|
258
|
+
* UI language for built-in labels (buttons, placeholders, status text).
|
|
259
|
+
* Supports `"en"`, `"fr"`, `"es"`. When omitted, the widget detects the
|
|
260
|
+
* locale from `<html lang>` and `navigator.language(s)`, falling back
|
|
261
|
+
* to English.
|
|
262
|
+
*/
|
|
263
|
+
locale?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Per-key overrides on top of the resolved locale catalog. Use this to
|
|
266
|
+
* tweak individual built-in strings without contributing a new locale.
|
|
267
|
+
*
|
|
268
|
+
* ```tsx
|
|
269
|
+
* messages={{ promptInput: { placeholder: "Ask the agent…" } }}
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
messages?: MessageOverrides;
|
|
179
273
|
}
|
|
180
274
|
/**
|
|
181
275
|
* MCP Apps configuration for {@link ChatEmbedProps}.
|
|
@@ -450,6 +544,17 @@ interface WaniwaniChatOverrides {
|
|
|
450
544
|
* String overrides the default wording; `false` hides it.
|
|
451
545
|
*/
|
|
452
546
|
disclaimer?: string | false;
|
|
547
|
+
/**
|
|
548
|
+
* UI language for built-in labels. One of `"en"`, `"fr"`, `"es"`.
|
|
549
|
+
* When omitted, the widget detects the locale from `<html lang>` /
|
|
550
|
+
* `navigator.language` and falls back to English.
|
|
551
|
+
*/
|
|
552
|
+
locale?: Locale;
|
|
553
|
+
/**
|
|
554
|
+
* Per-key overrides on top of the resolved locale catalog. Lets you
|
|
555
|
+
* tweak individual built-in strings without contributing a full locale.
|
|
556
|
+
*/
|
|
557
|
+
messages?: MessageOverrides;
|
|
453
558
|
}
|
|
454
559
|
/**
|
|
455
560
|
* Hosted-tier WaniWani chat. The React counterpart to the `<script>` embed.
|