@pooflabs/web 0.0.47-rc.2 → 0.0.47-rc.4

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.
@@ -13257,14 +13257,29 @@ function loginViaPopup() {
13257
13257
  }
13258
13258
  };
13259
13259
  window.addEventListener('message', onMessage);
13260
- // Poll for popup closed without completing auth
13260
+ // Poll for popup closed without completing auth.
13261
+ // Also check localStorage directly on each tick — storage events may not fire
13262
+ // if the popup closes too quickly after writing (browser tears down the context
13263
+ // before dispatching the event to other browsing contexts).
13261
13264
  const pollInterval = setInterval(() => {
13262
13265
  try {
13266
+ // Check localStorage directly for completion signal
13267
+ try {
13268
+ const stored = localStorage.getItem(AUTH_COMPLETE_KEY);
13269
+ if (stored) {
13270
+ const data = JSON.parse(stored);
13271
+ if (data.address) {
13272
+ complete(data.address);
13273
+ return;
13274
+ }
13275
+ }
13276
+ }
13277
+ catch (_a) { }
13263
13278
  if (popup.closed && !resolved) {
13264
13279
  fail(new Error('User cancelled login'));
13265
13280
  }
13266
13281
  }
13267
- catch (_a) { }
13282
+ catch (_b) { }
13268
13283
  }, POPUP_POLL_INTERVAL_MS);
13269
13284
  // Safety timeout
13270
13285
  const timeout = setTimeout(() => {
@@ -13282,6 +13297,24 @@ function loginViaPopup() {
13282
13297
  const VALID_PROVIDERS = ['injected', 'google', 'apple', 'deeplink'];
13283
13298
  // Storage key for preserving the original path before OAuth redirect
13284
13299
  const PHANTOM_ORIGINAL_PATH_KEY = 'phantom_oauth_original_path';
13300
+ // Cookie name for storing the return origin when using an OAuth redirect proxy
13301
+ const AUTH_RETURN_COOKIE = 'tarobase_auth_return';
13302
+ /**
13303
+ * Store the current origin in a cookie on the parent domain so an OAuth redirect
13304
+ * proxy page can relay back to this app after the OAuth flow completes.
13305
+ */
13306
+ function storeReturnOrigin() {
13307
+ if (typeof window === 'undefined' || typeof document === 'undefined')
13308
+ return;
13309
+ const origin = window.location.origin;
13310
+ // Derive parent domain (e.g., foo-preview.poof.new → .poof.new)
13311
+ const parts = window.location.hostname.split('.');
13312
+ const domain = parts.length >= 2 ? '.' + parts.slice(-2).join('.') : window.location.hostname;
13313
+ try {
13314
+ document.cookie = `${AUTH_RETURN_COOKIE}=${encodeURIComponent(origin)}; domain=${domain}; path=/; max-age=300; SameSite=None; Secure`;
13315
+ }
13316
+ catch (_a) { }
13317
+ }
13285
13318
  /**
13286
13319
  * Check if the current URL contains Phantom OAuth callback parameters.
13287
13320
  * Phantom uses various params like phantom_encryption_public_key, data, nonce for deeplink callbacks,
@@ -13405,6 +13438,15 @@ function getEffectiveRedirectUrl(configuredRedirectUrl) {
13405
13438
  }
13406
13439
  // If explicitly configured, use that
13407
13440
  if (configuredRedirectUrl) {
13441
+ // If redirecting to a different origin (proxy), store a cookie so the
13442
+ // proxy page knows where to relay the OAuth params back to
13443
+ try {
13444
+ const redirectOrigin = new URL(configuredRedirectUrl).origin;
13445
+ if (redirectOrigin !== window.location.origin) {
13446
+ storeReturnOrigin();
13447
+ }
13448
+ }
13449
+ catch (_a) { }
13408
13450
  return configuredRedirectUrl;
13409
13451
  }
13410
13452
  // Default to origin (base URL) - this is safer than using the full href
@@ -13431,7 +13473,7 @@ async function loadDependencies() {
13431
13473
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
13432
13474
  import('react'),
13433
13475
  import('react-dom/client'),
13434
- import('./index-C26G4SZ4.esm.js')
13476
+ import('./index-BvKCGGWr.esm.js')
13435
13477
  ]);
13436
13478
  // Extract default export from ESM module namespace
13437
13479
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -34809,4 +34851,4 @@ async function getIdToken() {
34809
34851
  }
34810
34852
 
34811
34853
  export { useAuth as A, getIdToken as B, PrivyWalletProvider as C, DEFAULT_TEST_ADDRESS as D, EventEmitter4 as E, buildSetDocumentsTransaction as F, clearCache as G, closeAllSubscriptions as H, convertRemainingAccounts as I, createSessionWithPrivy as J, createSessionWithSignature as K, genAuthNonce as L, MockAuthProvider as M, genSolanaMessage as N, OffchainAuthProvider as O, PhantomWalletProvider as P, getCachedData as Q, reconnectWithNewAuth as R, ServerSessionManager as S, refreshSession as T, signSessionCreateMessage as U, WebSessionManager as W, bs58 as a, bufferExports as b, commonjsRequire as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getCurrentUser as g, getConfig as h, init as i, getAuthProvider as j, get$2 as k, login as l, setMany as m, setFile as n, onAuthStateChanged as o, getFiles as p, runQuery as q, require$$0$1 as r, set$1 as s, runQueryMany as t, runExpression as u, runExpressionMany as v, signMessage as w, signTransaction as x, signAndSubmitTransaction as y, subscribe as z };
34812
- //# sourceMappingURL=index-BUuISZtf.esm.js.map
34854
+ //# sourceMappingURL=index-CEvNSK3V.esm.js.map