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