@avatarfirst/react 0.1.0 → 0.2.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/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -270,7 +280,7 @@ function useAvatarFirst(options) {
270
280
  }
271
281
  if (response.actions) {
272
282
  for (const action of response.actions) {
273
- optionsRef.current.onAction?.(action);
283
+ optionsRef.current.onAction?.({ type: action.intent, payload: action.data });
274
284
  }
275
285
  }
276
286
  setIsProcessing(false);
@@ -307,6 +317,7 @@ function useAvatarFirst(options) {
307
317
  }
308
318
 
309
319
  // src/components/overlays/OverlayContainer.tsx
320
+ var import_react8 = __toESM(require("react"), 1);
310
321
  var import_framer_motion = require("framer-motion");
311
322
 
312
323
  // src/animations/overlayAnimations.ts
@@ -380,6 +391,8 @@ function getPositionStyles(position = "bottom-center") {
380
391
  switch (position) {
381
392
  case "center":
382
393
  return { ...base, top: "50%", left: "50%", transform: "translate(-50%, -50%)" };
394
+ case "chest":
395
+ return { ...base, bottom: "5rem", left: "50%", transform: "translateX(-50%)", width: "90%", maxWidth: "28rem" };
383
396
  case "bottom-center":
384
397
  return { ...base, bottom: "2rem", left: "50%", transform: "translateX(-50%)" };
385
398
  case "bottom-right":
@@ -403,29 +416,42 @@ function OverlayContainer({ components }) {
403
416
  if (!Component) return null;
404
417
  const variants = getOverlayVariants(overlay.animation);
405
418
  const positionStyle = getPositionStyles(overlay.position);
406
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
407
- import_framer_motion.motion.div,
408
- {
409
- variants,
410
- initial: "initial",
411
- animate: "animate",
412
- exit: "exit",
413
- style: positionStyle,
414
- className: "pointer-events-auto",
415
- onClick: overlay.dismissOnClickOutside ? (e) => {
416
- if (e.target === e.currentTarget) hide(overlay.id);
417
- } : void 0,
418
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
419
- Component,
420
- {
421
- data: overlay.data,
422
- overlayId: overlay.id,
423
- onDismiss: () => hide(overlay.id)
424
- }
425
- )
426
- },
427
- overlay.id
428
- );
419
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react8.default.Fragment, { children: [
420
+ overlay.position === "center" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
421
+ import_framer_motion.motion.div,
422
+ {
423
+ className: "fixed inset-0 bg-black/60 pointer-events-auto",
424
+ initial: { opacity: 0 },
425
+ animate: { opacity: 1 },
426
+ exit: { opacity: 0 },
427
+ onClick: () => overlay.dismissOnClickOutside !== false && hide(overlay.id)
428
+ },
429
+ `backdrop-${overlay.id}`
430
+ ),
431
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
432
+ import_framer_motion.motion.div,
433
+ {
434
+ variants,
435
+ initial: "initial",
436
+ animate: "animate",
437
+ exit: "exit",
438
+ style: positionStyle,
439
+ className: "pointer-events-auto",
440
+ onClick: overlay.dismissOnClickOutside ? (e) => {
441
+ if (e.target === e.currentTarget) hide(overlay.id);
442
+ } : void 0,
443
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
444
+ Component,
445
+ {
446
+ data: overlay.data,
447
+ overlayId: overlay.id,
448
+ onDismiss: () => hide(overlay.id)
449
+ }
450
+ )
451
+ },
452
+ `content-${overlay.id}`
453
+ )
454
+ ] }, overlay.id);
429
455
  }) }) });
430
456
  }
431
457
 
@@ -444,11 +470,11 @@ function AvatarAgent({
444
470
  }
445
471
 
446
472
  // src/components/AvatarFirst.tsx
447
- var import_react14 = require("react");
473
+ var import_react15 = require("react");
448
474
  var import_core2 = require("@avatarfirst/core");
449
475
 
450
476
  // src/components/AvatarView.tsx
451
- var import_react8 = require("react");
477
+ var import_react9 = require("react");
452
478
  var import_framer_motion3 = require("framer-motion");
453
479
 
454
480
  // src/components/AvatarFallback.tsx
@@ -588,8 +614,8 @@ var sizeClasses = {
588
614
  };
589
615
  function AvatarView({ size = "medium", showStatus = true, className = "" }) {
590
616
  const { state, attachVideoElement } = useAvatar();
591
- const videoRef = (0, import_react8.useRef)(null);
592
- (0, import_react8.useEffect)(() => {
617
+ const videoRef = (0, import_react9.useRef)(null);
618
+ (0, import_react9.useEffect)(() => {
593
619
  if (videoRef.current) {
594
620
  attachVideoElement(videoRef.current);
595
621
  }
@@ -694,11 +720,11 @@ function CardOverlay({ data, onDismiss }) {
694
720
  }
695
721
 
696
722
  // src/components/overlays/FormOverlay.tsx
697
- var import_react9 = require("react");
723
+ var import_react10 = require("react");
698
724
  var import_jsx_runtime7 = require("react/jsx-runtime");
699
725
  function FormOverlay({ data, onDismiss }) {
700
726
  const { title, fields = [], submitLabel = "Submit", onSubmit } = data ?? {};
701
- const [values, setValues] = (0, import_react9.useState)({});
727
+ const [values, setValues] = (0, import_react10.useState)({});
702
728
  const handleSubmit = (e) => {
703
729
  e.preventDefault();
704
730
  onSubmit?.(values);
@@ -843,13 +869,13 @@ function ConfirmOverlay({ data, onDismiss }) {
843
869
  }
844
870
 
845
871
  // src/components/overlays/ChatOverlay.tsx
846
- var import_react10 = require("react");
872
+ var import_react11 = require("react");
847
873
  var import_framer_motion4 = require("framer-motion");
848
874
  var import_jsx_runtime11 = require("react/jsx-runtime");
849
875
  function ChatOverlay({ data, onDismiss }) {
850
876
  const { title = "Chat", messages: initialMessages = [], suggestions = [] } = data ?? {};
851
- const [messages, setMessages] = (0, import_react10.useState)(initialMessages);
852
- const [input, setInput] = (0, import_react10.useState)("");
877
+ const [messages, setMessages] = (0, import_react11.useState)(initialMessages);
878
+ const [input, setInput] = (0, import_react11.useState)("");
853
879
  const { speak } = useAvatar();
854
880
  const handleSend = async () => {
855
881
  if (!input.trim()) return;
@@ -1047,13 +1073,13 @@ function ComparisonOverlay({ data, onDismiss }) {
1047
1073
  }
1048
1074
 
1049
1075
  // src/components/overlays/CalendarOverlay.tsx
1050
- var import_react11 = require("react");
1076
+ var import_react12 = require("react");
1051
1077
  var import_jsx_runtime15 = require("react/jsx-runtime");
1052
1078
  function CalendarOverlay({ data, onDismiss }) {
1053
1079
  const { title, available_slots, onSelect } = data ?? {};
1054
- const [selectedDate, setSelectedDate] = (0, import_react11.useState)(null);
1055
- const [selectedSlot, setSelectedSlot] = (0, import_react11.useState)(null);
1056
- const groupedSlots = (0, import_react11.useMemo)(() => {
1080
+ const [selectedDate, setSelectedDate] = (0, import_react12.useState)(null);
1081
+ const [selectedSlot, setSelectedSlot] = (0, import_react12.useState)(null);
1082
+ const groupedSlots = (0, import_react12.useMemo)(() => {
1057
1083
  if (!available_slots) return /* @__PURE__ */ new Map();
1058
1084
  const groups = /* @__PURE__ */ new Map();
1059
1085
  for (const slot of available_slots) {
@@ -1200,7 +1226,7 @@ function MapOverlay({ data, onDismiss }) {
1200
1226
  }
1201
1227
 
1202
1228
  // src/components/overlays/RichTextOverlay.tsx
1203
- var import_react12 = require("react");
1229
+ var import_react13 = require("react");
1204
1230
  var import_jsx_runtime18 = require("react/jsx-runtime");
1205
1231
  function parseMarkdown(md) {
1206
1232
  let html = md.replace(/```(\w*)\n([\s\S]*?)```/g, '<pre class="bg-gray-900 text-gray-100 rounded-lg p-3 text-xs overflow-x-auto my-2"><code>$2</code></pre>').replace(/`([^`]+)`/g, '<code class="bg-gray-100 text-gray-800 px-1 py-0.5 rounded text-xs">$1</code>').replace(/^### (.+)$/gm, '<h4 class="text-base font-semibold mt-3 mb-1">$1</h4>').replace(/^## (.+)$/gm, '<h3 class="text-lg font-semibold mt-4 mb-1">$1</h3>').replace(/^# (.+)$/gm, '<h2 class="text-xl font-bold mt-4 mb-2">$1</h2>').replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:text-blue-600 underline">$1</a>').replace(/^- (.+)$/gm, '<li class="ml-4 list-disc text-sm">$1</li>').replace(/^(?!<[hlupao])(.*\S.*)$/gm, '<p class="text-sm text-gray-600 my-1">$1</p>');
@@ -1208,7 +1234,7 @@ function parseMarkdown(md) {
1208
1234
  }
1209
1235
  function RichTextOverlay({ data, onDismiss }) {
1210
1236
  const { title, content } = data ?? {};
1211
- const html = (0, import_react12.useMemo)(() => content ? parseMarkdown(content) : "", [content]);
1237
+ const html = (0, import_react13.useMemo)(() => content ? parseMarkdown(content) : "", [content]);
1212
1238
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "bg-white rounded-2xl shadow-2xl p-6 min-w-[320px] max-w-lg", children: [
1213
1239
  title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "text-lg font-semibold mb-4", children: title }),
1214
1240
  html && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
@@ -1330,7 +1356,7 @@ function ChartOverlay({ data, onDismiss }) {
1330
1356
  }
1331
1357
 
1332
1358
  // src/components/overlays/FileUploadOverlay.tsx
1333
- var import_react13 = require("react");
1359
+ var import_react14 = require("react");
1334
1360
  var import_jsx_runtime20 = require("react/jsx-runtime");
1335
1361
  var MIME_MAP = {
1336
1362
  pdf: "application/pdf",
@@ -1351,11 +1377,11 @@ function formatSize(bytes) {
1351
1377
  }
1352
1378
  function FileUploadOverlay({ data, onDismiss }) {
1353
1379
  const { title, accept, max_size, multiple, onUpload } = data ?? {};
1354
- const inputRef = (0, import_react13.useRef)(null);
1355
- const [files, setFiles] = (0, import_react13.useState)([]);
1356
- const [dragging, setDragging] = (0, import_react13.useState)(false);
1380
+ const inputRef = (0, import_react14.useRef)(null);
1381
+ const [files, setFiles] = (0, import_react14.useState)([]);
1382
+ const [dragging, setDragging] = (0, import_react14.useState)(false);
1357
1383
  const acceptMime = accept?.map((ext) => MIME_MAP[ext.toLowerCase()] ?? `.${ext}`).join(",");
1358
- const addFiles = (0, import_react13.useCallback)((newFiles) => {
1384
+ const addFiles = (0, import_react14.useCallback)((newFiles) => {
1359
1385
  if (!newFiles) return;
1360
1386
  const arr = Array.from(newFiles).filter((f) => {
1361
1387
  if (max_size && f.size > max_size) return false;
@@ -1443,25 +1469,38 @@ function FileUploadOverlay({ data, onDismiss }) {
1443
1469
  var import_jsx_runtime21 = require("react/jsx-runtime");
1444
1470
  var defaultOverlays = {
1445
1471
  card: CardOverlay,
1472
+ card_list: CardOverlay,
1473
+ detail: DetailCardOverlay,
1474
+ detail_card: DetailCardOverlay,
1446
1475
  form: FormOverlay,
1447
1476
  table: TableOverlay,
1448
1477
  progress: ProgressOverlay,
1449
1478
  confirm: ConfirmOverlay,
1450
1479
  chat: ChatOverlay,
1451
- insight: InsightOverlay
1480
+ insight: InsightOverlay,
1481
+ comparison: ComparisonOverlay,
1482
+ calendar: CalendarOverlay,
1483
+ media: MediaOverlay,
1484
+ map: MapOverlay,
1485
+ rich_text: RichTextOverlay,
1486
+ chart: ChartOverlay,
1487
+ file_upload: FileUploadOverlay
1452
1488
  };
1453
1489
  function AvatarFirstInner({
1454
1490
  client,
1491
+ onContainer,
1492
+ onActions,
1455
1493
  onOverlay,
1456
1494
  onAction
1457
1495
  }) {
1458
1496
  const { state: avatarState, speak } = useAvatar();
1459
- const { show } = useOverlay();
1460
- const [sessionId, setSessionId] = (0, import_react14.useState)(null);
1461
- const [greeting, setGreeting] = (0, import_react14.useState)(null);
1462
- const [hasGreeted, setHasGreeted] = (0, import_react14.useState)(false);
1463
- const [isProcessing, setIsProcessing] = (0, import_react14.useState)(false);
1464
- (0, import_react14.useEffect)(() => {
1497
+ const { show, hide } = useOverlay();
1498
+ const [sessionId, setSessionId] = (0, import_react15.useState)(null);
1499
+ const [greeting, setGreeting] = (0, import_react15.useState)(null);
1500
+ const [hasGreeted, setHasGreeted] = (0, import_react15.useState)(false);
1501
+ const [isProcessing, setIsProcessing] = (0, import_react15.useState)(false);
1502
+ const activeContainerRef = (0, import_react15.useRef)(null);
1503
+ (0, import_react15.useEffect)(() => {
1465
1504
  if (avatarState === "connected" && !sessionId) {
1466
1505
  client.createSession().then((session) => {
1467
1506
  setSessionId(session.sessionId);
@@ -1471,35 +1510,105 @@ function AvatarFirstInner({
1471
1510
  });
1472
1511
  }
1473
1512
  }, [avatarState, sessionId, client]);
1474
- (0, import_react14.useEffect)(() => {
1513
+ (0, import_react15.useEffect)(() => {
1475
1514
  if (sessionId && avatarState === "connected" && greeting && !hasGreeted) {
1476
1515
  setHasGreeted(true);
1477
1516
  speak(greeting);
1478
1517
  }
1479
1518
  }, [sessionId, avatarState, greeting, hasGreeted, speak]);
1480
- const handleResponse = (0, import_react14.useCallback)((data) => {
1519
+ const applyContainerAction = (0, import_react15.useCallback)((ui) => {
1520
+ if (!ui) return;
1521
+ switch (ui.action) {
1522
+ case "show": {
1523
+ const position = ui.position === "modal" ? "center" : "chest";
1524
+ const animation = ui.position === "modal" ? "fade" : "slide-up";
1525
+ show({
1526
+ id: ui.id,
1527
+ component: ui.type,
1528
+ data: {
1529
+ ...ui.data,
1530
+ title: ui.title,
1531
+ intents: ui.intents
1532
+ },
1533
+ position,
1534
+ animation,
1535
+ dismissOnClickOutside: ui.dismissible ?? true
1536
+ });
1537
+ activeContainerRef.current = ui;
1538
+ onContainer?.(ui);
1539
+ break;
1540
+ }
1541
+ case "update": {
1542
+ if (activeContainerRef.current) {
1543
+ const updated = {
1544
+ ...activeContainerRef.current,
1545
+ data: { ...activeContainerRef.current.data, ...ui.data }
1546
+ };
1547
+ show({
1548
+ id: updated.id,
1549
+ component: updated.type,
1550
+ data: {
1551
+ ...updated.data,
1552
+ title: updated.title,
1553
+ intents: updated.intents
1554
+ },
1555
+ position: updated.position === "modal" ? "center" : "chest",
1556
+ animation: "none",
1557
+ dismissOnClickOutside: updated.dismissible ?? true
1558
+ });
1559
+ activeContainerRef.current = updated;
1560
+ }
1561
+ onContainer?.(ui);
1562
+ break;
1563
+ }
1564
+ case "dismiss": {
1565
+ hide(ui.id ?? activeContainerRef.current?.id);
1566
+ activeContainerRef.current = null;
1567
+ onContainer?.(ui);
1568
+ break;
1569
+ }
1570
+ }
1571
+ }, [show, hide, onContainer]);
1572
+ const handleResponse = (0, import_react15.useCallback)((data) => {
1481
1573
  if (data.speech) {
1482
1574
  speak(data.speech);
1483
1575
  }
1484
- if (data.overlay) {
1576
+ if (data.ui) {
1577
+ applyContainerAction(data.ui);
1578
+ } else if (data.overlay) {
1485
1579
  const overlayId = `overlay-${Date.now()}`;
1486
1580
  show({
1487
1581
  id: overlayId,
1488
1582
  component: data.overlay.type,
1489
- data: data.overlay.data,
1490
- position: "right-center",
1491
- animation: "slide-left",
1583
+ data: data.overlay.data ?? {},
1584
+ position: "chest",
1585
+ animation: "slide-up",
1492
1586
  dismissOnClickOutside: true
1493
1587
  });
1494
1588
  onOverlay?.(data.overlay);
1495
1589
  }
1496
- if (data.actions) {
1497
- for (const action of data.actions) {
1498
- onAction?.(action);
1590
+ if (data.actions && data.actions.length > 0) {
1591
+ onActions?.(data.actions);
1592
+ if (onAction) {
1593
+ for (const action of data.actions) {
1594
+ onAction({ type: action.intent, payload: action.data });
1595
+ }
1499
1596
  }
1500
1597
  }
1501
- }, [speak, show, onOverlay, onAction]);
1502
- const handleSend = (0, import_react14.useCallback)(async (text) => {
1598
+ }, [speak, applyContainerAction, show, onOverlay, onActions, onAction]);
1599
+ const handleIntent = (0, import_react15.useCallback)(async (intent) => {
1600
+ if (!sessionId || isProcessing) return;
1601
+ setIsProcessing(true);
1602
+ try {
1603
+ const response = await client.sendIntent(sessionId, intent);
1604
+ handleResponse(response);
1605
+ } catch (err) {
1606
+ console.error("[AvatarFirst] Intent failed:", err);
1607
+ } finally {
1608
+ setIsProcessing(false);
1609
+ }
1610
+ }, [client, sessionId, isProcessing, handleResponse]);
1611
+ const handleSend = (0, import_react15.useCallback)(async (text) => {
1503
1612
  if (!sessionId || isProcessing) return;
1504
1613
  setIsProcessing(true);
1505
1614
  try {
@@ -1546,25 +1655,27 @@ function AvatarFirstInner({
1546
1655
  function AvatarFirst({
1547
1656
  apiKey,
1548
1657
  baseUrl,
1658
+ onContainer,
1659
+ onActions,
1549
1660
  onOverlay,
1550
1661
  onAction,
1551
1662
  onStateChange,
1552
1663
  className,
1553
1664
  overlayComponents
1554
1665
  }) {
1555
- const [agent, setAgent] = (0, import_react14.useState)(null);
1556
- const [error, setError] = (0, import_react14.useState)(false);
1557
- const client = (0, import_react14.useMemo)(
1666
+ const [agent, setAgent] = (0, import_react15.useState)(null);
1667
+ const [error, setError] = (0, import_react15.useState)(false);
1668
+ const client = (0, import_react15.useMemo)(
1558
1669
  () => new import_core2.AvatarFirstClient({ apiKey, baseUrl }),
1559
1670
  [apiKey, baseUrl]
1560
1671
  );
1561
- const mergedOverlays = (0, import_react14.useMemo)(
1672
+ const mergedOverlays = (0, import_react15.useMemo)(
1562
1673
  () => ({ ...defaultOverlays, ...overlayComponents }),
1563
1674
  [overlayComponents]
1564
1675
  );
1565
- const onStateChangeRef = (0, import_react14.useRef)(onStateChange);
1676
+ const onStateChangeRef = (0, import_react15.useRef)(onStateChange);
1566
1677
  onStateChangeRef.current = onStateChange;
1567
- (0, import_react14.useEffect)(() => {
1678
+ (0, import_react15.useEffect)(() => {
1568
1679
  let cancelled = false;
1569
1680
  async function init() {
1570
1681
  try {
@@ -1597,7 +1708,7 @@ function AvatarFirst({
1597
1708
  cancelled = true;
1598
1709
  };
1599
1710
  }, [client, baseUrl]);
1600
- (0, import_react14.useEffect)(() => {
1711
+ (0, import_react15.useEffect)(() => {
1601
1712
  return () => {
1602
1713
  agent?.destroy();
1603
1714
  };
@@ -1620,7 +1731,16 @@ function AvatarFirst({
1620
1731
  }
1621
1732
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(AvatarProvider, { agent, autoStart: true, children: [
1622
1733
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OverlayContainer, { components: mergedOverlays }),
1623
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AvatarFirstInner, { client, onOverlay, onAction })
1734
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1735
+ AvatarFirstInner,
1736
+ {
1737
+ client,
1738
+ onContainer,
1739
+ onActions,
1740
+ onOverlay,
1741
+ onAction
1742
+ }
1743
+ )
1624
1744
  ] }) });
1625
1745
  }
1626
1746
 
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { ReactNode } from 'react';
4
4
  import * as _avatarfirst_core from '@avatarfirst/core';
5
- import { AvatarAgent as AvatarAgent$1, AvatarState, OverlayInstance, OverlayConfig, AvatarEngineEvents, AvatarFirstClientConfig, MessageResponse, SessionResponse, OverlayAnimation } from '@avatarfirst/core';
5
+ import { AvatarAgent as AvatarAgent$1, AvatarState, OverlayInstance, OverlayConfig, AvatarEngineEvents, AvatarFirstClientConfig, MessageResponse, SessionResponse, ContainerAction, ActionButton, OverlayAnimation } from '@avatarfirst/core';
6
6
  import { Variants } from 'framer-motion';
7
7
  import { ClassValue } from 'clsx';
8
8
 
@@ -108,6 +108,11 @@ declare function AvatarAgent({ config, overlayComponents, autoStart, children, }
108
108
  interface AvatarFirstProps {
109
109
  apiKey: string;
110
110
  baseUrl?: string;
111
+ /** Called when a container is shown (new AFAP ui field) */
112
+ onContainer?: (container: ContainerAction) => void;
113
+ /** Called when action buttons are returned */
114
+ onActions?: (actions: ActionButton[]) => void;
115
+ /** @deprecated Use onContainer instead */
111
116
  onOverlay?: (overlay: MessageResponse['overlay']) => void;
112
117
  onAction?: (action: {
113
118
  type: string;
@@ -129,7 +134,7 @@ interface AvatarFirstProps {
129
134
  * }
130
135
  * ```
131
136
  */
132
- declare function AvatarFirst({ apiKey, baseUrl, onOverlay, onAction, onStateChange, className, overlayComponents, }: AvatarFirstProps): react_jsx_runtime.JSX.Element;
137
+ declare function AvatarFirst({ apiKey, baseUrl, onContainer, onActions, onOverlay, onAction, onStateChange, className, overlayComponents, }: AvatarFirstProps): react_jsx_runtime.JSX.Element;
133
138
 
134
139
  interface AvatarViewProps {
135
140
  /** Display size */
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { ReactNode } from 'react';
4
4
  import * as _avatarfirst_core from '@avatarfirst/core';
5
- import { AvatarAgent as AvatarAgent$1, AvatarState, OverlayInstance, OverlayConfig, AvatarEngineEvents, AvatarFirstClientConfig, MessageResponse, SessionResponse, OverlayAnimation } from '@avatarfirst/core';
5
+ import { AvatarAgent as AvatarAgent$1, AvatarState, OverlayInstance, OverlayConfig, AvatarEngineEvents, AvatarFirstClientConfig, MessageResponse, SessionResponse, ContainerAction, ActionButton, OverlayAnimation } from '@avatarfirst/core';
6
6
  import { Variants } from 'framer-motion';
7
7
  import { ClassValue } from 'clsx';
8
8
 
@@ -108,6 +108,11 @@ declare function AvatarAgent({ config, overlayComponents, autoStart, children, }
108
108
  interface AvatarFirstProps {
109
109
  apiKey: string;
110
110
  baseUrl?: string;
111
+ /** Called when a container is shown (new AFAP ui field) */
112
+ onContainer?: (container: ContainerAction) => void;
113
+ /** Called when action buttons are returned */
114
+ onActions?: (actions: ActionButton[]) => void;
115
+ /** @deprecated Use onContainer instead */
111
116
  onOverlay?: (overlay: MessageResponse['overlay']) => void;
112
117
  onAction?: (action: {
113
118
  type: string;
@@ -129,7 +134,7 @@ interface AvatarFirstProps {
129
134
  * }
130
135
  * ```
131
136
  */
132
- declare function AvatarFirst({ apiKey, baseUrl, onOverlay, onAction, onStateChange, className, overlayComponents, }: AvatarFirstProps): react_jsx_runtime.JSX.Element;
137
+ declare function AvatarFirst({ apiKey, baseUrl, onContainer, onActions, onOverlay, onAction, onStateChange, className, overlayComponents, }: AvatarFirstProps): react_jsx_runtime.JSX.Element;
133
138
 
134
139
  interface AvatarViewProps {
135
140
  /** Display size */