@xbrain-swe/nova-chat-widget 0.1.6 → 0.1.7

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.d.cts CHANGED
@@ -148,7 +148,7 @@ type ViewRenderer = (props: {
148
148
  }) => React.ReactNode;
149
149
  type ViewRendererMap = Partial<Record<ViewKind, ViewRenderer>>;
150
150
 
151
- declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdropStyle, defaultOpen, idleText, onVerdictAction, }: {
151
+ declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdropStyle, defaultOpen, idleText, avatarSize, onVerdictAction, }: {
152
152
  /** 특정 view만 자체 컴포넌트로 덮어쓰고 싶을 때 — 지정 안 한 view는 기본 렌더러를 쓴다. */
153
153
  viewRenderers?: ViewRendererMap;
154
154
  /** Provider의 기본 봇 대신 다른 봇과 고정적으로 대화하고 싶을 때. 힌트를 눌러 열면
@@ -167,6 +167,9 @@ declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdr
167
167
  defaultOpen?: boolean;
168
168
  /** 기본(idle) 상태 바 문구. */
169
169
  idleText?: string;
170
+ /** 바(AI 버튼)의 동그란 아바타 지름(px), 기본 28. 바의 접힌 원은 52px이라 44~48이면 원을 거의 채운다.
171
+ * 채팅 헤더의 아바타는 이 값에 맞춰 24~36px로 따라 커진다. */
172
+ avatarSize?: number;
170
173
  /** 판단 카드의 행동 버튼을 눌렀을 때 — 실제 동작(상담신청 폼 열기, 섹션 스크롤 등)은
171
174
  * 소비자가 정한다. SDK는 버튼에 적힌 `action` 문자열을 그대로 넘겨줄 뿐 뜻을 모른다. */
172
175
  onVerdictAction?: (action: string) => void;
package/dist/index.d.ts CHANGED
@@ -148,7 +148,7 @@ type ViewRenderer = (props: {
148
148
  }) => React.ReactNode;
149
149
  type ViewRendererMap = Partial<Record<ViewKind, ViewRenderer>>;
150
150
 
151
- declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdropStyle, defaultOpen, idleText, onVerdictAction, }: {
151
+ declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdropStyle, defaultOpen, idleText, avatarSize, onVerdictAction, }: {
152
152
  /** 특정 view만 자체 컴포넌트로 덮어쓰고 싶을 때 — 지정 안 한 view는 기본 렌더러를 쓴다. */
153
153
  viewRenderers?: ViewRendererMap;
154
154
  /** Provider의 기본 봇 대신 다른 봇과 고정적으로 대화하고 싶을 때. 힌트를 눌러 열면
@@ -167,6 +167,9 @@ declare function XbNovaChat({ viewRenderers, botId, barStyle, panelStyle, backdr
167
167
  defaultOpen?: boolean;
168
168
  /** 기본(idle) 상태 바 문구. */
169
169
  idleText?: string;
170
+ /** 바(AI 버튼)의 동그란 아바타 지름(px), 기본 28. 바의 접힌 원은 52px이라 44~48이면 원을 거의 채운다.
171
+ * 채팅 헤더의 아바타는 이 값에 맞춰 24~36px로 따라 커진다. */
172
+ avatarSize?: number;
170
173
  /** 판단 카드의 행동 버튼을 눌렀을 때 — 실제 동작(상담신청 폼 열기, 섹션 스크롤 등)은
171
174
  * 소비자가 정한다. SDK는 버튼에 적힌 `action` 문자열을 그대로 넘겨줄 뿐 뜻을 모른다. */
172
175
  onVerdictAction?: (action: string) => void;
package/dist/index.js CHANGED
@@ -1476,6 +1476,7 @@ function XbNovaChat({
1476
1476
  backdropStyle,
1477
1477
  defaultOpen = false,
1478
1478
  idleText = "AI\uC5D0\uAC8C \uC774 \uCC28 \uBB3C\uC5B4\uBCF4\uAE30",
1479
+ avatarSize = 28,
1479
1480
  onVerdictAction
1480
1481
  }) {
1481
1482
  const { auth, trackRegistry, factsRegistry, visitorId, clientActionHandlers, theme } = useXbNovaInternal();
@@ -1483,6 +1484,7 @@ function XbNovaChat({
1483
1484
  "--xbnova-accent-1": theme.accentFrom,
1484
1485
  "--xbnova-accent-2": theme.accentTo
1485
1486
  };
1487
+ const headerAvatarSize = Math.min(36, Math.max(24, Math.round(avatarSize * 0.8)));
1486
1488
  const avatarGradientStyle = {
1487
1489
  background: "linear-gradient(135deg, var(--xbnova-accent-1), var(--xbnova-accent-2))"
1488
1490
  };
@@ -1631,7 +1633,8 @@ function XbNovaChat({
1631
1633
  Avatar,
1632
1634
  {
1633
1635
  branding: onboarding?.branding,
1634
- className: "h-7 w-7 text-[11px] shadow-md",
1636
+ size: avatarSize,
1637
+ className: "shadow-md",
1635
1638
  gradient: avatarGradientStyle
1636
1639
  }
1637
1640
  )
@@ -1679,7 +1682,8 @@ function XbNovaChat({
1679
1682
  Avatar,
1680
1683
  {
1681
1684
  branding: onboarding?.branding,
1682
- className: "h-6 w-6 shrink-0 text-[10px]",
1685
+ size: headerAvatarSize,
1686
+ className: "shrink-0",
1683
1687
  gradient: avatarGradientStyle
1684
1688
  }
1685
1689
  ),
@@ -1797,9 +1801,11 @@ function XbNovaChat({
1797
1801
  }
1798
1802
  function Avatar({
1799
1803
  branding,
1800
- className,
1804
+ size,
1805
+ className = "",
1801
1806
  gradient
1802
1807
  }) {
1808
+ const box = { width: size, height: size };
1803
1809
  const logoUrl = branding?.logo_url?.trim() ?? "";
1804
1810
  const [failedUrl, setFailedUrl] = useState4("");
1805
1811
  if (logoUrl && failedUrl !== logoUrl) {
@@ -1809,6 +1815,7 @@ function Avatar({
1809
1815
  src: logoUrl,
1810
1816
  alt: "",
1811
1817
  onError: () => setFailedUrl(logoUrl),
1818
+ style: box,
1812
1819
  className: `${className} flex-none rounded-full bg-white object-cover`
1813
1820
  }
1814
1821
  );
@@ -1817,8 +1824,8 @@ function Avatar({
1817
1824
  return /* @__PURE__ */ jsx7(
1818
1825
  "span",
1819
1826
  {
1820
- className: `${className} flex items-center justify-center rounded-full font-bold text-white`,
1821
- style: gradient,
1827
+ className: `${className} flex flex-none items-center justify-center rounded-full font-bold text-white`,
1828
+ style: { ...gradient, ...box, fontSize: Math.max(10, Math.round(size * 0.4)) },
1822
1829
  children: text
1823
1830
  }
1824
1831
  );