@swype-org/react-sdk 0.1.103 → 0.1.104

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,7 +2672,10 @@ 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
2680
  /* @__PURE__ */ jsxs("div", { style: dropdownRowRightStyle, children: [
2673
2681
  active ? /* @__PURE__ */ jsx("span", { style: activeBadgeStyle(tokens), children: "Active" }) : /* @__PURE__ */ jsx("span", { style: inactiveBadgeStyle(tokens), children: "Setup incomplete" }),
@@ -2697,7 +2705,7 @@ function SourceCard({
2697
2705
  style: addProviderStyle(tokens),
2698
2706
  children: [
2699
2707
  /* @__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"
2708
+ "Add Account"
2701
2709
  ]
2702
2710
  }
2703
2711
  )
@@ -2819,6 +2827,12 @@ var dropdownFallbackIconStyle = (color) => ({
2819
2827
  color,
2820
2828
  flexShrink: 0
2821
2829
  });
2830
+ var dropdownNameColumnStyle = {
2831
+ display: "flex",
2832
+ flexDirection: "column",
2833
+ gap: 2,
2834
+ minWidth: 0
2835
+ };
2822
2836
  var dropdownNameStyle = (color) => ({
2823
2837
  fontWeight: 500,
2824
2838
  color,
@@ -2826,6 +2840,14 @@ var dropdownNameStyle = (color) => ({
2826
2840
  overflow: "hidden",
2827
2841
  textOverflow: "ellipsis"
2828
2842
  });
2843
+ var dropdownAddressStyle = (color) => ({
2844
+ fontSize: "0.72rem",
2845
+ color,
2846
+ fontFamily: '"SF Mono", "Fira Code", monospace',
2847
+ whiteSpace: "nowrap",
2848
+ overflow: "hidden",
2849
+ textOverflow: "ellipsis"
2850
+ });
2829
2851
  var activeBadgeStyle = (tokens) => ({
2830
2852
  fontSize: "0.6rem",
2831
2853
  fontWeight: 600,