@emblemvault/hustle-react 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/browser/hustle-react.js +109 -0
- package/dist/browser/hustle-react.js.map +1 -1
- package/dist/components/index.cjs +109 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +109 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -15324,6 +15324,9 @@ function HustleChat({
|
|
|
15324
15324
|
}
|
|
15325
15325
|
return false;
|
|
15326
15326
|
});
|
|
15327
|
+
const [paygStatus, setPaygStatus] = useState(null);
|
|
15328
|
+
const [paygLoading, setPaygLoading] = useState(false);
|
|
15329
|
+
const [paygError, setPaygError] = useState(null);
|
|
15327
15330
|
useEffect(() => {
|
|
15328
15331
|
if (typeof window !== "undefined") {
|
|
15329
15332
|
localStorage.setItem(`hustle-stt-enabled-${instanceId}`, String(speechToTextEnabled));
|
|
@@ -15377,6 +15380,34 @@ function HustleChat({
|
|
|
15377
15380
|
const removeAttachment = useCallback((index) => {
|
|
15378
15381
|
setAttachments((prev) => prev.filter((_2, i) => i !== index));
|
|
15379
15382
|
}, []);
|
|
15383
|
+
const fetchPaygStatus = useCallback(async () => {
|
|
15384
|
+
if (!client) return;
|
|
15385
|
+
setPaygLoading(true);
|
|
15386
|
+
setPaygError(null);
|
|
15387
|
+
try {
|
|
15388
|
+
const status = await client.getPaygStatus();
|
|
15389
|
+
setPaygStatus(status);
|
|
15390
|
+
} catch (err) {
|
|
15391
|
+
setPaygError(err.message || "Failed to fetch PAYG status");
|
|
15392
|
+
} finally {
|
|
15393
|
+
setPaygLoading(false);
|
|
15394
|
+
}
|
|
15395
|
+
}, [client]);
|
|
15396
|
+
const configurePayg = useCallback(async (options) => {
|
|
15397
|
+
if (!client) return;
|
|
15398
|
+
setPaygError(null);
|
|
15399
|
+
try {
|
|
15400
|
+
await client.configurePayg(options);
|
|
15401
|
+
await fetchPaygStatus();
|
|
15402
|
+
} catch (err) {
|
|
15403
|
+
setPaygError(err.message || "Failed to configure PAYG");
|
|
15404
|
+
}
|
|
15405
|
+
}, [client, fetchPaygStatus]);
|
|
15406
|
+
useEffect(() => {
|
|
15407
|
+
if (showSettingsPanel && client) {
|
|
15408
|
+
fetchPaygStatus();
|
|
15409
|
+
}
|
|
15410
|
+
}, [showSettingsPanel, client, fetchPaygStatus]);
|
|
15380
15411
|
const sendContinue = useCallback(async () => {
|
|
15381
15412
|
if (isStreaming || !isReady) return;
|
|
15382
15413
|
console.log("[AUTO_CONTINUE] Sending continue message...");
|
|
@@ -15831,6 +15862,84 @@ function HustleChat({
|
|
|
15831
15862
|
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Use your microphone to dictate messages" })
|
|
15832
15863
|
] }),
|
|
15833
15864
|
/* @__PURE__ */ jsx("div", { style: styles.settingDivider }),
|
|
15865
|
+
/* @__PURE__ */ jsxs("div", { style: styles.settingGroup, children: [
|
|
15866
|
+
/* @__PURE__ */ jsx("label", { style: styles.settingLabel, children: "Pay-As-You-Go Billing" }),
|
|
15867
|
+
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Manage your PAYG billing configuration" }),
|
|
15868
|
+
paygLoading && !paygStatus && /* @__PURE__ */ jsx("p", { style: { ...styles.settingDescription, fontStyle: "italic" }, children: "Loading billing status..." }),
|
|
15869
|
+
paygError && /* @__PURE__ */ jsx("p", { style: { ...styles.settingDescription, color: "#ef4444" }, children: paygError }),
|
|
15870
|
+
paygStatus && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15871
|
+
/* @__PURE__ */ jsxs(
|
|
15872
|
+
"div",
|
|
15873
|
+
{
|
|
15874
|
+
style: styles.toggleRow,
|
|
15875
|
+
onClick: () => configurePayg({ enabled: !paygStatus.enabled }),
|
|
15876
|
+
children: [
|
|
15877
|
+
/* @__PURE__ */ jsx("span", { style: styles.toggleLabel, children: paygStatus.enabled ? "PAYG Enabled" : "PAYG Disabled" }),
|
|
15878
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
15879
|
+
...styles.toggleSwitch,
|
|
15880
|
+
...paygStatus.enabled ? styles.toggleSwitchActive : {}
|
|
15881
|
+
}, children: /* @__PURE__ */ jsx("div", { style: {
|
|
15882
|
+
...styles.toggleKnob,
|
|
15883
|
+
...paygStatus.enabled ? styles.toggleKnobActive : {}
|
|
15884
|
+
} }) })
|
|
15885
|
+
]
|
|
15886
|
+
}
|
|
15887
|
+
),
|
|
15888
|
+
paygStatus.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15889
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: tokens.spacing.sm }, children: [
|
|
15890
|
+
/* @__PURE__ */ jsx("label", { style: { ...styles.settingDescription, display: "block", marginBottom: "4px" }, children: "Payment Token" }),
|
|
15891
|
+
/* @__PURE__ */ jsx(
|
|
15892
|
+
"select",
|
|
15893
|
+
{
|
|
15894
|
+
value: paygStatus.payment_token || "",
|
|
15895
|
+
onChange: (e) => configurePayg({ payment_token: e.target.value }),
|
|
15896
|
+
style: styles.settingSelect,
|
|
15897
|
+
children: (paygStatus.available_tokens || ["SOL", "SOL_USDC", "HUSTLE", "ETH", "ETH_USDC", "BASE_ETH", "BASE_USDC"]).map((token) => /* @__PURE__ */ jsx("option", { value: token, children: token }, token))
|
|
15898
|
+
}
|
|
15899
|
+
)
|
|
15900
|
+
] }),
|
|
15901
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: tokens.spacing.sm }, children: [
|
|
15902
|
+
/* @__PURE__ */ jsx("label", { style: { ...styles.settingDescription, display: "block", marginBottom: "4px" }, children: "Payment Mode" }),
|
|
15903
|
+
/* @__PURE__ */ jsxs(
|
|
15904
|
+
"select",
|
|
15905
|
+
{
|
|
15906
|
+
value: paygStatus.mode || "pay_per_request",
|
|
15907
|
+
onChange: (e) => configurePayg({ mode: e.target.value }),
|
|
15908
|
+
style: styles.settingSelect,
|
|
15909
|
+
children: [
|
|
15910
|
+
/* @__PURE__ */ jsx("option", { value: "pay_per_request", children: "Pay Per Request" }),
|
|
15911
|
+
/* @__PURE__ */ jsx("option", { value: "debt_accumulation", children: "Debt Accumulation" })
|
|
15912
|
+
]
|
|
15913
|
+
}
|
|
15914
|
+
)
|
|
15915
|
+
] }),
|
|
15916
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: tokens.spacing.md, padding: tokens.spacing.sm, background: "rgba(255,255,255,0.05)", borderRadius: tokens.radius.sm, fontSize: tokens.typography.fontSizeXs, color: tokens.colors.textSecondary }, children: [
|
|
15917
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15918
|
+
"Chain: ",
|
|
15919
|
+
paygStatus.payment_chain || "N/A"
|
|
15920
|
+
] }),
|
|
15921
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15922
|
+
"Total Debt: $",
|
|
15923
|
+
(paygStatus.total_debt_usd || 0).toFixed(4)
|
|
15924
|
+
] }),
|
|
15925
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15926
|
+
"Total Paid: $",
|
|
15927
|
+
(paygStatus.total_paid_usd || 0).toFixed(4)
|
|
15928
|
+
] }),
|
|
15929
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15930
|
+
"Debt Ceiling: $",
|
|
15931
|
+
(paygStatus.debt_ceiling_usd || 0).toFixed(2)
|
|
15932
|
+
] }),
|
|
15933
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15934
|
+
"Pending Charges: ",
|
|
15935
|
+
paygStatus.pending_charges || 0
|
|
15936
|
+
] }),
|
|
15937
|
+
paygStatus.is_blocked && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontWeight: "bold", marginTop: "4px" }, children: "Account is blocked" })
|
|
15938
|
+
] })
|
|
15939
|
+
] })
|
|
15940
|
+
] })
|
|
15941
|
+
] }),
|
|
15942
|
+
/* @__PURE__ */ jsx("div", { style: styles.settingDivider }),
|
|
15834
15943
|
/* @__PURE__ */ jsxs("div", { style: { ...styles.settingGroup, marginBottom: 0 }, children: [
|
|
15835
15944
|
/* @__PURE__ */ jsx("label", { style: styles.settingLabel, children: "Plugins" }),
|
|
15836
15945
|
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Extend the AI with custom tools" }),
|