@bounded-sh/client 0.0.50 → 0.0.51

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.
Files changed (54) hide show
  1. package/dist/auth/index.d.ts +8 -1
  2. package/dist/builds/types.d.ts +6 -0
  3. package/dist/{email-auth-provider-B7czfBEU.mjs → email-auth-provider-Bh2fDYcb.mjs} +2 -2
  4. package/dist/{email-auth-provider-DIZAETBC.mjs.map → email-auth-provider-Bh2fDYcb.mjs.map} +1 -1
  5. package/dist/{email-auth-provider-Dj66AuH0.js → email-auth-provider-Bm6vmoy3.js} +2 -2
  6. package/dist/{email-auth-provider-Dj66AuH0.js.map → email-auth-provider-Bm6vmoy3.js.map} +1 -1
  7. package/dist/{email-auth-provider-DIZAETBC.mjs → email-auth-provider-CdbhqElf.mjs} +2 -2
  8. package/dist/{email-auth-provider-B7czfBEU.mjs.map → email-auth-provider-CdbhqElf.mjs.map} +1 -1
  9. package/dist/{email-auth-provider-CmYs6Dcm.js → email-auth-provider-CnHsY8U-.js} +2 -2
  10. package/dist/{email-auth-provider-CmYs6Dcm.js.map → email-auth-provider-CnHsY8U-.js.map} +1 -1
  11. package/dist/global.d.ts +3 -3
  12. package/dist/{guest-auth-provider-B5sgg-q5.js → guest-auth-provider-CHqB_uN0.js} +2 -2
  13. package/dist/{guest-auth-provider-B5sgg-q5.js.map → guest-auth-provider-CHqB_uN0.js.map} +1 -1
  14. package/dist/{guest-auth-provider-BR0_YL8z.mjs → guest-auth-provider-Dgmr7e0Z.mjs} +2 -2
  15. package/dist/{guest-auth-provider-CCpNvX3j.mjs.map → guest-auth-provider-Dgmr7e0Z.mjs.map} +1 -1
  16. package/dist/{guest-auth-provider-CCpNvX3j.mjs → guest-auth-provider-Xir8zyfZ.mjs} +2 -2
  17. package/dist/{guest-auth-provider-BR0_YL8z.mjs.map → guest-auth-provider-Xir8zyfZ.mjs.map} +1 -1
  18. package/dist/{guest-auth-provider-CxsLCznO.js → guest-auth-provider-fjOMwfpW.js} +2 -2
  19. package/dist/{guest-auth-provider-CxsLCznO.js.map → guest-auth-provider-fjOMwfpW.js.map} +1 -1
  20. package/dist/{index-m42Be5Oj.js → index-BsrZb496.js} +63 -11
  21. package/dist/index-BsrZb496.js.map +1 -0
  22. package/dist/{index-BYy1tSkr.mjs → index-Cy0IRs6U.mjs} +63 -11
  23. package/dist/index-Cy0IRs6U.mjs.map +1 -0
  24. package/dist/index.d.ts +3 -1
  25. package/dist/index.js +9 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +2 -2
  28. package/dist/{index.native-B-ldAbu2.mjs → index.native-B29WKXlr.mjs} +63 -11
  29. package/dist/index.native-B29WKXlr.mjs.map +1 -0
  30. package/dist/{index.native-BfoLJCZg.js → index.native-BaEZwiWd.js} +63 -11
  31. package/dist/index.native-BaEZwiWd.js.map +1 -0
  32. package/dist/index.native.js +1 -1
  33. package/dist/index.native.mjs +1 -1
  34. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js → injected-evm-wallet-provider-CEWIg-_U.js} +2 -2
  35. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js.map → injected-evm-wallet-provider-CEWIg-_U.js.map} +1 -1
  36. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js → injected-evm-wallet-provider-DUyX7Xj9.js} +2 -2
  37. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js.map → injected-evm-wallet-provider-DUyX7Xj9.js.map} +1 -1
  38. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs → injected-evm-wallet-provider-DWnpa6Yx.mjs} +2 -2
  39. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs.map → injected-evm-wallet-provider-DWnpa6Yx.mjs.map} +1 -1
  40. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs → injected-evm-wallet-provider-DkyIMRce.mjs} +2 -2
  41. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs.map → injected-evm-wallet-provider-DkyIMRce.mjs.map} +1 -1
  42. package/dist/{injected-wallet-provider-PYcvLO2Z.js → injected-wallet-provider-C65NiItg.js} +2 -2
  43. package/dist/{injected-wallet-provider-PYcvLO2Z.js.map → injected-wallet-provider-C65NiItg.js.map} +1 -1
  44. package/dist/{injected-wallet-provider-Cml9TkyV.js → injected-wallet-provider-DpJvuK73.js} +2 -2
  45. package/dist/{injected-wallet-provider-Cml9TkyV.js.map → injected-wallet-provider-DpJvuK73.js.map} +1 -1
  46. package/dist/{injected-wallet-provider-BfzoheDy.mjs → injected-wallet-provider-DqBpuASt.mjs} +2 -2
  47. package/dist/{injected-wallet-provider-BfzoheDy.mjs.map → injected-wallet-provider-DqBpuASt.mjs.map} +1 -1
  48. package/dist/{injected-wallet-provider-DG87X6AQ.mjs → injected-wallet-provider-DsesEVnZ.mjs} +2 -2
  49. package/dist/{injected-wallet-provider-DG87X6AQ.mjs.map → injected-wallet-provider-DsesEVnZ.mjs.map} +1 -1
  50. package/package.json +2 -2
  51. package/dist/index-BYy1tSkr.mjs.map +0 -1
  52. package/dist/index-m42Be5Oj.js.map +0 -1
  53. package/dist/index.native-B-ldAbu2.mjs.map +0 -1
  54. package/dist/index.native-BfoLJCZg.js.map +0 -1
@@ -4445,7 +4445,7 @@ async function getAuthProvider(config) {
4445
4445
  // manager as legacy email sessions. Human login should be started
4446
4446
  // with loginWithRedirect(); this provider is kept as the restore and
4447
4447
  // logout surface for those sessions.
4448
- currentAuthProvider = new (await import('./email-auth-provider-DIZAETBC.mjs')).EmailAuthProvider();
4448
+ currentAuthProvider = new (await import('./email-auth-provider-CdbhqElf.mjs')).EmailAuthProvider();
4449
4449
  break;
4450
4450
  case "wallet":
4451
4451
  case "phantom": {
@@ -4464,7 +4464,7 @@ async function getAuthProvider(config) {
4464
4464
  if (!isWalletLoginEnabled(config)) {
4465
4465
  throw walletLoginNotEnabledError(authMethod);
4466
4466
  }
4467
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-BfzoheDy.mjs');
4467
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-DqBpuASt.mjs');
4468
4468
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
4469
4469
  break;
4470
4470
  }
@@ -4477,7 +4477,7 @@ async function getAuthProvider(config) {
4477
4477
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
4478
4478
  // to point at a specific wallet or set chainId/domain.
4479
4479
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
4480
- const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-sBCSkksr.mjs');
4480
+ const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-DkyIMRce.mjs');
4481
4481
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
4482
4482
  break;
4483
4483
  }
@@ -4505,7 +4505,7 @@ async function getAuthProvider(config) {
4505
4505
  break;
4506
4506
  case "guest":
4507
4507
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
4508
- currentAuthProvider = new (await import('./guest-auth-provider-BR0_YL8z.mjs')).GuestAuthProvider();
4508
+ currentAuthProvider = new (await import('./guest-auth-provider-Dgmr7e0Z.mjs')).GuestAuthProvider();
4509
4509
  break;
4510
4510
  }
4511
4511
  if (!currentAuthProvider) {
@@ -4561,7 +4561,7 @@ async function signInAnonymously() {
4561
4561
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
4562
4562
  // the main bundle for data-only apps. Specifier is a static string literal
4563
4563
  // so bundle-splitting can see it.
4564
- const provider = new (await import('./guest-auth-provider-BR0_YL8z.mjs')).GuestAuthProvider();
4564
+ const provider = new (await import('./guest-auth-provider-Dgmr7e0Z.mjs')).GuestAuthProvider();
4565
4565
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
4566
4566
  const commit = (user) => {
4567
4567
  // No await/interleaving inside this block: provider/method/config/marker
@@ -4737,8 +4737,45 @@ async function login$1(options) {
4737
4737
  function getCurrentAuthMethod() {
4738
4738
  return currentAuthMethod;
4739
4739
  }
4740
- async function logout$1() {
4741
- var _a;
4740
+ // The hosted issuer keeps its OWN browser session (the Better Auth cookie on
4741
+ // auth.bounded.sh) — clearing the app-local session alone leaves it alive, so
4742
+ // the next loginWithRedirect() silently re-signs the user in as the SAME
4743
+ // account: "sign out" that never lets you re-choose. The issuer ships
4744
+ // GET /logout for exactly this — it expires the session cookies and bounces
4745
+ // back — but it only redirects to https origins it trusts. Mirror that
4746
+ // allowlist here: on a trusted origin we end the issuer session with a
4747
+ // top-level bounce; anywhere else (custom domains, http dev) we keep the
4748
+ // local-only logout instead of stranding the user on the issuer origin.
4749
+ function issuerLogoutBounceUrl(issuerBase) {
4750
+ if (typeof window === 'undefined' || typeof document === 'undefined')
4751
+ return null; // RN/Node: no shared cookie jar to clear this way
4752
+ try {
4753
+ if (window.top !== window.self)
4754
+ return null; // framed: SameSite=Lax cookies don't ride iframe navigations
4755
+ }
4756
+ catch (_a) {
4757
+ return null;
4758
+ }
4759
+ try {
4760
+ const here = new URL(window.location.href);
4761
+ const host = here.hostname;
4762
+ const isLocalhost = host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost');
4763
+ const trusted = here.protocol === 'https:' &&
4764
+ (host === 'bounded.sh' ||
4765
+ host.endsWith('.bounded.sh') ||
4766
+ host.endsWith('.bounded.page') ||
4767
+ host.endsWith('.oapps.fun') ||
4768
+ isLocalhost);
4769
+ if (!trusted)
4770
+ return null;
4771
+ const base = issuerBase.replace(/\/$/, '');
4772
+ return `${base}/logout?redirect_uri=${encodeURIComponent(here.href)}`;
4773
+ }
4774
+ catch (_b) {
4775
+ return null;
4776
+ }
4777
+ }
4778
+ async function logout$1(options) {
4742
4779
  // Re-initialize the provider if it was cleared by a prior logout — the exact mirror
4743
4780
  // of login()'s self-heal above. A hosted popup/redirect login (loginWithPopup /
4744
4781
  // completeLoginFromRedirect) establishes a session WITHOUT touching the provider
@@ -4761,13 +4798,28 @@ async function logout$1() {
4761
4798
  // mistake a local-only logout for server revocation.
4762
4799
  const sm = getActiveSessionManager();
4763
4800
  const refreshToken = sm.getRefreshToken();
4801
+ const sessionIssuer = sm.getIssuer();
4764
4802
  if (refreshToken)
4765
- await revokeSession(refreshToken, (_a = sm.getIssuer()) !== null && _a !== void 0 ? _a : undefined);
4803
+ await revokeSession(refreshToken, sessionIssuer !== null && sessionIssuer !== void 0 ? sessionIssuer : undefined);
4804
+ // Hosted sessions ('email' covers the whole hosted surface: email OTP +
4805
+ // social + the OIDC redirect/popup flows) are the ones with an issuer
4806
+ // cookie; wallet and guest sessions have nothing hosted to end.
4807
+ const wasHosted = (currentAuthMethod !== null && currentAuthMethod !== void 0 ? currentAuthMethod : getStoredAuthMethod()) === 'email';
4766
4808
  await currentAuthProvider.logout();
4767
4809
  setStoredAuthMethod(null);
4768
4810
  currentAuthProvider = null;
4769
4811
  currentAuthMethod = null;
4770
4812
  currentAuthProviderConfigKey = null;
4813
+ if (wasHosted && !(options === null || options === void 0 ? void 0 : options.keepIssuerSession)) {
4814
+ const issuerBase = sessionIssuer
4815
+ || (await getConfig()).humanAuthApiUrl
4816
+ || 'https://auth.bounded.sh';
4817
+ const bounce = issuerLogoutBounceUrl(issuerBase);
4818
+ // Local state is already cleared, so even if the navigation is stopped
4819
+ // (tab close, extension) the app-side logout has fully happened.
4820
+ if (bounce)
4821
+ window.location.href = bounce;
4822
+ }
4771
4823
  }
4772
4824
 
4773
4825
  /**
@@ -4897,11 +4949,11 @@ async function login(options) {
4897
4949
  setCurrentUser(loggedInUser);
4898
4950
  return currentUser;
4899
4951
  }
4900
- async function logout() {
4952
+ async function logout(options) {
4901
4953
  if (!authProviderInstance) {
4902
4954
  throw new Error('SDK not initialized. Please call init() first.');
4903
4955
  }
4904
- await logout$1();
4956
+ await logout$1(options);
4905
4957
  setCurrentUser(null);
4906
4958
  }
4907
4959
  var hasRunFirstTime = false;
@@ -6120,4 +6172,4 @@ function defaultInjectedEvmProvider() {
6120
6172
  }
6121
6173
 
6122
6174
  export { loginWithPopup as A, completeLoginInPopup as B, useAuth as C, useQuery as D, EMBEDDED_WALLET_UNSUPPORTED as E, useBuildRun as F, apps as G, deserializeTransaction as H, getIdToken as I, setPlatform as J, requestEip6963Providers as K, builds as L, BuildsApiError as M, NON_TERMINAL_STATES as N, OffchainAuthProvider as O, PrivyExpoProvider as P, PARK_REASONS as Q, RUN_STATES as R, SURFNET_RPC_URL as S, TERMINAL_STATES as T, FAILURE_REASONS as U, hasEmbeddedEvmWallet as a, embeddedSignAndSubmit as b, setAuthLoading as c, defaultInjectedProvider as d, embeddedRunEvmTransaction as e, bufferExports as f, getPlatform as g, hasEmbeddedWallet as h, bs58 as i, confirmAndCheckTransaction as j, defaultInjectedEvmProvider as k, init as l, getCurrentUser as m, normalizeSolanaRpcUrl as n, onAuthStateChanged as o, onAuthLoadingChanged as p, getAuthLoading as q, resolveSolanaRpcUrl as r, setCurrentUser as s, login as t, logout as u, getAuthProvider as v, signInAnonymously as w, loginWithPrivy as x, loginWithRedirect as y, completeLoginFromRedirect as z };
6123
- //# sourceMappingURL=index-BYy1tSkr.mjs.map
6175
+ //# sourceMappingURL=index-Cy0IRs6U.mjs.map