@swype-org/react-sdk 0.1.180 → 0.1.182

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.cjs CHANGED
@@ -2316,7 +2316,7 @@ var dotStyle = (color) => ({
2316
2316
  var lineStyle = (color) => ({
2317
2317
  width: 32,
2318
2318
  height: 0,
2319
- borderTop: `2px dashed ${color}`,
2319
+ borderTop: `2px solid ${color}`,
2320
2320
  opacity: 0.4,
2321
2321
  flexShrink: 0
2322
2322
  });
@@ -3847,7 +3847,7 @@ var continueRowStyle = (tokens) => ({
3847
3847
  padding: "10px 16px",
3848
3848
  fontSize: "0.84rem",
3849
3849
  fontWeight: 600,
3850
- color: tokens.accent,
3850
+ color: tokens.text,
3851
3851
  background: `${tokens.accent}0d`,
3852
3852
  borderTop: `1px solid ${tokens.accent}22`
3853
3853
  });
@@ -5354,10 +5354,10 @@ function TokenPickerScreen({
5354
5354
  chains,
5355
5355
  onSelectAuthorized,
5356
5356
  onAuthorizeToken,
5357
- onBack
5357
+ onBack,
5358
+ depositAmount
5358
5359
  }) {
5359
- const { tokens: themeTokens } = useSwypeConfig();
5360
- const [selectedIndex, setSelectedIndex] = react.useState(null);
5360
+ const { tokens: t } = useSwypeConfig();
5361
5361
  const entries = [];
5362
5362
  for (const wallet of account.wallets) {
5363
5363
  for (const source of wallet.sources) {
@@ -5372,213 +5372,214 @@ function TokenPickerScreen({
5372
5372
  });
5373
5373
  }
5374
5374
  }
5375
- const selected = selectedIndex != null ? entries[selectedIndex] : null;
5376
- const isAuthorized = selected?.status === "AUTHORIZED";
5377
- const handleConfirm = () => {
5378
- if (!selected) return;
5379
- if (isAuthorized) {
5380
- onSelectAuthorized(selected.walletId, selected.tokenSymbol);
5375
+ const handleSelect = (entry) => {
5376
+ if (entry.status === "AUTHORIZED") {
5377
+ onSelectAuthorized(entry.walletId, entry.tokenSymbol);
5381
5378
  } else {
5382
- const chain = chains.find((c) => c.name === selected.chainName);
5379
+ const chain = chains.find((c) => c.name === entry.chainName);
5383
5380
  const evmChainId = chain?.commonId;
5384
5381
  if (evmChainId == null) return;
5385
- onAuthorizeToken(selected.walletId, selected.tokenAddress, evmChainId, selected.tokenSymbol);
5382
+ onAuthorizeToken(entry.walletId, entry.tokenAddress, evmChainId, entry.tokenSymbol);
5386
5383
  }
5387
5384
  };
5388
- const chainGroups = /* @__PURE__ */ new Map();
5389
- for (const entry of entries) {
5390
- const group = chainGroups.get(entry.chainName);
5391
- if (group) {
5392
- group.push(entry);
5393
- } else {
5394
- chainGroups.set(entry.chainName, [entry]);
5395
- }
5396
- }
5397
- const [expandedChain, setExpandedChain] = react.useState(
5398
- entries.length > 0 ? entries[0].chainName : null
5399
- );
5400
- return /* @__PURE__ */ jsxRuntime.jsxs(
5401
- ScreenLayout,
5402
- {
5403
- footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5404
- /* @__PURE__ */ jsxRuntime.jsx(
5405
- PrimaryButton,
5406
- {
5407
- onClick: handleConfirm,
5408
- disabled: selected == null,
5409
- children: selected == null ? "Select a token" : isAuthorized ? "Select Source" : "Authorize Token"
5410
- }
5411
- ),
5412
- /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
5413
- ] }),
5414
- children: [
5415
- /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Select Token", onBack }),
5416
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle9(themeTokens.textSecondary), children: "Choose a token to deposit with. Tokens that haven't been authorized yet will require a one-time wallet approval." }),
5417
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: chainListStyle2, children: [...chainGroups.entries()].map(([chainName, chainEntries]) => {
5418
- const isExpanded = expandedChain === chainName;
5419
- const chainTotal = chainEntries.reduce((sum, e) => sum + e.balance, 0);
5420
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: chainCardStyle2(themeTokens), children: [
5421
- /* @__PURE__ */ jsxRuntime.jsxs(
5422
- "button",
5423
- {
5424
- type: "button",
5425
- onClick: () => setExpandedChain((prev) => prev === chainName ? null : chainName),
5426
- style: chainHeaderStyle2(themeTokens),
5427
- children: [
5428
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: chainHeaderLeftStyle2, children: [
5429
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: chainNameStyle2(themeTokens.text), children: chainName }),
5430
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: chainBalanceStyle2(themeTokens.textMuted), children: [
5431
- "$",
5432
- chainTotal.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
5433
- ] })
5434
- ] }),
5435
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: chevronStyle(themeTokens.textMuted), children: isExpanded ? "\u25BE" : "\u25B8" })
5436
- ]
5437
- }
5438
- ),
5439
- isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenListStyle2, children: chainEntries.map((entry) => {
5440
- const globalIdx = entries.indexOf(entry);
5441
- const isSelected = selectedIndex === globalIdx;
5442
- const authorized = entry.status === "AUTHORIZED";
5443
- return /* @__PURE__ */ jsxRuntime.jsxs(
5444
- "button",
5445
- {
5446
- type: "button",
5447
- onClick: () => setSelectedIndex(globalIdx),
5448
- style: tokenRowStyle2(themeTokens, isSelected),
5449
- children: [
5450
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenInfoStyle2, children: [
5451
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenHeaderRowStyle, children: [
5452
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenSymbolStyle2(themeTokens.text), children: entry.tokenSymbol }),
5453
- authorized ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: statusBadgeStyle(themeTokens.success), children: "Authorized" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: statusBadgeStyle(themeTokens.textMuted), children: "Not authorized" })
5454
- ] }),
5455
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: tokenBalStyle2(themeTokens.textMuted), children: [
5456
- "$",
5457
- entry.balance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
5458
- ] })
5459
- ] }),
5460
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioStyle3(themeTokens, isSelected), children: isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioDotStyle3(themeTokens.accent) }) })
5461
- ]
5462
- },
5463
- `${entry.walletId}-${entry.tokenSymbol}`
5464
- );
5465
- }) })
5466
- ] }, chainName);
5467
- }) })
5468
- ]
5469
- }
5470
- );
5385
+ return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
5386
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
5387
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: mascotWrapStyle2, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: SWYPE_MASCOT, alt: "Swype", style: mascotImgStyle }) }),
5388
+ depositAmount != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositCardStyle2(t), children: [
5389
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: depositLabelStyle2(t.textMuted), children: "Depositing" }),
5390
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositAmountRowStyle, children: [
5391
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: depositAmountStyle(t.text), children: [
5392
+ "$",
5393
+ depositAmount.toLocaleString("en-US", { minimumFractionDigits: 0, maximumFractionDigits: 2 })
5394
+ ] }),
5395
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenIconWrapStyle3, children: [
5396
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "32", height: "32", viewBox: "0 0 36 36", fill: "none", children: [
5397
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
5398
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
5399
+ ] }),
5400
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", style: checkBadgeStyle3, children: [
5401
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "8", fill: "#2775CA" }),
5402
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 8l2 2 4-4", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
5403
+ ] })
5404
+ ] })
5405
+ ] })
5406
+ ] }),
5407
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: sectionLabelStyle(t.textMuted), children: "Choose token" }),
5408
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenListStyle2, children: entries.map((entry) => {
5409
+ const authorized = entry.status === "AUTHORIZED";
5410
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5411
+ "button",
5412
+ {
5413
+ type: "button",
5414
+ onClick: () => handleSelect(entry),
5415
+ style: tokenRowStyle2(t),
5416
+ children: [
5417
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconCircleStyle(t), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenIconTextStyle(t.textMuted), children: "$" }) }),
5418
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenInfoStyle2, children: [
5419
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenNameRowStyle, children: [
5420
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenSymbolTextStyle(t.text), children: entry.tokenSymbol }),
5421
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenChainDotStyle(t.textMuted), children: "\xB7" }),
5422
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenChainTextStyle(t.textMuted), children: entry.chainName })
5423
+ ] }),
5424
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenBalanceRowStyle, children: [
5425
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: tokenBalanceStyle(t.textMuted), children: [
5426
+ "$",
5427
+ entry.balance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
5428
+ ] }),
5429
+ !authorized && /* @__PURE__ */ jsxRuntime.jsx("span", { style: notAuthorizedStyle(t.textMuted), children: "Not authorized" })
5430
+ ] })
5431
+ ] }),
5432
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: authorized ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: authorized && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5433
+ ]
5434
+ },
5435
+ `${entry.walletId}-${entry.tokenSymbol}-${entry.chainName}`
5436
+ );
5437
+ }) })
5438
+ ] });
5471
5439
  }
5472
- var subtitleStyle9 = (color) => ({
5473
- fontSize: "0.86rem",
5474
- color,
5475
- margin: "0 0 20px",
5476
- lineHeight: 1.5
5477
- });
5478
- var chainListStyle2 = {
5440
+ var mascotWrapStyle2 = {
5479
5441
  display: "flex",
5480
- flexDirection: "column",
5481
- gap: 10
5442
+ justifyContent: "center",
5443
+ marginBottom: 16
5444
+ };
5445
+ var mascotImgStyle = {
5446
+ width: 36,
5447
+ height: 36
5482
5448
  };
5483
- var chainCardStyle2 = (tokens) => ({
5449
+ var depositCardStyle2 = (tokens) => ({
5450
+ background: tokens.bgInput,
5484
5451
  border: `1px solid ${tokens.border}`,
5485
- borderRadius: 14,
5486
- overflow: "hidden",
5487
- background: tokens.bgInput
5452
+ borderRadius: tokens.radiusLg,
5453
+ padding: "16px 20px",
5454
+ marginBottom: 24
5488
5455
  });
5489
- var chainHeaderStyle2 = (tokens) => ({
5490
- display: "flex",
5491
- alignItems: "center",
5492
- justifyContent: "space-between",
5493
- width: "100%",
5494
- padding: "14px 16px",
5495
- background: tokens.bgInput,
5496
- border: "none",
5497
- cursor: "pointer",
5498
- fontFamily: "inherit",
5499
- textAlign: "left"
5456
+ var depositLabelStyle2 = (color) => ({
5457
+ fontSize: "0.75rem",
5458
+ fontWeight: 500,
5459
+ color,
5460
+ marginBottom: 4
5500
5461
  });
5501
- var chainHeaderLeftStyle2 = {
5462
+ var depositAmountRowStyle = {
5502
5463
  display: "flex",
5503
- flexDirection: "column",
5504
- gap: 2
5464
+ alignItems: "center",
5465
+ justifyContent: "space-between"
5505
5466
  };
5506
- var chainNameStyle2 = (color) => ({
5507
- fontSize: "0.92rem",
5508
- fontWeight: 600,
5509
- color
5510
- });
5511
- var chainBalanceStyle2 = (color) => ({
5512
- fontSize: "0.76rem",
5467
+ var depositAmountStyle = (color) => ({
5468
+ fontSize: "2.2rem",
5469
+ fontWeight: 700,
5470
+ letterSpacing: "-0.02em",
5513
5471
  color
5514
5472
  });
5515
- var chevronStyle = (color) => ({
5516
- fontSize: "0.9rem",
5517
- color
5473
+ var tokenIconWrapStyle3 = {
5474
+ position: "relative",
5475
+ width: 32,
5476
+ height: 32,
5477
+ flexShrink: 0
5478
+ };
5479
+ var checkBadgeStyle3 = {
5480
+ position: "absolute",
5481
+ bottom: -1,
5482
+ right: -3
5483
+ };
5484
+ var sectionLabelStyle = (color) => ({
5485
+ fontSize: "0.84rem",
5486
+ fontWeight: 500,
5487
+ color,
5488
+ marginBottom: 12
5518
5489
  });
5519
5490
  var tokenListStyle2 = {
5520
- padding: "0 12px 12px",
5521
5491
  display: "flex",
5522
5492
  flexDirection: "column",
5523
- gap: 6
5493
+ gap: 10
5524
5494
  };
5525
- var tokenRowStyle2 = (tokens, selected) => ({
5495
+ var tokenRowStyle2 = (tokens) => ({
5526
5496
  display: "flex",
5527
5497
  alignItems: "center",
5528
- justifyContent: "space-between",
5529
- padding: "12px 14px",
5530
- background: tokens.bgCard,
5531
- border: `1.5px solid ${selected ? tokens.accent : tokens.border}`,
5532
- borderRadius: 10,
5498
+ gap: 14,
5499
+ padding: "14px 16px",
5500
+ background: tokens.bgInput,
5501
+ border: `1px solid ${tokens.border}`,
5502
+ borderRadius: 16,
5533
5503
  cursor: "pointer",
5534
5504
  fontFamily: "inherit",
5535
5505
  textAlign: "left",
5536
- transition: "border-color 0.15s ease"
5506
+ width: "100%"
5507
+ });
5508
+ var tokenIconCircleStyle = (tokens) => ({
5509
+ width: 36,
5510
+ height: 36,
5511
+ borderRadius: "50%",
5512
+ border: `1.5px solid ${tokens.border}`,
5513
+ display: "flex",
5514
+ alignItems: "center",
5515
+ justifyContent: "center",
5516
+ flexShrink: 0
5517
+ });
5518
+ var tokenIconTextStyle = (color) => ({
5519
+ fontSize: "1rem",
5520
+ fontWeight: 700,
5521
+ color
5537
5522
  });
5538
5523
  var tokenInfoStyle2 = {
5539
5524
  display: "flex",
5540
5525
  flexDirection: "column",
5541
- gap: 4,
5542
- flex: 1
5526
+ gap: 2,
5527
+ flex: 1,
5528
+ minWidth: 0
5543
5529
  };
5544
- var tokenHeaderRowStyle = {
5530
+ var tokenNameRowStyle = {
5545
5531
  display: "flex",
5546
5532
  alignItems: "center",
5547
- gap: 8
5533
+ gap: 4
5548
5534
  };
5549
- var tokenSymbolStyle2 = (color) => ({
5550
- fontSize: "0.88rem",
5535
+ var tokenSymbolTextStyle = (color) => ({
5536
+ fontSize: "0.92rem",
5551
5537
  fontWeight: 600,
5552
5538
  color
5553
5539
  });
5554
- var statusBadgeStyle = (color) => ({
5555
- fontSize: "0.65rem",
5556
- fontWeight: 600,
5557
- color,
5558
- border: `1px solid ${color}44`,
5559
- borderRadius: 999,
5560
- padding: "1px 7px",
5561
- letterSpacing: "0.02em"
5540
+ var tokenChainDotStyle = (color) => ({
5541
+ fontSize: "0.8rem",
5542
+ color
5562
5543
  });
5563
- var tokenBalStyle2 = (color) => ({
5564
- fontSize: "0.74rem",
5544
+ var tokenChainTextStyle = (color) => ({
5545
+ fontSize: "0.84rem",
5546
+ fontWeight: 400,
5565
5547
  color
5566
5548
  });
5567
- var radioStyle3 = (tokens, selected) => ({
5568
- width: 20,
5569
- height: 20,
5549
+ var tokenBalanceRowStyle = {
5550
+ display: "flex",
5551
+ alignItems: "center",
5552
+ gap: 8
5553
+ };
5554
+ var tokenBalanceStyle = (color) => ({
5555
+ fontSize: "0.78rem",
5556
+ color
5557
+ });
5558
+ var notAuthorizedStyle = (color) => ({
5559
+ fontSize: "0.7rem",
5560
+ fontWeight: 500,
5561
+ color
5562
+ });
5563
+ var selectCircleStyle = (borderColor) => ({
5564
+ width: 28,
5565
+ height: 28,
5570
5566
  borderRadius: "50%",
5571
- border: `2px solid ${selected ? tokens.accent : tokens.border}`,
5567
+ border: `2px solid ${borderColor}`,
5572
5568
  display: "flex",
5573
5569
  alignItems: "center",
5574
5570
  justifyContent: "center",
5575
5571
  flexShrink: 0
5576
5572
  });
5577
- var radioDotStyle3 = (color) => ({
5578
- width: 10,
5579
- height: 10,
5573
+ var selectCircleSelectedStyle = (color) => ({
5574
+ width: 28,
5575
+ height: 28,
5580
5576
  borderRadius: "50%",
5581
- background: color
5577
+ background: color,
5578
+ border: "none",
5579
+ display: "flex",
5580
+ alignItems: "center",
5581
+ justifyContent: "center",
5582
+ flexShrink: 0
5582
5583
  });
5583
5584
  var LINK_STEPS = /* @__PURE__ */ new Set([
5584
5585
  "create-passkey",
@@ -5834,7 +5835,8 @@ function StepRendererContent({
5834
5835
  chains: state.chains,
5835
5836
  onSelectAuthorized: handlers.onSelectAuthorizedToken,
5836
5837
  onAuthorizeToken: handlers.onAuthorizeToken,
5837
- onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit")
5838
+ onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
5839
+ depositAmount: depositAmount ?? void 0
5838
5840
  }
5839
5841
  );
5840
5842
  }