@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
@@ -13030,6 +13030,21 @@ async function login$1(options) {
13030
13030
  if (loginResult) {
13031
13031
  // Store which auth method was used so we restore the right provider on reload
13032
13032
  setStoredAuthMethod(currentAuthMethod);
13033
+ // If this top-level tab was opened solely to perform the wallet connect for
13034
+ // an embedded preview (?poofConnect — see openTopLevelForConnect in the
13035
+ // phantom provider), close it now that the session is established. The
13036
+ // session reflects back into the preview's iframe via same-origin storage.
13037
+ try {
13038
+ if (typeof window !== 'undefined'
13039
+ && window.top === window.self
13040
+ && new URLSearchParams(window.location.search).get('poofConnect') === '1') {
13041
+ setTimeout(() => { try {
13042
+ window.close();
13043
+ }
13044
+ catch ( /* noop */_a) { /* noop */ } }, 400);
13045
+ }
13046
+ }
13047
+ catch ( /* noop */_a) { /* noop */ }
13033
13048
  return Object.assign(Object.assign({}, loginResult), { provider: currentAuthProvider });
13034
13049
  }
13035
13050
  return null;
@@ -15681,6 +15696,27 @@ function shouldBreakOutOfIframe(provider) {
15681
15696
  // exactly the iframe-without-provider case we need to escape.
15682
15697
  return provider === 'deeplink' && isInIframe();
15683
15698
  }
15699
+ // In a cross-origin iframe (e.g. the poof.new build-page preview) on mobile,
15700
+ // Mobile Wallet Adapter can't run: its localhost association handshake needs
15701
+ // Chrome's Local Network Access, which is denied to cross-origin sub-frames.
15702
+ // So open the app's own URL TOP-LEVEL (a new tab / Custom Tab), where MWA works
15703
+ // natively; the connect happens there and the session — written to same-origin
15704
+ // storage — reflects back into this iframe (awaitTopLevelConnect picks it up).
15705
+ // Must be called synchronously inside a user-gesture handler so window.open
15706
+ // isn't popup-blocked. Returns true if the tab was opened.
15707
+ function openTopLevelForConnect() {
15708
+ if (typeof window === 'undefined' || !isInIframe())
15709
+ return false;
15710
+ try {
15711
+ const url = new URL(window.location.href);
15712
+ url.searchParams.set('poofConnect', '1');
15713
+ const w = window.open(url.toString(), '_blank');
15714
+ return !!w;
15715
+ }
15716
+ catch (_a) {
15717
+ return false;
15718
+ }
15719
+ }
15684
15720
  // Dynamically import React and Phantom SDK - only when needed
15685
15721
  let React$1;
15686
15722
  let ReactDOM$1;
@@ -15701,7 +15737,7 @@ async function loadDependencies() {
15701
15737
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15702
15738
  import('react'),
15703
15739
  import('react-dom/client'),
15704
- Promise.resolve().then(function () { return require('./index-CTtGbOzo.js'); })
15740
+ Promise.resolve().then(function () { return require('./index-CaP3L422.js'); })
15705
15741
  ]);
15706
15742
  // Extract default export from ESM module namespace
15707
15743
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -16084,26 +16120,19 @@ class PhantomWalletProvider {
16084
16120
  const handleWalletClick = async (options) => {
16085
16121
  walletClickedRef.current = true;
16086
16122
  setShowWalletModal(false);
16087
- // If we're in an iframe and the user chose deeplink, Phantom's SDK
16088
- // will navigate *this* iframe to phantom.app/ul/browse/..., which
16089
- // Android App Links won't intercept and phantom.app won't let be
16090
- // framed. Escape to top-level first so the wallet browser can
16091
- // inject its provider and the normal injected flow takes over
16092
- // on the user's next connect tap.
16123
+ // Cross-origin preview iframe + deeplink: the old approach navigated
16124
+ // the top frame to this URL, but in a TWA that lands out-of-scope and
16125
+ // shows a chrome-error ("bad page"). Instead, open the app TOP-LEVEL
16126
+ // in a new tab where the wallet connect works natively; the session
16127
+ // reflects back into this iframe (see openTopLevelForConnect /
16128
+ // awaitTopLevelConnect).
16093
16129
  if (shouldBreakOutOfIframe(options === null || options === void 0 ? void 0 : options.provider)) {
16094
- try {
16095
- // Same-site navigation (*.poof.new → *.poof.new) plus the
16096
- // iframe's allow-top-navigation-by-user-activation sandbox
16097
- // token make this go through.
16098
- window.top.location.href = window.location.href;
16130
+ if (openTopLevelForConnect()) {
16131
+ that.awaitTopLevelConnect();
16099
16132
  return;
16100
16133
  }
16101
- catch (_a) {
16102
- // Top-nav blocked (no sandbox grant, cross-origin top, etc.).
16103
- // Fall through to the normal deeplink path — at least the
16104
- // user gets the original broken-ish behavior instead of a
16105
- // silently-dead button.
16106
- }
16134
+ // Popup blocked — fall through to the original deeplink path
16135
+ // (better a broken-ish button than a silently-dead one).
16107
16136
  }
16108
16137
  try {
16109
16138
  if (options === null || options === void 0 ? void 0 : options.walletId) {
@@ -16149,6 +16178,14 @@ class PhantomWalletProvider {
16149
16178
  that.loginInProgress = false;
16150
16179
  walletClickedRef.current = true;
16151
16180
  setShowWalletModal(false);
16181
+ // Cross-origin preview iframe (e.g. poof.new build page) on mobile:
16182
+ // MWA can't run here (Chrome denies Local Network Access to sub-frames,
16183
+ // and its localhost handshake fails). Open the app top-level for the
16184
+ // connect; the session reflects back into this iframe.
16185
+ if (isInIframe() && openTopLevelForConnect()) {
16186
+ that.awaitTopLevelConnect();
16187
+ return;
16188
+ }
16152
16189
  if (that.onSwitchToMWA) {
16153
16190
  try {
16154
16191
  const mwaProvider = await that.onSwitchToMWA();
@@ -16661,6 +16698,54 @@ class PhantomWalletProvider {
16661
16698
  }
16662
16699
  return null;
16663
16700
  }
16701
+ // When connect is delegated to a top-level tab (openTopLevelForConnect — used
16702
+ // for the cross-origin preview iframe on mobile, where MWA can't run), the
16703
+ // actual connect happens in that tab and writes the session to same-origin
16704
+ // storage. This watches for that session to appear and resolves the in-flight
16705
+ // login() with it. It listens for `storage` events and visibility regain (the
16706
+ // user returning from the tab), with a polling fallback and a hard timeout.
16707
+ awaitTopLevelConnect() {
16708
+ if (typeof window === 'undefined')
16709
+ return;
16710
+ let done = false;
16711
+ const cleanup = () => {
16712
+ clearInterval(poll);
16713
+ clearTimeout(timeout);
16714
+ window.removeEventListener('storage', onChange);
16715
+ document.removeEventListener('visibilitychange', onVisible);
16716
+ };
16717
+ const tryResolve = async () => {
16718
+ if (done)
16719
+ return;
16720
+ try {
16721
+ const user = await this.restoreSession();
16722
+ if (user && this.pendingLogin) {
16723
+ done = true;
16724
+ cleanup();
16725
+ this.pendingLogin.resolve(user);
16726
+ this.pendingLogin = null;
16727
+ this.loginInProgress = false;
16728
+ }
16729
+ }
16730
+ catch (_a) {
16731
+ // not ready yet — keep waiting
16732
+ }
16733
+ };
16734
+ const onChange = () => { void tryResolve(); };
16735
+ const onVisible = () => { if (document.visibilityState === 'visible')
16736
+ void tryResolve(); };
16737
+ const poll = setInterval(() => { void tryResolve(); }, 1500);
16738
+ const timeout = setTimeout(() => {
16739
+ cleanup();
16740
+ if (!done && this.pendingLogin) {
16741
+ this.pendingLogin.reject(new Error('Wallet connection timed out'));
16742
+ this.pendingLogin = null;
16743
+ this.loginInProgress = false;
16744
+ }
16745
+ }, 180000);
16746
+ window.addEventListener('storage', onChange);
16747
+ document.addEventListener('visibilitychange', onVisible);
16748
+ }
16664
16749
  async address() {
16665
16750
  var _a, _b, _c, _d;
16666
16751
  await this.ensureReady();
@@ -21794,7 +21879,7 @@ async function registerMobileWalletAdapter(config) {
21794
21879
  if (typeof window === 'undefined')
21795
21880
  return;
21796
21881
  try {
21797
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-BxKN5pIs.js'); });
21882
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-D2cnbAmp.js'); });
21798
21883
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21799
21884
  if (!registerMwa) {
21800
21885
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21933,7 +22018,7 @@ class SolanaMobileWalletProvider {
21933
22018
  async ensureWallet() {
21934
22019
  if (this.wallet)
21935
22020
  return this.wallet;
21936
- const mod = await Promise.resolve().then(function () { return require('./index.browser-BxKN5pIs.js'); });
22021
+ const mod = await Promise.resolve().then(function () { return require('./index.browser-D2cnbAmp.js'); });
21937
22022
  const chain = mapChainToWalletStandard(this.cluster);
21938
22023
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21939
22024
  appIdentity: this.appIdentity,
@@ -23182,4 +23267,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
23182
23267
  exports.signTransaction = signTransaction;
23183
23268
  exports.subscribe = subscribe;
23184
23269
  exports.useAuth = useAuth;
23185
- //# sourceMappingURL=index-Lm0k5Hwv.js.map
23270
+ //# sourceMappingURL=index-Bu0P9-rk.js.map