@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
package/dist/components/index.js
CHANGED
|
@@ -3719,6 +3719,9 @@ function HustleChat({
|
|
|
3719
3719
|
}
|
|
3720
3720
|
return false;
|
|
3721
3721
|
});
|
|
3722
|
+
const [paygStatus, setPaygStatus] = useState(null);
|
|
3723
|
+
const [paygLoading, setPaygLoading] = useState(false);
|
|
3724
|
+
const [paygError, setPaygError] = useState(null);
|
|
3722
3725
|
useEffect(() => {
|
|
3723
3726
|
if (typeof window !== "undefined") {
|
|
3724
3727
|
localStorage.setItem(`hustle-stt-enabled-${instanceId}`, String(speechToTextEnabled));
|
|
@@ -3772,6 +3775,34 @@ function HustleChat({
|
|
|
3772
3775
|
const removeAttachment = useCallback((index) => {
|
|
3773
3776
|
setAttachments((prev) => prev.filter((_, i) => i !== index));
|
|
3774
3777
|
}, []);
|
|
3778
|
+
const fetchPaygStatus = useCallback(async () => {
|
|
3779
|
+
if (!client) return;
|
|
3780
|
+
setPaygLoading(true);
|
|
3781
|
+
setPaygError(null);
|
|
3782
|
+
try {
|
|
3783
|
+
const status = await client.getPaygStatus();
|
|
3784
|
+
setPaygStatus(status);
|
|
3785
|
+
} catch (err) {
|
|
3786
|
+
setPaygError(err.message || "Failed to fetch PAYG status");
|
|
3787
|
+
} finally {
|
|
3788
|
+
setPaygLoading(false);
|
|
3789
|
+
}
|
|
3790
|
+
}, [client]);
|
|
3791
|
+
const configurePayg = useCallback(async (options) => {
|
|
3792
|
+
if (!client) return;
|
|
3793
|
+
setPaygError(null);
|
|
3794
|
+
try {
|
|
3795
|
+
await client.configurePayg(options);
|
|
3796
|
+
await fetchPaygStatus();
|
|
3797
|
+
} catch (err) {
|
|
3798
|
+
setPaygError(err.message || "Failed to configure PAYG");
|
|
3799
|
+
}
|
|
3800
|
+
}, [client, fetchPaygStatus]);
|
|
3801
|
+
useEffect(() => {
|
|
3802
|
+
if (showSettingsPanel && client) {
|
|
3803
|
+
fetchPaygStatus();
|
|
3804
|
+
}
|
|
3805
|
+
}, [showSettingsPanel, client, fetchPaygStatus]);
|
|
3775
3806
|
const sendContinue = useCallback(async () => {
|
|
3776
3807
|
if (isStreaming || !isReady) return;
|
|
3777
3808
|
console.log("[AUTO_CONTINUE] Sending continue message...");
|
|
@@ -4226,6 +4257,84 @@ function HustleChat({
|
|
|
4226
4257
|
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Use your microphone to dictate messages" })
|
|
4227
4258
|
] }),
|
|
4228
4259
|
/* @__PURE__ */ jsx("div", { style: styles.settingDivider }),
|
|
4260
|
+
/* @__PURE__ */ jsxs("div", { style: styles.settingGroup, children: [
|
|
4261
|
+
/* @__PURE__ */ jsx("label", { style: styles.settingLabel, children: "Pay-As-You-Go Billing" }),
|
|
4262
|
+
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Manage your PAYG billing configuration" }),
|
|
4263
|
+
paygLoading && !paygStatus && /* @__PURE__ */ jsx("p", { style: { ...styles.settingDescription, fontStyle: "italic" }, children: "Loading billing status..." }),
|
|
4264
|
+
paygError && /* @__PURE__ */ jsx("p", { style: { ...styles.settingDescription, color: "#ef4444" }, children: paygError }),
|
|
4265
|
+
paygStatus && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4266
|
+
/* @__PURE__ */ jsxs(
|
|
4267
|
+
"div",
|
|
4268
|
+
{
|
|
4269
|
+
style: styles.toggleRow,
|
|
4270
|
+
onClick: () => configurePayg({ enabled: !paygStatus.enabled }),
|
|
4271
|
+
children: [
|
|
4272
|
+
/* @__PURE__ */ jsx("span", { style: styles.toggleLabel, children: paygStatus.enabled ? "PAYG Enabled" : "PAYG Disabled" }),
|
|
4273
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
4274
|
+
...styles.toggleSwitch,
|
|
4275
|
+
...paygStatus.enabled ? styles.toggleSwitchActive : {}
|
|
4276
|
+
}, children: /* @__PURE__ */ jsx("div", { style: {
|
|
4277
|
+
...styles.toggleKnob,
|
|
4278
|
+
...paygStatus.enabled ? styles.toggleKnobActive : {}
|
|
4279
|
+
} }) })
|
|
4280
|
+
]
|
|
4281
|
+
}
|
|
4282
|
+
),
|
|
4283
|
+
paygStatus.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4284
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: tokens.spacing.sm }, children: [
|
|
4285
|
+
/* @__PURE__ */ jsx("label", { style: { ...styles.settingDescription, display: "block", marginBottom: "4px" }, children: "Payment Token" }),
|
|
4286
|
+
/* @__PURE__ */ jsx(
|
|
4287
|
+
"select",
|
|
4288
|
+
{
|
|
4289
|
+
value: paygStatus.payment_token || "",
|
|
4290
|
+
onChange: (e) => configurePayg({ payment_token: e.target.value }),
|
|
4291
|
+
style: styles.settingSelect,
|
|
4292
|
+
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))
|
|
4293
|
+
}
|
|
4294
|
+
)
|
|
4295
|
+
] }),
|
|
4296
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: tokens.spacing.sm }, children: [
|
|
4297
|
+
/* @__PURE__ */ jsx("label", { style: { ...styles.settingDescription, display: "block", marginBottom: "4px" }, children: "Payment Mode" }),
|
|
4298
|
+
/* @__PURE__ */ jsxs(
|
|
4299
|
+
"select",
|
|
4300
|
+
{
|
|
4301
|
+
value: paygStatus.mode || "pay_per_request",
|
|
4302
|
+
onChange: (e) => configurePayg({ mode: e.target.value }),
|
|
4303
|
+
style: styles.settingSelect,
|
|
4304
|
+
children: [
|
|
4305
|
+
/* @__PURE__ */ jsx("option", { value: "pay_per_request", children: "Pay Per Request" }),
|
|
4306
|
+
/* @__PURE__ */ jsx("option", { value: "debt_accumulation", children: "Debt Accumulation" })
|
|
4307
|
+
]
|
|
4308
|
+
}
|
|
4309
|
+
)
|
|
4310
|
+
] }),
|
|
4311
|
+
/* @__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: [
|
|
4312
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4313
|
+
"Chain: ",
|
|
4314
|
+
paygStatus.payment_chain || "N/A"
|
|
4315
|
+
] }),
|
|
4316
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4317
|
+
"Total Debt: $",
|
|
4318
|
+
(paygStatus.total_debt_usd || 0).toFixed(4)
|
|
4319
|
+
] }),
|
|
4320
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4321
|
+
"Total Paid: $",
|
|
4322
|
+
(paygStatus.total_paid_usd || 0).toFixed(4)
|
|
4323
|
+
] }),
|
|
4324
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4325
|
+
"Debt Ceiling: $",
|
|
4326
|
+
(paygStatus.debt_ceiling_usd || 0).toFixed(2)
|
|
4327
|
+
] }),
|
|
4328
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4329
|
+
"Pending Charges: ",
|
|
4330
|
+
paygStatus.pending_charges || 0
|
|
4331
|
+
] }),
|
|
4332
|
+
paygStatus.is_blocked && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontWeight: "bold", marginTop: "4px" }, children: "Account is blocked" })
|
|
4333
|
+
] })
|
|
4334
|
+
] })
|
|
4335
|
+
] })
|
|
4336
|
+
] }),
|
|
4337
|
+
/* @__PURE__ */ jsx("div", { style: styles.settingDivider }),
|
|
4229
4338
|
/* @__PURE__ */ jsxs("div", { style: { ...styles.settingGroup, marginBottom: 0 }, children: [
|
|
4230
4339
|
/* @__PURE__ */ jsx("label", { style: styles.settingLabel, children: "Plugins" }),
|
|
4231
4340
|
/* @__PURE__ */ jsx("p", { style: styles.settingDescription, children: "Extend the AI with custom tools" }),
|