@paramms/chat-widget 1.6.2 → 1.7.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/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useState as d, useEffect as R, useRef as $, useSyncExternalStore as w, useMemo as h } from "react";
2
2
  import { RelayClient as C } from "./core.js";
3
- import { r as b, p as U } from "./codec.js";
3
+ import { r as b, p as U } from "./chatlist2.js";
4
4
  function T(e) {
5
5
  var c;
6
6
  const l = `${e.url}|${e.token ?? ""}|${e.profileId}|${e.subjectId ?? ""}|${e.kind ?? ""}|${e.peerId ?? ""}`, o = $(null);
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ export type WidgetLocale = 'en' | 'ko';
2
+ /** The auto-localized string set (everything except the two special keys above). */
3
+ export interface WidgetStrings {
4
+ placeholder: string;
5
+ offline: string;
6
+ online: string;
7
+ away: string;
8
+ aiAssistant: string;
9
+ resolved: string;
10
+ reopen: string;
11
+ sources: string;
12
+ helpful: string;
13
+ notHelpful: string;
14
+ title: string;
15
+ newChat: string;
16
+ startChat: string;
17
+ all: string;
18
+ empty: string;
19
+ error: string;
20
+ retry: string;
21
+ search: string;
22
+ unread: string;
23
+ close: string;
24
+ }
25
+ /** Host overrides: any built-in string, plus the two special override-only keys. */
26
+ export type WidgetI18nOverrides = Partial<WidgetStrings> & {
27
+ poweredBy?: string;
28
+ send?: string;
29
+ };
30
+ /** Resolve a supported locale from an explicit option or the browser. KO⇄EN
31
+ * only — anything that isn't Korean resolves to English. Accepts full BCP-47
32
+ * tags ('ko-KR'), bare codes ('ko'), or names ('korean'/'한국어'). */
33
+ export declare function resolveLocale(explicit?: string): WidgetLocale;
34
+ /** The full string set for the resolved locale, with host per-key overrides
35
+ * applied on top (overrides win; blank/undefined override values are ignored so
36
+ * a partial override object never blanks a built-in string). The result may
37
+ * also carry `poweredBy`/`send` when the host provided them. */
38
+ export declare function resolveStrings(locale?: string, overrides?: WidgetI18nOverrides): WidgetStrings & {
39
+ poweredBy?: string;
40
+ send?: string;
41
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { asConversationId } from './protocol/index.js';
2
2
  import { type WidgetConfig } from './renderer.js';
3
+ import { type WidgetI18nOverrides } from './i18n.js';
3
4
  export interface UserInfo {
4
5
  /** Display name shown in the conversation (e.g. "Sarah Chen"). */
5
6
  name?: string;
@@ -58,6 +59,13 @@ export interface MountOptions {
58
59
  * calls this. Used by `<ChatApp>` so tapping a conversation opens the room and
59
60
  * the back arrow returns to the list — native-app style. */
60
61
  onBack?: () => void;
62
+ /** Turn this into a self-contained inbox: the back chevron opens the user's
63
+ * full thread list IN PLACE (no navigation), and picking a row opens that
64
+ * thread with a back chevron returning to the list. */
65
+ inbox?: boolean;
66
+ /** Inbox scope: 'tenant' (default) lists the user's threads across ALL your
67
+ * chatrooms; 'profile' limits to this chatroom. */
68
+ inboxScope?: 'tenant' | 'profile';
61
69
  /** If set, shows a 🌐 translate button on incoming messages that translates
62
70
  * them into this language (ISO code or language name) via the server's
63
71
  * /translate endpoint. Omit to disable the feature. */
@@ -91,19 +99,13 @@ export interface MountOptions {
91
99
  csat?: boolean;
92
100
  deflection?: boolean;
93
101
  };
94
- /** i18n: override UI strings. All keys are optional omitted keys fall
95
- * back to English defaults. */
96
- i18n?: {
97
- placeholder?: string;
98
- send?: string;
99
- offline?: string;
100
- poweredBy?: string;
101
- online?: string;
102
- away?: string;
103
- aiAssistant?: string;
104
- resolved?: string;
105
- reopen?: string;
106
- };
102
+ /** UI language for built-in strings. A BCP-47 tag ('ko', 'ko-KR'), bare code,
103
+ * or name. Omit to auto-detect from the visitor's browser (navigator.language).
104
+ * Currently Korean ⇄ English; anything non-Korean resolves to English. */
105
+ locale?: string;
106
+ /** i18n: override UI strings. All keys are optional — omitted keys use the
107
+ * built-in dictionary for the resolved `locale` (English by default). */
108
+ i18n?: WidgetI18nOverrides;
107
109
  }
108
110
  export interface WidgetHandle {
109
111
  close(): void;