@akropolys/kiku 1.7.1 → 1.7.3

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.mjs CHANGED
@@ -1335,7 +1335,7 @@ function SourceImg({ src, alt, onImageClick }) {
1335
1335
  }
1336
1336
  );
1337
1337
  }
1338
- function SourcesCarousel({ sources, defaultCurrency, onSelectSource, onImageClick, referencedIds = [] }) {
1338
+ function SourcesCarousel({ sources, defaultCurrency, onSelectSource, onImageClick, referencedIds = [], compact = false }) {
1339
1339
  const client = useAkropolysContext3();
1340
1340
  const isProperty = client?.vertical === "property";
1341
1341
  const railRef = useRef5(null);
@@ -1363,7 +1363,7 @@ function SourcesCarousel({ sources, defaultCurrency, onSelectSource, onImageClic
1363
1363
  };
1364
1364
  const display = sources.filter((s) => s.id && referencedIds.includes(s.id));
1365
1365
  if (display.length === 0) return null;
1366
- return /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-sources-wrap", children: [
1366
+ return /* @__PURE__ */ jsxs6("div", { className: cn("hsk-cb-sources-wrap", compact && "hsk-cb-sources-wrap--compact"), children: [
1367
1367
  /* @__PURE__ */ jsx7("div", { className: "hsk-cb-sources", ref: railRef, children: display.map((src, si) => {
1368
1368
  const isReferenced = !!(src.id && referencedIds.includes(src.id));
1369
1369
  return /* @__PURE__ */ jsxs6(
@@ -1993,7 +1993,9 @@ function ChatModal({
1993
1993
  ] }) : displayMessages.map((msg, idx) => {
1994
1994
  const isLast = idx === displayMessages.length - 1;
1995
1995
  const isUser = msg.role === "user";
1996
- const displayContent = !isUser && isLast && lastIntent === "compare" && sources.length >= 2 ? stripMarkdownTables(msg.content) : msg.content;
1996
+ const compareSources = sources.filter((s) => s.id && referencedIds.includes(s.id));
1997
+ const showMatrix = isLast && lastIntent === "compare" && compareSources.length >= 2;
1998
+ const displayContent = !isUser && showMatrix ? stripMarkdownTables(msg.content) : msg.content;
1997
1999
  return /* @__PURE__ */ jsx7("div", { className: "hsk-cb-msg-group", ref: (el) => {
1998
2000
  messageRefs.current[idx] = el;
1999
2001
  }, children: isUser ? /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-user-msg", children: [
@@ -2019,18 +2021,21 @@ function ChatModal({
2019
2021
  /* @__PURE__ */ jsx7("span", { className: "hsk-cb-viz-spinner" }),
2020
2022
  /* @__PURE__ */ jsx7("span", { children: "Visualizing\u2026" })
2021
2023
  ] }),
2022
- msg.visualization && /* @__PURE__ */ jsx7("div", { className: "hsk-cb-viz", children: /* @__PURE__ */ jsx7(
2023
- "img",
2024
- {
2025
- src: msg.visualization,
2026
- alt: "Product visualized in your photo",
2027
- className: "hsk-markdown-img",
2028
- onError: (e) => {
2029
- e.target.style.display = "none";
2024
+ msg.visualization && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-viz", children: [
2025
+ /* @__PURE__ */ jsx7(
2026
+ "img",
2027
+ {
2028
+ src: msg.visualization,
2029
+ alt: "Product visualized in your photo",
2030
+ className: "hsk-markdown-img",
2031
+ onError: (e) => {
2032
+ e.target.style.display = "none";
2033
+ }
2030
2034
  }
2031
- }
2032
- ) }),
2033
- isLast && lastIntent === "compare" && sources.length >= 2 && /* @__PURE__ */ jsx7(ComparisonMatrix, { sources, defaultCurrency }),
2035
+ ),
2036
+ /* @__PURE__ */ jsx7("div", { className: "hsk-cb-viz-disclaimer", children: "AI-generated preview \u2014 colours, size and placement may differ from the real product." })
2037
+ ] }),
2038
+ showMatrix && /* @__PURE__ */ jsx7(ComparisonMatrix, { sources: compareSources, defaultCurrency }),
2034
2039
  (() => {
2035
2040
  const msgReferencedIds = isLast ? referencedIds : msg.referencedIds ?? [];
2036
2041
  const msgSources = isLast ? sources : msg.sources ?? [];
@@ -2044,7 +2049,8 @@ function ChatModal({
2044
2049
  defaultCurrency,
2045
2050
  onSelectSource: handleSourceClick,
2046
2051
  onImageClick: setLightboxSrc,
2047
- referencedIds: msgReferencedIds
2052
+ referencedIds: msgReferencedIds,
2053
+ compact: !!msg.visualization
2048
2054
  }
2049
2055
  );
2050
2056
  })(),
@@ -2085,6 +2091,7 @@ function ChatModal({
2085
2091
  loading && !streaming && /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-typing-row", style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
2086
2092
  /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-thinking-icon", children: [
2087
2093
  /* @__PURE__ */ jsx7("svg", { className: "hsk-brand-mark", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx7("path", { d: "M39.4 10.4 Q44 0 48.6 10.4 L86.1 95.8 Q88 100 83.4 100 L4.6 100 Q0 100 1.9 95.8 Z M24 100 L24 65 Q24 60 27.4 56.3 Q44 38 60.6 56.3 Q64 60 64 65 L64 100 Z", transform: "translate(22.7 19) scale(0.62)", fillRule: "evenodd" }) }),
2094
+ /* @__PURE__ */ jsx7("svg", { className: "hsk-brand-mark hsk-brand-mark--sheen", viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsx7("path", { d: "M39.4 10.4 Q44 0 48.6 10.4 L86.1 95.8 Q88 100 83.4 100 L4.6 100 Q0 100 1.9 95.8 Z M24 100 L24 65 Q24 60 27.4 56.3 Q44 38 60.6 56.3 Q64 60 64 65 L64 100 Z", transform: "translate(22.7 19) scale(0.62)", fillRule: "evenodd" }) }),
2088
2095
  /* @__PURE__ */ jsx7("span", { className: "hsk-handle-orbit", children: /* @__PURE__ */ jsxs6("span", { className: "hsk-handle-ring", children: [
2089
2096
  /* @__PURE__ */ jsx7("span", { className: "hsk-handle-ball" }),
2090
2097
  /* @__PURE__ */ jsx7("span", { className: "hsk-handle-ball" }),