@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.
@@ -3544,22 +3544,29 @@ function useCopyFeedback() {
3544
3544
 
3545
3545
  // src/components/buy/GenerateSignerKeyPanel.tsx
3546
3546
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
3547
- function NumberedStep({ index, title }) {
3548
- return /* @__PURE__ */ jsxs3(XStack3, { gap: "$2", alignItems: "center", children: [
3549
- /* @__PURE__ */ jsx3(
3550
- YStack3,
3551
- {
3552
- width: 24,
3553
- height: 24,
3554
- borderRadius: "$full",
3555
- backgroundColor: "$backgroundSurface",
3556
- alignItems: "center",
3557
- justifyContent: "center",
3558
- flexShrink: 0,
3559
- children: /* @__PURE__ */ jsx3(Text3, { fontSize: "$1", fontWeight: "700", children: index })
3560
- }
3561
- ),
3562
- /* @__PURE__ */ jsx3(Text3, { fontSize: "$3", fontWeight: "700", children: title })
3547
+ function NumberedStep({
3548
+ index,
3549
+ title,
3550
+ note
3551
+ }) {
3552
+ return /* @__PURE__ */ jsxs3(YStack3, { gap: "$1", children: [
3553
+ /* @__PURE__ */ jsxs3(XStack3, { gap: "$2", alignItems: "center", children: [
3554
+ /* @__PURE__ */ jsx3(
3555
+ YStack3,
3556
+ {
3557
+ width: 24,
3558
+ height: 24,
3559
+ borderRadius: "$full",
3560
+ backgroundColor: "$backgroundSurface",
3561
+ alignItems: "center",
3562
+ justifyContent: "center",
3563
+ flexShrink: 0,
3564
+ children: /* @__PURE__ */ jsx3(Text3, { fontSize: "$1", fontWeight: "700", children: index })
3565
+ }
3566
+ ),
3567
+ /* @__PURE__ */ jsx3(Text3, { fontSize: "$3", fontWeight: "700", children: title })
3568
+ ] }),
3569
+ note && /* @__PURE__ */ jsx3(Text3, { marginLeft: 32, fontSize: "$2", color: "$warning", fontStyle: "italic", lineHeight: "$3", children: note })
3563
3570
  ] });
3564
3571
  }
3565
3572
  function GenerateSignerKeyPanel({
@@ -3593,11 +3600,18 @@ function GenerateSignerKeyPanel({
3593
3600
  /* @__PURE__ */ jsxs3(YStack3, { gap: "$2", children: [
3594
3601
  /* @__PURE__ */ jsx3(NumberedStep, { index: 1, title: "Open Antseed Desktop" }),
3595
3602
  /* @__PURE__ */ jsx3(NumberedStep, { index: 2, title: "Go to Profile \u2192 Signer" }),
3596
- /* @__PURE__ */ jsx3(NumberedStep, { index: 3, title: "Tap \u2191, paste your Signer Private Key, and save" })
3603
+ /* @__PURE__ */ jsx3(
3604
+ NumberedStep,
3605
+ {
3606
+ index: 3,
3607
+ title: "Back up your existing Signer Key",
3608
+ note: "\u26A0\uFE0F Tap \u2193 to back up your existing signer key. Importing a new signer key will replace it."
3609
+ }
3610
+ ),
3611
+ /* @__PURE__ */ jsx3(NumberedStep, { index: 4, title: "Tap \u2191 to paste your Signer Key, then save." })
3597
3612
  ] }),
3598
3613
  /* @__PURE__ */ jsx3(AntseedSignerRow, { mode: "generate", showCaption: false }),
3599
3614
  /* @__PURE__ */ jsx3(AiCreditsStatusNotice, { children: /* @__PURE__ */ jsx3(Text3, { 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." }) }),
3600
- /* @__PURE__ */ jsx3(AiCreditsStatusNotice, { borderColor: "$warning", children: /* @__PURE__ */ jsx3(Text3, { 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." }) }),
3601
3615
  onOpenApiSetup && /* @__PURE__ */ jsxs3(XStack3, { gap: "$2", alignItems: "center", children: [
3602
3616
  /* @__PURE__ */ jsx3(Icon, { name: "settings", size: "xs", color: "muted" }),
3603
3617
  /* @__PURE__ */ jsxs3(Text3, { fontSize: "$2", tone: "soft", flex: 1, lineHeight: "$3", children: [
@@ -4153,10 +4167,15 @@ import {
4153
4167
  Button as Button4,
4154
4168
  ButtonText as ButtonText4,
4155
4169
  Card as Card6,
4170
+ Coins,
4171
+ Gift,
4156
4172
  Heading as Heading4,
4157
4173
  Input as Input2,
4174
+ Repeat,
4158
4175
  Spinner as Spinner4,
4159
4176
  Text as Text7,
4177
+ TrendingUp,
4178
+ Wallet,
4160
4179
  XStack as XStack7,
4161
4180
  YStack as YStack7
4162
4181
  } from "@goodwidget/ui";
@@ -4168,14 +4187,43 @@ var WITHDRAW_TOOLTIP = "Withdraws principal to your payer wallet (not bonus). Re
4168
4187
 
4169
4188
  // src/components/manage/CreditsManagementCard.tsx
4170
4189
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
4171
- function StatCell({ label, children }) {
4172
- return /* @__PURE__ */ jsxs7(Card6, { raised: true, borderWidth: 0, flexGrow: 1, flexBasis: 0, children: [
4173
- /* @__PURE__ */ jsx7(Text7, { fontSize: "$1", tone: "soft", children: label }),
4174
- /* @__PURE__ */ jsx7(YStack7, { justifyContent: "center", children })
4175
- ] });
4190
+ function StatCell({
4191
+ label,
4192
+ icon: Glyph,
4193
+ children
4194
+ }) {
4195
+ return /* @__PURE__ */ jsxs7(
4196
+ Card6,
4197
+ {
4198
+ raised: true,
4199
+ borderWidth: 0,
4200
+ flexGrow: 1,
4201
+ flexBasis: 0,
4202
+ padding: "$3",
4203
+ gap: "$1",
4204
+ children: [
4205
+ Glyph ? /* @__PURE__ */ jsx7(
4206
+ XStack7,
4207
+ {
4208
+ width: 28,
4209
+ height: 28,
4210
+ borderRadius: "$2",
4211
+ backgroundColor: "$background",
4212
+ alignItems: "center",
4213
+ justifyContent: "center",
4214
+ children: /* @__PURE__ */ jsx7(Glyph, { size: 16, color: "$colorSoft" })
4215
+ }
4216
+ ) : null,
4217
+ /* @__PURE__ */ jsxs7(YStack7, { children: [
4218
+ /* @__PURE__ */ jsx7(Text7, { fontSize: "$1", tone: "soft", children: label }),
4219
+ children
4220
+ ] })
4221
+ ]
4222
+ }
4223
+ );
4176
4224
  }
4177
4225
  function StatRow({ children }) {
4178
- return /* @__PURE__ */ jsx7(XStack7, { gap: "$2", width: "100%", alignItems: "stretch", children });
4226
+ return /* @__PURE__ */ jsx7(XStack7, { gap: "$1", width: "100%", alignItems: "stretch", children });
4179
4227
  }
4180
4228
  function StatValueText({
4181
4229
  children,
@@ -4184,12 +4232,30 @@ function StatValueText({
4184
4232
  }) {
4185
4233
  return /* @__PURE__ */ jsx7(Text7, { fontSize, fontWeight: "700", color, children });
4186
4234
  }
4235
+ function StatValue({
4236
+ value,
4237
+ unit,
4238
+ unitPosition,
4239
+ fontSize = "$2",
4240
+ unitFontSize = "$1",
4241
+ color
4242
+ }) {
4243
+ const hoistMarker = unitPosition === "prefix" && value.startsWith("<");
4244
+ const unitLabel = hoistMarker ? `<${unit}` : unit;
4245
+ const digits = hoistMarker ? value.slice(1) : value;
4246
+ const unitText = /* @__PURE__ */ jsx7(Text7, { fontSize: unitFontSize, fontWeight: "700", tone: "soft", children: unitLabel });
4247
+ return /* @__PURE__ */ jsxs7(XStack7, { alignItems: "baseline", gap: "$1", children: [
4248
+ unitPosition === "prefix" ? unitText : null,
4249
+ /* @__PURE__ */ jsx7(StatValueText, { fontSize, color, children: digits }),
4250
+ unitPosition === "suffix" ? unitText : null
4251
+ ] });
4252
+ }
4187
4253
  function CompactGStatValue({ amount }) {
4188
4254
  const [open, setOpen] = useState8(false);
4189
4255
  const display = formatGValue(amount);
4190
4256
  const exact = formatExactGAmount(amount);
4191
4257
  if (!isGValueCompacted(amount)) {
4192
- return /* @__PURE__ */ jsx7(StatValueText, { children: display });
4258
+ return /* @__PURE__ */ jsx7(StatValue, { value: display, unit: "G$", unitPosition: "suffix" });
4193
4259
  }
4194
4260
  return /* @__PURE__ */ jsxs7(
4195
4261
  XStack7,
@@ -4205,7 +4271,7 @@ function CompactGStatValue({ amount }) {
4205
4271
  onBlur: () => setOpen(false),
4206
4272
  onPress: () => setOpen((prev) => !prev),
4207
4273
  children: [
4208
- /* @__PURE__ */ jsx7(StatValueText, { children: display }),
4274
+ /* @__PURE__ */ jsx7(StatValue, { value: display, unit: "G$", unitPosition: "suffix" }),
4209
4275
  open && /* @__PURE__ */ jsx7(
4210
4276
  YStack7,
4211
4277
  {
@@ -4230,6 +4296,43 @@ function CompactGStatValue({ amount }) {
4230
4296
  function formatUsdAmount2(usdMicro) {
4231
4297
  return formatUsdMicroValue(usdMicro);
4232
4298
  }
4299
+ function CreditBalanceCard({
4300
+ balance,
4301
+ monthlyCredit
4302
+ }) {
4303
+ return /* @__PURE__ */ jsxs7(Card6, { raised: true, borderWidth: 0, width: "100%", gap: "$2", children: [
4304
+ /* @__PURE__ */ jsx7(Text7, { fontSize: "$1", tone: "soft", children: "Credit balance" }),
4305
+ balance !== null ? /* @__PURE__ */ jsx7(
4306
+ StatValue,
4307
+ {
4308
+ value: balance,
4309
+ unit: "US$",
4310
+ unitPosition: "prefix",
4311
+ fontSize: "$8",
4312
+ unitFontSize: "$5"
4313
+ }
4314
+ ) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }),
4315
+ monthlyCredit ? /* @__PURE__ */ jsxs7(
4316
+ XStack7,
4317
+ {
4318
+ alignSelf: "flex-start",
4319
+ alignItems: "center",
4320
+ gap: "$1",
4321
+ paddingHorizontal: "$2",
4322
+ paddingVertical: "$1",
4323
+ borderRadius: "$full",
4324
+ backgroundColor: "$infoMuted",
4325
+ children: [
4326
+ /* @__PURE__ */ jsx7(TrendingUp, { size: 14, color: "$primary" }),
4327
+ /* @__PURE__ */ jsxs7(Text7, { fontSize: "$1", fontWeight: "700", color: "$primary", children: [
4328
+ monthlyCredit.startsWith("<") ? monthlyCredit : `~${monthlyCredit}`,
4329
+ " / month"
4330
+ ] })
4331
+ ]
4332
+ }
4333
+ ) : null
4334
+ ] });
4335
+ }
4233
4336
  function CreditsManagementCard({ state, actions }) {
4234
4337
  const [isClosing, setIsClosing] = useState8(false);
4235
4338
  const [isWithdrawing, setIsWithdrawing] = useState8(false);
@@ -4254,7 +4357,7 @@ function CreditsManagementCard({ state, actions }) {
4254
4357
  streamBonusPercent: state.streamBonusPercent
4255
4358
  });
4256
4359
  if (usdMicro <= 0n) return null;
4257
- return formatUsdAmount2(usdMicro.toString());
4360
+ return formatUsdMicroAmount(usdMicro.toString());
4258
4361
  }, [
4259
4362
  monthlyStreamG,
4260
4363
  gdUsdPerToken,
@@ -4270,20 +4373,16 @@ function CreditsManagementCard({ state, actions }) {
4270
4373
  const canWithdraw = Boolean(signerPrvKey) && hasWithdrawableBalance && Boolean(withdrawAmount.trim()) && !isWithdrawing;
4271
4374
  return /* @__PURE__ */ jsxs7(Card6, { children: [
4272
4375
  /* @__PURE__ */ jsx7(Heading4, { level: 6, children: "AI Credits" }),
4273
- /* @__PURE__ */ jsxs7(StatRow, { children: [
4274
- /* @__PURE__ */ jsx7(StatCell, { label: "Total Credit (US$)", children: totalCreditDisplay !== null ? /* @__PURE__ */ jsx7(StatValueText, { fontSize: "$5", children: totalCreditDisplay }) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }) }),
4275
- /* @__PURE__ */ jsx7(StatCell, { label: "Monthly Credit (US$)", children: monthlyStreamUsdDisplay ? /* @__PURE__ */ jsxs7(StatValueText, { fontSize: "$5", color: "$primary", children: [
4276
- "~",
4277
- monthlyStreamUsdDisplay
4278
- ] }) : /* @__PURE__ */ jsx7(StatValueText, { fontSize: "$5", children: "\u2014" }) })
4279
- ] }),
4280
- /* @__PURE__ */ jsxs7(StatRow, { children: [
4281
- /* @__PURE__ */ jsx7(StatCell, { label: "Total Deposited (G$)", children: /* @__PURE__ */ jsx7(CompactGStatValue, { amount: totalGdDepositedG ?? "0.00" }) }),
4282
- /* @__PURE__ */ jsx7(StatCell, { label: "Monthly Stream (G$)", children: /* @__PURE__ */ jsx7(CompactGStatValue, { amount: monthlyStreamG ?? "0.00" }) })
4283
- ] }),
4284
- /* @__PURE__ */ jsxs7(StatRow, { children: [
4285
- /* @__PURE__ */ jsx7(StatCell, { label: "Bonus Earned (US$)", children: totalBonusDisplay !== null ? /* @__PURE__ */ jsx7(StatValueText, { children: totalBonusDisplay }) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }) }),
4286
- /* @__PURE__ */ jsx7(StatCell, { label: "Withdrawable (US$)", children: withdrawableDisplay !== null ? /* @__PURE__ */ jsx7(StatValueText, { children: withdrawableDisplay }) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }) })
4376
+ /* @__PURE__ */ jsxs7(YStack7, { gap: "$2", width: "100%", children: [
4377
+ /* @__PURE__ */ jsx7(CreditBalanceCard, { balance: totalCreditDisplay, monthlyCredit: monthlyStreamUsdDisplay }),
4378
+ /* @__PURE__ */ jsxs7(StatRow, { children: [
4379
+ /* @__PURE__ */ jsx7(StatCell, { label: "Deposited", icon: Coins, children: /* @__PURE__ */ jsx7(CompactGStatValue, { amount: totalGdDepositedG ?? "0.00" }) }),
4380
+ /* @__PURE__ */ jsx7(StatCell, { label: "Monthly Streaming", icon: Repeat, children: /* @__PURE__ */ jsx7(CompactGStatValue, { amount: monthlyStreamG ?? "0.00" }) })
4381
+ ] }),
4382
+ /* @__PURE__ */ jsxs7(StatRow, { children: [
4383
+ /* @__PURE__ */ jsx7(StatCell, { label: "Bonus", icon: Gift, children: totalBonusDisplay !== null ? /* @__PURE__ */ jsx7(StatValue, { value: totalBonusDisplay, unit: "US$", unitPosition: "prefix" }) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }) }),
4384
+ /* @__PURE__ */ jsx7(StatCell, { label: "Withdrawable", icon: Wallet, children: withdrawableDisplay !== null ? /* @__PURE__ */ jsx7(StatValue, { value: withdrawableDisplay, unit: "US$", unitPosition: "prefix" }) : /* @__PURE__ */ jsx7(Spinner4, { size: "sm" }) })
4385
+ ] })
4287
4386
  ] }),
4288
4387
  /* @__PURE__ */ jsxs7(YStack7, { gap: "$1", width: "100%", children: [
4289
4388
  /* @__PURE__ */ jsxs7(XStack7, { gap: "$1", alignItems: "center", children: [
@@ -6812,4 +6911,4 @@ export {
6812
6911
  useAiCreditsAdapter,
6813
6912
  AiCreditsWidget
6814
6913
  };
6815
- //# sourceMappingURL=chunk-635NKGPL.js.map
6914
+ //# sourceMappingURL=chunk-3QY3YZDH.js.map