@bounded-sh/client 0.0.105 → 0.0.106

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-CB5ZBjJL.js → email-auth-provider-C_0SoVG4.js} +2 -2
  3. package/dist/{email-auth-provider-CB5ZBjJL.js.map → email-auth-provider-C_0SoVG4.js.map} +1 -1
  4. package/dist/{email-auth-provider-sA_9RTRl.mjs → email-auth-provider-DEchcb2r.mjs} +2 -2
  5. package/dist/{email-auth-provider-sA_9RTRl.mjs.map → email-auth-provider-DEchcb2r.mjs.map} +1 -1
  6. package/dist/{guest-auth-provider-1mrlNF2G.mjs → guest-auth-provider-CF1zahC4.mjs} +2 -2
  7. package/dist/{guest-auth-provider-1mrlNF2G.mjs.map → guest-auth-provider-CF1zahC4.mjs.map} +1 -1
  8. package/dist/{guest-auth-provider-DXNCZ0R6.js → guest-auth-provider-DPZRPch_.js} +2 -2
  9. package/dist/{guest-auth-provider-DXNCZ0R6.js.map → guest-auth-provider-DPZRPch_.js.map} +1 -1
  10. package/dist/hosted-identity.d.ts +10 -0
  11. package/dist/{index-Bu6vnwxM.mjs → index-nVYK3QUO.mjs} +59 -11
  12. package/dist/index-nVYK3QUO.mjs.map +1 -0
  13. package/dist/{index-yb-jFt5B.js → index-ok-Nn6DV.js} +57 -9
  14. package/dist/index-ok-Nn6DV.js.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-D7tQrDaO.js → injected-evm-wallet-provider-C3Z2c4Yl.js} +2 -2
  19. package/dist/{injected-evm-wallet-provider-D7tQrDaO.js.map → injected-evm-wallet-provider-C3Z2c4Yl.js.map} +1 -1
  20. package/dist/{injected-evm-wallet-provider-BuDISWSq.mjs → injected-evm-wallet-provider-pI1JMr7g.mjs} +2 -2
  21. package/dist/{injected-evm-wallet-provider-BuDISWSq.mjs.map → injected-evm-wallet-provider-pI1JMr7g.mjs.map} +1 -1
  22. package/dist/{injected-wallet-provider-CFwJYxh2.js → injected-wallet-provider-CEtgcsQl.js} +2 -2
  23. package/dist/{injected-wallet-provider-CFwJYxh2.js.map → injected-wallet-provider-CEtgcsQl.js.map} +1 -1
  24. package/dist/{injected-wallet-provider-BDCLkdR_.mjs → injected-wallet-provider-DNZA1IJ9.mjs} +2 -2
  25. package/dist/{injected-wallet-provider-BDCLkdR_.mjs.map → injected-wallet-provider-DNZA1IJ9.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
@@ -6181,7 +6181,7 @@ async function getAuthProvider(config) {
6181
6181
  // manager as legacy email sessions. Human login should be started
6182
6182
  // with loginWithRedirect(); this provider is kept as the restore and
6183
6183
  // logout surface for those sessions.
6184
- currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-CB5ZBjJL.js'); })).EmailAuthProvider();
6184
+ currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-C_0SoVG4.js'); })).EmailAuthProvider();
6185
6185
  break;
6186
6186
  case "phantom": {
6187
6187
  // First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
@@ -6223,7 +6223,7 @@ async function getAuthProvider(config) {
6223
6223
  // (bounded-login-widget.ts), so registration never counts as
6224
6224
  // evidence the user has a wallet.
6225
6225
  await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
6226
- const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-CFwJYxh2.js'); });
6226
+ const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-CEtgcsQl.js'); });
6227
6227
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
6228
6228
  break;
6229
6229
  }
@@ -6236,7 +6236,7 @@ async function getAuthProvider(config) {
6236
6236
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
6237
6237
  // to point at a specific wallet or set chainId/domain.
6238
6238
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
6239
- const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-D7tQrDaO.js'); });
6239
+ const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-C3Z2c4Yl.js'); });
6240
6240
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
6241
6241
  break;
6242
6242
  }
@@ -6261,7 +6261,7 @@ async function getAuthProvider(config) {
6261
6261
  break;
6262
6262
  case "guest":
6263
6263
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
6264
- currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DXNCZ0R6.js'); })).GuestAuthProvider();
6264
+ currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DPZRPch_.js'); })).GuestAuthProvider();
6265
6265
  break;
6266
6266
  }
6267
6267
  if (!currentAuthProvider) {
@@ -6323,7 +6323,7 @@ async function signInAnonymously() {
6323
6323
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
6324
6324
  // the main bundle for data-only apps. Specifier is a static string literal
6325
6325
  // so bundle-splitting can see it.
6326
- const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DXNCZ0R6.js'); })).GuestAuthProvider();
6326
+ const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DPZRPch_.js'); })).GuestAuthProvider();
6327
6327
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
6328
6328
  // adoptSessionProvider awaits only getConfig() (already resolved here) and then
6329
6329
  // runs every write - provider/method/config/marker/user - in one synchronous
@@ -6494,7 +6494,7 @@ function ensureSharedWalletLoginReady() {
6494
6494
  if (!sharedWalletReady) {
6495
6495
  sharedWalletReady = (async () => {
6496
6496
  await core.getConfig();
6497
- await Promise.resolve().then(function () { return require('./injected-wallet-provider-CFwJYxh2.js'); });
6497
+ await Promise.resolve().then(function () { return require('./injected-wallet-provider-CEtgcsQl.js'); });
6498
6498
  })().catch((error) => {
6499
6499
  sharedWalletReady = null;
6500
6500
  throw error;
@@ -6597,7 +6597,7 @@ async function loginWithWallet(options) {
6597
6597
  await ensureSharedWalletLoginReady();
6598
6598
  else
6599
6599
  await ensureWalletLoginReady();
6600
- const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-CFwJYxh2.js'); });
6600
+ const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-CEtgcsQl.js'); });
6601
6601
  // Keep the RAW wallet provider: the offchain wrapper forwards only a fixed
6602
6602
  // set of methods, so cleanup below must speak to the provider that actually
6603
6603
  // holds the config rather than to whatever is wrapping it.
@@ -7034,7 +7034,7 @@ function sameConfigValue(a, b, seen = new WeakMap()) {
7034
7034
  return left.length === right.length && left.every((key) => Object.prototype.hasOwnProperty.call(b, key)
7035
7035
  && sameConfigValue(a[key], b[key], seen));
7036
7036
  }
7037
- function init(newConfig) {
7037
+ function init$1(newConfig) {
7038
7038
  if (initializingConfig) {
7039
7039
  if (sameConfigValue(initializingConfig, newConfig)) {
7040
7040
  return authReadyPromise;
@@ -7176,6 +7176,38 @@ function setAuthProviderInstance(provider) {
7176
7176
  authProviderInstance = provider;
7177
7177
  }
7178
7178
 
7179
+ /** The text OpenApps templates carried where an app id belongs. Never a real id. */
7180
+ const APP_ID_PLACEHOLDER = 'REPLACE_WITH_MAIN_APP_ID';
7181
+ const NETWORKS = new Set(['bounded', 'bounded-staging', 'bounded-production']);
7182
+ // Bounded hosting states which app a page is: `<meta name="bounded-app-id">`
7183
+ // and `<meta name="bounded-network">`, first in <head> of every page it serves,
7184
+ // so the first tag of each name is the host's (docs/app-identity.md). Outside a
7185
+ // browser there is no page to read.
7186
+ function pageMeta(name) {
7187
+ var _a, _b;
7188
+ if (typeof document === 'undefined' || typeof document.querySelector !== 'function')
7189
+ return undefined;
7190
+ 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();
7191
+ return value || undefined;
7192
+ }
7193
+ /**
7194
+ * The configuration init() runs with. An explicit appId keeps the call exactly
7195
+ * as written. Without one (or with the template placeholder), a page served by
7196
+ * Bounded supplies its app id, and its network unless the call names one, so
7197
+ * code in any framework can call init() without carrying an id in its source.
7198
+ */
7199
+ function withHostedIdentity(config) {
7200
+ if (config.appId && config.appId !== APP_ID_PLACEHOLDER)
7201
+ return config;
7202
+ const appId = pageMeta('bounded-app-id');
7203
+ if (!appId || appId === APP_ID_PLACEHOLDER) {
7204
+ throw new Error('No app ID provided. Pass init({ appId }), or serve this page from Bounded hosting, '
7205
+ + 'which states it in <meta name="bounded-app-id">.');
7206
+ }
7207
+ const network = config.network === undefined ? pageMeta('bounded-network') : undefined;
7208
+ return Object.assign(Object.assign(Object.assign({}, config), { appId }), (network && NETWORKS.has(network) ? { network: network } : {}));
7209
+ }
7210
+
7179
7211
  // bounded-widget-ownership.ts - per-open ownership generation for the singleton
7180
7212
  // login/signing modal (bounded-widget-modal.ts).
7181
7213
  //
@@ -10962,6 +10994,22 @@ async function connectServiceSession(ticket, options) {
10962
10994
  }
10963
10995
  }
10964
10996
 
10997
+ /**
10998
+ * Initialize the SDK. A page served by Bounded already states which app it is,
10999
+ * so `init()` there needs no `appId`; pass one to run anywhere else (another
11000
+ * host, local development). An explicit `appId` is used exactly as given.
11001
+ */
11002
+ function init(config = {}) {
11003
+ let resolved;
11004
+ try {
11005
+ resolved = withHostedIdentity(config);
11006
+ }
11007
+ catch (error) {
11008
+ return Promise.reject(error);
11009
+ }
11010
+ return init$1(resolved);
11011
+ }
11012
+
10965
11013
  exports.BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA;
10966
11014
  exports.BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA;
10967
11015
  exports.BUILD_REVIEW_CAPABILITY_SCHEMA = BUILD_REVIEW_CAPABILITY_SCHEMA;
@@ -11033,4 +11081,4 @@ exports.useAuth = useAuth;
11033
11081
  exports.useBuildRun = useBuildRun;
11034
11082
  exports.useQuery = useQuery;
11035
11083
  exports.waitForAuthReady = waitForAuthReady;
11036
- //# sourceMappingURL=index-yb-jFt5B.js.map
11084
+ //# sourceMappingURL=index-ok-Nn6DV.js.map