@akropolys/kiku 1.5.8 → 1.5.10
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.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +180 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -103
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -116,8 +116,9 @@ declare function CheckoutModal({ onClose, theme, customStyles, hskThemeAttr }: {
|
|
|
116
116
|
interface ComparisonMatrixProps {
|
|
117
117
|
sources: ChatSource[];
|
|
118
118
|
defaultCurrency?: string;
|
|
119
|
+
displayConfig?: Record<string, string>;
|
|
119
120
|
}
|
|
120
|
-
declare function ComparisonMatrix({ sources, defaultCurrency }: ComparisonMatrixProps): React.JSX.Element | null;
|
|
121
|
+
declare function ComparisonMatrix({ sources, defaultCurrency, displayConfig }: ComparisonMatrixProps): React.JSX.Element | null;
|
|
121
122
|
|
|
122
123
|
interface VoiceButtonProps {
|
|
123
124
|
onTranscript: (text: string) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -116,8 +116,9 @@ declare function CheckoutModal({ onClose, theme, customStyles, hskThemeAttr }: {
|
|
|
116
116
|
interface ComparisonMatrixProps {
|
|
117
117
|
sources: ChatSource[];
|
|
118
118
|
defaultCurrency?: string;
|
|
119
|
+
displayConfig?: Record<string, string>;
|
|
119
120
|
}
|
|
120
|
-
declare function ComparisonMatrix({ sources, defaultCurrency }: ComparisonMatrixProps): React.JSX.Element | null;
|
|
121
|
+
declare function ComparisonMatrix({ sources, defaultCurrency, displayConfig }: ComparisonMatrixProps): React.JSX.Element | null;
|
|
121
122
|
|
|
122
123
|
interface VoiceButtonProps {
|
|
123
124
|
onTranscript: (text: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -106,7 +106,7 @@ function SearchBar({
|
|
|
106
106
|
}
|
|
107
107
|
ignoreNextQueryChange.current = true;
|
|
108
108
|
setOpen(false);
|
|
109
|
-
setQuery(r.product.name);
|
|
109
|
+
setQuery(r.product.name ?? "");
|
|
110
110
|
onSelect?.(r);
|
|
111
111
|
};
|
|
112
112
|
const handleCommitSearch = () => {
|
|
@@ -798,66 +798,51 @@ I couldn't find any matching products in the store.`;
|
|
|
798
798
|
// src/components/KikuButton.tsx
|
|
799
799
|
var import_react5 = require("react");
|
|
800
800
|
var import_react_dom = require("react-dom");
|
|
801
|
-
var import_sdk4 = require("@akropolys/sdk");
|
|
802
801
|
var import_sdk5 = require("@akropolys/sdk");
|
|
803
802
|
var import_sdk6 = require("@akropolys/sdk");
|
|
803
|
+
var import_sdk7 = require("@akropolys/sdk");
|
|
804
804
|
|
|
805
805
|
// src/components/ComparisonMatrix.tsx
|
|
806
|
+
var import_sdk4 = require("@akropolys/sdk");
|
|
806
807
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
807
|
-
function
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
808
|
+
function normalizeKey(key) {
|
|
809
|
+
let s = key.replace(/[_-]+/g, " ");
|
|
810
|
+
s = s.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
811
|
+
return s.split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
812
|
+
}
|
|
813
|
+
function getBaseGroup(normalized) {
|
|
814
|
+
const norm = normalized.toLowerCase().trim();
|
|
815
|
+
if (norm.startsWith("salary") || norm.startsWith("pay") || norm.startsWith("wage")) {
|
|
816
|
+
return "Salary";
|
|
813
817
|
}
|
|
814
|
-
if (
|
|
815
|
-
|
|
816
|
-
if (mTv) {
|
|
817
|
-
const size = parseInt(mTv[1], 10);
|
|
818
|
-
if (size >= 24 && size <= 120) {
|
|
819
|
-
return `${size} inches`;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
818
|
+
if (norm.startsWith("price") || norm.startsWith("cost") || norm.startsWith("rate")) {
|
|
819
|
+
return "Price";
|
|
822
820
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
if (
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
const m = name.match(/(\d+)\s*GB(?!\s*RAM)/i);
|
|
834
|
-
return m ? `${m[1]} GB` : null;
|
|
835
|
-
}
|
|
836
|
-
function extractRAM(name) {
|
|
837
|
-
const m = name.match(/(\d+)\s*GB\s*RAM/i);
|
|
838
|
-
return m ? `${m[1]} GB` : null;
|
|
839
|
-
}
|
|
840
|
-
function extractCamera(name) {
|
|
841
|
-
const m = name.match(/(\d+)\s*MP/i);
|
|
842
|
-
return m ? `${m[1]} MP` : null;
|
|
843
|
-
}
|
|
844
|
-
function extractBattery(name) {
|
|
845
|
-
const m = name.match(/(\d{3,5})\s*mAh/i);
|
|
846
|
-
return m ? `${m[1]} mAh` : null;
|
|
821
|
+
if (norm.startsWith("location") || norm.startsWith("address") || norm.startsWith("city")) {
|
|
822
|
+
return "Location";
|
|
823
|
+
}
|
|
824
|
+
if (norm.startsWith("image") || norm.startsWith("photo") || norm.startsWith("pic") || norm.startsWith("thumb")) {
|
|
825
|
+
return "Image";
|
|
826
|
+
}
|
|
827
|
+
if (norm.startsWith("title") || norm.startsWith("name") || norm.startsWith("label") || norm.startsWith("heading")) {
|
|
828
|
+
return "Title";
|
|
829
|
+
}
|
|
830
|
+
return normalized;
|
|
847
831
|
}
|
|
848
|
-
function buildRows(products,
|
|
832
|
+
function buildRows(products, displayConfig, defaultCurrency = "KES") {
|
|
849
833
|
const rows = [];
|
|
834
|
+
const resolved = products.map((p) => (0, import_sdk4.resolveDisplayFields)(p.fields || p, displayConfig));
|
|
850
835
|
rows.push({
|
|
851
836
|
label: "Product Preview",
|
|
852
|
-
values:
|
|
837
|
+
values: resolved.map((r) => r.image || null),
|
|
853
838
|
type: "image"
|
|
854
839
|
});
|
|
855
|
-
const prices =
|
|
856
|
-
const n = parseFloat(String(
|
|
840
|
+
const prices = resolved.map((r) => {
|
|
841
|
+
const n = parseFloat(String(r.price ?? "").replace(/[^0-9.]/g, ""));
|
|
857
842
|
return isNaN(n) ? null : n;
|
|
858
843
|
});
|
|
859
|
-
const priceLabels = products.map((
|
|
860
|
-
const c =
|
|
844
|
+
const priceLabels = products.map((p, i) => {
|
|
845
|
+
const c = p.fields?.currency || p.currency || defaultCurrency;
|
|
861
846
|
const n = prices[i];
|
|
862
847
|
return n !== null ? `${c} ${n.toLocaleString("en-KE", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null;
|
|
863
848
|
});
|
|
@@ -869,38 +854,101 @@ function buildRows(products, currency) {
|
|
|
869
854
|
type: "price",
|
|
870
855
|
bestIdx: minPrice !== null ? prices.indexOf(minPrice) : void 0
|
|
871
856
|
});
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
857
|
+
const keysToExclude = /* @__PURE__ */ new Set([
|
|
858
|
+
"url",
|
|
859
|
+
"fields",
|
|
860
|
+
"id",
|
|
861
|
+
"score",
|
|
862
|
+
"currency",
|
|
863
|
+
"status",
|
|
864
|
+
"indexed_at",
|
|
865
|
+
"indexedAt"
|
|
866
|
+
]);
|
|
867
|
+
if (displayConfig) {
|
|
868
|
+
Object.values(displayConfig).forEach((v) => {
|
|
869
|
+
if (v) keysToExclude.add(v);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
const commonKeys = [
|
|
873
|
+
"title",
|
|
874
|
+
"name",
|
|
875
|
+
"label",
|
|
876
|
+
"headline",
|
|
877
|
+
"subject",
|
|
878
|
+
"job_title",
|
|
879
|
+
"listing_title",
|
|
880
|
+
"common_name",
|
|
881
|
+
"product_name",
|
|
882
|
+
"image",
|
|
883
|
+
"images",
|
|
884
|
+
"thumbnail",
|
|
885
|
+
"photo",
|
|
886
|
+
"cover",
|
|
887
|
+
"featured_image",
|
|
888
|
+
"hero_image",
|
|
889
|
+
"listing_image",
|
|
890
|
+
"logo",
|
|
891
|
+
"price",
|
|
892
|
+
"cost",
|
|
893
|
+
"listingPrice",
|
|
894
|
+
"rate",
|
|
895
|
+
"fee",
|
|
896
|
+
"startingFrom",
|
|
897
|
+
"brand",
|
|
898
|
+
"category",
|
|
899
|
+
"location",
|
|
900
|
+
"type",
|
|
901
|
+
"variety",
|
|
902
|
+
"make"
|
|
881
903
|
];
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
904
|
+
commonKeys.forEach((k) => keysToExclude.add(k));
|
|
905
|
+
const allFieldKeys = /* @__PURE__ */ new Set();
|
|
906
|
+
products.forEach((p) => {
|
|
907
|
+
const f = p.fields || p;
|
|
908
|
+
if (f) {
|
|
909
|
+
Object.keys(f).forEach((k) => {
|
|
910
|
+
if (!keysToExclude.has(k)) {
|
|
911
|
+
allFieldKeys.add(k);
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
const groupedKeys = /* @__PURE__ */ new Map();
|
|
917
|
+
allFieldKeys.forEach((k) => {
|
|
918
|
+
const norm = normalizeKey(k);
|
|
919
|
+
const base = getBaseGroup(norm);
|
|
920
|
+
if (!groupedKeys.has(base)) {
|
|
921
|
+
groupedKeys.set(base, []);
|
|
922
|
+
}
|
|
923
|
+
groupedKeys.get(base).push(k);
|
|
924
|
+
});
|
|
925
|
+
const sortedGroups = Array.from(groupedKeys.keys()).sort();
|
|
926
|
+
sortedGroups.forEach((group) => {
|
|
927
|
+
const originalKeys = groupedKeys.get(group);
|
|
928
|
+
const values = products.map((p) => {
|
|
929
|
+
const f = p.fields || p;
|
|
930
|
+
if (!f) return null;
|
|
931
|
+
for (const k of originalKeys) {
|
|
932
|
+
if (f[k] !== void 0 && f[k] !== null) {
|
|
933
|
+
if (typeof f[k] === "object") {
|
|
934
|
+
return JSON.stringify(f[k]);
|
|
935
|
+
}
|
|
936
|
+
return String(f[k]);
|
|
937
|
+
}
|
|
898
938
|
}
|
|
939
|
+
return null;
|
|
940
|
+
});
|
|
941
|
+
if (values.some((v) => v !== null)) {
|
|
942
|
+
rows.push({
|
|
943
|
+
label: group,
|
|
944
|
+
values,
|
|
945
|
+
type: "text"
|
|
946
|
+
});
|
|
899
947
|
}
|
|
900
|
-
|
|
901
|
-
}
|
|
948
|
+
});
|
|
902
949
|
const avail = products.map((s) => {
|
|
903
|
-
const
|
|
950
|
+
const f = s.fields || s;
|
|
951
|
+
const a = f.availability || "";
|
|
904
952
|
if (!a) return null;
|
|
905
953
|
if (/in.?stock/i.test(a)) return "In-Stock";
|
|
906
954
|
if (/out.?of.?stock/i.test(a)) return "Out of Stock";
|
|
@@ -909,7 +957,10 @@ function buildRows(products, currency) {
|
|
|
909
957
|
if (avail.some(Boolean)) {
|
|
910
958
|
rows.push({ label: "Availability", values: avail, type: "availability" });
|
|
911
959
|
}
|
|
912
|
-
const cats = products.map((s) =>
|
|
960
|
+
const cats = products.map((s) => {
|
|
961
|
+
const f = s.fields || s;
|
|
962
|
+
return f.category || null;
|
|
963
|
+
});
|
|
913
964
|
if (cats.some(Boolean)) rows.push({ label: "Category", values: cats });
|
|
914
965
|
return rows;
|
|
915
966
|
}
|
|
@@ -949,16 +1000,15 @@ function AvailabilityCell({ value }) {
|
|
|
949
1000
|
value
|
|
950
1001
|
] });
|
|
951
1002
|
}
|
|
952
|
-
function ComparisonMatrix({ sources, defaultCurrency = "KES" }) {
|
|
953
|
-
if (sources.length < 2) return null;
|
|
1003
|
+
function ComparisonMatrix({ sources, defaultCurrency = "KES", displayConfig }) {
|
|
1004
|
+
if (!sources || sources.length < 2) return null;
|
|
954
1005
|
const products = sources.slice(0, 3);
|
|
955
|
-
const rows = buildRows(products, defaultCurrency);
|
|
1006
|
+
const rows = buildRows(products, displayConfig, defaultCurrency);
|
|
956
1007
|
const colTemplate = `140px repeat(${products.length}, 1fr)`;
|
|
957
1008
|
const labelStyle = {
|
|
958
1009
|
padding: "10px 12px",
|
|
959
1010
|
fontSize: 11,
|
|
960
1011
|
fontWeight: 700,
|
|
961
|
-
// Solid dark fallback — never inherit a muted ancestor color
|
|
962
1012
|
color: "var(--hsk-text-muted, #4b5563)",
|
|
963
1013
|
textTransform: "uppercase",
|
|
964
1014
|
letterSpacing: "0.05em",
|
|
@@ -971,7 +1021,6 @@ function ComparisonMatrix({ sources, defaultCurrency = "KES" }) {
|
|
|
971
1021
|
const cellBase = {
|
|
972
1022
|
padding: "10px 14px",
|
|
973
1023
|
fontSize: 13,
|
|
974
|
-
// Explicit color so cells are always readable regardless of parent theme
|
|
975
1024
|
color: "var(--hsk-text, #111827)",
|
|
976
1025
|
borderBottom: "1px solid var(--hsk-border, rgba(0,0,0,0.07))",
|
|
977
1026
|
verticalAlign: "middle",
|
|
@@ -993,27 +1042,30 @@ function ComparisonMatrix({ sources, defaultCurrency = "KES" }) {
|
|
|
993
1042
|
children: [
|
|
994
1043
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: colTemplate, background: "var(--hsk-surface2, #f9fafb)", borderBottom: "2px solid var(--hsk-border, rgba(0,0,0,0.09))" }, children: [
|
|
995
1044
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { ...labelStyle, borderBottom: "none", color: "var(--hsk-text, #111)", fontSize: 12 }, children: "Feature" }),
|
|
996
|
-
products.map((p, i) =>
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1045
|
+
products.map((p, i) => {
|
|
1046
|
+
const { title } = (0, import_sdk4.resolveDisplayFields)(p.fields || p, displayConfig);
|
|
1047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1048
|
+
"a",
|
|
1049
|
+
{
|
|
1050
|
+
href: p.url || "#",
|
|
1051
|
+
target: "_blank",
|
|
1052
|
+
rel: "noopener noreferrer",
|
|
1053
|
+
style: {
|
|
1054
|
+
display: "flex",
|
|
1055
|
+
alignItems: "center",
|
|
1056
|
+
padding: "10px 14px",
|
|
1057
|
+
fontSize: 12,
|
|
1058
|
+
fontWeight: 700,
|
|
1059
|
+
color: "var(--hsk-primary, #16a34a)",
|
|
1060
|
+
textDecoration: "none",
|
|
1061
|
+
lineHeight: 1.3,
|
|
1062
|
+
borderLeft: i > 0 ? "1px solid var(--hsk-border, rgba(0,0,0,0.07))" : "none"
|
|
1063
|
+
},
|
|
1064
|
+
children: title
|
|
1012
1065
|
},
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
))
|
|
1066
|
+
i
|
|
1067
|
+
);
|
|
1068
|
+
})
|
|
1017
1069
|
] }),
|
|
1018
1070
|
rows.map((row, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1019
1071
|
"div",
|
|
@@ -1028,8 +1080,9 @@ function ComparisonMatrix({ sources, defaultCurrency = "KES" }) {
|
|
|
1028
1080
|
products.map((p, i) => {
|
|
1029
1081
|
const val = row.values[i];
|
|
1030
1082
|
const isBest = row.bestIdx === i && row.values.filter(Boolean).length > 1;
|
|
1083
|
+
const { title } = (0, import_sdk4.resolveDisplayFields)(p.fields || p, displayConfig);
|
|
1031
1084
|
if (row.type === "image") {
|
|
1032
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { ...cellBase, justifyContent: "center", padding: "12px", borderLeft: i > 0 ? "1px solid var(--hsk-border, rgba(0,0,0,0.07))" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ImageCell, { value: val, name:
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { ...cellBase, justifyContent: "center", padding: "12px", borderLeft: i > 0 ? "1px solid var(--hsk-border, rgba(0,0,0,0.07))" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ImageCell, { value: val, name: title }) }, i);
|
|
1033
1086
|
}
|
|
1034
1087
|
if (row.type === "availability") {
|
|
1035
1088
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { ...cellBase, borderLeft: i > 0 ? "1px solid var(--hsk-border, rgba(0,0,0,0.07))" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AvailabilityCell, { value: val }) }, i);
|
|
@@ -1040,7 +1093,6 @@ function ComparisonMatrix({ sources, defaultCurrency = "KES" }) {
|
|
|
1040
1093
|
style: {
|
|
1041
1094
|
...cellBase,
|
|
1042
1095
|
fontWeight: isBest ? 700 : 400,
|
|
1043
|
-
// Always use a solid dark fallback — never 'inherit' which can be muted/invisible
|
|
1044
1096
|
color: isBest ? "var(--hsk-primary, #ea580c)" : row.type === "price" ? "var(--hsk-text, #374151)" : "var(--hsk-text, #111827)",
|
|
1045
1097
|
borderLeft: i > 0 ? "1px solid var(--hsk-border, rgba(0,0,0,0.07))" : "none"
|
|
1046
1098
|
},
|
|
@@ -1282,7 +1334,7 @@ function ActionPills({ cart, actionType, onSend, loading }) {
|
|
|
1282
1334
|
)) });
|
|
1283
1335
|
}
|
|
1284
1336
|
function SourcesCarousel({ sources, defaultCurrency, onSelectSource, referencedIds = [] }) {
|
|
1285
|
-
const client = (0,
|
|
1337
|
+
const client = (0, import_sdk7.useAkropolysContext)();
|
|
1286
1338
|
const isProperty = client?.vertical === "property";
|
|
1287
1339
|
const railRef = (0, import_react5.useRef)(null);
|
|
1288
1340
|
const [showNext, setShowNext] = (0, import_react5.useState)(false);
|
|
@@ -1380,7 +1432,7 @@ function SmartContextPills({
|
|
|
1380
1432
|
onSend,
|
|
1381
1433
|
loading
|
|
1382
1434
|
}) {
|
|
1383
|
-
const client = (0,
|
|
1435
|
+
const client = (0, import_sdk7.useAkropolysContext)();
|
|
1384
1436
|
const isProperty = client?.vertical === "property";
|
|
1385
1437
|
if (!intent) return null;
|
|
1386
1438
|
const pills = [];
|
|
@@ -1598,8 +1650,8 @@ function ChatModal({
|
|
|
1598
1650
|
enableVision = false,
|
|
1599
1651
|
visionCategoryHint
|
|
1600
1652
|
}) {
|
|
1601
|
-
const client = (0,
|
|
1602
|
-
const { messages, sources, loading, streaming, error, lastAction, lastIntent, send, reset, referencedIds } = (0,
|
|
1653
|
+
const client = (0, import_sdk7.useAkropolysContext)();
|
|
1654
|
+
const { messages, sources, loading, streaming, error, lastAction, lastIntent, send, reset, referencedIds } = (0, import_sdk5.useKiku)();
|
|
1603
1655
|
const [input, setInput] = (0, import_react5.useState)("");
|
|
1604
1656
|
const [attachments, setAttachments] = (0, import_react5.useState)([]);
|
|
1605
1657
|
const imageInputRef = (0, import_react5.useRef)(null);
|
|
@@ -1670,7 +1722,7 @@ function ChatModal({
|
|
|
1670
1722
|
const [sessions, setSessions] = (0, import_react5.useState)(() => loadSessions());
|
|
1671
1723
|
const [sidebarOpen, setSidebarOpen] = (0, import_react5.useState)(false);
|
|
1672
1724
|
const [replayMessages, setReplayMessages] = (0, import_react5.useState)(null);
|
|
1673
|
-
const { status: pollStatus } = (0,
|
|
1725
|
+
const { status: pollStatus } = (0, import_sdk6.usePaymentPolling)({
|
|
1674
1726
|
client: client.api,
|
|
1675
1727
|
merchantReference: merchantRef,
|
|
1676
1728
|
onSuccess: () => {
|
|
@@ -1930,7 +1982,13 @@ function ChatModal({
|
|
|
1930
1982
|
const { thinking, content, isComplete } = parseThinking(displayContent);
|
|
1931
1983
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1932
1984
|
thinking && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThinkingBlock, { text: thinking, isComplete }),
|
|
1933
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1985
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-ai-text", children: [
|
|
1986
|
+
renderMarkdown(content),
|
|
1987
|
+
isLast && streaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `@keyframes hsk-blink { 0%,100%{opacity:.18} 50%{opacity:.9} }` }),
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { display: "inline-block", width: "0.5em", height: "1.05em", marginLeft: "2px", verticalAlign: "text-bottom", background: "currentColor", borderRadius: "1px", animation: "hsk-blink 1.1s ease-in-out infinite" } })
|
|
1990
|
+
] })
|
|
1991
|
+
] })
|
|
1934
1992
|
] });
|
|
1935
1993
|
})(),
|
|
1936
1994
|
isLast && lastIntent === "compare" && sources.length >= 2 && !replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ComparisonMatrix, { sources, defaultCurrency }),
|
|
@@ -1998,7 +2056,7 @@ function ChatModal({
|
|
|
1998
2056
|
50% { opacity: 1; }
|
|
1999
2057
|
}
|
|
2000
2058
|
` }),
|
|
2001
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { fontSize: "0.85rem", color: "#6b7280", fontStyle: "italic", animation: "hsk-pulse 1.5s infinite ease-in-out" }, children:
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { fontSize: "0.85rem", color: "#6b7280", fontStyle: "italic", animation: "hsk-pulse 1.5s infinite ease-in-out" }, children: "Thinking\u2026" }),
|
|
2002
2060
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cb-typing", style: { margin: 0, alignSelf: "flex-start" }, children: [
|
|
2003
2061
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-dot" }),
|
|
2004
2062
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cb-dot" }),
|
|
@@ -2264,7 +2322,7 @@ function KikuButton({
|
|
|
2264
2322
|
// src/components/Sparkle.tsx
|
|
2265
2323
|
var import_react6 = require("react");
|
|
2266
2324
|
var import_react_dom2 = require("react-dom");
|
|
2267
|
-
var
|
|
2325
|
+
var import_sdk8 = require("@akropolys/sdk");
|
|
2268
2326
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2269
2327
|
var SparkleIcon3 = ({ className, size = 16 }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2270
2328
|
"svg",
|
|
@@ -2375,11 +2433,11 @@ function SparkleModal({
|
|
|
2375
2433
|
classNames = {},
|
|
2376
2434
|
product: initialProduct
|
|
2377
2435
|
}) {
|
|
2378
|
-
const client = (0,
|
|
2436
|
+
const client = (0, import_sdk8.useAkropolysContext)();
|
|
2379
2437
|
const [fetchedProduct, setFetchedProduct] = (0, import_react6.useState)(null);
|
|
2380
2438
|
const displayProduct = initialProduct || fetchedProduct;
|
|
2381
|
-
const { results, loading: searchLoading, search } = (0,
|
|
2382
|
-
const { messages, sources, loading: chatLoading, error: chatError, send } = (0,
|
|
2439
|
+
const { results, loading: searchLoading, search } = (0, import_sdk8.useSearch)({ type: "vector" });
|
|
2440
|
+
const { messages, sources, loading: chatLoading, error: chatError, send } = (0, import_sdk8.useKiku)();
|
|
2383
2441
|
const [chatInput, setChatInput] = (0, import_react6.useState)("");
|
|
2384
2442
|
const [isMobile, setIsMobile] = (0, import_react6.useState)(false);
|
|
2385
2443
|
const [showSpecs, setShowSpecs] = (0, import_react6.useState)(false);
|
|
@@ -2865,10 +2923,10 @@ function Sparkle({
|
|
|
2865
2923
|
}
|
|
2866
2924
|
|
|
2867
2925
|
// src/components/CartBadge.tsx
|
|
2868
|
-
var
|
|
2926
|
+
var import_sdk9 = require("@akropolys/sdk");
|
|
2869
2927
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2870
2928
|
function CartBadge({ className }) {
|
|
2871
|
-
const { cart } = (0,
|
|
2929
|
+
const { cart } = (0, import_sdk9.useCart)();
|
|
2872
2930
|
if (!cart || cart.item_count === 0) return null;
|
|
2873
2931
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("hsk-cart-badge", className), children: cart.item_count });
|
|
2874
2932
|
}
|
|
@@ -2876,12 +2934,12 @@ function CartBadge({ className }) {
|
|
|
2876
2934
|
// src/components/CartDrawer.tsx
|
|
2877
2935
|
var import_react8 = require("react");
|
|
2878
2936
|
var import_react_dom4 = require("react-dom");
|
|
2879
|
-
var
|
|
2937
|
+
var import_sdk11 = require("@akropolys/sdk");
|
|
2880
2938
|
|
|
2881
2939
|
// src/components/CheckoutModal.tsx
|
|
2882
2940
|
var import_react7 = require("react");
|
|
2883
2941
|
var import_react_dom3 = require("react-dom");
|
|
2884
|
-
var
|
|
2942
|
+
var import_sdk10 = require("@akropolys/sdk");
|
|
2885
2943
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2886
2944
|
function CheckoutModal({
|
|
2887
2945
|
onClose,
|
|
@@ -2889,8 +2947,8 @@ function CheckoutModal({
|
|
|
2889
2947
|
customStyles,
|
|
2890
2948
|
hskThemeAttr
|
|
2891
2949
|
}) {
|
|
2892
|
-
const { cart, loading: cartLoading } = (0,
|
|
2893
|
-
const client = (0,
|
|
2950
|
+
const { cart, loading: cartLoading } = (0, import_sdk10.useCart)();
|
|
2951
|
+
const client = (0, import_sdk10.useAkropolysContext)();
|
|
2894
2952
|
const [config, setConfig] = (0, import_react7.useState)(null);
|
|
2895
2953
|
const [loadingConfig, setLoadingConfig] = (0, import_react7.useState)(true);
|
|
2896
2954
|
const [phone, setPhone] = (0, import_react7.useState)(() => {
|
|
@@ -2920,7 +2978,7 @@ function CheckoutModal({
|
|
|
2920
2978
|
const [phase, setPhase] = (0, import_react7.useState)("idle");
|
|
2921
2979
|
const [merchantRef, setMerchantRef] = (0, import_react7.useState)(null);
|
|
2922
2980
|
const [payError, setPayError] = (0, import_react7.useState)(null);
|
|
2923
|
-
const {} = (0,
|
|
2981
|
+
const {} = (0, import_sdk10.usePaymentPolling)({
|
|
2924
2982
|
client: client.api,
|
|
2925
2983
|
merchantReference: merchantRef,
|
|
2926
2984
|
onSuccess: () => {
|
|
@@ -3185,11 +3243,11 @@ function CartDrawer({
|
|
|
3185
3243
|
className,
|
|
3186
3244
|
theme
|
|
3187
3245
|
}) {
|
|
3188
|
-
const { cart, loading } = (0,
|
|
3246
|
+
const { cart, loading } = (0, import_sdk11.useCart)();
|
|
3189
3247
|
const [open, setOpen] = (0, import_react8.useState)(false);
|
|
3190
3248
|
const [showCheckout, setShowCheckout] = (0, import_react8.useState)(false);
|
|
3191
3249
|
const [mounted, setMounted] = (0, import_react8.useState)(false);
|
|
3192
|
-
const client = (0,
|
|
3250
|
+
const client = (0, import_sdk11.useAkropolysContext)();
|
|
3193
3251
|
(0, import_react8.useEffect)(() => {
|
|
3194
3252
|
setMounted(true);
|
|
3195
3253
|
const handleTriggerCheckout = () => {
|