@bounded-sh/client 0.0.50 → 0.0.52

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 (58) hide show
  1. package/dist/auth/index.d.ts +8 -1
  2. package/dist/builds/apps.d.ts +2 -0
  3. package/dist/builds/client.d.ts +23 -1
  4. package/dist/builds/index.d.ts +7 -4
  5. package/dist/builds/types.d.ts +72 -0
  6. package/dist/{email-auth-provider-Dj66AuH0.js → email-auth-provider-6seVxrWq.js} +2 -2
  7. package/dist/{email-auth-provider-Dj66AuH0.js.map → email-auth-provider-6seVxrWq.js.map} +1 -1
  8. package/dist/{email-auth-provider-CmYs6Dcm.js → email-auth-provider-BCI1_WLA.js} +2 -2
  9. package/dist/{email-auth-provider-CmYs6Dcm.js.map → email-auth-provider-BCI1_WLA.js.map} +1 -1
  10. package/dist/{email-auth-provider-B7czfBEU.mjs → email-auth-provider-D22p_2xV.mjs} +2 -2
  11. package/dist/{email-auth-provider-DIZAETBC.mjs.map → email-auth-provider-D22p_2xV.mjs.map} +1 -1
  12. package/dist/{email-auth-provider-DIZAETBC.mjs → email-auth-provider-uZbdT_Bx.mjs} +2 -2
  13. package/dist/{email-auth-provider-B7czfBEU.mjs.map → email-auth-provider-uZbdT_Bx.mjs.map} +1 -1
  14. package/dist/global.d.ts +3 -3
  15. package/dist/{guest-auth-provider-CCpNvX3j.mjs → guest-auth-provider-B_9cVFL1.mjs} +2 -2
  16. package/dist/{guest-auth-provider-CCpNvX3j.mjs.map → guest-auth-provider-B_9cVFL1.mjs.map} +1 -1
  17. package/dist/{guest-auth-provider-B5sgg-q5.js → guest-auth-provider-BrSO-CUp.js} +2 -2
  18. package/dist/{guest-auth-provider-B5sgg-q5.js.map → guest-auth-provider-BrSO-CUp.js.map} +1 -1
  19. package/dist/{guest-auth-provider-CxsLCznO.js → guest-auth-provider-DY-u2wpK.js} +2 -2
  20. package/dist/{guest-auth-provider-CxsLCznO.js.map → guest-auth-provider-DY-u2wpK.js.map} +1 -1
  21. package/dist/{guest-auth-provider-BR0_YL8z.mjs → guest-auth-provider-ShmskrcH.mjs} +2 -2
  22. package/dist/{guest-auth-provider-BR0_YL8z.mjs.map → guest-auth-provider-ShmskrcH.mjs.map} +1 -1
  23. package/dist/{index-BYy1tSkr.mjs → index-BvUrIsky.mjs} +98 -15
  24. package/dist/index-BvUrIsky.mjs.map +1 -0
  25. package/dist/{index-m42Be5Oj.js → index-D4jNluH9.js} +100 -14
  26. package/dist/index-D4jNluH9.js.map +1 -0
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.js +12 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +2 -2
  31. package/dist/{index.native-BfoLJCZg.js → index.native-2Mmuh7RB.js} +100 -14
  32. package/dist/index.native-2Mmuh7RB.js.map +1 -0
  33. package/dist/{index.native-B-ldAbu2.mjs → index.native-gU1kSEmQ.mjs} +98 -15
  34. package/dist/index.native-gU1kSEmQ.mjs.map +1 -0
  35. package/dist/index.native.js +4 -1
  36. package/dist/index.native.js.map +1 -1
  37. package/dist/index.native.mjs +1 -1
  38. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js → injected-evm-wallet-provider-BEGvuTUU.js} +2 -2
  39. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js.map → injected-evm-wallet-provider-BEGvuTUU.js.map} +1 -1
  40. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs → injected-evm-wallet-provider-CNnMBwAY.mjs} +2 -2
  41. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs.map → injected-evm-wallet-provider-CNnMBwAY.mjs.map} +1 -1
  42. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs → injected-evm-wallet-provider-COM5BPuY.mjs} +2 -2
  43. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs.map → injected-evm-wallet-provider-COM5BPuY.mjs.map} +1 -1
  44. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js → injected-evm-wallet-provider-DoB2BLir.js} +2 -2
  45. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js.map → injected-evm-wallet-provider-DoB2BLir.js.map} +1 -1
  46. package/dist/{injected-wallet-provider-BfzoheDy.mjs → injected-wallet-provider-CGoMdKhp.mjs} +2 -2
  47. package/dist/{injected-wallet-provider-BfzoheDy.mjs.map → injected-wallet-provider-CGoMdKhp.mjs.map} +1 -1
  48. package/dist/{injected-wallet-provider-DG87X6AQ.mjs → injected-wallet-provider-CLeRnTLu.mjs} +2 -2
  49. package/dist/{injected-wallet-provider-DG87X6AQ.mjs.map → injected-wallet-provider-CLeRnTLu.mjs.map} +1 -1
  50. package/dist/{injected-wallet-provider-Cml9TkyV.js → injected-wallet-provider-CyCGjf2G.js} +2 -2
  51. package/dist/{injected-wallet-provider-Cml9TkyV.js.map → injected-wallet-provider-CyCGjf2G.js.map} +1 -1
  52. package/dist/{injected-wallet-provider-PYcvLO2Z.js → injected-wallet-provider-g0md2vEj.js} +2 -2
  53. package/dist/{injected-wallet-provider-PYcvLO2Z.js.map → injected-wallet-provider-g0md2vEj.js.map} +1 -1
  54. package/package.json +2 -2
  55. package/dist/index-BYy1tSkr.mjs.map +0 -1
  56. package/dist/index-m42Be5Oj.js.map +0 -1
  57. package/dist/index.native-B-ldAbu2.mjs.map +0 -1
  58. 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-B7czfBEU.mjs')).EmailAuthProvider();
4448
+ currentAuthProvider = new (await import('./email-auth-provider-D22p_2xV.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-DG87X6AQ.mjs');
4467
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-CLeRnTLu.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-ubsHX217.mjs');
4480
+ const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-CNnMBwAY.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-CCpNvX3j.mjs')).GuestAuthProvider();
4508
+ currentAuthProvider = new (await import('./guest-auth-provider-B_9cVFL1.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-CCpNvX3j.mjs')).GuestAuthProvider();
4564
+ const provider = new (await import('./guest-auth-provider-B_9cVFL1.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;
@@ -5226,6 +5278,31 @@ async function decideGate(appId, runId, gateId, options) {
5226
5278
  const { intentKey: _intentKey, idempotencyKey: _suppliedKey } = options, decision = __rest(options, ["intentKey", "idempotencyKey"]);
5227
5279
  return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/decision`, { method: 'POST', body: Object.assign(Object.assign({}, decision), { idempotencyKey }) });
5228
5280
  }
5281
+ async function refreshReviewCapability(appId, runId, gateId, options) {
5282
+ const idempotencyKey = actionIdempotencyKey(options, 'refreshReviewCapability()');
5283
+ return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/review-capability/refresh`, {
5284
+ method: 'POST',
5285
+ body: {
5286
+ expectedGeneration: options.expectedGeneration,
5287
+ expectedExpiresAtMs: options.expectedExpiresAtMs,
5288
+ expectedRecoveryUntilMs: options.expectedRecoveryUntilMs,
5289
+ expectedAudience: options.expectedAudience,
5290
+ expectedReviewerBindingHash: options.expectedReviewerBindingHash,
5291
+ idempotencyKey,
5292
+ },
5293
+ });
5294
+ }
5295
+ /**
5296
+ * Read one exact delegated-review capability and its narrow lifecycle result.
5297
+ * This does not refresh or extend the window and exposes no generic run-view
5298
+ * authority.
5299
+ */
5300
+ async function getReviewCapability(appId, runId, gateId, options) {
5301
+ return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/review-capability`, {
5302
+ method: 'POST',
5303
+ body: { expectedPreviewUrl: options.expectedPreviewUrl },
5304
+ });
5305
+ }
5229
5306
  async function topup(appId, runId, options) {
5230
5307
  return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/topup`, { method: 'POST', body: options });
5231
5308
  }
@@ -5271,6 +5348,9 @@ const FAILURE_REASONS = [
5271
5348
  'bind_failed',
5272
5349
  'internal_error',
5273
5350
  ];
5351
+ const BUILD_REVIEW_CAPABILITY_SCHEMA = 'bounded.build-review-capability.v1';
5352
+ const BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = 'bounded.build-review-capability-refresh.v1';
5353
+ const BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = 'bounded.build-delegated-review-capability.v1';
5274
5354
 
5275
5355
  const NORMAL_POLL_MS = 2000;
5276
5356
  const PARKED_POLL_MS = 5000;
@@ -5507,22 +5587,25 @@ function useBuildRun(appId, runId, options) {
5507
5587
  }
5508
5588
 
5509
5589
  /**
5510
- * Platform first-party surfaces only (bounded.sh, oapps.fun, localhost) —
5511
- * dev-api CORS blocks calls from generated-app origins. Server-side callers unaffected.
5590
+ * Platform first-party surfaces only (bounded.sh, oapps.fun, localhost), with
5591
+ * one exact Drafted exception for delegated review/decision routes. Other
5592
+ * generated-app origins remain blocked; server-side callers are unaffected.
5512
5593
  */
5513
5594
  const builds = {
5514
5595
  submit,
5515
5596
  get,
5597
+ getReviewCapability,
5516
5598
  events,
5517
5599
  cancel,
5518
5600
  decideGate,
5601
+ refreshReviewCapability,
5519
5602
  topup,
5520
5603
  list: list$1,
5521
5604
  watch,
5522
5605
  };
5523
5606
 
5524
5607
  async function create(options = {}) {
5525
- const body = Object.assign(Object.assign(Object.assign(Object.assign({}, (options.name !== undefined ? { name: options.name } : {})), (options.prompt !== undefined ? { prompt: options.prompt } : {})), (options.clientToken !== undefined ? { clientToken: options.clientToken } : {})), (options.intent !== undefined ? { intent: options.intent } : {}));
5608
+ const body = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.name !== undefined ? { name: options.name } : {})), (options.prompt !== undefined ? { prompt: options.prompt } : {})), (options.clientToken !== undefined ? { clientToken: options.clientToken } : {})), (options.intent !== undefined ? { intent: options.intent } : {})), (options.oapp === true ? { oapp: true } : {}));
5526
5609
  const app = await requestDevApi('/apps/new', {
5527
5610
  method: 'POST',
5528
5611
  body,
@@ -5968,5 +6051,5 @@ class PrivyExpoProvider {
5968
6051
  }
5969
6052
  }
5970
6053
 
5971
- export { useAuth as A, useBuildRun as B, apps as C, deserializeTransaction as D, EMBEDDED_WALLET_UNSUPPORTED as E, getIdToken as F, setPlatform as G, builds as H, BuildsApiError as I, PARK_REASONS as J, FAILURE_REASONS as K, NON_TERMINAL_STATES as N, OffchainAuthProvider as O, PrivyExpoProvider as P, RUN_STATES as R, SURFNET_RPC_URL as S, TERMINAL_STATES as T, hasEmbeddedEvmWallet as a, embeddedSignAndSubmit as b, setAuthLoading as c, bufferExports as d, embeddedRunEvmTransaction as e, bs58 as f, getPlatform as g, hasEmbeddedWallet as h, confirmAndCheckTransaction as i, init as j, getCurrentUser as k, onAuthLoadingChanged as l, getAuthLoading as m, normalizeSolanaRpcUrl as n, onAuthStateChanged as o, login as p, logout as q, resolveSolanaRpcUrl as r, setCurrentUser as s, getAuthProvider as t, signInAnonymously as u, loginWithPrivy as v, loginWithRedirect as w, completeLoginFromRedirect as x, loginWithPopup as y, completeLoginInPopup as z };
5972
- //# sourceMappingURL=index.native-B-ldAbu2.mjs.map
6054
+ export { useAuth as A, useBuildRun as B, apps as C, deserializeTransaction as D, EMBEDDED_WALLET_UNSUPPORTED as E, getIdToken as F, setPlatform as G, builds as H, BuildsApiError as I, PARK_REASONS as J, FAILURE_REASONS as K, BUILD_REVIEW_CAPABILITY_SCHEMA as L, BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA as M, NON_TERMINAL_STATES as N, OffchainAuthProvider as O, PrivyExpoProvider as P, BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA as Q, RUN_STATES as R, SURFNET_RPC_URL as S, TERMINAL_STATES as T, hasEmbeddedEvmWallet as a, embeddedSignAndSubmit as b, setAuthLoading as c, bufferExports as d, embeddedRunEvmTransaction as e, bs58 as f, getPlatform as g, hasEmbeddedWallet as h, confirmAndCheckTransaction as i, init as j, getCurrentUser as k, onAuthLoadingChanged as l, getAuthLoading as m, normalizeSolanaRpcUrl as n, onAuthStateChanged as o, login as p, logout as q, resolveSolanaRpcUrl as r, setCurrentUser as s, getAuthProvider as t, signInAnonymously as u, loginWithPrivy as v, loginWithRedirect as w, completeLoginFromRedirect as x, loginWithPopup as y, completeLoginInPopup as z };
6055
+ //# sourceMappingURL=index.native-gU1kSEmQ.mjs.map