@akropolys/kiku 1.5.18 → 1.5.19

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
@@ -71,7 +71,7 @@ function SearchBar({
71
71
  }
72
72
  ignoreNextQueryChange.current = true;
73
73
  setOpen(false);
74
- setQuery(r.product.name ?? "");
74
+ setQuery(r.entity.title ?? r.entity.name ?? "");
75
75
  onSelect?.(r);
76
76
  };
77
77
  const handleCommitSearch = () => {
@@ -151,8 +151,8 @@ function SearchBar({
151
151
  children: [
152
152
  /* @__PURE__ */ jsx("span", { className: "hsk-sb-row-icon", children: /* @__PURE__ */ jsx(SearchIcon, {}) }),
153
153
  /* @__PURE__ */ jsxs("div", { className: "hsk-sb-row-body", children: [
154
- /* @__PURE__ */ jsx("div", { className: "hsk-sb-row-title", children: r.product.name }),
155
- (r.product.category || r.product.brand) && /* @__PURE__ */ jsx("div", { className: "hsk-sb-row-sub", children: r.product.category ?? r.product.brand })
154
+ /* @__PURE__ */ jsx("div", { className: "hsk-sb-row-title", children: r.entity.title ?? r.entity.name }),
155
+ (r.entity.category || r.entity.brand) && /* @__PURE__ */ jsx("div", { className: "hsk-sb-row-sub", children: r.entity.category ?? r.entity.brand })
156
156
  ] })
157
157
  ]
158
158
  },
@@ -653,7 +653,7 @@ I couldn't find any matching products in the store.`;
653
653
  }) }) });
654
654
  }
655
655
  const featured = sources.filter((src) => src.id && referencedIds.includes(src.id));
656
- const general = featured.length > 0 ? [] : sources.filter((src) => !src.id || !referencedIds.includes(src.id));
656
+ const general = referencedIds.length > 0 ? [] : sources.filter((src) => !src.id || !referencedIds.includes(src.id));
657
657
  return /* @__PURE__ */ jsxs4("div", { className: "hsk-sources-container", children: [
658
658
  featured.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "hsk-sources-group", style: { marginBottom: "10px" }, children: [
659
659
  /* @__PURE__ */ jsx5("div", { className: "hsk-sources-group-title", children: "\u2B50 Featured in response" }),
@@ -1325,7 +1325,7 @@ function SourcesCarousel({ sources, defaultCurrency, onSelectSource, referencedI
1325
1325
  railRef.current?.scrollBy({ left: 170, behavior: "smooth" });
1326
1326
  };
1327
1327
  const referenced = sources.filter((s) => s.id && referencedIds.includes(s.id));
1328
- const display = referenced.length > 0 ? referenced : sources;
1328
+ const display = referencedIds.length > 0 ? referenced : sources;
1329
1329
  return /* @__PURE__ */ jsxs6("div", { className: "hsk-cb-sources-wrap", children: [
1330
1330
  /* @__PURE__ */ jsx7("div", { className: "hsk-cb-sources", ref: railRef, children: display.map((src, si) => {
1331
1331
  const isReferenced = !!(src.id && referencedIds.includes(src.id));
@@ -2440,7 +2440,7 @@ function SparkleModal({
2440
2440
  if (!initialProduct && !fetchedProduct) {
2441
2441
  client.api.searchVector(productName, 1).then((res) => {
2442
2442
  if (res.results && res.results.length > 0) {
2443
- setFetchedProduct(res.results[0].product);
2443
+ setFetchedProduct(res.results[0].entity);
2444
2444
  }
2445
2445
  }).catch((err) => console.error("[Akropolys] Failed to fetch product details", err));
2446
2446
  }
@@ -2473,7 +2473,7 @@ function SparkleModal({
2473
2473
  const prevent = onNavigate?.(r);
2474
2474
  if (prevent !== false) {
2475
2475
  onClose();
2476
- if (r.product.url) window.location.href = r.product.url;
2476
+ if (r.entity.url) window.location.href = r.entity.url;
2477
2477
  }
2478
2478
  };
2479
2479
  const handleSend = async (text) => {
@@ -2560,7 +2560,7 @@ Question: ${q}`;
2560
2560
  /* @__PURE__ */ jsx8("div", { className: "hsk-cb-ai-text", children: renderMarkdown(msg.content) }),
2561
2561
  idx === 0 && displayProduct && /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-attachment-deck", children: [
2562
2562
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-main-card", children: [
2563
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-main-card-img", children: displayProduct.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: displayProduct.images[0], alt: displayProduct.name }) : /* @__PURE__ */ jsx8("span", { children: "\u{1F6CD}" }) }),
2563
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-main-card-img", children: displayProduct.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: displayProduct.images[0], alt: displayProduct.name }) : /* @__PURE__ */ jsx8("span", { children: "\xF0\u0178\u203A\x8D" }) }),
2564
2564
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-main-card-info", children: [
2565
2565
  /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-main-card-brand", children: displayProduct.brand || displayProduct.category || "Product" }),
2566
2566
  /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-main-card-name", children: displayProduct.name }),
@@ -2583,8 +2583,8 @@ Question: ${q}`;
2583
2583
  (() => {
2584
2584
  const similarProducts = results.filter(
2585
2585
  (r) => {
2586
- const isSameName = !!(r.product.name && displayProduct?.name && r.product.name.toLowerCase() === displayProduct.name.toLowerCase());
2587
- const isSameSlug = r.product.slug && displayProduct?.slug && r.product.slug.toLowerCase() === displayProduct.slug.toLowerCase();
2586
+ const isSameName = !!(r.entity.name && displayProduct?.name && r.entity.name.toLowerCase() === displayProduct.name.toLowerCase());
2587
+ const isSameSlug = r.entity.slug && displayProduct?.slug && r.entity.slug.toLowerCase() === displayProduct.slug.toLowerCase();
2588
2588
  return !isSameName && !isSameSlug;
2589
2589
  }
2590
2590
  );
@@ -2592,17 +2592,17 @@ Question: ${q}`;
2592
2592
  return /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-similar-carousel-inline", children: [
2593
2593
  /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-title", children: "Similar Products" }),
2594
2594
  /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-list", children: similarProducts.map((r) => {
2595
- const price = parseFloat(r.product.price?.replace(/[^0-9.]/g, "") || "0");
2596
- const currency = r.product.currency ?? "KES";
2595
+ const price = parseFloat(r.entity.price?.replace(/[^0-9.]/g, "") || "0");
2596
+ const currency = r.entity.currency ?? "KES";
2597
2597
  return /* @__PURE__ */ jsxs7(
2598
2598
  "div",
2599
2599
  {
2600
2600
  className: "hsk-sp-mobile-similar-carousel-item",
2601
2601
  onClick: () => handleNav(r),
2602
2602
  children: [
2603
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-img", children: r.product.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: r.product.images[0], alt: r.product.name }) : /* @__PURE__ */ jsx8("span", { children: "\u{1F6CD}" }) }),
2603
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-img", children: r.entity.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: r.entity.images[0], alt: r.entity.name }) : /* @__PURE__ */ jsx8("span", { children: "\xF0\u0178\u203A\x8D" }) }),
2604
2604
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-similar-carousel-meta", children: [
2605
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-name", title: r.product.name, children: r.product.name }),
2605
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-mobile-similar-carousel-name", title: r.entity.name, children: r.entity.name }),
2606
2606
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-mobile-similar-carousel-price", children: [
2607
2607
  currency,
2608
2608
  " ",
@@ -2706,7 +2706,7 @@ Question: ${q}`;
2706
2706
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-details-pane", children: [
2707
2707
  displayProduct && /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-product-profile-container", children: [
2708
2708
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-product-profile", children: [
2709
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-details-imgwrap", children: displayProduct.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: displayProduct.images[0], alt: displayProduct.name }) : /* @__PURE__ */ jsx8("span", { className: "hsk-sp-img-placeholder", children: "\u{1F6CD}" }) }),
2709
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-details-imgwrap", children: displayProduct.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: displayProduct.images[0], alt: displayProduct.name }) : /* @__PURE__ */ jsx8("span", { className: "hsk-sp-img-placeholder", children: "\xF0\u0178\u203A\x8D" }) }),
2710
2710
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-details-meta", children: [
2711
2711
  displayProduct.brand && /* @__PURE__ */ jsx8("span", { className: "hsk-sp-item-brand", children: displayProduct.brand }),
2712
2712
  displayProduct.category && /* @__PURE__ */ jsx8("span", { className: "hsk-sp-item-cat", children: displayProduct.category }),
@@ -2723,7 +2723,7 @@ Question: ${q}`;
2723
2723
  ] }),
2724
2724
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-item-meta-badges", children: [
2725
2725
  displayProduct.rating && /* @__PURE__ */ jsxs7("span", { className: "hsk-sp-meta-badge hsk-sp-meta-badge-rating", children: [
2726
- "\u2605 ",
2726
+ "\xE2\u02DC\u2026 ",
2727
2727
  parseFloat(displayProduct.rating.toString()).toFixed(1),
2728
2728
  " ",
2729
2729
  displayProduct.reviewCount ? `(${displayProduct.reviewCount})` : ""
@@ -2753,8 +2753,8 @@ Question: ${q}`;
2753
2753
  /* @__PURE__ */ jsx8("div", { className: "hsk-sp-results", children: (() => {
2754
2754
  const similarProducts = results.filter(
2755
2755
  (r) => {
2756
- const isSameName = !!(r.product.name && displayProduct?.name && r.product.name.toLowerCase() === displayProduct.name.toLowerCase());
2757
- const isSameSlug = r.product.slug && displayProduct?.slug && r.product.slug.toLowerCase() === displayProduct.slug.toLowerCase();
2756
+ const isSameName = !!(r.entity.name && displayProduct?.name && r.entity.name.toLowerCase() === displayProduct.name.toLowerCase());
2757
+ const isSameSlug = r.entity.slug && displayProduct?.slug && r.entity.slug.toLowerCase() === displayProduct.slug.toLowerCase();
2758
2758
  return !isSameName && !isSameSlug;
2759
2759
  }
2760
2760
  );
@@ -2762,8 +2762,8 @@ Question: ${q}`;
2762
2762
  return /* @__PURE__ */ jsx8("div", { className: "hsk-sp-empty", children: "No similar products found." });
2763
2763
  }
2764
2764
  return similarProducts.map((r, i) => {
2765
- const price = parseFloat(r.product.price?.replace(/[^0-9.]/g, "") || "0");
2766
- const currency = r.product.currency ?? "KES";
2765
+ const price = parseFloat(r.entity.price?.replace(/[^0-9.]/g, "") || "0");
2766
+ const currency = r.entity.currency ?? "KES";
2767
2767
  return /* @__PURE__ */ jsxs7(
2768
2768
  "div",
2769
2769
  {
@@ -2771,11 +2771,11 @@ Question: ${q}`;
2771
2771
  style: { animationDelay: `${i * 55}ms`, cursor: "pointer" },
2772
2772
  onClick: () => handleNav(r),
2773
2773
  children: [
2774
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-img-wrap", children: r.product.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: r.product.images[0], alt: r.product.name }) : /* @__PURE__ */ jsx8("span", { className: "hsk-sp-img-placeholder", children: "\u{1F6CD}" }) }),
2774
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-img-wrap", children: r.entity.images?.[0] ? /* @__PURE__ */ jsx8("img", { src: r.entity.images[0], alt: r.entity.name }) : /* @__PURE__ */ jsx8("span", { className: "hsk-sp-img-placeholder", children: "\xF0\u0178\u203A\x8D" }) }),
2775
2775
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-item-body", children: [
2776
2776
  /* @__PURE__ */ jsxs7("div", { children: [
2777
- r.product.category && /* @__PURE__ */ jsx8("div", { className: "hsk-sp-item-cat", children: r.product.category }),
2778
- /* @__PURE__ */ jsx8("div", { className: "hsk-sp-item-name", title: r.product.name, children: r.product.name })
2777
+ r.entity.category && /* @__PURE__ */ jsx8("div", { className: "hsk-sp-item-cat", children: r.entity.category }),
2778
+ /* @__PURE__ */ jsx8("div", { className: "hsk-sp-item-name", title: r.entity.name, children: r.entity.name })
2779
2779
  ] }),
2780
2780
  /* @__PURE__ */ jsxs7("div", { className: "hsk-sp-item-price-row", children: [
2781
2781
  /* @__PURE__ */ jsx8("span", { className: "hsk-sp-item-currency", children: currency }),