@swype-org/react-sdk 0.1.212 → 0.1.213

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
@@ -665,12 +665,14 @@ declare function PoweredByFooter(): react_jsx_runtime.JSX.Element;
665
665
  interface PrimaryButtonProps {
666
666
  children: ReactNode;
667
667
  onClick?: () => void;
668
+ /** When set, renders as an `<a>` tag instead of `<button>`. */
669
+ href?: string;
668
670
  disabled?: boolean;
669
671
  loading?: boolean;
670
672
  /** Optional icon element rendered left of the label */
671
673
  icon?: ReactNode;
672
674
  }
673
- declare function PrimaryButton({ children, onClick, disabled, loading, icon }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
675
+ declare function PrimaryButton({ children, onClick, href, disabled, loading, icon }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
674
676
 
675
677
  interface OutlineButtonProps {
676
678
  children: ReactNode;
package/dist/index.d.ts CHANGED
@@ -665,12 +665,14 @@ declare function PoweredByFooter(): react_jsx_runtime.JSX.Element;
665
665
  interface PrimaryButtonProps {
666
666
  children: ReactNode;
667
667
  onClick?: () => void;
668
+ /** When set, renders as an `<a>` tag instead of `<button>`. */
669
+ href?: string;
668
670
  disabled?: boolean;
669
671
  loading?: boolean;
670
672
  /** Optional icon element rendered left of the label */
671
673
  icon?: ReactNode;
672
674
  }
673
- declare function PrimaryButton({ children, onClick, disabled, loading, icon }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
675
+ declare function PrimaryButton({ children, onClick, href, disabled, loading, icon }: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
674
676
 
675
677
  interface OutlineButtonProps {
676
678
  children: ReactNode;
package/dist/index.js CHANGED
@@ -2507,20 +2507,32 @@ var rowStyle = {
2507
2507
  alignItems: "center",
2508
2508
  gap: 6
2509
2509
  };
2510
- function PrimaryButton({ children, onClick, disabled, loading, icon }) {
2510
+ function PrimaryButton({ children, onClick, href, disabled, loading, icon }) {
2511
2511
  const { tokens } = useBlinkConfig();
2512
2512
  const isDisabled = disabled || loading;
2513
- return /* @__PURE__ */ jsxs(
2513
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
2514
+ icon && /* @__PURE__ */ jsx("span", { style: iconWrapStyle, children: icon }),
2515
+ loading ? "Please wait..." : children
2516
+ ] });
2517
+ if (href && !isDisabled) {
2518
+ return /* @__PURE__ */ jsx(
2519
+ "a",
2520
+ {
2521
+ href,
2522
+ onClick,
2523
+ style: linkButtonStyle(tokens),
2524
+ children: content
2525
+ }
2526
+ );
2527
+ }
2528
+ return /* @__PURE__ */ jsx(
2514
2529
  "button",
2515
2530
  {
2516
2531
  type: "button",
2517
2532
  onClick,
2518
2533
  disabled: isDisabled,
2519
2534
  style: buttonStyle(tokens, isDisabled),
2520
- children: [
2521
- icon && /* @__PURE__ */ jsx("span", { style: iconWrapStyle, children: icon }),
2522
- loading ? "Please wait..." : children
2523
- ]
2535
+ children: content
2524
2536
  }
2525
2537
  );
2526
2538
  }
@@ -2543,6 +2555,10 @@ var buttonStyle = (tokens, disabled) => ({
2543
2555
  justifyContent: "center",
2544
2556
  gap: 8
2545
2557
  });
2558
+ var linkButtonStyle = (tokens) => ({
2559
+ ...buttonStyle(tokens, false),
2560
+ textDecoration: "none"
2561
+ });
2546
2562
  var iconWrapStyle = {
2547
2563
  display: "flex",
2548
2564
  alignItems: "center"
@@ -4980,10 +4996,13 @@ function OpenWalletScreen({
4980
4996
  {
4981
4997
  footer: /* @__PURE__ */ jsxs("div", { style: footerContentStyle, children: [
4982
4998
  error && /* @__PURE__ */ jsx(InfoBanner, { children: error }),
4983
- !loading && /* @__PURE__ */ jsxs(PrimaryButton, { onClick: handleOpen, children: [
4999
+ !loading && (isCustomSchemeUri(deeplinkUri) ? /* @__PURE__ */ jsxs(PrimaryButton, { onClick: handleOpen, children: [
4984
5000
  "Open ",
4985
5001
  displayName
4986
- ] }),
5002
+ ] }) : /* @__PURE__ */ jsxs(PrimaryButton, { href: deeplinkUri, children: [
5003
+ "Open ",
5004
+ displayName
5005
+ ] })),
4987
5006
  error && onRetryStatus && /* @__PURE__ */ jsx(OutlineButton, { onClick: onRetryStatus, children: "Retry status check" }),
4988
5007
  /* @__PURE__ */ jsx("p", { style: hintStyle(tokens.textMuted), children: loading ? "Preparing authorization..." : error ? "Retry the status check after returning to the browser, or reopen your wallet if needed." : "If your wallet didn't open automatically, tap the button above" }),
4989
5008
  /* @__PURE__ */ jsx(PoweredByFooter, {})
@@ -6547,11 +6566,7 @@ function useProviderHandlers(deps) {
6547
6566
  providerId,
6548
6567
  isSetup: true
6549
6568
  });
6550
- if (isCustomSchemeUri(sessionUri)) {
6551
- triggerDeeplink(sessionUri);
6552
- } else {
6553
- window.location.href = sessionUri;
6554
- }
6569
+ triggerDeeplink(sessionUri);
6555
6570
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: sessionUri });
6556
6571
  } else {
6557
6572
  await authExecutor.executeSessionById(sessionId);
@@ -6667,11 +6682,7 @@ function useProviderHandlers(deps) {
6667
6682
  isReauthorization: true
6668
6683
  });
6669
6684
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
6670
- if (isCustomSchemeUri(session.uri)) {
6671
- triggerDeeplink(session.uri);
6672
- } else {
6673
- window.location.href = session.uri;
6674
- }
6685
+ triggerDeeplink(session.uri);
6675
6686
  } else {
6676
6687
  dispatch({ type: "NAVIGATE", step: "open-wallet" });
6677
6688
  await authExecutor.executeSessionById(session.id);
@@ -6764,11 +6775,7 @@ function useProviderHandlers(deps) {
6764
6775
  reauthorizationToken: { walletId: _walletId, tokenSymbol }
6765
6776
  });
6766
6777
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
6767
- if (isCustomSchemeUri(session.uri)) {
6768
- triggerDeeplink(session.uri);
6769
- } else {
6770
- window.location.href = session.uri;
6771
- }
6778
+ triggerDeeplink(session.uri);
6772
6779
  } else {
6773
6780
  dispatch({ type: "NAVIGATE", step: "open-wallet" });
6774
6781
  await authExecutor.executeSessionById(session.id);