@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.mjs
CHANGED
|
@@ -1161,6 +1161,15 @@ function ChatModal({
|
|
|
1161
1161
|
if (typeof window !== "undefined") {
|
|
1162
1162
|
localStorage.setItem("akropolys_user_phone", phoneInput.trim());
|
|
1163
1163
|
}
|
|
1164
|
+
const isHistoryIntent = lastIntent === "capture" || lastIntent === "delete" || lastIntent === "view_history";
|
|
1165
|
+
if (isHistoryIntent) {
|
|
1166
|
+
setPaymentPhase("idle");
|
|
1167
|
+
const lastUserMsg = [...messages].reverse().find((m) => m.role === "user");
|
|
1168
|
+
if (lastUserMsg) {
|
|
1169
|
+
await send(lastUserMsg.content);
|
|
1170
|
+
}
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1164
1173
|
const res = await client.api.initiatePayment(phoneInput.trim());
|
|
1165
1174
|
setMerchantRef(res.merchantReference);
|
|
1166
1175
|
setPaymentPhase("awaiting");
|
|
@@ -1427,22 +1436,31 @@ function ChatModal({
|
|
|
1427
1436
|
] })
|
|
1428
1437
|
] }),
|
|
1429
1438
|
error && /* @__PURE__ */ jsx5("div", { className: "hsk-cb-error", children: getFriendlyError(error) }),
|
|
1430
|
-
!replayMessages && paymentPhase === "prompt_phone" &&
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1439
|
+
!replayMessages && paymentPhase === "prompt_phone" && (() => {
|
|
1440
|
+
const isHistoryIntent = lastIntent === "capture" || lastIntent === "delete" || lastIntent === "view_history";
|
|
1441
|
+
if (isHistoryIntent) {
|
|
1442
|
+
return null;
|
|
1443
|
+
}
|
|
1444
|
+
return /* @__PURE__ */ jsxs4("div", { className: "hsk-cb-ai-msg", children: [
|
|
1445
|
+
/* @__PURE__ */ jsx5("div", { className: "hsk-cb-ai-icon", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx5(SparkleIcon2, {}) }),
|
|
1446
|
+
/* @__PURE__ */ jsx5("div", { className: "hsk-cb-ai-body", children: /* @__PURE__ */ jsx5("div", { className: "hsk-cb-ai-text", children: /* @__PURE__ */ jsxs4("div", { className: "hsk-cb-phone-form", children: [
|
|
1447
|
+
/* @__PURE__ */ jsx5("label", { className: "hsk-cb-phone-label", children: "Enter your M-Pesa number to pay" }),
|
|
1448
|
+
/* @__PURE__ */ jsx5(
|
|
1449
|
+
"input",
|
|
1450
|
+
{
|
|
1451
|
+
type: "tel",
|
|
1452
|
+
className: "hsk-cb-phone-input",
|
|
1453
|
+
placeholder: "0712 345 678",
|
|
1454
|
+
value: phoneInput,
|
|
1455
|
+
onChange: (e) => setPhoneInput(e.target.value.replace(/\D/g, "")),
|
|
1456
|
+
onKeyDown: (e) => e.key === "Enter" && handlePhoneSubmit(),
|
|
1457
|
+
autoFocus: true
|
|
1458
|
+
}
|
|
1459
|
+
),
|
|
1460
|
+
/* @__PURE__ */ jsx5("button", { className: "hsk-cb-phone-submit", onClick: handlePhoneSubmit, children: "Send STK push" })
|
|
1461
|
+
] }) }) })
|
|
1462
|
+
] });
|
|
1463
|
+
})(),
|
|
1446
1464
|
!replayMessages && paymentPhase === "awaiting" && /* @__PURE__ */ jsxs4("div", { className: "hsk-cb-payment-prompt hsk-cb-payment-prompt--awaiting", children: [
|
|
1447
1465
|
/* @__PURE__ */ jsx5("div", { className: "hsk-cb-payment-pulse-ring" }),
|
|
1448
1466
|
/* @__PURE__ */ jsx5("div", { className: "hsk-cb-payment-icon-wrap", children: /* @__PURE__ */ jsx5("span", { style: { fontSize: "2rem" }, children: "\u{1F4F1}" }) }),
|