@goodwidget/ai-credits-widget 0.1.8 → 0.1.10
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/{chunk-635NKGPL.js → chunk-3QY3YZDH.js} +141 -42
- package/dist/chunk-3QY3YZDH.js.map +1 -0
- package/dist/element.cjs +135 -41
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/index.cjs +135 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mocked/index.cjs +135 -41
- package/dist/mocked/index.cjs.map +1 -1
- package/dist/mocked/index.js +1 -1
- package/dist/register.cjs +135 -41
- package/dist/register.cjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-635NKGPL.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/mocked/index.cjs
CHANGED
|
@@ -3547,22 +3547,29 @@ function useCopyFeedback() {
|
|
|
3547
3547
|
|
|
3548
3548
|
// src/components/buy/GenerateSignerKeyPanel.tsx
|
|
3549
3549
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3550
|
-
function NumberedStep({
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3550
|
+
function NumberedStep({
|
|
3551
|
+
index,
|
|
3552
|
+
title,
|
|
3553
|
+
note
|
|
3554
|
+
}) {
|
|
3555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui5.YStack, { gap: "$1", children: [
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui5.XStack, { gap: "$2", alignItems: "center", children: [
|
|
3557
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3558
|
+
import_ui5.YStack,
|
|
3559
|
+
{
|
|
3560
|
+
width: 24,
|
|
3561
|
+
height: 24,
|
|
3562
|
+
borderRadius: "$full",
|
|
3563
|
+
backgroundColor: "$backgroundSurface",
|
|
3564
|
+
alignItems: "center",
|
|
3565
|
+
justifyContent: "center",
|
|
3566
|
+
flexShrink: 0,
|
|
3567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Text, { fontSize: "$1", fontWeight: "700", children: index })
|
|
3568
|
+
}
|
|
3569
|
+
),
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Text, { fontSize: "$3", fontWeight: "700", children: title })
|
|
3571
|
+
] }),
|
|
3572
|
+
note && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Text, { marginLeft: 32, fontSize: "$2", color: "$warning", fontStyle: "italic", lineHeight: "$3", children: note })
|
|
3566
3573
|
] });
|
|
3567
3574
|
}
|
|
3568
3575
|
function GenerateSignerKeyPanel({
|
|
@@ -3596,11 +3603,18 @@ function GenerateSignerKeyPanel({
|
|
|
3596
3603
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui5.YStack, { gap: "$2", children: [
|
|
3597
3604
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NumberedStep, { index: 1, title: "Open Antseed Desktop" }),
|
|
3598
3605
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NumberedStep, { index: 2, title: "Go to Profile \u2192 Signer" }),
|
|
3599
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3607
|
+
NumberedStep,
|
|
3608
|
+
{
|
|
3609
|
+
index: 3,
|
|
3610
|
+
title: "Back up your existing Signer Key",
|
|
3611
|
+
note: "\u26A0\uFE0F Tap \u2193 to back up your existing signer key. Importing a new signer key will replace it."
|
|
3612
|
+
}
|
|
3613
|
+
),
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NumberedStep, { index: 4, title: "Tap \u2191 to paste your Signer Key, then save." })
|
|
3600
3615
|
] }),
|
|
3601
3616
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AntseedSignerRow, { mode: "generate", showCaption: false }),
|
|
3602
3617
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AiCreditsStatusNotice, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Text, { fontSize: "$2", tone: "soft", lineHeight: "$3", children: "The address you see when you paste your private key is the public address used for your AI credits." }) }),
|
|
3603
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AiCreditsStatusNotice, { borderColor: "$warning", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Text, { color: "$warning", fontSize: "$2", lineHeight: "$3", children: "Back up any existing AntSeed signer key before importing this one. Importing replaces the signer used by your AntSeed account." }) }),
|
|
3604
3618
|
onOpenApiSetup && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui5.XStack, { gap: "$2", alignItems: "center", children: [
|
|
3605
3619
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui5.Icon, { name: "settings", size: "xs", color: "muted" }),
|
|
3606
3620
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui5.Text, { fontSize: "$2", tone: "soft", flex: 1, lineHeight: "$3", children: [
|
|
@@ -4149,14 +4163,43 @@ var WITHDRAW_TOOLTIP = "Withdraws principal to your payer wallet (not bonus). Re
|
|
|
4149
4163
|
|
|
4150
4164
|
// src/components/manage/CreditsManagementCard.tsx
|
|
4151
4165
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4152
|
-
function StatCell({
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4166
|
+
function StatCell({
|
|
4167
|
+
label,
|
|
4168
|
+
icon: Glyph,
|
|
4169
|
+
children
|
|
4170
|
+
}) {
|
|
4171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
4172
|
+
import_ui9.Card,
|
|
4173
|
+
{
|
|
4174
|
+
raised: true,
|
|
4175
|
+
borderWidth: 0,
|
|
4176
|
+
flexGrow: 1,
|
|
4177
|
+
flexBasis: 0,
|
|
4178
|
+
padding: "$3",
|
|
4179
|
+
gap: "$1",
|
|
4180
|
+
children: [
|
|
4181
|
+
Glyph ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4182
|
+
import_ui9.XStack,
|
|
4183
|
+
{
|
|
4184
|
+
width: 28,
|
|
4185
|
+
height: 28,
|
|
4186
|
+
borderRadius: "$2",
|
|
4187
|
+
backgroundColor: "$background",
|
|
4188
|
+
alignItems: "center",
|
|
4189
|
+
justifyContent: "center",
|
|
4190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Glyph, { size: 16, color: "$colorSoft" })
|
|
4191
|
+
}
|
|
4192
|
+
) : null,
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.YStack, { children: [
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { fontSize: "$1", tone: "soft", children: label }),
|
|
4195
|
+
children
|
|
4196
|
+
] })
|
|
4197
|
+
]
|
|
4198
|
+
}
|
|
4199
|
+
);
|
|
4157
4200
|
}
|
|
4158
4201
|
function StatRow({ children }) {
|
|
4159
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.XStack, { gap: "$
|
|
4202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.XStack, { gap: "$1", width: "100%", alignItems: "stretch", children });
|
|
4160
4203
|
}
|
|
4161
4204
|
function StatValueText({
|
|
4162
4205
|
children,
|
|
@@ -4165,12 +4208,30 @@ function StatValueText({
|
|
|
4165
4208
|
}) {
|
|
4166
4209
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { fontSize, fontWeight: "700", color, children });
|
|
4167
4210
|
}
|
|
4211
|
+
function StatValue({
|
|
4212
|
+
value,
|
|
4213
|
+
unit,
|
|
4214
|
+
unitPosition,
|
|
4215
|
+
fontSize = "$2",
|
|
4216
|
+
unitFontSize = "$1",
|
|
4217
|
+
color
|
|
4218
|
+
}) {
|
|
4219
|
+
const hoistMarker = unitPosition === "prefix" && value.startsWith("<");
|
|
4220
|
+
const unitLabel = hoistMarker ? `<${unit}` : unit;
|
|
4221
|
+
const digits = hoistMarker ? value.slice(1) : value;
|
|
4222
|
+
const unitText = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { fontSize: unitFontSize, fontWeight: "700", tone: "soft", children: unitLabel });
|
|
4223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.XStack, { alignItems: "baseline", gap: "$1", children: [
|
|
4224
|
+
unitPosition === "prefix" ? unitText : null,
|
|
4225
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValueText, { fontSize, color, children: digits }),
|
|
4226
|
+
unitPosition === "suffix" ? unitText : null
|
|
4227
|
+
] });
|
|
4228
|
+
}
|
|
4168
4229
|
function CompactGStatValue({ amount }) {
|
|
4169
4230
|
const [open, setOpen] = (0, import_react8.useState)(false);
|
|
4170
4231
|
const display = formatGValue(amount);
|
|
4171
4232
|
const exact = formatExactGAmount(amount);
|
|
4172
4233
|
if (!isGValueCompacted(amount)) {
|
|
4173
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValue, { value: display, unit: "G$", unitPosition: "suffix" });
|
|
4174
4235
|
}
|
|
4175
4236
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
4176
4237
|
import_ui9.XStack,
|
|
@@ -4186,7 +4247,7 @@ function CompactGStatValue({ amount }) {
|
|
|
4186
4247
|
onBlur: () => setOpen(false),
|
|
4187
4248
|
onPress: () => setOpen((prev) => !prev),
|
|
4188
4249
|
children: [
|
|
4189
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValue, { value: display, unit: "G$", unitPosition: "suffix" }),
|
|
4190
4251
|
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4191
4252
|
import_ui9.YStack,
|
|
4192
4253
|
{
|
|
@@ -4211,6 +4272,43 @@ function CompactGStatValue({ amount }) {
|
|
|
4211
4272
|
function formatUsdAmount2(usdMicro) {
|
|
4212
4273
|
return formatUsdMicroValue(usdMicro);
|
|
4213
4274
|
}
|
|
4275
|
+
function CreditBalanceCard({
|
|
4276
|
+
balance,
|
|
4277
|
+
monthlyCredit
|
|
4278
|
+
}) {
|
|
4279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Card, { raised: true, borderWidth: 0, width: "100%", gap: "$2", children: [
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { fontSize: "$1", tone: "soft", children: "Credit balance" }),
|
|
4281
|
+
balance !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4282
|
+
StatValue,
|
|
4283
|
+
{
|
|
4284
|
+
value: balance,
|
|
4285
|
+
unit: "US$",
|
|
4286
|
+
unitPosition: "prefix",
|
|
4287
|
+
fontSize: "$8",
|
|
4288
|
+
unitFontSize: "$5"
|
|
4289
|
+
}
|
|
4290
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Spinner, { size: "sm" }),
|
|
4291
|
+
monthlyCredit ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
4292
|
+
import_ui9.XStack,
|
|
4293
|
+
{
|
|
4294
|
+
alignSelf: "flex-start",
|
|
4295
|
+
alignItems: "center",
|
|
4296
|
+
gap: "$1",
|
|
4297
|
+
paddingHorizontal: "$2",
|
|
4298
|
+
paddingVertical: "$1",
|
|
4299
|
+
borderRadius: "$full",
|
|
4300
|
+
backgroundColor: "$infoMuted",
|
|
4301
|
+
children: [
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.TrendingUp, { size: 14, color: "$primary" }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Text, { fontSize: "$1", fontWeight: "700", color: "$primary", children: [
|
|
4304
|
+
monthlyCredit.startsWith("<") ? monthlyCredit : `~${monthlyCredit}`,
|
|
4305
|
+
" / month"
|
|
4306
|
+
] })
|
|
4307
|
+
]
|
|
4308
|
+
}
|
|
4309
|
+
) : null
|
|
4310
|
+
] });
|
|
4311
|
+
}
|
|
4214
4312
|
function CreditsManagementCard({ state, actions }) {
|
|
4215
4313
|
const [isClosing, setIsClosing] = (0, import_react8.useState)(false);
|
|
4216
4314
|
const [isWithdrawing, setIsWithdrawing] = (0, import_react8.useState)(false);
|
|
@@ -4235,7 +4333,7 @@ function CreditsManagementCard({ state, actions }) {
|
|
|
4235
4333
|
streamBonusPercent: state.streamBonusPercent
|
|
4236
4334
|
});
|
|
4237
4335
|
if (usdMicro <= 0n) return null;
|
|
4238
|
-
return
|
|
4336
|
+
return formatUsdMicroAmount(usdMicro.toString());
|
|
4239
4337
|
}, [
|
|
4240
4338
|
monthlyStreamG,
|
|
4241
4339
|
gdUsdPerToken,
|
|
@@ -4251,20 +4349,16 @@ function CreditsManagementCard({ state, actions }) {
|
|
|
4251
4349
|
const canWithdraw = Boolean(signerPrvKey) && hasWithdrawableBalance && Boolean(withdrawAmount.trim()) && !isWithdrawing;
|
|
4252
4350
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Card, { children: [
|
|
4253
4351
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Heading, { level: 6, children: "AI Credits" }),
|
|
4254
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
4255
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4256
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
4257
|
-
"
|
|
4258
|
-
|
|
4259
|
-
] })
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
] }),
|
|
4265
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(StatRow, { children: [
|
|
4266
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Bonus Earned (US$)", children: totalBonusDisplay !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValueText, { children: totalBonusDisplay }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Spinner, { size: "sm" }) }),
|
|
4267
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Withdrawable (US$)", children: withdrawableDisplay !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValueText, { children: withdrawableDisplay }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Spinner, { size: "sm" }) })
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.YStack, { gap: "$2", width: "100%", children: [
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CreditBalanceCard, { balance: totalCreditDisplay, monthlyCredit: monthlyStreamUsdDisplay }),
|
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(StatRow, { children: [
|
|
4355
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Deposited", icon: import_ui9.Coins, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CompactGStatValue, { amount: totalGdDepositedG ?? "0.00" }) }),
|
|
4356
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Monthly Streaming", icon: import_ui9.Repeat, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CompactGStatValue, { amount: monthlyStreamG ?? "0.00" }) })
|
|
4357
|
+
] }),
|
|
4358
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(StatRow, { children: [
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Bonus", icon: import_ui9.Gift, children: totalBonusDisplay !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValue, { value: totalBonusDisplay, unit: "US$", unitPosition: "prefix" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Spinner, { size: "sm" }) }),
|
|
4360
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatCell, { label: "Withdrawable", icon: import_ui9.Wallet, children: withdrawableDisplay !== null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StatValue, { value: withdrawableDisplay, unit: "US$", unitPosition: "prefix" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Spinner, { size: "sm" }) })
|
|
4361
|
+
] })
|
|
4268
4362
|
] }),
|
|
4269
4363
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.YStack, { gap: "$1", width: "100%", children: [
|
|
4270
4364
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.XStack, { gap: "$1", alignItems: "center", children: [
|