@wallavi/widget 1.12.3 → 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,
@@ -4243,7 +4253,7 @@ function BubbleWidget({
4243
4253
  react.useEffect(() => {
4244
4254
  if (!open) return;
4245
4255
  const t = setTimeout(
4246
- () => panelRef.current?.querySelector("textarea")?.focus(),
4256
+ () => panelRef.current?.querySelector("#wallavi-chat-input")?.focus(),
4247
4257
  50
4248
4258
  );
4249
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,
@@ -4217,7 +4227,7 @@ function BubbleWidget({
4217
4227
  useEffect(() => {
4218
4228
  if (!open) return;
4219
4229
  const t = setTimeout(
4220
- () => panelRef.current?.querySelector("textarea")?.focus(),
4230
+ () => panelRef.current?.querySelector("#wallavi-chat-input")?.focus(),
4221
4231
  50
4222
4232
  );
4223
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.3",
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",