@akropolys/kiku 1.5.7 → 1.5.9
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 +189 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -110
- 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
|
@@ -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 = [];
|
|
@@ -1489,20 +1541,28 @@ var getFriendlyError = (err) => {
|
|
|
1489
1541
|
}
|
|
1490
1542
|
};
|
|
1491
1543
|
function parseThinking(text) {
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
const openIdx = text.indexOf(openTag);
|
|
1495
|
-
if (openIdx === -1) {
|
|
1544
|
+
const openMatch = text.match(/<\s*thinking\s*>/i);
|
|
1545
|
+
if (!openMatch) {
|
|
1496
1546
|
return { thinking: "", content: text, isComplete: true };
|
|
1497
1547
|
}
|
|
1498
|
-
const
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1548
|
+
const openIdx = openMatch.index ?? 0;
|
|
1549
|
+
const openTagLength = openMatch[0].length;
|
|
1550
|
+
const start = openIdx + openTagLength;
|
|
1551
|
+
const contentBefore = text.slice(0, openIdx);
|
|
1552
|
+
const textAfterOpen = text.slice(start);
|
|
1553
|
+
const closeMatch = textAfterOpen.match(/<\/\s*thinking\s*>/i);
|
|
1554
|
+
if (!closeMatch) {
|
|
1555
|
+
return {
|
|
1556
|
+
thinking: textAfterOpen,
|
|
1557
|
+
content: contentBefore,
|
|
1558
|
+
isComplete: false
|
|
1559
|
+
};
|
|
1502
1560
|
}
|
|
1561
|
+
const closeIdx = closeMatch.index ?? 0;
|
|
1562
|
+
const closeTagLength = closeMatch[0].length;
|
|
1503
1563
|
return {
|
|
1504
|
-
thinking:
|
|
1505
|
-
content:
|
|
1564
|
+
thinking: textAfterOpen.slice(0, closeIdx),
|
|
1565
|
+
content: contentBefore + textAfterOpen.slice(closeIdx + closeTagLength),
|
|
1506
1566
|
isComplete: true
|
|
1507
1567
|
};
|
|
1508
1568
|
}
|
|
@@ -1590,8 +1650,8 @@ function ChatModal({
|
|
|
1590
1650
|
enableVision = false,
|
|
1591
1651
|
visionCategoryHint
|
|
1592
1652
|
}) {
|
|
1593
|
-
const client = (0,
|
|
1594
|
-
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)();
|
|
1595
1655
|
const [input, setInput] = (0, import_react5.useState)("");
|
|
1596
1656
|
const [attachments, setAttachments] = (0, import_react5.useState)([]);
|
|
1597
1657
|
const imageInputRef = (0, import_react5.useRef)(null);
|
|
@@ -1662,7 +1722,7 @@ function ChatModal({
|
|
|
1662
1722
|
const [sessions, setSessions] = (0, import_react5.useState)(() => loadSessions());
|
|
1663
1723
|
const [sidebarOpen, setSidebarOpen] = (0, import_react5.useState)(false);
|
|
1664
1724
|
const [replayMessages, setReplayMessages] = (0, import_react5.useState)(null);
|
|
1665
|
-
const { status: pollStatus } = (0,
|
|
1725
|
+
const { status: pollStatus } = (0, import_sdk6.usePaymentPolling)({
|
|
1666
1726
|
client: client.api,
|
|
1667
1727
|
merchantReference: merchantRef,
|
|
1668
1728
|
onSuccess: () => {
|
|
@@ -2256,7 +2316,7 @@ function KikuButton({
|
|
|
2256
2316
|
// src/components/Sparkle.tsx
|
|
2257
2317
|
var import_react6 = require("react");
|
|
2258
2318
|
var import_react_dom2 = require("react-dom");
|
|
2259
|
-
var
|
|
2319
|
+
var import_sdk8 = require("@akropolys/sdk");
|
|
2260
2320
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2261
2321
|
var SparkleIcon3 = ({ className, size = 16 }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2262
2322
|
"svg",
|
|
@@ -2367,11 +2427,11 @@ function SparkleModal({
|
|
|
2367
2427
|
classNames = {},
|
|
2368
2428
|
product: initialProduct
|
|
2369
2429
|
}) {
|
|
2370
|
-
const client = (0,
|
|
2430
|
+
const client = (0, import_sdk8.useAkropolysContext)();
|
|
2371
2431
|
const [fetchedProduct, setFetchedProduct] = (0, import_react6.useState)(null);
|
|
2372
2432
|
const displayProduct = initialProduct || fetchedProduct;
|
|
2373
|
-
const { results, loading: searchLoading, search } = (0,
|
|
2374
|
-
const { messages, sources, loading: chatLoading, error: chatError, send } = (0,
|
|
2433
|
+
const { results, loading: searchLoading, search } = (0, import_sdk8.useSearch)({ type: "vector" });
|
|
2434
|
+
const { messages, sources, loading: chatLoading, error: chatError, send } = (0, import_sdk8.useKiku)();
|
|
2375
2435
|
const [chatInput, setChatInput] = (0, import_react6.useState)("");
|
|
2376
2436
|
const [isMobile, setIsMobile] = (0, import_react6.useState)(false);
|
|
2377
2437
|
const [showSpecs, setShowSpecs] = (0, import_react6.useState)(false);
|
|
@@ -2857,10 +2917,10 @@ function Sparkle({
|
|
|
2857
2917
|
}
|
|
2858
2918
|
|
|
2859
2919
|
// src/components/CartBadge.tsx
|
|
2860
|
-
var
|
|
2920
|
+
var import_sdk9 = require("@akropolys/sdk");
|
|
2861
2921
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2862
2922
|
function CartBadge({ className }) {
|
|
2863
|
-
const { cart } = (0,
|
|
2923
|
+
const { cart } = (0, import_sdk9.useCart)();
|
|
2864
2924
|
if (!cart || cart.item_count === 0) return null;
|
|
2865
2925
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("hsk-cart-badge", className), children: cart.item_count });
|
|
2866
2926
|
}
|
|
@@ -2868,12 +2928,12 @@ function CartBadge({ className }) {
|
|
|
2868
2928
|
// src/components/CartDrawer.tsx
|
|
2869
2929
|
var import_react8 = require("react");
|
|
2870
2930
|
var import_react_dom4 = require("react-dom");
|
|
2871
|
-
var
|
|
2931
|
+
var import_sdk11 = require("@akropolys/sdk");
|
|
2872
2932
|
|
|
2873
2933
|
// src/components/CheckoutModal.tsx
|
|
2874
2934
|
var import_react7 = require("react");
|
|
2875
2935
|
var import_react_dom3 = require("react-dom");
|
|
2876
|
-
var
|
|
2936
|
+
var import_sdk10 = require("@akropolys/sdk");
|
|
2877
2937
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2878
2938
|
function CheckoutModal({
|
|
2879
2939
|
onClose,
|
|
@@ -2881,8 +2941,8 @@ function CheckoutModal({
|
|
|
2881
2941
|
customStyles,
|
|
2882
2942
|
hskThemeAttr
|
|
2883
2943
|
}) {
|
|
2884
|
-
const { cart, loading: cartLoading } = (0,
|
|
2885
|
-
const client = (0,
|
|
2944
|
+
const { cart, loading: cartLoading } = (0, import_sdk10.useCart)();
|
|
2945
|
+
const client = (0, import_sdk10.useAkropolysContext)();
|
|
2886
2946
|
const [config, setConfig] = (0, import_react7.useState)(null);
|
|
2887
2947
|
const [loadingConfig, setLoadingConfig] = (0, import_react7.useState)(true);
|
|
2888
2948
|
const [phone, setPhone] = (0, import_react7.useState)(() => {
|
|
@@ -2912,7 +2972,7 @@ function CheckoutModal({
|
|
|
2912
2972
|
const [phase, setPhase] = (0, import_react7.useState)("idle");
|
|
2913
2973
|
const [merchantRef, setMerchantRef] = (0, import_react7.useState)(null);
|
|
2914
2974
|
const [payError, setPayError] = (0, import_react7.useState)(null);
|
|
2915
|
-
const {} = (0,
|
|
2975
|
+
const {} = (0, import_sdk10.usePaymentPolling)({
|
|
2916
2976
|
client: client.api,
|
|
2917
2977
|
merchantReference: merchantRef,
|
|
2918
2978
|
onSuccess: () => {
|
|
@@ -3177,11 +3237,11 @@ function CartDrawer({
|
|
|
3177
3237
|
className,
|
|
3178
3238
|
theme
|
|
3179
3239
|
}) {
|
|
3180
|
-
const { cart, loading } = (0,
|
|
3240
|
+
const { cart, loading } = (0, import_sdk11.useCart)();
|
|
3181
3241
|
const [open, setOpen] = (0, import_react8.useState)(false);
|
|
3182
3242
|
const [showCheckout, setShowCheckout] = (0, import_react8.useState)(false);
|
|
3183
3243
|
const [mounted, setMounted] = (0, import_react8.useState)(false);
|
|
3184
|
-
const client = (0,
|
|
3244
|
+
const client = (0, import_sdk11.useAkropolysContext)();
|
|
3185
3245
|
(0, import_react8.useEffect)(() => {
|
|
3186
3246
|
setMounted(true);
|
|
3187
3247
|
const handleTriggerCheckout = () => {
|