@swype-org/react-sdk 0.1.103 → 0.1.105

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/index.d.cts CHANGED
@@ -50,6 +50,8 @@ interface Wallet {
50
50
  interface Account {
51
51
  id: string;
52
52
  name: string;
53
+ /** Optional user-chosen display name for this account. */
54
+ nickname?: string | null;
53
55
  wallets: Wallet[];
54
56
  /** Remaining One-Tap allowance in USD, or null when not configured. */
55
57
  remainingAllowance?: number | null;
@@ -304,6 +306,8 @@ interface CreateAccountParams {
304
306
  name: string;
305
307
  credentialId: string;
306
308
  providerId: string;
309
+ /** Optional user-chosen display name. */
310
+ nickname?: string;
307
311
  }
308
312
  declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
309
313
  interface CreateTransferParams {
package/dist/index.d.ts CHANGED
@@ -50,6 +50,8 @@ interface Wallet {
50
50
  interface Account {
51
51
  id: string;
52
52
  name: string;
53
+ /** Optional user-chosen display name for this account. */
54
+ nickname?: string | null;
53
55
  wallets: Wallet[];
54
56
  /** Remaining One-Tap allowance in USD, or null when not configured. */
55
57
  remainingAllowance?: number | null;
@@ -304,6 +306,8 @@ interface CreateAccountParams {
304
306
  name: string;
305
307
  credentialId: string;
306
308
  providerId: string;
309
+ /** Optional user-chosen display name. */
310
+ nickname?: string;
307
311
  }
308
312
  declare function createAccount(apiBaseUrl: string, token: string, params: CreateAccountParams): Promise<Account>;
309
313
  interface CreateTransferParams {
package/dist/index.js CHANGED
@@ -220,6 +220,9 @@ async function createAccount(apiBaseUrl, token, params) {
220
220
  credentialId: params.credentialId,
221
221
  providerId: params.providerId
222
222
  };
223
+ if (params.nickname) {
224
+ body.nickname = params.nickname;
225
+ }
223
226
  const res = await fetch(`${apiBaseUrl}/v1/accounts`, {
224
227
  method: "POST",
225
228
  headers: {
@@ -2644,6 +2647,8 @@ function SourceCard({
2644
2647
  accounts.map((account) => {
2645
2648
  const active = hasActiveWallet2(account);
2646
2649
  const isSelected = account.id === selectedAccountId;
2650
+ const displayName = account.nickname ?? account.name;
2651
+ const walletAddress = account.wallets[0]?.name;
2647
2652
  return /* @__PURE__ */ jsxs(
2648
2653
  "button",
2649
2654
  {
@@ -2667,18 +2672,12 @@ function SourceCard({
2667
2672
  style: dropdownLogoStyle
2668
2673
  }
2669
2674
  ) : /* @__PURE__ */ jsx("div", { style: dropdownFallbackIconStyle(active ? tokens.textMuted : tokens.border), children: account.name.charAt(0) }),
2670
- /* @__PURE__ */ jsx("span", { style: dropdownNameStyle(active ? tokens.text : tokens.textMuted), children: account.name })
2675
+ /* @__PURE__ */ jsxs("div", { style: dropdownNameColumnStyle, children: [
2676
+ /* @__PURE__ */ jsx("span", { style: dropdownNameStyle(active ? tokens.text : tokens.textMuted), children: displayName }),
2677
+ walletAddress && /* @__PURE__ */ jsx("span", { style: dropdownAddressStyle(active ? tokens.textMuted : tokens.border), children: walletAddress })
2678
+ ] })
2671
2679
  ] }),
2672
- /* @__PURE__ */ jsxs("div", { style: dropdownRowRightStyle, children: [
2673
- active ? /* @__PURE__ */ jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }),
2674
- isSelected && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
2675
- "path",
2676
- {
2677
- d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",
2678
- fill: tokens.accent
2679
- }
2680
- ) })
2681
- ] })
2680
+ /* @__PURE__ */ jsx("div", { style: dropdownRowRightStyle, children: active ? /* @__PURE__ */ jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }) })
2682
2681
  ]
2683
2682
  },
2684
2683
  account.id
@@ -2697,7 +2696,7 @@ function SourceCard({
2697
2696
  style: addProviderStyle(tokens),
2698
2697
  children: [
2699
2698
  /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) }),
2700
- "Add Provider"
2699
+ "Add Account"
2701
2700
  ]
2702
2701
  }
2703
2702
  )
@@ -2819,6 +2818,12 @@ var dropdownFallbackIconStyle = (color) => ({
2819
2818
  color,
2820
2819
  flexShrink: 0
2821
2820
  });
2821
+ var dropdownNameColumnStyle = {
2822
+ display: "flex",
2823
+ flexDirection: "column",
2824
+ gap: 2,
2825
+ minWidth: 0
2826
+ };
2822
2827
  var dropdownNameStyle = (color) => ({
2823
2828
  fontWeight: 500,
2824
2829
  color,
@@ -2826,6 +2831,14 @@ var dropdownNameStyle = (color) => ({
2826
2831
  overflow: "hidden",
2827
2832
  textOverflow: "ellipsis"
2828
2833
  });
2834
+ var dropdownAddressStyle = (color) => ({
2835
+ fontSize: "0.72rem",
2836
+ color,
2837
+ fontFamily: '"SF Mono", "Fira Code", monospace',
2838
+ whiteSpace: "nowrap",
2839
+ overflow: "hidden",
2840
+ textOverflow: "ellipsis"
2841
+ });
2829
2842
  var activeBadgeStyle = (tokens) => ({
2830
2843
  fontSize: "0.6rem",
2831
2844
  fontWeight: 600,
@@ -5186,7 +5199,7 @@ function StepRenderer({
5186
5199
  sourceName,
5187
5200
  sourceAddress,
5188
5201
  sourceVerified,
5189
- availableBalance: maxSourceBalance,
5202
+ availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
5190
5203
  remainingLimit: selectedAccount?.remainingAllowance ?? state.oneTapLimit,
5191
5204
  tokenCount,
5192
5205
  initialAmount: parsedAmt,