@akropolys/kiku 1.2.0 → 1.2.4
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 +34 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +57 -36
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1194,6 +1194,15 @@ function ChatModal({
|
|
|
1194
1194
|
if (typeof window !== "undefined") {
|
|
1195
1195
|
localStorage.setItem("akropolys_user_phone", phoneInput.trim());
|
|
1196
1196
|
}
|
|
1197
|
+
const isHistoryIntent = lastIntent === "capture" || lastIntent === "delete" || lastIntent === "view_history";
|
|
1198
|
+
if (isHistoryIntent) {
|
|
1199
|
+
setPaymentPhase("idle");
|
|
1200
|
+
const lastUserMsg = [...messages].reverse().find((m) => m.role === "user");
|
|
1201
|
+
if (lastUserMsg) {
|
|
1202
|
+
await send(lastUserMsg.content);
|
|
1203
|
+
}
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1197
1206
|
const res = await client.api.initiatePayment(phoneInput.trim());
|
|
1198
1207
|
setMerchantRef(res.merchantReference);
|
|
1199
1208
|
setPaymentPhase("awaiting");
|
|
@@ -1460,22 +1469,31 @@ function ChatModal({
|
|
|
1460
1469
|
] })
|
|
1461
1470
|
] }),
|
|
1462
1471
|
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),
|
|
1463
|
-
!replayMessages && paymentPhase === "prompt_phone" &&
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1472
|
+
!replayMessages && paymentPhase === "prompt_phone" && (() => {
|
|
1473
|
+
const isHistoryIntent = lastIntent === "capture" || lastIntent === "delete" || lastIntent === "view_history";
|
|
1474
|
+
if (isHistoryIntent) {
|
|
1475
|
+
return null;
|
|
1476
|
+
}
|
|
1477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hsk-cb-ai-msg", children: [
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-ai-icon", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SparkleIcon2, {}) }),
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-ai-body", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-ai-text", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hsk-cb-phone-form", children: [
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "hsk-cb-phone-label", children: "Enter your M-Pesa number to pay" }),
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1482
|
+
"input",
|
|
1483
|
+
{
|
|
1484
|
+
type: "tel",
|
|
1485
|
+
className: "hsk-cb-phone-input",
|
|
1486
|
+
placeholder: "0712 345 678",
|
|
1487
|
+
value: phoneInput,
|
|
1488
|
+
onChange: (e) => setPhoneInput(e.target.value.replace(/\D/g, "")),
|
|
1489
|
+
onKeyDown: (e) => e.key === "Enter" && handlePhoneSubmit(),
|
|
1490
|
+
autoFocus: true
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: "hsk-cb-phone-submit", onClick: handlePhoneSubmit, children: "Send STK push" })
|
|
1494
|
+
] }) }) })
|
|
1495
|
+
] });
|
|
1496
|
+
})(),
|
|
1479
1497
|
!replayMessages && paymentPhase === "awaiting" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "hsk-cb-payment-prompt hsk-cb-payment-prompt--awaiting", children: [
|
|
1480
1498
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-payment-pulse-ring" }),
|
|
1481
1499
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "hsk-cb-payment-icon-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: "2rem" }, children: "\u{1F4F1}" }) }),
|