@pooflabs/web 0.0.88 → 0.0.89-rc1

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 (55) hide show
  1. package/dist/auth/providers/phantom-wallet-provider.d.ts +1 -0
  2. package/dist/{index-DBYgqO9f.js → index-B2tbqv9S.js} +3 -3
  3. package/dist/{index-DBYgqO9f.js.map → index-B2tbqv9S.js.map} +1 -1
  4. package/dist/{index-MF_M5V0O.esm.js → index-BbBFWBRS.esm.js} +3 -3
  5. package/dist/{index-MF_M5V0O.esm.js.map → index-BbBFWBRS.esm.js.map} +1 -1
  6. package/dist/{index-Lm0k5Hwv.js → index-Bu0P9-rk.js} +106 -21
  7. package/dist/index-Bu0P9-rk.js.map +1 -0
  8. package/dist/{index-BfsQaxom.esm.js → index-C_t7524U.esm.js} +2 -2
  9. package/dist/{index-BfsQaxom.esm.js.map → index-C_t7524U.esm.js.map} +1 -1
  10. package/dist/{index-CTtGbOzo.js → index-CaP3L422.js} +2 -2
  11. package/dist/{index-CTtGbOzo.js.map → index-CaP3L422.js.map} +1 -1
  12. package/dist/{index-CvNX4W0l.js → index-DIO6OzTK.js} +2 -2
  13. package/dist/index-DIO6OzTK.js.map +1 -0
  14. package/dist/{index-CJRFnq6O.esm.js → index-DqaHVIzZ.esm.js} +106 -21
  15. package/dist/index-DqaHVIzZ.esm.js.map +1 -0
  16. package/dist/index-Mdx7ymmb.esm.js +6 -0
  17. package/dist/index-Mdx7ymmb.esm.js.map +1 -0
  18. package/dist/{index.browser-BCr9Sc8V.js → index.browser-BCCeqt95.js} +2 -2
  19. package/dist/{index.browser-BCr9Sc8V.js.map → index.browser-BCCeqt95.js.map} +1 -1
  20. package/dist/{index.browser-CGZvkfTO.esm.js → index.browser-CMH5pzud.esm.js} +2 -2
  21. package/dist/{index.browser-CGZvkfTO.esm.js.map → index.browser-CMH5pzud.esm.js.map} +1 -1
  22. package/dist/{index.browser-BxKN5pIs.js → index.browser-D2cnbAmp.js} +2 -2
  23. package/dist/{index.browser-BxKN5pIs.js.map → index.browser-D2cnbAmp.js.map} +1 -1
  24. package/dist/{index.browser-CMijwVwX.esm.js → index.browser-K7sgUCDX.esm.js} +2 -2
  25. package/dist/{index.browser-CMijwVwX.esm.js.map → index.browser-K7sgUCDX.esm.js.map} +1 -1
  26. package/dist/index.esm.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/{index.native-FMbSnE7i.js → index.native-DGACm1O5.js} +19 -4
  29. package/dist/index.native-DGACm1O5.js.map +1 -0
  30. package/dist/{index.native-GyqT8Dn5.esm.js → index.native-RPvM5J_E.esm.js} +19 -4
  31. package/dist/index.native-RPvM5J_E.esm.js.map +1 -0
  32. package/dist/index.native.esm.js +1 -1
  33. package/dist/index.native.js +1 -1
  34. package/dist/{phantom-wallet-provider-4_DBhDbx.js → phantom-wallet-provider-B-5jhIZ6.js} +91 -21
  35. package/dist/phantom-wallet-provider-B-5jhIZ6.js.map +1 -0
  36. package/dist/{phantom-wallet-provider-BFSfBW0w.esm.js → phantom-wallet-provider-BcxNxeLW.esm.js} +91 -21
  37. package/dist/phantom-wallet-provider-BcxNxeLW.esm.js.map +1 -0
  38. package/dist/{privy-wallet-provider-Dl0feuCb.esm.js → privy-wallet-provider-B8SDd66x.esm.js} +3 -3
  39. package/dist/{privy-wallet-provider-Dl0feuCb.esm.js.map → privy-wallet-provider-B8SDd66x.esm.js.map} +1 -1
  40. package/dist/{privy-wallet-provider-DRss_Hua.js → privy-wallet-provider-Du1rVhyc.js} +3 -3
  41. package/dist/{privy-wallet-provider-DRss_Hua.js.map → privy-wallet-provider-Du1rVhyc.js.map} +1 -1
  42. package/dist/{solana-mobile-wallet-provider-C5mN8Dxh.esm.js → solana-mobile-wallet-provider-DKCgh6ep.esm.js} +4 -4
  43. package/dist/{solana-mobile-wallet-provider-C5mN8Dxh.esm.js.map → solana-mobile-wallet-provider-DKCgh6ep.esm.js.map} +1 -1
  44. package/dist/{solana-mobile-wallet-provider-CAZs-TkL.js → solana-mobile-wallet-provider-DuB_IGjv.js} +4 -4
  45. package/dist/{solana-mobile-wallet-provider-CAZs-TkL.js.map → solana-mobile-wallet-provider-DuB_IGjv.js.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/index-CJRFnq6O.esm.js.map +0 -1
  48. package/dist/index-CvNX4W0l.js.map +0 -1
  49. package/dist/index-DpiO7Cpe.esm.js +0 -6
  50. package/dist/index-DpiO7Cpe.esm.js.map +0 -1
  51. package/dist/index-Lm0k5Hwv.js.map +0 -1
  52. package/dist/index.native-FMbSnE7i.js.map +0 -1
  53. package/dist/index.native-GyqT8Dn5.esm.js.map +0 -1
  54. package/dist/phantom-wallet-provider-4_DBhDbx.js.map +0 -1
  55. package/dist/phantom-wallet-provider-BFSfBW0w.esm.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-FMbSnE7i.js');
3
+ var index_native = require('./index.native-DGACm1O5.js');
4
4
 
5
5
  var bufferExports = index_native.requireBuffer();
6
6
 
7
7
  exports.bufferExports = bufferExports;
8
- //# sourceMappingURL=index-CvNX4W0l.js.map
8
+ //# sourceMappingURL=index-DIO6OzTK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DIO6OzTK.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -13009,6 +13009,21 @@ async function login$1(options) {
13009
13009
  if (loginResult) {
13010
13010
  // Store which auth method was used so we restore the right provider on reload
13011
13011
  setStoredAuthMethod(currentAuthMethod);
13012
+ // If this top-level tab was opened solely to perform the wallet connect for
13013
+ // an embedded preview (?poofConnect — see openTopLevelForConnect in the
13014
+ // phantom provider), close it now that the session is established. The
13015
+ // session reflects back into the preview's iframe via same-origin storage.
13016
+ try {
13017
+ if (typeof window !== 'undefined'
13018
+ && window.top === window.self
13019
+ && new URLSearchParams(window.location.search).get('poofConnect') === '1') {
13020
+ setTimeout(() => { try {
13021
+ window.close();
13022
+ }
13023
+ catch ( /* noop */_a) { /* noop */ } }, 400);
13024
+ }
13025
+ }
13026
+ catch ( /* noop */_a) { /* noop */ }
13012
13027
  return Object.assign(Object.assign({}, loginResult), { provider: currentAuthProvider });
13013
13028
  }
13014
13029
  return null;
@@ -15660,6 +15675,27 @@ function shouldBreakOutOfIframe(provider) {
15660
15675
  // exactly the iframe-without-provider case we need to escape.
15661
15676
  return provider === 'deeplink' && isInIframe();
15662
15677
  }
15678
+ // In a cross-origin iframe (e.g. the poof.new build-page preview) on mobile,
15679
+ // Mobile Wallet Adapter can't run: its localhost association handshake needs
15680
+ // Chrome's Local Network Access, which is denied to cross-origin sub-frames.
15681
+ // So open the app's own URL TOP-LEVEL (a new tab / Custom Tab), where MWA works
15682
+ // natively; the connect happens there and the session — written to same-origin
15683
+ // storage — reflects back into this iframe (awaitTopLevelConnect picks it up).
15684
+ // Must be called synchronously inside a user-gesture handler so window.open
15685
+ // isn't popup-blocked. Returns true if the tab was opened.
15686
+ function openTopLevelForConnect() {
15687
+ if (typeof window === 'undefined' || !isInIframe())
15688
+ return false;
15689
+ try {
15690
+ const url = new URL(window.location.href);
15691
+ url.searchParams.set('poofConnect', '1');
15692
+ const w = window.open(url.toString(), '_blank');
15693
+ return !!w;
15694
+ }
15695
+ catch (_a) {
15696
+ return false;
15697
+ }
15698
+ }
15663
15699
  // Dynamically import React and Phantom SDK - only when needed
15664
15700
  let React$1;
15665
15701
  let ReactDOM$1;
@@ -15680,7 +15716,7 @@ async function loadDependencies() {
15680
15716
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15681
15717
  import('react'),
15682
15718
  import('react-dom/client'),
15683
- import('./index-BfsQaxom.esm.js')
15719
+ import('./index-C_t7524U.esm.js')
15684
15720
  ]);
15685
15721
  // Extract default export from ESM module namespace
15686
15722
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -16063,26 +16099,19 @@ class PhantomWalletProvider {
16063
16099
  const handleWalletClick = async (options) => {
16064
16100
  walletClickedRef.current = true;
16065
16101
  setShowWalletModal(false);
16066
- // If we're in an iframe and the user chose deeplink, Phantom's SDK
16067
- // will navigate *this* iframe to phantom.app/ul/browse/..., which
16068
- // Android App Links won't intercept and phantom.app won't let be
16069
- // framed. Escape to top-level first so the wallet browser can
16070
- // inject its provider and the normal injected flow takes over
16071
- // on the user's next connect tap.
16102
+ // Cross-origin preview iframe + deeplink: the old approach navigated
16103
+ // the top frame to this URL, but in a TWA that lands out-of-scope and
16104
+ // shows a chrome-error ("bad page"). Instead, open the app TOP-LEVEL
16105
+ // in a new tab where the wallet connect works natively; the session
16106
+ // reflects back into this iframe (see openTopLevelForConnect /
16107
+ // awaitTopLevelConnect).
16072
16108
  if (shouldBreakOutOfIframe(options === null || options === void 0 ? void 0 : options.provider)) {
16073
- try {
16074
- // Same-site navigation (*.poof.new → *.poof.new) plus the
16075
- // iframe's allow-top-navigation-by-user-activation sandbox
16076
- // token make this go through.
16077
- window.top.location.href = window.location.href;
16109
+ if (openTopLevelForConnect()) {
16110
+ that.awaitTopLevelConnect();
16078
16111
  return;
16079
16112
  }
16080
- catch (_a) {
16081
- // Top-nav blocked (no sandbox grant, cross-origin top, etc.).
16082
- // Fall through to the normal deeplink path — at least the
16083
- // user gets the original broken-ish behavior instead of a
16084
- // silently-dead button.
16085
- }
16113
+ // Popup blocked — fall through to the original deeplink path
16114
+ // (better a broken-ish button than a silently-dead one).
16086
16115
  }
16087
16116
  try {
16088
16117
  if (options === null || options === void 0 ? void 0 : options.walletId) {
@@ -16128,6 +16157,14 @@ class PhantomWalletProvider {
16128
16157
  that.loginInProgress = false;
16129
16158
  walletClickedRef.current = true;
16130
16159
  setShowWalletModal(false);
16160
+ // Cross-origin preview iframe (e.g. poof.new build page) on mobile:
16161
+ // MWA can't run here (Chrome denies Local Network Access to sub-frames,
16162
+ // and its localhost handshake fails). Open the app top-level for the
16163
+ // connect; the session reflects back into this iframe.
16164
+ if (isInIframe() && openTopLevelForConnect()) {
16165
+ that.awaitTopLevelConnect();
16166
+ return;
16167
+ }
16131
16168
  if (that.onSwitchToMWA) {
16132
16169
  try {
16133
16170
  const mwaProvider = await that.onSwitchToMWA();
@@ -16640,6 +16677,54 @@ class PhantomWalletProvider {
16640
16677
  }
16641
16678
  return null;
16642
16679
  }
16680
+ // When connect is delegated to a top-level tab (openTopLevelForConnect — used
16681
+ // for the cross-origin preview iframe on mobile, where MWA can't run), the
16682
+ // actual connect happens in that tab and writes the session to same-origin
16683
+ // storage. This watches for that session to appear and resolves the in-flight
16684
+ // login() with it. It listens for `storage` events and visibility regain (the
16685
+ // user returning from the tab), with a polling fallback and a hard timeout.
16686
+ awaitTopLevelConnect() {
16687
+ if (typeof window === 'undefined')
16688
+ return;
16689
+ let done = false;
16690
+ const cleanup = () => {
16691
+ clearInterval(poll);
16692
+ clearTimeout(timeout);
16693
+ window.removeEventListener('storage', onChange);
16694
+ document.removeEventListener('visibilitychange', onVisible);
16695
+ };
16696
+ const tryResolve = async () => {
16697
+ if (done)
16698
+ return;
16699
+ try {
16700
+ const user = await this.restoreSession();
16701
+ if (user && this.pendingLogin) {
16702
+ done = true;
16703
+ cleanup();
16704
+ this.pendingLogin.resolve(user);
16705
+ this.pendingLogin = null;
16706
+ this.loginInProgress = false;
16707
+ }
16708
+ }
16709
+ catch (_a) {
16710
+ // not ready yet — keep waiting
16711
+ }
16712
+ };
16713
+ const onChange = () => { void tryResolve(); };
16714
+ const onVisible = () => { if (document.visibilityState === 'visible')
16715
+ void tryResolve(); };
16716
+ const poll = setInterval(() => { void tryResolve(); }, 1500);
16717
+ const timeout = setTimeout(() => {
16718
+ cleanup();
16719
+ if (!done && this.pendingLogin) {
16720
+ this.pendingLogin.reject(new Error('Wallet connection timed out'));
16721
+ this.pendingLogin = null;
16722
+ this.loginInProgress = false;
16723
+ }
16724
+ }, 180000);
16725
+ window.addEventListener('storage', onChange);
16726
+ document.addEventListener('visibilitychange', onVisible);
16727
+ }
16643
16728
  async address() {
16644
16729
  var _a, _b, _c, _d;
16645
16730
  await this.ensureReady();
@@ -21773,7 +21858,7 @@ async function registerMobileWalletAdapter(config) {
21773
21858
  if (typeof window === 'undefined')
21774
21859
  return;
21775
21860
  try {
21776
- const walletStandardMobile = await import('./index.browser-CMijwVwX.esm.js');
21861
+ const walletStandardMobile = await import('./index.browser-K7sgUCDX.esm.js');
21777
21862
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21778
21863
  if (!registerMwa) {
21779
21864
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21912,7 +21997,7 @@ class SolanaMobileWalletProvider {
21912
21997
  async ensureWallet() {
21913
21998
  if (this.wallet)
21914
21999
  return this.wallet;
21915
- const mod = await import('./index.browser-CMijwVwX.esm.js');
22000
+ const mod = await import('./index.browser-K7sgUCDX.esm.js');
21916
22001
  const chain = mapChainToWalletStandard(this.cluster);
21917
22002
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21918
22003
  appIdentity: this.appIdentity,
@@ -23102,4 +23187,4 @@ class PrivyExpoProvider {
23102
23187
  }
23103
23188
 
23104
23189
  export { genAuthNonce as $, count as A, aggregate as B, subscribe as C, useAuth as D, deserializeTransaction as E, getIdToken as F, setPlatform as G, getPlatform as H, PrivyWalletProvider as I, DEFAULT_TEST_ADDRESS as J, isMobileWalletAvailable as K, registerMobileWalletAdapter as L, MockAuthProvider as M, PrivyExpoProvider as N, OffchainAuthProvider as O, PhantomWalletProvider as P, InsufficientBalanceError as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, ServerSessionManager as T, buildSetDocumentsTransaction as U, clearCache as V, WebSessionManager as W, closeAllSubscriptions as X, convertRemainingAccounts as Y, createSessionWithPrivy as Z, createSessionWithSignature as _, base58 as a, genSolanaMessage as a0, getCachedData as a1, getMany as a2, reconnectWithNewAuth as a3, refreshSession as a4, signSessionCreateMessage as a5, bufferExports as b, commonjsRequire as c, getCurrentUser as d, onAuthLoadingChanged as e, getAuthLoading as f, getDefaultExportFromCjs$1 as g, logout as h, init as i, getConfig as j, getAuthProvider as k, login as l, get as m, setMany as n, onAuthStateChanged as o, setFile as p, getFiles as q, require$$0 as r, set as s, runQuery as t, runQueryMany as u, runExpression as v, runExpressionMany as w, signMessage as x, signTransaction as y, signAndSubmitTransaction as z };
23105
- //# sourceMappingURL=index-CJRFnq6O.esm.js.map
23190
+ //# sourceMappingURL=index-DqaHVIzZ.esm.js.map