@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
@@ -4466,7 +4466,7 @@ async function getAuthProvider(config) {
4466
4466
  // manager as legacy email sessions. Human login should be started
4467
4467
  // with loginWithRedirect(); this provider is kept as the restore and
4468
4468
  // logout surface for those sessions.
4469
- currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-Dj66AuH0.js'); })).EmailAuthProvider();
4469
+ currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-6seVxrWq.js'); })).EmailAuthProvider();
4470
4470
  break;
4471
4471
  case "wallet":
4472
4472
  case "phantom": {
@@ -4485,7 +4485,7 @@ async function getAuthProvider(config) {
4485
4485
  if (!isWalletLoginEnabled(config)) {
4486
4486
  throw walletLoginNotEnabledError(authMethod);
4487
4487
  }
4488
- const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-Cml9TkyV.js'); });
4488
+ const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-CyCGjf2G.js'); });
4489
4489
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
4490
4490
  break;
4491
4491
  }
@@ -4498,7 +4498,7 @@ async function getAuthProvider(config) {
4498
4498
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
4499
4499
  // to point at a specific wallet or set chainId/domain.
4500
4500
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
4501
- const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-BLQzWiBP.js'); });
4501
+ const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-BEGvuTUU.js'); });
4502
4502
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
4503
4503
  break;
4504
4504
  }
@@ -4526,7 +4526,7 @@ async function getAuthProvider(config) {
4526
4526
  break;
4527
4527
  case "guest":
4528
4528
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
4529
- currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-B5sgg-q5.js'); })).GuestAuthProvider();
4529
+ currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-BrSO-CUp.js'); })).GuestAuthProvider();
4530
4530
  break;
4531
4531
  }
4532
4532
  if (!currentAuthProvider) {
@@ -4582,7 +4582,7 @@ async function signInAnonymously() {
4582
4582
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
4583
4583
  // the main bundle for data-only apps. Specifier is a static string literal
4584
4584
  // so bundle-splitting can see it.
4585
- const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-B5sgg-q5.js'); })).GuestAuthProvider();
4585
+ const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-BrSO-CUp.js'); })).GuestAuthProvider();
4586
4586
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
4587
4587
  const commit = (user) => {
4588
4588
  // No await/interleaving inside this block: provider/method/config/marker
@@ -4758,8 +4758,45 @@ async function login$1(options) {
4758
4758
  function getCurrentAuthMethod() {
4759
4759
  return currentAuthMethod;
4760
4760
  }
4761
- async function logout$1() {
4762
- var _a;
4761
+ // The hosted issuer keeps its OWN browser session (the Better Auth cookie on
4762
+ // auth.bounded.sh) — clearing the app-local session alone leaves it alive, so
4763
+ // the next loginWithRedirect() silently re-signs the user in as the SAME
4764
+ // account: "sign out" that never lets you re-choose. The issuer ships
4765
+ // GET /logout for exactly this — it expires the session cookies and bounces
4766
+ // back — but it only redirects to https origins it trusts. Mirror that
4767
+ // allowlist here: on a trusted origin we end the issuer session with a
4768
+ // top-level bounce; anywhere else (custom domains, http dev) we keep the
4769
+ // local-only logout instead of stranding the user on the issuer origin.
4770
+ function issuerLogoutBounceUrl(issuerBase) {
4771
+ if (typeof window === 'undefined' || typeof document === 'undefined')
4772
+ return null; // RN/Node: no shared cookie jar to clear this way
4773
+ try {
4774
+ if (window.top !== window.self)
4775
+ return null; // framed: SameSite=Lax cookies don't ride iframe navigations
4776
+ }
4777
+ catch (_a) {
4778
+ return null;
4779
+ }
4780
+ try {
4781
+ const here = new URL(window.location.href);
4782
+ const host = here.hostname;
4783
+ const isLocalhost = host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost');
4784
+ const trusted = here.protocol === 'https:' &&
4785
+ (host === 'bounded.sh' ||
4786
+ host.endsWith('.bounded.sh') ||
4787
+ host.endsWith('.bounded.page') ||
4788
+ host.endsWith('.oapps.fun') ||
4789
+ isLocalhost);
4790
+ if (!trusted)
4791
+ return null;
4792
+ const base = issuerBase.replace(/\/$/, '');
4793
+ return `${base}/logout?redirect_uri=${encodeURIComponent(here.href)}`;
4794
+ }
4795
+ catch (_b) {
4796
+ return null;
4797
+ }
4798
+ }
4799
+ async function logout$1(options) {
4763
4800
  // Re-initialize the provider if it was cleared by a prior logout — the exact mirror
4764
4801
  // of login()'s self-heal above. A hosted popup/redirect login (loginWithPopup /
4765
4802
  // completeLoginFromRedirect) establishes a session WITHOUT touching the provider
@@ -4782,13 +4819,28 @@ async function logout$1() {
4782
4819
  // mistake a local-only logout for server revocation.
4783
4820
  const sm = core.getActiveSessionManager();
4784
4821
  const refreshToken = sm.getRefreshToken();
4822
+ const sessionIssuer = sm.getIssuer();
4785
4823
  if (refreshToken)
4786
- await core.revokeSession(refreshToken, (_a = sm.getIssuer()) !== null && _a !== void 0 ? _a : undefined);
4824
+ await core.revokeSession(refreshToken, sessionIssuer !== null && sessionIssuer !== void 0 ? sessionIssuer : undefined);
4825
+ // Hosted sessions ('email' covers the whole hosted surface: email OTP +
4826
+ // social + the OIDC redirect/popup flows) are the ones with an issuer
4827
+ // cookie; wallet and guest sessions have nothing hosted to end.
4828
+ const wasHosted = (currentAuthMethod !== null && currentAuthMethod !== void 0 ? currentAuthMethod : getStoredAuthMethod()) === 'email';
4787
4829
  await currentAuthProvider.logout();
4788
4830
  setStoredAuthMethod(null);
4789
4831
  currentAuthProvider = null;
4790
4832
  currentAuthMethod = null;
4791
4833
  currentAuthProviderConfigKey = null;
4834
+ if (wasHosted && !(options === null || options === void 0 ? void 0 : options.keepIssuerSession)) {
4835
+ const issuerBase = sessionIssuer
4836
+ || (await core.getConfig()).humanAuthApiUrl
4837
+ || 'https://auth.bounded.sh';
4838
+ const bounce = issuerLogoutBounceUrl(issuerBase);
4839
+ // Local state is already cleared, so even if the navigation is stopped
4840
+ // (tab close, extension) the app-side logout has fully happened.
4841
+ if (bounce)
4842
+ window.location.href = bounce;
4843
+ }
4792
4844
  }
4793
4845
 
4794
4846
  /**
@@ -4918,11 +4970,11 @@ async function login(options) {
4918
4970
  setCurrentUser(loggedInUser);
4919
4971
  return currentUser;
4920
4972
  }
4921
- async function logout() {
4973
+ async function logout(options) {
4922
4974
  if (!authProviderInstance) {
4923
4975
  throw new Error('SDK not initialized. Please call init() first.');
4924
4976
  }
4925
- await logout$1();
4977
+ await logout$1(options);
4926
4978
  setCurrentUser(null);
4927
4979
  }
4928
4980
  var hasRunFirstTime = false;
@@ -5313,6 +5365,31 @@ async function decideGate(appId, runId, gateId, options) {
5313
5365
  const { intentKey: _intentKey, idempotencyKey: _suppliedKey } = options, decision = __rest(options, ["intentKey", "idempotencyKey"]);
5314
5366
  return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/decision`, { method: 'POST', body: Object.assign(Object.assign({}, decision), { idempotencyKey }) });
5315
5367
  }
5368
+ async function refreshReviewCapability(appId, runId, gateId, options) {
5369
+ const idempotencyKey = actionIdempotencyKey(options, 'refreshReviewCapability()');
5370
+ return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/review-capability/refresh`, {
5371
+ method: 'POST',
5372
+ body: {
5373
+ expectedGeneration: options.expectedGeneration,
5374
+ expectedExpiresAtMs: options.expectedExpiresAtMs,
5375
+ expectedRecoveryUntilMs: options.expectedRecoveryUntilMs,
5376
+ expectedAudience: options.expectedAudience,
5377
+ expectedReviewerBindingHash: options.expectedReviewerBindingHash,
5378
+ idempotencyKey,
5379
+ },
5380
+ });
5381
+ }
5382
+ /**
5383
+ * Read one exact delegated-review capability and its narrow lifecycle result.
5384
+ * This does not refresh or extend the window and exposes no generic run-view
5385
+ * authority.
5386
+ */
5387
+ async function getReviewCapability(appId, runId, gateId, options) {
5388
+ return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/gates/${encodeURIComponent(gateId)}/review-capability`, {
5389
+ method: 'POST',
5390
+ body: { expectedPreviewUrl: options.expectedPreviewUrl },
5391
+ });
5392
+ }
5316
5393
  async function topup(appId, runId, options) {
5317
5394
  return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/topup`, { method: 'POST', body: options });
5318
5395
  }
@@ -5358,6 +5435,9 @@ const FAILURE_REASONS = [
5358
5435
  'bind_failed',
5359
5436
  'internal_error',
5360
5437
  ];
5438
+ const BUILD_REVIEW_CAPABILITY_SCHEMA = 'bounded.build-review-capability.v1';
5439
+ const BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = 'bounded.build-review-capability-refresh.v1';
5440
+ const BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = 'bounded.build-delegated-review-capability.v1';
5361
5441
 
5362
5442
  const NORMAL_POLL_MS = 2000;
5363
5443
  const PARKED_POLL_MS = 5000;
@@ -5594,22 +5674,25 @@ function useBuildRun(appId, runId, options) {
5594
5674
  }
5595
5675
 
5596
5676
  /**
5597
- * Platform first-party surfaces only (bounded.sh, oapps.fun, localhost) —
5598
- * dev-api CORS blocks calls from generated-app origins. Server-side callers unaffected.
5677
+ * Platform first-party surfaces only (bounded.sh, oapps.fun, localhost), with
5678
+ * one exact Drafted exception for delegated review/decision routes. Other
5679
+ * generated-app origins remain blocked; server-side callers are unaffected.
5599
5680
  */
5600
5681
  const builds = {
5601
5682
  submit,
5602
5683
  get,
5684
+ getReviewCapability,
5603
5685
  events,
5604
5686
  cancel,
5605
5687
  decideGate,
5688
+ refreshReviewCapability,
5606
5689
  topup,
5607
5690
  list: list$1,
5608
5691
  watch,
5609
5692
  };
5610
5693
 
5611
5694
  async function create(options = {}) {
5612
- 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 } : {}));
5695
+ 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 } : {}));
5613
5696
  const app = await requestDevApi('/apps/new', {
5614
5697
  method: 'POST',
5615
5698
  body,
@@ -6140,6 +6223,9 @@ function defaultInjectedEvmProvider() {
6140
6223
  return null;
6141
6224
  }
6142
6225
 
6226
+ exports.BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA;
6227
+ exports.BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA;
6228
+ exports.BUILD_REVIEW_CAPABILITY_SCHEMA = BUILD_REVIEW_CAPABILITY_SCHEMA;
6143
6229
  exports.BuildsApiError = BuildsApiError;
6144
6230
  exports.EMBEDDED_WALLET_UNSUPPORTED = EMBEDDED_WALLET_UNSUPPORTED;
6145
6231
  exports.FAILURE_REASONS = FAILURE_REASONS;
@@ -6187,4 +6273,4 @@ exports.signInAnonymously = signInAnonymously;
6187
6273
  exports.useAuth = useAuth;
6188
6274
  exports.useBuildRun = useBuildRun;
6189
6275
  exports.useQuery = useQuery;
6190
- //# sourceMappingURL=index-m42Be5Oj.js.map
6276
+ //# sourceMappingURL=index-D4jNluH9.js.map