@akropolys/kiku 1.6.4 → 1.6.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.js +91 -233
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -233
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +68 -1388
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -547,7 +547,6 @@ function ChatWidget({
|
|
|
547
547
|
next[historyIdx] = {
|
|
548
548
|
...next[historyIdx],
|
|
549
549
|
content: messages[hookIdx].content,
|
|
550
|
-
cartSnapshot: messages[hookIdx].cartSnapshot,
|
|
551
550
|
actionType: messages[hookIdx].actionType
|
|
552
551
|
};
|
|
553
552
|
break;
|
|
@@ -1201,30 +1200,11 @@ var HistoryIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { w
|
|
|
1201
1200
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 7v5l4 2" })
|
|
1202
1201
|
] });
|
|
1203
1202
|
var NewChatIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
1204
|
-
var
|
|
1205
|
-
|
|
1206
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("
|
|
1207
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "
|
|
1203
|
+
var BookmarkIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M19 21 12 16l-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" }) });
|
|
1204
|
+
var TrashIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M3 6h18" }),
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1208
1207
|
] });
|
|
1209
|
-
var SecureShieldIcon = ({ className, size = 18 }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1210
|
-
"svg",
|
|
1211
|
-
{
|
|
1212
|
-
className,
|
|
1213
|
-
width: size,
|
|
1214
|
-
height: size,
|
|
1215
|
-
viewBox: "0 0 24 24",
|
|
1216
|
-
fill: "none",
|
|
1217
|
-
stroke: "currentColor",
|
|
1218
|
-
strokeWidth: "2.5",
|
|
1219
|
-
strokeLinecap: "round",
|
|
1220
|
-
strokeLinejoin: "round",
|
|
1221
|
-
children: [
|
|
1222
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }),
|
|
1223
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 11a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z" }),
|
|
1224
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 11v4" })
|
|
1225
|
-
]
|
|
1226
|
-
}
|
|
1227
|
-
);
|
|
1228
1208
|
var PaperclipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
1229
1209
|
var MicIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1230
1210
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z" }),
|
|
@@ -1287,73 +1267,62 @@ function KikuPickerMenu({
|
|
|
1287
1267
|
"aria-label": "@kiku commands",
|
|
1288
1268
|
onMouseDown: (e) => e.preventDefault(),
|
|
1289
1269
|
children: [
|
|
1290
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
"button",
|
|
1299
|
-
{
|
|
1300
|
-
className: "hsk-kiku-picker-item",
|
|
1301
|
-
role: "menuitem",
|
|
1302
|
-
onClick: () => {
|
|
1303
|
-
onCapture(src);
|
|
1304
|
-
onDismiss();
|
|
1305
|
-
},
|
|
1306
|
-
children: [
|
|
1307
|
-
src.image ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: src.image, alt: src.name, className: "hsk-kiku-picker-img" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-img-placeholder", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SecureShieldIcon, { size: 14 }) }),
|
|
1308
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-body", children: [
|
|
1309
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-name", children: [
|
|
1310
|
-
"\u{1F4CC} ",
|
|
1311
|
-
src.name
|
|
1312
|
-
] }),
|
|
1313
|
-
src.price && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-price", children: [
|
|
1314
|
-
src.currency ?? defaultCurrency,
|
|
1315
|
-
" ",
|
|
1316
|
-
parseFloat(String(src.price).replace(/[^0-9.]/g, "") || "0").toLocaleString()
|
|
1317
|
-
] })
|
|
1318
|
-
] })
|
|
1319
|
-
]
|
|
1270
|
+
discussed.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1271
|
+
"button",
|
|
1272
|
+
{
|
|
1273
|
+
className: "hsk-kiku-picker-item",
|
|
1274
|
+
role: "menuitem",
|
|
1275
|
+
onClick: () => {
|
|
1276
|
+
onCapture(src);
|
|
1277
|
+
onDismiss();
|
|
1320
1278
|
},
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1279
|
+
children: [
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon", children: src.image ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { src: src.image, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BookmarkIcon, {}) }),
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: src.name }),
|
|
1282
|
+
src.price && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-price", children: [
|
|
1283
|
+
src.currency ?? defaultCurrency,
|
|
1284
|
+
" ",
|
|
1285
|
+
parseFloat(String(src.price).replace(/[^0-9.]/g, "") || "0").toLocaleString()
|
|
1286
|
+
] })
|
|
1287
|
+
]
|
|
1288
|
+
},
|
|
1289
|
+
src.id ?? i
|
|
1290
|
+
)),
|
|
1291
|
+
discussed.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1292
|
+
"button",
|
|
1293
|
+
{
|
|
1294
|
+
className: "hsk-kiku-picker-item",
|
|
1295
|
+
role: "menuitem",
|
|
1296
|
+
onClick: () => {
|
|
1297
|
+
onCaptureAll(discussed);
|
|
1298
|
+
onDismiss();
|
|
1299
|
+
},
|
|
1300
|
+
children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BookmarkIcon, {}) }),
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-name", children: [
|
|
1303
|
+
"Capture all (",
|
|
1334
1304
|
discussed.length,
|
|
1335
|
-
"
|
|
1336
|
-
] })
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
"
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
},
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1305
|
+
")"
|
|
1306
|
+
] })
|
|
1307
|
+
]
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
discussed.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1311
|
+
"button",
|
|
1312
|
+
{
|
|
1313
|
+
className: "hsk-kiku-picker-item",
|
|
1314
|
+
role: "menuitem",
|
|
1315
|
+
onClick: () => {
|
|
1316
|
+
onCapture({ name: "current page", id: void 0 });
|
|
1317
|
+
onDismiss();
|
|
1318
|
+
},
|
|
1319
|
+
children: [
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BookmarkIcon, {}) }),
|
|
1321
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "Capture current page" })
|
|
1322
|
+
]
|
|
1323
|
+
}
|
|
1324
|
+
),
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1357
1326
|
"button",
|
|
1358
1327
|
{
|
|
1359
1328
|
className: "hsk-kiku-picker-item",
|
|
@@ -1362,10 +1331,13 @@ function KikuPickerMenu({
|
|
|
1362
1331
|
onViewHistory();
|
|
1363
1332
|
onDismiss();
|
|
1364
1333
|
},
|
|
1365
|
-
children:
|
|
1334
|
+
children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HistoryIcon, {}) }),
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "What have you saved?" })
|
|
1337
|
+
]
|
|
1366
1338
|
}
|
|
1367
1339
|
),
|
|
1368
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1369
1341
|
"button",
|
|
1370
1342
|
{
|
|
1371
1343
|
className: "hsk-kiku-picker-item",
|
|
@@ -1374,7 +1346,10 @@ function KikuPickerMenu({
|
|
|
1374
1346
|
onDelete();
|
|
1375
1347
|
onDismiss();
|
|
1376
1348
|
},
|
|
1377
|
-
children:
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TrashIcon, {}) }),
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "Delete this" })
|
|
1352
|
+
]
|
|
1378
1353
|
}
|
|
1379
1354
|
)
|
|
1380
1355
|
]
|
|
@@ -1382,35 +1357,25 @@ function KikuPickerMenu({
|
|
|
1382
1357
|
);
|
|
1383
1358
|
}
|
|
1384
1359
|
function AtPickerMenu({ onSelect, onDismiss }) {
|
|
1385
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1386
1361
|
"div",
|
|
1387
1362
|
{
|
|
1388
1363
|
className: "hsk-kiku-picker",
|
|
1389
1364
|
role: "menu",
|
|
1390
1365
|
"aria-label": "Extensions",
|
|
1391
1366
|
onMouseDown: (e) => e.preventDefault(),
|
|
1392
|
-
children:
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
children: [
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-img-placeholder", style: { background: "color-mix(in srgb, var(--hsk-primary, #7c5cfc) 15%, transparent)", color: "var(--hsk-primary, #7c5cfc)" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SparkleIcon2, {}) }),
|
|
1406
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-kiku-picker-item-body", children: [
|
|
1407
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "@kiku" }),
|
|
1408
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-price", style: { fontSize: "11px", whiteSpace: "normal", lineHeight: "1.3" }, children: "Ask Kiku to capture pages, remember items, or show your history" })
|
|
1409
|
-
] })
|
|
1410
|
-
]
|
|
1411
|
-
}
|
|
1412
|
-
)
|
|
1413
|
-
]
|
|
1367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1368
|
+
"button",
|
|
1369
|
+
{
|
|
1370
|
+
className: "hsk-kiku-picker-item",
|
|
1371
|
+
role: "menuitem",
|
|
1372
|
+
onClick: () => onSelect("@kiku"),
|
|
1373
|
+
children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-icon hsk-kiku-picker-icon--accent", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SparkleIcon2, {}) }),
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-kiku-picker-item-name", children: "kiku \u2014 capture & remember" })
|
|
1376
|
+
]
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1414
1379
|
}
|
|
1415
1380
|
);
|
|
1416
1381
|
}
|
|
@@ -1440,88 +1405,6 @@ function relativeTime(ts) {
|
|
|
1440
1405
|
const days = Math.floor(hrs / 24);
|
|
1441
1406
|
return `${days}d ago`;
|
|
1442
1407
|
}
|
|
1443
|
-
function CartContextCard({ cart, defaultCurrency }) {
|
|
1444
|
-
if (!cart.items || cart.items.length === 0) return null;
|
|
1445
|
-
const currency = cart.currency || defaultCurrency;
|
|
1446
|
-
const total = cart.total ?? cart.items.reduce((s, i) => s + i.price_numeric * i.quantity, 0);
|
|
1447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-card", children: [
|
|
1448
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-card-header", children: [
|
|
1449
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ShoppingBagIcon, {}),
|
|
1450
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
1451
|
-
"Your cart \xB7 ",
|
|
1452
|
-
cart.item_count ?? cart.items.length,
|
|
1453
|
-
" item",
|
|
1454
|
-
(cart.item_count ?? cart.items.length) !== 1 ? "s" : ""
|
|
1455
|
-
] })
|
|
1456
|
-
] }),
|
|
1457
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cart-items", children: cart.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-item", children: [
|
|
1458
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-item-img-wrap", children: [
|
|
1459
|
-
item.image ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("img", { className: "hsk-cart-item-img", src: item.image, alt: item.name, loading: "lazy" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cart-item-img-placeholder", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ShoppingBagIcon, {}) }),
|
|
1460
|
-
item.quantity > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-cart-item-qty", children: item.quantity })
|
|
1461
|
-
] }),
|
|
1462
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-item-info", children: [
|
|
1463
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-cart-item-name", children: item.name }),
|
|
1464
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-item-price", children: [
|
|
1465
|
-
item.quantity > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-cart-item-qty-label", children: [
|
|
1466
|
-
item.quantity,
|
|
1467
|
-
"\xD7 "
|
|
1468
|
-
] }),
|
|
1469
|
-
currency,
|
|
1470
|
-
" ",
|
|
1471
|
-
(item.price_numeric * item.quantity).toLocaleString()
|
|
1472
|
-
] })
|
|
1473
|
-
] })
|
|
1474
|
-
] }, item.id)) }),
|
|
1475
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "hsk-cart-total", children: [
|
|
1476
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Total" }),
|
|
1477
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "hsk-cart-total-amount", children: [
|
|
1478
|
-
currency,
|
|
1479
|
-
" ",
|
|
1480
|
-
total.toLocaleString()
|
|
1481
|
-
] })
|
|
1482
|
-
] })
|
|
1483
|
-
] });
|
|
1484
|
-
}
|
|
1485
|
-
function ActionPills({ cart, actionType, onSend, loading }) {
|
|
1486
|
-
const hasItems = cart.items && cart.items.length > 0;
|
|
1487
|
-
const lastItem = hasItems ? cart.items[cart.items.length - 1] : null;
|
|
1488
|
-
const pills = [];
|
|
1489
|
-
if (hasItems && lastItem) {
|
|
1490
|
-
if (actionType === "add_to_cart") {
|
|
1491
|
-
const name = lastItem.name || "item";
|
|
1492
|
-
const shortName = name.split(" ")[0] || "item";
|
|
1493
|
-
pills.push({ emoji: "\u2795", label: "Add 1 more", query: `Add one more ${name} to my cart` });
|
|
1494
|
-
pills.push({ emoji: "\u{1F5D1}\uFE0F", label: `Remove ${shortName}`, query: `Remove the ${name} from my cart` });
|
|
1495
|
-
}
|
|
1496
|
-
if (cart.items.length > 1) {
|
|
1497
|
-
pills.push({ emoji: "\u{1F6D2}", label: "View cart", query: "Show me my cart" });
|
|
1498
|
-
}
|
|
1499
|
-
pills.push({ emoji: "\u{1F4B3}", label: "Checkout", query: "Proceed to checkout" });
|
|
1500
|
-
pills.push({ emoji: "\u{1F6CD}\uFE0F", label: "Keep shopping", query: "What else do you recommend?" });
|
|
1501
|
-
} else if (actionType === "clear_cart" || actionType === "remove_from_cart") {
|
|
1502
|
-
pills.push({ emoji: "\u{1F6CD}\uFE0F", label: "Continue shopping", query: "Show me popular products" });
|
|
1503
|
-
pills.push({ emoji: "\u{1F50D}", label: "Search again", query: "Help me find something" });
|
|
1504
|
-
} else if (actionType === "view_cart") {
|
|
1505
|
-
if (hasItems) {
|
|
1506
|
-
pills.push({ emoji: "\u{1F4B3}", label: "Checkout", query: "Proceed to checkout" });
|
|
1507
|
-
pills.push({ emoji: "\u{1F5D1}\uFE0F", label: "Clear cart", query: "Clear my cart" });
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
if (pills.length === 0) return null;
|
|
1511
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-action-pills", children: pills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1512
|
-
"button",
|
|
1513
|
-
{
|
|
1514
|
-
className: "hsk-action-pill",
|
|
1515
|
-
onClick: () => onSend(pill.query),
|
|
1516
|
-
disabled: loading,
|
|
1517
|
-
children: [
|
|
1518
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "hsk-pill-emoji", children: pill.emoji }),
|
|
1519
|
-
pill.label
|
|
1520
|
-
]
|
|
1521
|
-
},
|
|
1522
|
-
pill.query
|
|
1523
|
-
)) });
|
|
1524
|
-
}
|
|
1525
1408
|
function SourcesCarousel({ sources, defaultCurrency, onSelectSource, referencedIds = [] }) {
|
|
1526
1409
|
const client = (0, import_sdk6.useAkropolysContext)();
|
|
1527
1410
|
const isProperty = client?.vertical === "property";
|
|
@@ -1642,13 +1525,12 @@ function SmartContextPills({
|
|
|
1642
1525
|
query: `Compare the ${firstTwo[0]} and ${firstTwo[1]}`
|
|
1643
1526
|
});
|
|
1644
1527
|
}
|
|
1645
|
-
if (cheapest && !isProperty) {
|
|
1646
|
-
const
|
|
1647
|
-
const short = name.split(" ").slice(0, 3).join(" ");
|
|
1528
|
+
if (cheapest && !isProperty && cheapest.name) {
|
|
1529
|
+
const short = cheapest.name.split(" ").slice(0, 3).join(" ");
|
|
1648
1530
|
pills.push({
|
|
1649
|
-
emoji: "\u{
|
|
1650
|
-
label: `
|
|
1651
|
-
query: `
|
|
1531
|
+
emoji: "\u{1F4A1}",
|
|
1532
|
+
label: `More on ${short}`,
|
|
1533
|
+
query: `Tell me more about the ${cheapest.name}`
|
|
1652
1534
|
});
|
|
1653
1535
|
}
|
|
1654
1536
|
if (isProperty) {
|
|
@@ -1657,15 +1539,6 @@ function SmartContextPills({
|
|
|
1657
1539
|
pills.push({ emoji: "\u{1F4B0}", label: "Under KSh 20K", query: "Show me options under KSh 20,000" });
|
|
1658
1540
|
}
|
|
1659
1541
|
} else if (intent === "compare" && sources.length > 0) {
|
|
1660
|
-
if (cheapest && !isProperty) {
|
|
1661
|
-
const name = cheapest.name || "";
|
|
1662
|
-
const short = name.split(" ").slice(0, 3).join(" ");
|
|
1663
|
-
pills.push({
|
|
1664
|
-
emoji: "\u{1F6D2}",
|
|
1665
|
-
label: `Add ${short}`,
|
|
1666
|
-
query: `Add the ${name} to my cart`
|
|
1667
|
-
});
|
|
1668
|
-
}
|
|
1669
1542
|
if (firstName) {
|
|
1670
1543
|
pills.push({
|
|
1671
1544
|
emoji: "\u{1F50D}",
|
|
@@ -1676,9 +1549,6 @@ function SmartContextPills({
|
|
|
1676
1549
|
pills.push({ emoji: "\u{1F4A1}", label: "Which is best?", query: "Which one would you recommend and why?" });
|
|
1677
1550
|
} else if (intent === "specs" && sources.length > 0) {
|
|
1678
1551
|
if (firstName) {
|
|
1679
|
-
if (!isProperty) {
|
|
1680
|
-
pills.push({ emoji: "\u{1F6D2}", label: "Add to cart", query: `Add the ${firstName} to my cart` });
|
|
1681
|
-
}
|
|
1682
1552
|
pills.push({
|
|
1683
1553
|
emoji: "\u{1F504}",
|
|
1684
1554
|
label: "Find alternatives",
|
|
@@ -2275,7 +2145,7 @@ function ChatModal({
|
|
|
2275
2145
|
] });
|
|
2276
2146
|
})(),
|
|
2277
2147
|
isLast && lastIntent === "compare" && sources.length >= 2 && !replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ComparisonMatrix, { sources, defaultCurrency }),
|
|
2278
|
-
isLast && referencedIds.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_kiku_key" && lastAction?.type !== "
|
|
2148
|
+
isLast && referencedIds.length > 0 && lastIntent !== "compare" && lastAction?.type !== "request_kiku_key" && lastAction?.type !== "capture" && lastAction?.type !== "delete" && lastAction?.type !== "view_history" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2279
2149
|
SourcesCarousel,
|
|
2280
2150
|
{
|
|
2281
2151
|
sources,
|
|
@@ -2284,23 +2154,11 @@ function ChatModal({
|
|
|
2284
2154
|
referencedIds
|
|
2285
2155
|
}
|
|
2286
2156
|
),
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
}
|
|
2293
|
-
),
|
|
2294
|
-
isLast && msg.cartSnapshot && !loading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2295
|
-
ActionPills,
|
|
2296
|
-
{
|
|
2297
|
-
cart: msg.cartSnapshot,
|
|
2298
|
-
actionType: msg.actionType,
|
|
2299
|
-
onSend: handleSend,
|
|
2300
|
-
loading
|
|
2301
|
-
}
|
|
2302
|
-
),
|
|
2303
|
-
isLast && !loading && !msg.cartSnapshot && !replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2157
|
+
isLast && !loading && lastAction?.url && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "hsk-action-pills", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { className: "hsk-action-pill", href: lastAction.url, children: [
|
|
2158
|
+
String(lastAction.type || "continue").replace(/_/g, " "),
|
|
2159
|
+
" \u2192"
|
|
2160
|
+
] }) }),
|
|
2161
|
+
isLast && !loading && !replayMessages && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2304
2162
|
SmartContextPills,
|
|
2305
2163
|
{
|
|
2306
2164
|
intent: lastIntent,
|