@wallavi/widget 1.12.2 → 1.12.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/index.js CHANGED
@@ -3281,6 +3281,16 @@ function ChatWidget({
3281
3281
  window.addEventListener("resize", checkSize);
3282
3282
  return () => window.removeEventListener("resize", checkSize);
3283
3283
  }, []);
3284
+ react.useEffect(() => {
3285
+ if (typeof window === "undefined") return;
3286
+ const handleMessage = (e) => {
3287
+ if (e.data?.type === "wallavi:focusInput") {
3288
+ document.querySelector("#wallavi-chat-input")?.focus();
3289
+ }
3290
+ };
3291
+ window.addEventListener("message", handleMessage);
3292
+ return () => window.removeEventListener("message", handleMessage);
3293
+ }, []);
3284
3294
  const chat = useChat({
3285
3295
  agentId,
3286
3296
  workspaceId,
@@ -3721,6 +3731,8 @@ function useAutoConfig(agentId, enabled) {
3721
3731
  remote.ragTopics = cfg.ragTopics;
3722
3732
  if (Array.isArray(cfg.ragDocuments))
3723
3733
  remote.ragDocuments = cfg.ragDocuments;
3734
+ if (cfg.locale != null)
3735
+ remote.locale = cfg.locale;
3724
3736
  setResult({
3725
3737
  remoteConfig: remote,
3726
3738
  bubbleIconUrl: cfg.chatIcon || cfg.profilePicture || void 0,
@@ -4241,7 +4253,7 @@ function BubbleWidget({
4241
4253
  react.useEffect(() => {
4242
4254
  if (!open) return;
4243
4255
  const t = setTimeout(
4244
- () => panelRef.current?.querySelector("textarea")?.focus(),
4256
+ () => panelRef.current?.querySelector("#wallavi-chat-input")?.focus(),
4245
4257
  50
4246
4258
  );
4247
4259
  return () => clearTimeout(t);
package/dist/index.mjs CHANGED
@@ -3255,6 +3255,16 @@ function ChatWidget({
3255
3255
  window.addEventListener("resize", checkSize);
3256
3256
  return () => window.removeEventListener("resize", checkSize);
3257
3257
  }, []);
3258
+ useEffect(() => {
3259
+ if (typeof window === "undefined") return;
3260
+ const handleMessage = (e) => {
3261
+ if (e.data?.type === "wallavi:focusInput") {
3262
+ document.querySelector("#wallavi-chat-input")?.focus();
3263
+ }
3264
+ };
3265
+ window.addEventListener("message", handleMessage);
3266
+ return () => window.removeEventListener("message", handleMessage);
3267
+ }, []);
3258
3268
  const chat = useChat({
3259
3269
  agentId,
3260
3270
  workspaceId,
@@ -3695,6 +3705,8 @@ function useAutoConfig(agentId, enabled) {
3695
3705
  remote.ragTopics = cfg.ragTopics;
3696
3706
  if (Array.isArray(cfg.ragDocuments))
3697
3707
  remote.ragDocuments = cfg.ragDocuments;
3708
+ if (cfg.locale != null)
3709
+ remote.locale = cfg.locale;
3698
3710
  setResult({
3699
3711
  remoteConfig: remote,
3700
3712
  bubbleIconUrl: cfg.chatIcon || cfg.profilePicture || void 0,
@@ -4215,7 +4227,7 @@ function BubbleWidget({
4215
4227
  useEffect(() => {
4216
4228
  if (!open) return;
4217
4229
  const t = setTimeout(
4218
- () => panelRef.current?.querySelector("textarea")?.focus(),
4230
+ () => panelRef.current?.querySelector("#wallavi-chat-input")?.focus(),
4219
4231
  50
4220
4232
  );
4221
4233
  return () => clearTimeout(t);
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "private": false,
44
44
  "types": "./dist/index.d.ts",
45
- "version": "1.12.2",
45
+ "version": "1.12.4",
46
46
  "scripts": {
47
47
  "build": "tsup && pnpm build:css",
48
48
  "build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --config tailwind.config.cjs --minify",