@bounded-sh/client 0.0.105 → 0.0.107

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 (28) hide show
  1. package/README.md +9 -0
  2. package/dist/{email-auth-provider-sA_9RTRl.mjs → email-auth-provider-BPeQo6xL.mjs} +2 -2
  3. package/dist/{email-auth-provider-sA_9RTRl.mjs.map → email-auth-provider-BPeQo6xL.mjs.map} +1 -1
  4. package/dist/{email-auth-provider-CB5ZBjJL.js → email-auth-provider-T-Go_9h9.js} +2 -2
  5. package/dist/{email-auth-provider-CB5ZBjJL.js.map → email-auth-provider-T-Go_9h9.js.map} +1 -1
  6. package/dist/{guest-auth-provider-DXNCZ0R6.js → guest-auth-provider-BDhwvzem.js} +2 -2
  7. package/dist/{guest-auth-provider-DXNCZ0R6.js.map → guest-auth-provider-BDhwvzem.js.map} +1 -1
  8. package/dist/{guest-auth-provider-1mrlNF2G.mjs → guest-auth-provider-BIohNOHi.mjs} +2 -2
  9. package/dist/{guest-auth-provider-1mrlNF2G.mjs.map → guest-auth-provider-BIohNOHi.mjs.map} +1 -1
  10. package/dist/hosted-identity.d.ts +10 -0
  11. package/dist/{index-yb-jFt5B.js → index-Cs5nPIzA.js} +70 -9
  12. package/dist/index-Cs5nPIzA.js.map +1 -0
  13. package/dist/{index-Bu6vnwxM.mjs → index-DbXoOlIa.mjs} +72 -11
  14. package/dist/index-DbXoOlIa.mjs.map +1 -0
  15. package/dist/index.d.ts +8 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.mjs +1 -1
  18. package/dist/{injected-evm-wallet-provider-BuDISWSq.mjs → injected-evm-wallet-provider-BjqqLfPD.mjs} +2 -2
  19. package/dist/{injected-evm-wallet-provider-BuDISWSq.mjs.map → injected-evm-wallet-provider-BjqqLfPD.mjs.map} +1 -1
  20. package/dist/{injected-evm-wallet-provider-D7tQrDaO.js → injected-evm-wallet-provider-CMl0Fyxk.js} +2 -2
  21. package/dist/{injected-evm-wallet-provider-D7tQrDaO.js.map → injected-evm-wallet-provider-CMl0Fyxk.js.map} +1 -1
  22. package/dist/{injected-wallet-provider-CFwJYxh2.js → injected-wallet-provider-CgHOrtmj.js} +2 -2
  23. package/dist/{injected-wallet-provider-CFwJYxh2.js.map → injected-wallet-provider-CgHOrtmj.js.map} +1 -1
  24. package/dist/{injected-wallet-provider-BDCLkdR_.mjs → injected-wallet-provider-D-Pq9QVK.mjs} +2 -2
  25. package/dist/{injected-wallet-provider-BDCLkdR_.mjs.map → injected-wallet-provider-D-Pq9QVK.mjs.map} +1 -1
  26. package/package.json +2 -2
  27. package/dist/index-Bu6vnwxM.mjs.map +0 -1
  28. package/dist/index-yb-jFt5B.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getConfig, getActiveSessionManager, WebSessionManager, ReactNativeSessionManager, revokeSession, init as init$1, reconnectWithNewAuth, onSessionCleared, deriveUserIdentityFromIdToken, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
1
+ import { getConfig, getActiveSessionManager, WebSessionManager, ReactNativeSessionManager, revokeSession, reconnectWithNewAuth, init as init$2, deriveUserIdentityFromIdToken, onSessionCleared, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
2
2
  import * as React from 'react';
3
3
 
4
4
  function walletContextFromClaims(claims, baseUrl, expectedAppId, tenantOrigin) {
@@ -6160,7 +6160,7 @@ async function getAuthProvider(config) {
6160
6160
  // manager as legacy email sessions. Human login should be started
6161
6161
  // with loginWithRedirect(); this provider is kept as the restore and
6162
6162
  // logout surface for those sessions.
6163
- currentAuthProvider = new (await import('./email-auth-provider-sA_9RTRl.mjs')).EmailAuthProvider();
6163
+ currentAuthProvider = new (await import('./email-auth-provider-BPeQo6xL.mjs')).EmailAuthProvider();
6164
6164
  break;
6165
6165
  case "phantom": {
6166
6166
  // First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
@@ -6202,7 +6202,7 @@ async function getAuthProvider(config) {
6202
6202
  // (bounded-login-widget.ts), so registration never counts as
6203
6203
  // evidence the user has a wallet.
6204
6204
  await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
6205
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-BDCLkdR_.mjs');
6205
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-D-Pq9QVK.mjs');
6206
6206
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
6207
6207
  break;
6208
6208
  }
@@ -6215,7 +6215,7 @@ async function getAuthProvider(config) {
6215
6215
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
6216
6216
  // to point at a specific wallet or set chainId/domain.
6217
6217
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
6218
- const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-BuDISWSq.mjs');
6218
+ const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-BjqqLfPD.mjs');
6219
6219
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
6220
6220
  break;
6221
6221
  }
@@ -6240,7 +6240,7 @@ async function getAuthProvider(config) {
6240
6240
  break;
6241
6241
  case "guest":
6242
6242
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
6243
- currentAuthProvider = new (await import('./guest-auth-provider-1mrlNF2G.mjs')).GuestAuthProvider();
6243
+ currentAuthProvider = new (await import('./guest-auth-provider-BIohNOHi.mjs')).GuestAuthProvider();
6244
6244
  break;
6245
6245
  }
6246
6246
  if (!currentAuthProvider) {
@@ -6302,7 +6302,7 @@ async function signInAnonymously() {
6302
6302
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
6303
6303
  // the main bundle for data-only apps. Specifier is a static string literal
6304
6304
  // so bundle-splitting can see it.
6305
- const provider = new (await import('./guest-auth-provider-1mrlNF2G.mjs')).GuestAuthProvider();
6305
+ const provider = new (await import('./guest-auth-provider-BIohNOHi.mjs')).GuestAuthProvider();
6306
6306
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
6307
6307
  // adoptSessionProvider awaits only getConfig() (already resolved here) and then
6308
6308
  // runs every write - provider/method/config/marker/user - in one synchronous
@@ -6473,7 +6473,7 @@ function ensureSharedWalletLoginReady() {
6473
6473
  if (!sharedWalletReady) {
6474
6474
  sharedWalletReady = (async () => {
6475
6475
  await getConfig();
6476
- await import('./injected-wallet-provider-BDCLkdR_.mjs');
6476
+ await import('./injected-wallet-provider-D-Pq9QVK.mjs');
6477
6477
  })().catch((error) => {
6478
6478
  sharedWalletReady = null;
6479
6479
  throw error;
@@ -6576,7 +6576,7 @@ async function loginWithWallet(options) {
6576
6576
  await ensureSharedWalletLoginReady();
6577
6577
  else
6578
6578
  await ensureWalletLoginReady();
6579
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-BDCLkdR_.mjs');
6579
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-D-Pq9QVK.mjs');
6580
6580
  // Keep the RAW wallet provider: the offchain wrapper forwards only a fixed
6581
6581
  // set of methods, so cleanup below must speak to the provider that actually
6582
6582
  // holds the config rather than to whatever is wrapping it.
@@ -6941,7 +6941,7 @@ async function initialize(newConfig) {
6941
6941
  // Get auth provider first
6942
6942
  authProviderInstance = await getAuthProvider(newConfig);
6943
6943
  // Initialize config with auth provider
6944
- await init$1(Object.assign(Object.assign({}, newConfig), { authProvider: authProviderInstance }));
6944
+ await init$2(Object.assign(Object.assign({}, newConfig), { authProvider: authProviderInstance }));
6945
6945
  // A return establishes its own provider/session, or hands off a popup.
6946
6946
  // Restoring the old provider afterwards would overwrite the new login.
6947
6947
  try {
@@ -7013,7 +7013,7 @@ function sameConfigValue(a, b, seen = new WeakMap()) {
7013
7013
  return left.length === right.length && left.every((key) => Object.prototype.hasOwnProperty.call(b, key)
7014
7014
  && sameConfigValue(a[key], b[key], seen));
7015
7015
  }
7016
- function init(newConfig) {
7016
+ function init$1(newConfig) {
7017
7017
  if (initializingConfig) {
7018
7018
  if (sameConfigValue(initializingConfig, newConfig)) {
7019
7019
  return authReadyPromise;
@@ -7155,6 +7155,51 @@ function setAuthProviderInstance(provider) {
7155
7155
  authProviderInstance = provider;
7156
7156
  }
7157
7157
 
7158
+ /**
7159
+ * The text OpenApps templates carry where an app id belongs, the one the platform names
7160
+ * STARTER_MAIN_APP_ID_PLACEHOLDER (shared/starter-app-id.ts). Never a real id.
7161
+ *
7162
+ * Matched by a pattern and never spelled out, here or in a comment: bounded-host refuses a
7163
+ * Hermes release whose built output carries that text anywhere (hermes-release.ts,
7164
+ * `app_id_placeholder`), and every app that bundles this SDK would carry it. A regex source
7165
+ * reaches the bundle as written, where a string assembled from parts can be folded back into
7166
+ * the literal by a minifier.
7167
+ */
7168
+ const APP_ID_PLACEHOLDER = /^REPLACE_WITH_MAIN_APP_I[D]$/;
7169
+ /** Whether `value` is the template placeholder rather than an app id. */
7170
+ function isAppIdPlaceholder(value) {
7171
+ return APP_ID_PLACEHOLDER.test(value);
7172
+ }
7173
+ const NETWORKS = new Set(['bounded', 'bounded-staging', 'bounded-production']);
7174
+ // Bounded hosting states which app a page is: `<meta name="bounded-app-id">`
7175
+ // and `<meta name="bounded-network">`, first in <head> of every page it serves,
7176
+ // so the first tag of each name is the host's (docs/app-identity.md). Outside a
7177
+ // browser there is no page to read.
7178
+ function pageMeta(name) {
7179
+ var _a, _b;
7180
+ if (typeof document === 'undefined' || typeof document.querySelector !== 'function')
7181
+ return undefined;
7182
+ const value = (_b = (_a = document.querySelector(`meta[name="${name}"]`)) === null || _a === void 0 ? void 0 : _a.getAttribute('content')) === null || _b === void 0 ? void 0 : _b.trim();
7183
+ return value || undefined;
7184
+ }
7185
+ /**
7186
+ * The configuration init() runs with. An explicit appId keeps the call exactly
7187
+ * as written. Without one (or with the template placeholder), a page served by
7188
+ * Bounded supplies its app id, and its network unless the call names one, so
7189
+ * code in any framework can call init() without carrying an id in its source.
7190
+ */
7191
+ function withHostedIdentity(config) {
7192
+ if (config.appId && !isAppIdPlaceholder(config.appId))
7193
+ return config;
7194
+ const appId = pageMeta('bounded-app-id');
7195
+ if (!appId || isAppIdPlaceholder(appId)) {
7196
+ throw new Error('No app ID provided. Pass init({ appId }), or serve this page from Bounded hosting, '
7197
+ + 'which states it in <meta name="bounded-app-id">.');
7198
+ }
7199
+ const network = config.network === undefined ? pageMeta('bounded-network') : undefined;
7200
+ return Object.assign(Object.assign(Object.assign({}, config), { appId }), (network && NETWORKS.has(network) ? { network: network } : {}));
7201
+ }
7202
+
7158
7203
  // bounded-widget-ownership.ts - per-open ownership generation for the singleton
7159
7204
  // login/signing modal (bounded-widget-modal.ts).
7160
7205
  //
@@ -10941,5 +10986,21 @@ async function connectServiceSession(ticket, options) {
10941
10986
  }
10942
10987
  }
10943
10988
 
10989
+ /**
10990
+ * Initialize the SDK. A page served by Bounded already states which app it is,
10991
+ * so `init()` there needs no `appId`; pass one to run anywhere else (another
10992
+ * host, local development). An explicit `appId` is used exactly as given.
10993
+ */
10994
+ function init(config = {}) {
10995
+ let resolved;
10996
+ try {
10997
+ resolved = withHostedIdentity(config);
10998
+ }
10999
+ catch (error) {
11000
+ return Promise.reject(error);
11001
+ }
11002
+ return init$1(resolved);
11003
+ }
11004
+
10944
11005
  export { onrampStatus as $, getAuthProvider as A, signInAnonymously as B, loginWithPrivy as C, loginWithWallet as D, ensureWalletLoginReady as E, ensureSharedWalletLoginReady as F, preloadWalletLogin as G, loginWithRedirect as H, completeLoginFromRedirect as I, getLoginReturnError as J, loginWithPopup as K, openBoundedWidget as L, ensureSignedIn as M, useAuth as N, useQuery as O, useBuildRun as P, apps as Q, signSolanaMessageViaTurnkey as R, getOrCreateTurnkeyWallet as S, openTurnkeyKeyExport as T, getTurnkeyWalletSessionState as U, getTurnkeyWalletRecoveryUrl as V, WalletConfigError as W, startTurnkeyEmailLogin as X, getIdToken as Y, onramp as Z, onrampQuote as _, signMessageWithTurnkey as a, setPlatform as a0, OffchainAuthProvider as a1, PrivyExpoProvider as a2, requestEip6963Providers as a3, connectBroadcast as a4, connectServiceSession as a5, builds as a6, BuildsApiError as a7, mediaAgentTools as a8, NON_TERMINAL_STATES as a9, TERMINAL_STATES as aa, RUN_STATES as ab, PARK_REASONS as ac, FAILURE_REASONS as ad, BUILD_REVIEW_CAPABILITY_SCHEMA as ae, BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA as af, BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA as ag, signTransactionWithTurnkey as b, signTransactionV1WithTurnkey as c, signAndSubmitTransactionWithTurnkey as d, bs58 as e, defaultInjectedProvider as f, getPlatform as g, hasTurnkeyWallet as h, firstStandardWalletProvider as i, setAuthLoading as j, bufferExports as k, setStoredAuthMethod as l, confirmAndCheckTransaction as m, normalizeSolanaRpcUrl as n, defaultInjectedEvmProvider as o, init as p, getCurrentUser as q, resolveSolanaRpcUrl as r, setCurrentUser as s, transactionHasSignature as t, onAuthStateChanged as u, onAuthLoadingChanged as v, getAuthLoading as w, waitForAuthReady as x, login as y, logout as z };
10945
- //# sourceMappingURL=index-Bu6vnwxM.mjs.map
11006
+ //# sourceMappingURL=index-DbXoOlIa.mjs.map