@pooflabs/web 0.0.47-rc.8 → 0.0.47

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.
@@ -13,5 +13,4 @@ export declare const SOLANA_MAINNET_RPC_URL = "https://celestia-cegncv-fast-main
13
13
  export declare const SURFNET_RPC_URL = "https://surfpool.fly.dev";
14
14
  export declare function getAuthProvider(config?: Partial<ClientConfig>): Promise<AuthProvider>;
15
15
  export declare function login(): Promise<User | null>;
16
- export declare function getCurrentAuthMethod(): string | null;
17
16
  export declare function logout(): Promise<void>;
@@ -27,8 +27,6 @@ export declare class PhantomWalletProvider implements AuthProvider {
27
27
  private pendingLogin;
28
28
  private loginInProgress;
29
29
  private autoLoginInProgress;
30
- /** Captured at construction time — true if the URL had Phantom OAuth callback params on page load */
31
- private hadOAuthParamsOnLoad;
32
30
  private initPromise;
33
31
  /** Callback to swap to a Privy provider when the user clicks "Log in with Privy instead" */
34
32
  onSwitchToPrivy: (() => Promise<AuthProvider>) | null;
@@ -54,12 +52,6 @@ export declare class PhantomWalletProvider implements AuthProvider {
54
52
  */
55
53
  login(): Promise<User | null>;
56
54
  restoreSession(): Promise<User | null>;
57
- /**
58
- * Poll for the Tarobase session to be created after an OAuth redirect.
59
- * The autoCreateSession React effect creates the session once the Phantom SDK
60
- * finishes auto-connecting. We poll SessionManager until it appears or we time out.
61
- */
62
- private waitForOAuthSession;
63
55
  address(): Promise<string | null>;
64
56
  runTransaction(_evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
65
57
  /**
@@ -13051,302 +13051,9 @@ function requireBuffer () {
13051
13051
 
13052
13052
  var bufferExports = requireBuffer();
13053
13053
 
13054
- /**
13055
- * Popup Auth Bridge
13056
- *
13057
- * When the SDK runs inside an iframe, OAuth login (Google/Apple) fails because
13058
- * Google blocks iframe rendering via X-Frame-Options. This module opens a popup
13059
- * at the same origin, runs the full auth flow there, and signals back to the
13060
- * iframe via localStorage events + postMessage.
13061
- */
13062
- const POPUP_URL_PARAM = '__tarobase_auth_popup';
13063
- const POPUP_SESSION_KEY = 'tarobase_auth_popup_state';
13064
- const AUTH_COMPLETE_KEY = 'tarobase_auth_complete';
13065
- const POPUP_WINDOW_NAME = 'tarobase_auth';
13066
- const POPUP_FEATURES = 'width=500,height=700,scrollbars=yes,resizable=yes';
13067
- const POPUP_TIMEOUT_MS = 180000;
13068
- const POPUP_POLL_INTERVAL_MS = 500;
13069
- /** Check if the SDK is running inside an iframe */
13070
- function isInIframe() {
13071
- if (typeof window === 'undefined')
13072
- return false;
13073
- try {
13074
- return window.self !== window.top;
13075
- }
13076
- catch (_a) {
13077
- // Cross-origin iframes throw when accessing window.top
13078
- return true;
13079
- }
13080
- }
13081
- /** Check if this window is an auth popup (first load via URL param, or post-redirect via sessionStorage) */
13082
- function isAuthPopup() {
13083
- if (typeof window === 'undefined')
13084
- return false;
13085
- try {
13086
- const params = new URLSearchParams(window.location.search);
13087
- if (params.has(POPUP_URL_PARAM))
13088
- return true;
13089
- }
13090
- catch (_a) { }
13091
- try {
13092
- const state = sessionStorage.getItem(POPUP_SESSION_KEY);
13093
- return state === 'pending' || state === 'complete';
13094
- }
13095
- catch (_b) { }
13096
- return false;
13097
- }
13098
- /** Read the popup state from sessionStorage */
13099
- function getPopupState() {
13100
- if (typeof window === 'undefined')
13101
- return null;
13102
- try {
13103
- return sessionStorage.getItem(POPUP_SESSION_KEY);
13104
- }
13105
- catch (_a) {
13106
- return null;
13107
- }
13108
- }
13109
- /** Write the popup state to sessionStorage */
13110
- function setPopupState(state) {
13111
- if (typeof window === 'undefined')
13112
- return;
13113
- try {
13114
- if (state) {
13115
- sessionStorage.setItem(POPUP_SESSION_KEY, state);
13116
- }
13117
- else {
13118
- sessionStorage.removeItem(POPUP_SESSION_KEY);
13119
- }
13120
- }
13121
- catch (_a) { }
13122
- }
13123
- /** Remove the __tarobase_auth_popup param from the URL without a page reload */
13124
- function cleanPopupParam() {
13125
- if (typeof window === 'undefined')
13126
- return;
13127
- try {
13128
- const url = new URL(window.location.href);
13129
- if (url.searchParams.has(POPUP_URL_PARAM)) {
13130
- url.searchParams.delete(POPUP_URL_PARAM);
13131
- window.history.replaceState({}, '', url.pathname + url.search + url.hash);
13132
- }
13133
- }
13134
- catch (_a) { }
13135
- }
13136
- /** Show a "Login complete, close this tab" fallback message */
13137
- function showPopupCloseMessage() {
13138
- var _a, _b;
13139
- if (typeof document === 'undefined')
13140
- return;
13141
- const overlay = document.createElement('div');
13142
- overlay.id = 'tarobase-popup-close-msg';
13143
- overlay.style.cssText = [
13144
- 'position:fixed', 'inset:0', 'z-index:2147483647',
13145
- 'background:#000', 'display:flex', 'align-items:center',
13146
- 'justify-content:center', 'flex-direction:column',
13147
- 'font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',
13148
- ].join(';');
13149
- overlay.innerHTML = `
13150
- <div style="text-align:center;color:white;">
13151
- <p style="font-size:18px;margin:0 0 8px;">Login complete</p>
13152
- <p style="font-size:14px;color:#999;margin:0;">You can close this tab and return to the app.</p>
13153
- </div>
13154
- `;
13155
- // Remove any existing overlay first
13156
- (_a = document.getElementById('tarobase-popup-overlay')) === null || _a === void 0 ? void 0 : _a.remove();
13157
- (_b = document.getElementById('tarobase-popup-close-msg')) === null || _b === void 0 ? void 0 : _b.remove();
13158
- document.body.appendChild(overlay);
13159
- }
13160
- /** Inject a dark overlay to hide the app UI in the popup (login modal appears on top) */
13161
- function injectPopupOverlay() {
13162
- if (typeof document === 'undefined')
13163
- return;
13164
- const overlay = document.createElement('div');
13165
- overlay.id = 'tarobase-popup-overlay';
13166
- overlay.style.cssText = [
13167
- 'position:fixed', 'inset:0', 'z-index:9998',
13168
- 'background:rgba(0,0,0,0.85)', 'display:flex',
13169
- 'align-items:center', 'justify-content:center',
13170
- ].join(';');
13171
- overlay.innerHTML = `
13172
- <div style="text-align:center;color:white;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;">
13173
- <p style="font-size:16px;margin:0 0 8px;">Loading login...</p>
13174
- <p style="font-size:13px;color:#999;margin:0;">Please wait</p>
13175
- </div>
13176
- `;
13177
- document.body.appendChild(overlay);
13178
- }
13179
- /**
13180
- * Signal auth completion to the opener (iframe).
13181
- * Uses both localStorage (reliable cross-tab) and postMessage (faster on desktop).
13182
- */
13183
- function signalAuthComplete(address) {
13184
- var _a;
13185
- if (typeof window === 'undefined')
13186
- return;
13187
- console.log('[PopupAuth] Signaling auth complete, address:', address);
13188
- const data = { type: 'TAROBASE_AUTH_COMPLETE', address, timestamp: Date.now() };
13189
- // Write to localStorage — fires 'storage' event in other same-origin windows
13190
- try {
13191
- localStorage.setItem(AUTH_COMPLETE_KEY, JSON.stringify(data));
13192
- console.log('[PopupAuth] Wrote signal to localStorage');
13193
- }
13194
- catch (_b) { }
13195
- // Also postMessage to opener (faster, backup)
13196
- try {
13197
- console.log('[PopupAuth] window.opener exists:', !!window.opener);
13198
- (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(data, window.location.origin);
13199
- }
13200
- catch (_c) { }
13201
- // Update popup state
13202
- setPopupState('complete');
13203
- // Try to close the popup window
13204
- try {
13205
- window.close();
13206
- }
13207
- catch (_d) { }
13208
- // If window.close() didn't work (some mobile browsers block it after redirect),
13209
- // show a fallback message after a short delay
13210
- setTimeout(() => {
13211
- if (typeof window !== 'undefined' && !window.closed) {
13212
- showPopupCloseMessage();
13213
- }
13214
- }, 500);
13215
- }
13216
- /**
13217
- * Open a popup for auth and wait for completion.
13218
- * Returns the logged-in address when the popup signals success.
13219
- */
13220
- function loginViaPopup() {
13221
- console.log('[PopupAuth] loginViaPopup called, opening popup...');
13222
- return new Promise((resolve, reject) => {
13223
- if (typeof window === 'undefined') {
13224
- reject(new Error('Cannot open popup in non-browser environment'));
13225
- return;
13226
- }
13227
- // Build popup URL: same origin + path, preserve query params, add popup flag
13228
- const popupUrl = new URL(window.location.href);
13229
- popupUrl.searchParams.set(POPUP_URL_PARAM, '1');
13230
- console.log('[PopupAuth] Opening popup at:', popupUrl.toString());
13231
- const popup = window.open(popupUrl.toString(), POPUP_WINDOW_NAME, POPUP_FEATURES);
13232
- if (!popup || popup.closed) {
13233
- reject(new Error('Popup was blocked. Please allow popups for this site and try again.'));
13234
- return;
13235
- }
13236
- console.log('[PopupAuth] Popup opened successfully, waiting for auth signal...');
13237
- let resolved = false;
13238
- const cleanup = () => {
13239
- resolved = true;
13240
- window.removeEventListener('storage', onStorage);
13241
- window.removeEventListener('message', onMessage);
13242
- clearInterval(pollInterval);
13243
- clearTimeout(timeout);
13244
- // Clean up the signal key
13245
- try {
13246
- localStorage.removeItem(AUTH_COMPLETE_KEY);
13247
- }
13248
- catch (_a) { }
13249
- };
13250
- const complete = (address) => {
13251
- if (resolved)
13252
- return;
13253
- console.log('[PopupAuth] Auth complete! Address:', address);
13254
- cleanup();
13255
- resolve({ address });
13256
- };
13257
- const fail = (error) => {
13258
- if (resolved)
13259
- return;
13260
- console.log('[PopupAuth] Auth failed:', error.message);
13261
- cleanup();
13262
- reject(error);
13263
- };
13264
- // Listen for localStorage changes (cross-tab, same-origin — most reliable)
13265
- const onStorage = (event) => {
13266
- if (event.key === AUTH_COMPLETE_KEY && event.newValue) {
13267
- console.log('[PopupAuth] Received storage event signal');
13268
- try {
13269
- const data = JSON.parse(event.newValue);
13270
- if (data.address) {
13271
- complete(data.address);
13272
- }
13273
- }
13274
- catch (_a) { }
13275
- }
13276
- };
13277
- window.addEventListener('storage', onStorage);
13278
- // Listen for postMessage (backup, faster on desktop)
13279
- const onMessage = (event) => {
13280
- var _a, _b;
13281
- // Validate origin
13282
- if (event.origin !== window.location.origin)
13283
- return;
13284
- if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === 'TAROBASE_AUTH_COMPLETE' && ((_b = event.data) === null || _b === void 0 ? void 0 : _b.address)) {
13285
- console.log('[PopupAuth] Received postMessage signal');
13286
- complete(event.data.address);
13287
- }
13288
- };
13289
- window.addEventListener('message', onMessage);
13290
- // Poll for popup closed without completing auth.
13291
- // Also check localStorage directly on each tick — storage events may not fire
13292
- // if the popup closes too quickly after writing (browser tears down the context
13293
- // before dispatching the event to other browsing contexts).
13294
- const pollInterval = setInterval(() => {
13295
- try {
13296
- // Check localStorage directly for completion signal
13297
- try {
13298
- const stored = localStorage.getItem(AUTH_COMPLETE_KEY);
13299
- if (stored) {
13300
- console.log('[PopupAuth] Found auth signal in localStorage (poll)');
13301
- const data = JSON.parse(stored);
13302
- if (data.address) {
13303
- complete(data.address);
13304
- return;
13305
- }
13306
- }
13307
- }
13308
- catch (_a) { }
13309
- if (popup.closed && !resolved) {
13310
- console.log('[PopupAuth] Popup closed without auth signal');
13311
- fail(new Error('User cancelled login'));
13312
- }
13313
- }
13314
- catch (_b) { }
13315
- }, POPUP_POLL_INTERVAL_MS);
13316
- // Safety timeout
13317
- const timeout = setTimeout(() => {
13318
- if (!resolved) {
13319
- fail(new Error('Login timed out'));
13320
- try {
13321
- popup.close();
13322
- }
13323
- catch (_a) { }
13324
- }
13325
- }, POPUP_TIMEOUT_MS);
13326
- });
13327
- }
13328
-
13329
13054
  const VALID_PROVIDERS = ['injected', 'google', 'apple', 'deeplink'];
13330
13055
  // Storage key for preserving the original path before OAuth redirect
13331
13056
  const PHANTOM_ORIGINAL_PATH_KEY = 'phantom_oauth_original_path';
13332
- // Cookie name for storing the return origin when using an OAuth redirect proxy
13333
- const AUTH_RETURN_COOKIE = 'tarobase_auth_return';
13334
- /**
13335
- * Store the current origin in a cookie on the parent domain so an OAuth redirect
13336
- * proxy page can relay back to this app after the OAuth flow completes.
13337
- */
13338
- function storeReturnOrigin() {
13339
- if (typeof window === 'undefined' || typeof document === 'undefined')
13340
- return;
13341
- const origin = window.location.origin;
13342
- // Derive parent domain (e.g., foo-preview.poof.new → .poof.new)
13343
- const parts = window.location.hostname.split('.');
13344
- const domain = parts.length >= 2 ? '.' + parts.slice(-2).join('.') : window.location.hostname;
13345
- try {
13346
- document.cookie = `${AUTH_RETURN_COOKIE}=${encodeURIComponent(origin)}; domain=${domain}; path=/; max-age=300; SameSite=None; Secure`;
13347
- }
13348
- catch (_a) { }
13349
- }
13350
13057
  /**
13351
13058
  * Check if the current URL contains Phantom OAuth callback parameters.
13352
13059
  * Phantom uses various params like phantom_encryption_public_key, data, nonce for deeplink callbacks,
@@ -13470,15 +13177,6 @@ function getEffectiveRedirectUrl(configuredRedirectUrl) {
13470
13177
  }
13471
13178
  // If explicitly configured, use that
13472
13179
  if (configuredRedirectUrl) {
13473
- // If redirecting to a different origin (proxy), store a cookie so the
13474
- // proxy page knows where to relay the OAuth params back to
13475
- try {
13476
- const redirectOrigin = new URL(configuredRedirectUrl).origin;
13477
- if (redirectOrigin !== window.location.origin) {
13478
- storeReturnOrigin();
13479
- }
13480
- }
13481
- catch (_a) { }
13482
13180
  return configuredRedirectUrl;
13483
13181
  }
13484
13182
  // Default to origin (base URL) - this is safer than using the full href
@@ -13505,7 +13203,7 @@ async function loadDependencies() {
13505
13203
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
13506
13204
  import('react'),
13507
13205
  import('react-dom/client'),
13508
- Promise.resolve().then(function () { return require('./index-Ckn51oy3.js'); })
13206
+ Promise.resolve().then(function () { return require('./index-BEla3UUZ.js'); })
13509
13207
  ]);
13510
13208
  // Extract default export from ESM module namespace
13511
13209
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -13525,8 +13223,6 @@ class PhantomWalletProvider {
13525
13223
  this.pendingLogin = null;
13526
13224
  this.loginInProgress = false;
13527
13225
  this.autoLoginInProgress = false;
13528
- /** Captured at construction time — true if the URL had Phantom OAuth callback params on page load */
13529
- this.hadOAuthParamsOnLoad = false;
13530
13226
  this.initPromise = null;
13531
13227
  /** Callback to swap to a Privy provider when the user clicks "Log in with Privy instead" */
13532
13228
  this.onSwitchToPrivy = null;
@@ -13539,11 +13235,6 @@ class PhantomWalletProvider {
13539
13235
  if (PhantomWalletProvider.instance) {
13540
13236
  return PhantomWalletProvider.instance;
13541
13237
  }
13542
- // Capture OAuth params BEFORE Phantom SDK loads and cleans them from the URL
13543
- this.hadOAuthParamsOnLoad = hasPhantomOAuthParams();
13544
- if (this.hadOAuthParamsOnLoad) {
13545
- console.log('[PhantomAuth] OAuth callback params detected in URL at construction time');
13546
- }
13547
13238
  // Resolve providers from config (doesn't need SDK)
13548
13239
  this.resolveProviders();
13549
13240
  // Start async initialization (load SDK and initialize React component)
@@ -13644,32 +13335,18 @@ class PhantomWalletProvider {
13644
13335
  // This handles social login callbacks where user returns from OAuth already connected.
13645
13336
  React$1.useEffect(() => {
13646
13337
  const autoCreateSession = async () => {
13647
- var _a, _b;
13338
+ var _a;
13648
13339
  // Only proceed when SDK is ready, connected, has addresses, and not already in a login flow
13649
13340
  if (!(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected) || (phantom === null || phantom === void 0 ? void 0 : phantom.isLoading) || that.loginInProgress || that.autoLoginInProgress || that.pendingLogin) {
13650
- console.log('[PhantomAuth] autoCreateSession skipped:', {
13651
- isConnected: phantom === null || phantom === void 0 ? void 0 : phantom.isConnected,
13652
- isLoading: phantom === null || phantom === void 0 ? void 0 : phantom.isLoading,
13653
- loginInProgress: that.loginInProgress,
13654
- autoLoginInProgress: that.autoLoginInProgress,
13655
- hasPendingLogin: !!that.pendingLogin,
13656
- });
13657
13341
  return;
13658
13342
  }
13659
13343
  // Need solana to be available AND connected for signing
13660
13344
  if (!solana || !solanaHook.isAvailable || !solana.connected) {
13661
- console.log('[PhantomAuth] autoCreateSession waiting for solana:', {
13662
- hasSolana: !!solana,
13663
- isAvailable: solanaHook.isAvailable,
13664
- connected: solana === null || solana === void 0 ? void 0 : solana.connected,
13665
- });
13666
13345
  return;
13667
13346
  }
13668
- console.log('[PhantomAuth] autoCreateSession proceeding, addresses:', (_a = phantom.addresses) === null || _a === void 0 ? void 0 : _a.length);
13669
13347
  // Find Solana address
13670
- const solAddress = (_b = phantom.addresses) === null || _b === void 0 ? void 0 : _b.find((addr) => addr.addressType === AddressType.solana);
13348
+ const solAddress = (_a = phantom.addresses) === null || _a === void 0 ? void 0 : _a.find((addr) => addr.addressType === AddressType.solana);
13671
13349
  if (!solAddress) {
13672
- console.log('[PhantomAuth] autoCreateSession: no Solana address found');
13673
13350
  return;
13674
13351
  }
13675
13352
  const publicKey = solAddress.address;
@@ -13718,7 +13395,6 @@ class PhantomWalletProvider {
13718
13395
  }
13719
13396
  }
13720
13397
  catch (error) {
13721
- console.error('[PhantomAuth] autoCreateSession error:', (error === null || error === void 0 ? void 0 : error.message) || error);
13722
13398
  // User rejected signing or other error - disconnect fully
13723
13399
  // Clear stored path since login failed
13724
13400
  getAndClearOriginalPath();
@@ -14029,10 +13705,8 @@ class PhantomWalletProvider {
14029
13705
  this.pendingLogin = { resolve, reject };
14030
13706
  this.loginInProgress = true;
14031
13707
  // Store current path before OAuth redirect (for social login providers)
14032
- // so we can redirect back after auth completes.
14033
- // Skip in popup context — we don't want to navigate the popup after OAuth
14034
- // redirect; the popup signals back to the iframe and closes instead.
14035
- if (this.hasSocialProviders() && !isAuthPopup()) {
13708
+ // so we can redirect back after auth completes
13709
+ if (this.hasSocialProviders()) {
14036
13710
  storeOriginalPath();
14037
13711
  }
14038
13712
  // Open the Phantom connect modal
@@ -14053,46 +13727,8 @@ class PhantomWalletProvider {
14053
13727
  if (session) {
14054
13728
  return { provider: this, address: session.address };
14055
13729
  }
14056
- // If this page load is a Phantom OAuth callback (e.g., returning from Google/Apple),
14057
- // the Phantom SDK auto-connects via React useEffect which runs AFTER init() returns.
14058
- // The autoCreateSession effect then creates the Tarobase session.
14059
- // Wait for that to complete before returning null, otherwise the caller sees
14060
- // no session and may trigger premature logout.
14061
- // Note: We use hadOAuthParamsOnLoad (captured in constructor) because the Phantom SDK
14062
- // may have already cleaned the OAuth params from the URL by this point.
14063
- if (this.hadOAuthParamsOnLoad) {
14064
- console.log('[PhantomAuth] OAuth params detected on page load, waiting for session...');
14065
- return this.waitForOAuthSession(15000);
14066
- }
14067
13730
  return null;
14068
13731
  }
14069
- /**
14070
- * Poll for the Tarobase session to be created after an OAuth redirect.
14071
- * The autoCreateSession React effect creates the session once the Phantom SDK
14072
- * finishes auto-connecting. We poll SessionManager until it appears or we time out.
14073
- */
14074
- waitForOAuthSession(timeoutMs) {
14075
- return new Promise((resolve) => {
14076
- const startTime = Date.now();
14077
- const check = async () => {
14078
- const session = await WebSessionManager.getSession();
14079
- if (session) {
14080
- console.log('[PhantomAuth] OAuth session created, address:', session.address);
14081
- resolve({ provider: this, address: session.address });
14082
- return;
14083
- }
14084
- const elapsed = Date.now() - startTime;
14085
- if (elapsed > timeoutMs) {
14086
- console.log('[PhantomAuth] OAuth session wait timed out after', elapsed, 'ms');
14087
- resolve(null);
14088
- return;
14089
- }
14090
- setTimeout(check, 200);
14091
- };
14092
- // Small initial delay to let React effects fire
14093
- setTimeout(check, 300);
14094
- });
14095
- }
14096
13732
  async address() {
14097
13733
  var _a, _b, _c, _d;
14098
13734
  await this.ensureReady();
@@ -34708,6 +34344,9 @@ async function getAuthProvider(config) {
34708
34344
  console.log("[Offchain] Wrapping auth provider for Poofnet transaction tracking");
34709
34345
  currentAuthProvider = new OffchainAuthProvider(currentAuthProvider);
34710
34346
  }
34347
+ // Update core config to reflect the actual auth method being used
34348
+ const coreConfig = await getConfig();
34349
+ coreConfig.authMethod = authMethod;
34711
34350
  return currentAuthProvider;
34712
34351
  }
34713
34352
  async function login$1() {
@@ -34729,9 +34368,6 @@ async function login$1() {
34729
34368
  }
34730
34369
  return null;
34731
34370
  }
34732
- function getCurrentAuthMethod() {
34733
- return currentAuthMethod;
34734
- }
34735
34371
  async function logout$1() {
34736
34372
  if (!currentAuthProvider) {
34737
34373
  throw new Error("Auth provider not initialized. Please call init() first.");
@@ -34755,12 +34391,6 @@ async function init(newConfig) {
34755
34391
  authProviderInstance = await getAuthProvider(newConfig);
34756
34392
  // Initialize config with auth provider
34757
34393
  await init$1(Object.assign(Object.assign({}, newConfig), { authProvider: authProviderInstance }));
34758
- // Now that core is initialized, update the auth method on the config
34759
- const authMethod = getCurrentAuthMethod();
34760
- if (authMethod) {
34761
- const coreConfig = await getConfig();
34762
- coreConfig.authMethod = authMethod;
34763
- }
34764
34394
  // Wait for restoreSession to complete
34765
34395
  // The appId check is done in SessionManager.getSession which is called by restoreSession
34766
34396
  // If there's an appId mismatch, the session will be cleared and restoreSession will return null
@@ -34773,36 +34403,6 @@ async function init(newConfig) {
34773
34403
  setCurrentUser(user);
34774
34404
  // Mark init as completed
34775
34405
  initCompleted = true;
34776
- // Handle auth popup context (this window was opened by the SDK for iframe auth)
34777
- if (isAuthPopup()) {
34778
- cleanPopupParam();
34779
- const state = getPopupState();
34780
- if (state === 'complete')
34781
- return; // Already signaled
34782
- injectPopupOverlay();
34783
- // Listen for auth completion (handles post-OAuth-redirect auto-connect)
34784
- onAuthStateChanged((popupUser) => {
34785
- if (popupUser && getPopupState() !== 'complete') {
34786
- setPopupState('complete');
34787
- signalAuthComplete(popupUser.address);
34788
- }
34789
- });
34790
- if (!state) {
34791
- // First load of popup — trigger login automatically
34792
- setPopupState('pending');
34793
- if (!currentUser) {
34794
- login().then((u) => {
34795
- if (u && getPopupState() !== 'complete') {
34796
- setPopupState('complete');
34797
- signalAuthComplete(u.address);
34798
- }
34799
- }).catch(() => {
34800
- // User cancelled or error — popup stays open, user can close it
34801
- });
34802
- }
34803
- }
34804
- // If state === 'pending': post-OAuth redirect — wait for auto-connect via onAuthStateChanged
34805
- }
34806
34406
  }
34807
34407
  // TODO: Have a way to remove listeners
34808
34408
  function onAuthStateChanged(callback) {
@@ -34830,19 +34430,6 @@ async function login() {
34830
34430
  if (!authProviderInstance) {
34831
34431
  throw new Error('SDK not initialized. Please call init() first.');
34832
34432
  }
34833
- // If running inside an iframe, use popup bridge for auth
34834
- // (OAuth redirects are blocked in iframes by Google/Apple X-Frame-Options)
34835
- if (isInIframe() && !isAuthPopup()) {
34836
- console.log('[PopupAuth] In iframe, using popup bridge for login');
34837
- const result = await loginViaPopup();
34838
- console.log('[PopupAuth] Popup resolved with address:', result.address);
34839
- // Session tokens are now in shared localStorage (written by popup, same origin)
34840
- console.log('[PopupAuth] Calling restoreSession...');
34841
- const user = await authProviderInstance.restoreSession();
34842
- console.log('[PopupAuth] restoreSession returned:', user ? user.address : null);
34843
- setCurrentUser(user);
34844
- return currentUser;
34845
- }
34846
34433
  const loggedInUser = await login$1();
34847
34434
  setCurrentUser(loggedInUser);
34848
34435
  return currentUser;
@@ -34994,4 +34581,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
34994
34581
  exports.signTransaction = signTransaction;
34995
34582
  exports.subscribe = subscribe;
34996
34583
  exports.useAuth = useAuth;
34997
- //# sourceMappingURL=index-BWUoa715.js.map
34584
+ //# sourceMappingURL=index-7SWQ00_t.js.map