@chatcops/widget 0.6.0 → 1.0.0-rc.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 (89) hide show
  1. package/README.md +2 -1
  2. package/dist/api/client.d.ts +17 -2
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/protocol.d.ts +7 -1
  5. package/dist/api/protocol.d.ts.map +1 -1
  6. package/dist/api/turnstile.d.ts.map +1 -1
  7. package/dist/api/types.d.ts +7 -0
  8. package/dist/api/types.d.ts.map +1 -1
  9. package/dist/chatcops.esm.js +1094 -499
  10. package/dist/chatcops.full.min.js +1 -0
  11. package/dist/chatcops.min.js +1 -1
  12. package/dist/chatcops.panel.js +1 -0
  13. package/dist/chunks/prechat-form-DiHgHUnU.js +1 -0
  14. package/dist/chunks/turnstile-CAnVL3fK.js +1 -0
  15. package/dist/dom/bubble.d.ts +3 -0
  16. package/dist/dom/bubble.d.ts.map +1 -1
  17. package/dist/dom/fab.d.ts +4 -1
  18. package/dist/dom/fab.d.ts.map +1 -1
  19. package/dist/dom/icons.d.ts +4 -0
  20. package/dist/dom/icons.d.ts.map +1 -0
  21. package/dist/dom/input.d.ts +1 -0
  22. package/dist/dom/input.d.ts.map +1 -1
  23. package/dist/dom/messages.d.ts +38 -1
  24. package/dist/dom/messages.d.ts.map +1 -1
  25. package/dist/dom/panel.d.ts +8 -0
  26. package/dist/dom/panel.d.ts.map +1 -1
  27. package/dist/dom/prechat-form.d.ts.map +1 -1
  28. package/dist/dom/shadow.d.ts +10 -1
  29. package/dist/dom/shadow.d.ts.map +1 -1
  30. package/dist/i18n.d.ts +7 -1
  31. package/dist/i18n.d.ts.map +1 -1
  32. package/dist/index.d.ts +41 -5
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/loader/index.d.ts +2 -0
  35. package/dist/loader/index.d.ts.map +1 -0
  36. package/dist/loader/loader.d.ts +71 -0
  37. package/dist/loader/loader.d.ts.map +1 -0
  38. package/dist/locales/ar.d.ts +4 -0
  39. package/dist/locales/ar.d.ts.map +1 -0
  40. package/dist/locales/ar.js +1 -0
  41. package/dist/locales/de.d.ts +4 -0
  42. package/dist/locales/de.d.ts.map +1 -0
  43. package/dist/locales/de.js +1 -0
  44. package/dist/locales/es.d.ts +4 -0
  45. package/dist/locales/es.d.ts.map +1 -0
  46. package/dist/locales/es.js +1 -0
  47. package/dist/locales/fr.d.ts +4 -0
  48. package/dist/locales/fr.d.ts.map +1 -0
  49. package/dist/locales/fr.js +1 -0
  50. package/dist/locales/he.d.ts +4 -0
  51. package/dist/locales/he.d.ts.map +1 -0
  52. package/dist/locales/he.js +1 -0
  53. package/dist/locales/hi.d.ts +4 -0
  54. package/dist/locales/hi.d.ts.map +1 -0
  55. package/dist/locales/hi.js +1 -0
  56. package/dist/locales/it.d.ts +4 -0
  57. package/dist/locales/it.d.ts.map +1 -0
  58. package/dist/locales/it.js +1 -0
  59. package/dist/locales/ja.d.ts +4 -0
  60. package/dist/locales/ja.d.ts.map +1 -0
  61. package/dist/locales/ja.js +1 -0
  62. package/dist/locales/ko.d.ts +4 -0
  63. package/dist/locales/ko.d.ts.map +1 -0
  64. package/dist/locales/ko.js +1 -0
  65. package/dist/locales/nl.d.ts +4 -0
  66. package/dist/locales/nl.d.ts.map +1 -0
  67. package/dist/locales/nl.js +1 -0
  68. package/dist/locales/pt.d.ts +4 -0
  69. package/dist/locales/pt.d.ts.map +1 -0
  70. package/dist/locales/pt.js +1 -0
  71. package/dist/locales/ur.d.ts +4 -0
  72. package/dist/locales/ur.d.ts.map +1 -0
  73. package/dist/locales/ur.js +1 -0
  74. package/dist/locales/zh.d.ts +4 -0
  75. package/dist/locales/zh.d.ts.map +1 -0
  76. package/dist/locales/zh.js +1 -0
  77. package/dist/panel.d.ts +6 -0
  78. package/dist/panel.d.ts.map +1 -0
  79. package/dist/script-config.d.ts +5 -0
  80. package/dist/script-config.d.ts.map +1 -0
  81. package/dist/storage.d.ts +30 -10
  82. package/dist/storage.d.ts.map +1 -1
  83. package/dist/theme.d.ts +15 -0
  84. package/dist/theme.d.ts.map +1 -1
  85. package/dist/version.d.ts +3 -0
  86. package/dist/version.d.ts.map +1 -0
  87. package/dist/widget.d.ts +124 -15
  88. package/dist/widget.d.ts.map +1 -1
  89. package/package.json +7 -3
package/dist/storage.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ import type { MessageErrorType } from './dom/messages.js';
2
+ /** Where the widget keeps the conversation: nowhere (`none`), this tab (`session`) or this browser (`local`). */
3
+ export type Persistence = 'none' | 'session' | 'local';
4
+ /** A string store: localStorage, sessionStorage, or memory for `none`. Never throws. */
5
+ export interface KeyStore {
6
+ get(key: string): string | null;
7
+ set(key: string, value: string): void;
8
+ remove(key: string): void;
9
+ }
1
10
  interface StoredConversation {
2
11
  id: string;
3
12
  messages: Array<{
@@ -5,24 +14,35 @@ interface StoredConversation {
5
14
  role: 'user' | 'assistant';
6
15
  content: string;
7
16
  status?: 'streaming' | 'complete' | 'error';
8
- errorType?: import('./dom/messages.js').MessageErrorType;
17
+ errorType?: MessageErrorType;
9
18
  timestamp: number;
19
+ sources?: Array<{
20
+ url: string;
21
+ title?: string;
22
+ }>;
10
23
  }>;
24
+ /** Pre-chat answers, kept with the conversation so a restored chat has them too. */
25
+ userData?: Record<string, string>;
26
+ /** The pre-chat form was submitted for this conversation. */
27
+ preChatDone?: boolean;
11
28
  updatedAt: number;
12
29
  }
30
+ /** The store for a persistence mode. Every call is wrapped, since storage can be blocked or full. */
31
+ export declare function keyStore(persistence: Persistence): KeyStore;
32
+ /**
33
+ * The saved conversation for one widget. Nothing here runs until the widget
34
+ * reads or saves, so constructing it touches no storage.
35
+ */
13
36
  export declare class ConversationStorage {
37
+ readonly store: KeyStore;
14
38
  private key;
15
- private sessionKey;
16
- /** Without a siteId the keys are the ones the widget has always used. */
17
- constructor(siteId?: string);
18
- load(): StoredConversation | null;
39
+ private ttlMs;
40
+ /** Without a siteId the key is the one the widget has always used. */
41
+ constructor(siteId?: string, persistence?: Persistence, historyTtlDays?: number);
42
+ /** The saved conversation, or null when there is none, it's unreadable, or it expired. */
43
+ load(now?: number): StoredConversation | null;
19
44
  save(conversation: StoredConversation): void;
20
45
  clear(): void;
21
- getSessionId(): string;
22
- isPreChatCompleted(sessionId: string): boolean;
23
- setPreChatCompleted(sessionId: string, data?: Record<string, string>): void;
24
- getPreChatData(sessionId: string): Record<string, string> | null;
25
- setPreChatData(sessionId: string, data: Record<string, string>): void;
26
46
  }
27
47
  export {};
28
48
  //# sourceMappingURL=storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAC3B,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;QAC5C,SAAS,CAAC,EAAE,OAAO,mBAAmB,EAAE,gBAAgB,CAAC;QACzD,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,UAAU,CAAS;IAE3B,yEAAyE;gBAC7D,MAAM,CAAC,EAAE,MAAM;IAK3B,IAAI,IAAI,kBAAkB,GAAG,IAAI;IA8CjC,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAc5C,KAAK,IAAI,IAAI;IAQb,YAAY,IAAI,MAAM;IAatB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAQ9C,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM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AAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD,qGAAqG;AACrG,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,QAAQ,CAiC3D;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAS;IAEtB,sEAAsE;gBAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,GAAE,WAAqB,EAAE,cAAc,SAAK;IAOpF,0FAA0F;IAC1F,IAAI,CAAC,GAAG,SAAa,GAAG,kBAAkB,GAAG,IAAI;IAmEjD,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAQ5C,KAAK,IAAI,IAAI;CAGd"}
package/dist/theme.d.ts CHANGED
@@ -1,5 +1,13 @@
1
+ export type ThemeMode = 'light' | 'dark' | 'auto';
1
2
  export interface ThemeConfig {
3
+ /**
4
+ * `auto` (the default) follows the visitor's system setting and switches
5
+ * when it changes. `dark` is the look the widget had before light mode.
6
+ */
7
+ mode?: ThemeMode;
2
8
  accent?: string;
9
+ /** The accent in dark mode. Defaults to `accent`. */
10
+ accentDark?: string;
3
11
  textColor?: string;
4
12
  bgColor?: string;
5
13
  fontFamily?: string;
@@ -7,6 +15,13 @@ export interface ThemeConfig {
7
15
  position?: 'bottom-right' | 'bottom-left';
8
16
  }
9
17
  export declare function applyTheme(root: ShadowRoot, theme: ThemeConfig): void;
18
+ /**
19
+ * The mode to show. A config from before light mode that sets `bgColor` or
20
+ * `textColor` but no `mode` was made for the dark look, unless its colors are
21
+ * light, so it keeps the mode its colors fit instead of getting light text
22
+ * on light panels.
23
+ */
24
+ export declare function themeMode(theme: ThemeConfig): ThemeMode | undefined;
10
25
  export declare function contrastRatio(a: string, b: string): number;
11
26
  /**
12
27
  * Picks the text color for an accent background, and the accent shade to put
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;CAC3C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CA6BrE;AA6BD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYhG"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;CAC3C;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAsBrE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAKnE;AA8CD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYhG"}
@@ -0,0 +1,3 @@
1
+ /** The widget's version, from package.json at build time. */
2
+ export declare const VERSION: string;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,6DAA6D;AAC7D,eAAO,MAAM,OAAO,EAAE,MAAsF,CAAC"}
package/dist/widget.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { type Persistence } from './storage.js';
2
+ import { type ThemeConfig } from './theme.js';
1
3
  import { type WidgetLocaleStrings } from './i18n.js';
2
4
  import type { MessageData } from './dom/messages.js';
3
5
  export interface PreChatField {
@@ -24,6 +26,11 @@ export interface WidgetConfig {
24
26
  * Cloudflare's script loads only when the widget first needs a session.
25
27
  */
26
28
  turnstileSiteKey?: string;
29
+ /**
30
+ * For a visitor your site has signed in: an HS256 JWT your server signs
31
+ * with the chat server's `identity.secret` (`sub`, `exp`, optional `tier`).
32
+ */
33
+ userToken?: string;
27
34
  mode?: 'popup' | 'inline';
28
35
  /**
29
36
  * Names this widget's saved conversation. Set a different one on each widget
@@ -32,31 +39,43 @@ export interface WidgetConfig {
32
39
  */
33
40
  siteId?: string;
34
41
  container?: string | HTMLElement;
35
- theme?: {
36
- accent?: string;
37
- textColor?: string;
38
- bgColor?: string;
39
- fontFamily?: string;
40
- borderRadius?: string | number;
41
- position?: 'bottom-right' | 'bottom-left';
42
- };
42
+ theme?: ThemeConfig;
43
43
  branding?: {
44
44
  name?: string;
45
45
  avatar?: string;
46
46
  subtitle?: string;
47
47
  };
48
48
  welcomeMessage?: string;
49
+ /**
50
+ * The note at the top of the chat that visitors are talking to an AI, as
51
+ * the EU AI Act asks (Article 50). On by default. `text` replaces the
52
+ * wording, and `learnMoreUrl` adds a link. `false` turns it off, and then
53
+ * telling visitors is up to you.
54
+ */
55
+ disclosure?: false | {
56
+ text?: string;
57
+ learnMoreUrl?: string;
58
+ };
59
+ suggestions?: string[];
49
60
  welcomeBubble?: {
50
61
  text: string;
51
62
  delay?: number;
52
63
  showOnce?: boolean;
53
64
  };
54
65
  placeholder?: string;
55
- persistHistory?: boolean;
66
+ /**
67
+ * Where the conversation is kept: `local` (this browser, the default),
68
+ * `session` (this tab) or `none` (memory only, gone on reload). Nothing is
69
+ * read or written until the chat is opened (or shown, in inline mode).
70
+ */
71
+ persistence?: Persistence;
72
+ /** Saved conversations older than this are dropped. Default 30 days. */
73
+ historyTtlDays?: number;
56
74
  maxMessages?: number;
57
75
  pageContext?: boolean;
58
76
  autoOpen?: boolean | number;
59
77
  locale?: string;
78
+ dir?: 'ltr' | 'rtl' | 'auto';
60
79
  strings?: Partial<WidgetLocaleStrings>;
61
80
  preChatForm?: PreChatFormConfig;
62
81
  onOpen?: () => void;
@@ -66,8 +85,31 @@ export interface WidgetConfig {
66
85
  onLeadCaptured?: (leadData?: Record<string, unknown>) => void;
67
86
  onPreChatSubmit?: (data: Record<string, string>) => void;
68
87
  }
69
- export type WidgetEventType = 'open' | 'close' | 'message' | 'error' | 'leadCaptured' | 'preChatSubmit';
70
- export type WidgetEventHandler = (...args: unknown[]) => void;
88
+ /** What `update()` can change on a running chat. */
89
+ export type WidgetUpdate = Pick<WidgetConfig, 'branding' | 'welcomeMessage' | 'disclosure' | 'suggestions' | 'placeholder' | 'strings'> & {
90
+ theme?: Omit<ThemeConfig, 'position'>;
91
+ };
92
+ /** What each widget event passes to its handlers. */
93
+ export interface WidgetEvents {
94
+ open: [];
95
+ close: [];
96
+ /** A message the visitor sent, or a finished reply. */
97
+ message: [message: MessageData];
98
+ /** A reply that failed. */
99
+ error: [error: Error];
100
+ leadCaptured: [lead: Record<string, unknown> | undefined];
101
+ preChatSubmit: [data: Record<string, string>];
102
+ }
103
+ export type WidgetEventType = keyof WidgetEvents;
104
+ /** A handler for one event, typed by it: `on('message', (message) => ...)`. */
105
+ export type WidgetEventHandler<E extends WidgetEventType = WidgetEventType> = (...args: WidgetEvents[E]) => void;
106
+ /**
107
+ * The pre-chat form's chunk, loaded once and only by widgets that use the
108
+ * form. A failed load is forgotten, so the next widget tries again.
109
+ */
110
+ export declare function loadPreChatForm(): Promise<typeof import('./dom/prechat-form.js')>;
111
+ /** Starts downloading what this config will need, before the chat is shown. */
112
+ export declare function prefetch(config: WidgetConfig): void;
71
113
  export declare class Widget {
72
114
  private config;
73
115
  private shadow;
@@ -81,33 +123,100 @@ export declare class Widget {
81
123
  private namespace;
82
124
  private locale;
83
125
  private conversationId;
126
+ /** The pre-chat form was submitted for this conversation. */
127
+ private preChatDone;
128
+ /** The saved conversation has been read (on first open, or at mount in inline mode). */
129
+ private hydrated;
84
130
  private messages;
85
131
  private userData?;
86
132
  private isStreaming;
87
133
  /** Set once the server answers in protocol v1 (0.6 and later). */
88
134
  private v1;
89
135
  private destroyed;
136
+ /** Goes up on newConversation() and clear(), so a reply from before is ignored. */
137
+ private generation;
138
+ /** What the site added with setContext(), sent with every message. */
139
+ private pageData?;
140
+ /** The conversation the visitor details were last sent with: a v1 server keeps them from its first message. */
141
+ private userDataSentWith?;
142
+ /** Visitor details came from setUser(), so they're sent without a pre-chat form. */
143
+ private userFromSite;
90
144
  private abortController?;
91
145
  private retryRequests;
92
146
  private eventHandlers;
93
147
  private containerEl?;
94
148
  private autoOpenTimer?;
149
+ private unreadReplies;
150
+ private savedOverflow?;
95
151
  get isInline(): boolean;
96
152
  constructor(config: WidgetConfig);
97
153
  private resolveContainer;
98
154
  init(): void;
155
+ /** Reads the saved conversation and shows it, or the pre-chat form. Runs once. */
156
+ private hydrate;
99
157
  open(): void;
100
158
  close(): void;
101
159
  toggle(): void;
160
+ /**
161
+ * Sends `text` as the visitor, as if they typed it, and opens the chat
162
+ * first unless `open: false`. Resolves when the reply has finished. A
163
+ * message sent while a reply is still coming is ignored, as in the input.
164
+ */
165
+ sendMessage(text: string, options?: {
166
+ open?: boolean;
167
+ }): Promise<void>;
168
+ /**
169
+ * Starts a fresh conversation: a new id, and the log back to the welcome
170
+ * message. A reply that's still coming is stopped. Pre-chat answers stay.
171
+ */
172
+ newConversation(): void;
173
+ /**
174
+ * Like newConversation(), and forgets what this browser saved: the
175
+ * transcript and the pre-chat answers, so the form shows again.
176
+ */
177
+ clear(): void;
178
+ private reset;
179
+ /**
180
+ * The signed-in visitor. `token` is the identity token for the server
181
+ * (signed-in visitors); `name` and `email` are sent as visitor details, and
182
+ * the name greets them. Switching to another user, or signing out with
183
+ * `null`, clears the chat, so one person's conversation never shows for
184
+ * the next.
185
+ */
186
+ setUser(user: {
187
+ name?: string;
188
+ email?: string;
189
+ token?: string;
190
+ } | null): void;
191
+ /**
192
+ * Details about the page or the visitor that the bot should know for the
193
+ * next messages, such as `{ plan: 'Team' }`. Sent with each message as
194
+ * page context; `null` removes them. Ignored when `pageContext: false`.
195
+ */
196
+ setContext(data: Record<string, string> | null): void;
197
+ /**
198
+ * Changes the look or wording of the running chat without loading it
199
+ * again: the theme (not `position`), branding, strings, placeholder,
200
+ * disclosure, welcome message and suggestions. What you leave out stays
201
+ * as it is. A conversation that has only the welcome message shows the
202
+ * new one; otherwise the welcome message and suggestions are for the
203
+ * next conversation.
204
+ */
205
+ update(changes: WidgetUpdate): void;
206
+ private panelLabels;
207
+ private actionLabels;
208
+ private renderDisclosure;
209
+ private isStale;
102
210
  destroy(): void;
103
- on(event: WidgetEventType, handler: WidgetEventHandler): () => void;
104
- off(event: WidgetEventType, handler: WidgetEventHandler): void;
211
+ private lockScroll;
212
+ private restoreScroll;
213
+ on<E extends WidgetEventType>(event: E, handler: WidgetEventHandler<E>): () => void;
214
+ off<E extends WidgetEventType>(event: E, handler: WidgetEventHandler<E>): void;
105
215
  private emit;
106
- private isPreChatCompleted;
107
- private setPreChatCompleted;
108
216
  private showPreChatForm;
109
217
  private handlePreChatSubmit;
110
218
  private showChatView;
219
+ private renderSuggestions;
111
220
  private handleSend;
112
221
  private handleRetry;
113
222
  private handleRegenerate;
@@ -1 +1 @@
1
- {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGtE,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAavE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B;;;;OAIG;IACH,M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AI,GAAG,IAAI;IAIrD;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAwBnC,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,OAAO;IAIf,OAAO,IAAI,IAAI;IAiBf,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,aAAa;IAWrB,EAAE,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAQnF,GAAG,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI;IAI9E,OAAO,CAAC,IAAI;IAOZ,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,iBAAiB;YASX,UAAU;YAkBV,WAAW;YAgCX,gBAAgB;YAwBhB,YAAY;IA0J1B,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,gCAAgC;IAiBxC,OAAO,CAAC,0BAA0B;IASlC,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,WAAW;CAoBpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatcops/widget",
3
- "version": "0.6.0",
3
+ "version": "1.0.0-rc.0",
4
4
  "description": "Embeddable AI chatbot widget - zero dependencies, Shadow DOM isolated",
5
5
  "keywords": [
6
6
  "chatcops",
@@ -21,6 +21,10 @@
21
21
  ".": {
22
22
  "types": "./dist/index.d.ts",
23
23
  "import": "./dist/chatcops.esm.js"
24
+ },
25
+ "./locales/*": {
26
+ "types": "./dist/locales/*.d.ts",
27
+ "import": "./dist/locales/*.js"
24
28
  }
25
29
  },
26
30
  "files": [
@@ -32,7 +36,7 @@
32
36
  "typescript": "^5.7.0",
33
37
  "vite": "^6.4.3",
34
38
  "vitest": "^4.1.11",
35
- "@chatcops/core": "^0.5.0"
39
+ "@chatcops/core": "^1.0.0-rc.0"
36
40
  },
37
41
  "repository": {
38
42
  "type": "git",
@@ -48,7 +52,7 @@
48
52
  },
49
53
  "scripts": {
50
54
  "dev": "vite build --watch",
51
- "build": "vite build && rm -f tsconfig.tsbuildinfo && tsc --emitDeclarationOnly",
55
+ "build": "vite build && vite build -c vite.panel.config.ts && vite build -c vite.loader.config.ts && rm -f tsconfig.tsbuildinfo && tsc --emitDeclarationOnly",
52
56
  "typecheck": "tsc --noEmit",
53
57
  "test": "vitest run",
54
58
  "test:watch": "vitest",