@pooflabs/web 0.0.85-rc1 → 0.0.85-rc3

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 (51) hide show
  1. package/dist/auth/providers/solana-mobile-wallet-provider.d.ts +5 -0
  2. package/dist/{index-DlyeWzMk.js → index-B5qYY4YM.js} +2 -2
  3. package/dist/index-B5qYY4YM.js.map +1 -0
  4. package/dist/{index-Buu8v-Oe.esm.js → index-BE-VWSJT.esm.js} +2 -2
  5. package/dist/{index-Buu8v-Oe.esm.js.map → index-BE-VWSJT.esm.js.map} +1 -1
  6. package/dist/{index-BoWQVxMI.js → index-BaKs3A8s.js} +2 -2
  7. package/dist/{index-BoWQVxMI.js.map → index-BaKs3A8s.js.map} +1 -1
  8. package/dist/{index-C2p1Cldz.js → index-BzeiIIwF.js} +3 -3
  9. package/dist/{index-C2p1Cldz.js.map → index-BzeiIIwF.js.map} +1 -1
  10. package/dist/{index-ZKzq5QT_.esm.js → index-C4AnWFs_.esm.js} +421 -13
  11. package/dist/{index-ZKzq5QT_.esm.js.map → index-C4AnWFs_.esm.js.map} +1 -1
  12. package/dist/index-TzHXEf3-.esm.js +6 -0
  13. package/dist/index-TzHXEf3-.esm.js.map +1 -0
  14. package/dist/{index-R7cvXys2.js → index-bEXLwE7_.js} +421 -13
  15. package/dist/{index-R7cvXys2.js.map → index-bEXLwE7_.js.map} +1 -1
  16. package/dist/{index-4TKz3Mn_.esm.js → index-dqqR5q7b.esm.js} +3 -3
  17. package/dist/{index-4TKz3Mn_.esm.js.map → index-dqqR5q7b.esm.js.map} +1 -1
  18. package/dist/{index.browser-BQSN-6X2.js → index.browser-CN6obNQM.js} +2 -118
  19. package/dist/{index.browser-BQSN-6X2.js.map → index.browser-CN6obNQM.js.map} +1 -1
  20. package/dist/{index.browser-DZCNegue.js → index.browser-CZIJCtms.js} +2 -2
  21. package/dist/{index.browser-DZCNegue.js.map → index.browser-CZIJCtms.js.map} +1 -1
  22. package/dist/{index.browser-tPepE5fo.esm.js → index.browser-D8ttddP4.esm.js} +3 -117
  23. package/dist/{index.browser-tPepE5fo.esm.js.map → index.browser-D8ttddP4.esm.js.map} +1 -1
  24. package/dist/{index.browser-zfGYm0ST.esm.js → index.browser-DQIwLToJ.esm.js} +2 -2
  25. package/dist/{index.browser-zfGYm0ST.esm.js.map → index.browser-DQIwLToJ.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-BPQqeP6_.esm.js → index.native-DLziTime.esm.js} +4 -4
  29. package/dist/{index.native-BPQqeP6_.esm.js.map → index.native-DLziTime.esm.js.map} +1 -1
  30. package/dist/{index.native-BGaUOX9f.js → index.native-pG1NTZ0f.js} +4 -4
  31. package/dist/{index.native-BGaUOX9f.js.map → index.native-pG1NTZ0f.js.map} +1 -1
  32. package/dist/index.native.esm.js +1 -1
  33. package/dist/index.native.js +1 -1
  34. package/dist/{phantom-wallet-provider-DheGhOp4.esm.js → phantom-wallet-provider-CP6NXRwG.esm.js} +4 -4
  35. package/dist/{phantom-wallet-provider-DheGhOp4.esm.js.map → phantom-wallet-provider-CP6NXRwG.esm.js.map} +1 -1
  36. package/dist/{phantom-wallet-provider-MFcwrRpJ.js → phantom-wallet-provider-zBp7-uEw.js} +4 -4
  37. package/dist/{phantom-wallet-provider-MFcwrRpJ.js.map → phantom-wallet-provider-zBp7-uEw.js.map} +1 -1
  38. package/dist/{privy-wallet-provider-D15Au3j8.esm.js → privy-wallet-provider-CGYvf3-r.esm.js} +3 -3
  39. package/dist/{privy-wallet-provider-D15Au3j8.esm.js.map → privy-wallet-provider-CGYvf3-r.esm.js.map} +1 -1
  40. package/dist/{privy-wallet-provider-CFw6o7O5.js → privy-wallet-provider-CoyW5Gdg.js} +3 -3
  41. package/dist/{privy-wallet-provider-CFw6o7O5.js.map → privy-wallet-provider-CoyW5Gdg.js.map} +1 -1
  42. package/dist/{solana-mobile-wallet-provider-ChHh-U_p.esm.js → solana-mobile-wallet-provider-B8rHfsPN.esm.js} +414 -9
  43. package/dist/solana-mobile-wallet-provider-B8rHfsPN.esm.js.map +1 -0
  44. package/dist/{solana-mobile-wallet-provider-BM9wdF0m.js → solana-mobile-wallet-provider-CN-D_H4l.js} +414 -9
  45. package/dist/solana-mobile-wallet-provider-CN-D_H4l.js.map +1 -0
  46. package/package.json +1 -1
  47. package/dist/index-COF6zNCs.esm.js +0 -6
  48. package/dist/index-COF6zNCs.esm.js.map +0 -1
  49. package/dist/index-DlyeWzMk.js.map +0 -1
  50. package/dist/solana-mobile-wallet-provider-BM9wdF0m.js.map +0 -1
  51. package/dist/solana-mobile-wallet-provider-ChHh-U_p.esm.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ import { r as requireBuffer } from './index.native-DLziTime.esm.js';
2
+
3
+ var bufferExports = requireBuffer();
4
+
5
+ export { bufferExports as b };
6
+ //# sourceMappingURL=index-TzHXEf3-.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-TzHXEf3-.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -15730,7 +15730,7 @@ async function loadDependencies() {
15730
15730
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15731
15731
  import('react'),
15732
15732
  import('react-dom/client'),
15733
- Promise.resolve().then(function () { return require('./index-BoWQVxMI.js'); })
15733
+ Promise.resolve().then(function () { return require('./index-BaKs3A8s.js'); })
15734
15734
  ]);
15735
15735
  // Extract default export from ESM module namespace
15736
15736
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -21301,6 +21301,381 @@ function isMobileWalletAvailable() {
21301
21301
  const ED25519_SIGNATURE_LENGTH = 64;
21302
21302
  const STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';
21303
21303
  const MWA_AUTH_METHOD = 'mobile-wallet-adapter';
21304
+ function findMwaError(e, maxDepth = 5) {
21305
+ var _a;
21306
+ let cur = e;
21307
+ let depth = 0;
21308
+ while (cur && depth < maxDepth) {
21309
+ if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {
21310
+ return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };
21311
+ }
21312
+ cur = cur === null || cur === void 0 ? void 0 : cur.cause;
21313
+ depth++;
21314
+ }
21315
+ return null;
21316
+ }
21317
+ /**
21318
+ * Returns the matched MwaErrorInfo when the error is from an association
21319
+ * failure that an automatic retry can recover from (i.e. the wallet exists
21320
+ * on-device but the dApp's protocol session didn't complete in time). Returns
21321
+ * null for non-retryable errors (user cancel, unknown wallet errors, etc.).
21322
+ *
21323
+ * Specifically:
21324
+ * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when
21325
+ * it gave up waiting for a wallet to respond. On Seeker this races the
21326
+ * first-time-consent UI on the very first authorize.
21327
+ * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment
21328
+ * timer expired.
21329
+ * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel ("Wallet connection
21330
+ * cancelled by user") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT
21331
+ * ("Wallet connection timed out"). Discriminate by message — never retry
21332
+ * a user cancel.
21333
+ */
21334
+ function isMwaAssociationRetryable(e) {
21335
+ const info = findMwaError(e);
21336
+ if (!info)
21337
+ return null;
21338
+ if (info.code === 'ERROR_WALLET_NOT_FOUND')
21339
+ return info;
21340
+ if (info.code === 'ERROR_SESSION_TIMEOUT')
21341
+ return info;
21342
+ if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))
21343
+ return info;
21344
+ return null;
21345
+ }
21346
+ /**
21347
+ * Single-retry wrapper for MWA association failures. Used ONLY for login's
21348
+ * `standard:connect` and `solana:signMessage` calls — never for
21349
+ * `signAndSendTransaction`/`runTransaction` because retry on a path that
21350
+ * may have already submitted a tx can double-send.
21351
+ *
21352
+ * The retry exists for one specific scenario: on first-time MWA usage from a
21353
+ * given origin on Seeker, the protocol's session-establishment timer races
21354
+ * Seeker's first-time consent UI. The user reads the consent sheet, taps
21355
+ * Connect — but by then the protocol has given up and thrown
21356
+ * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,
21357
+ * so a second attempt skips the consent sheet, jumps straight to
21358
+ * Verify/Approve, and completes inside the timeout.
21359
+ */
21360
+ async function withMwaAssociationRetry(label, fn) {
21361
+ const t0 = Date.now();
21362
+ console.log(`[MWA-DEBUG] ${label} attempt=1 start`);
21363
+ try {
21364
+ const result = await fn();
21365
+ console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);
21366
+ return result;
21367
+ }
21368
+ catch (e) {
21369
+ const info = findMwaError(e);
21370
+ console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {
21371
+ outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },
21372
+ mwa: info,
21373
+ });
21374
+ const retryable = isMwaAssociationRetryable(e);
21375
+ if (!retryable)
21376
+ throw e;
21377
+ // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't
21378
+ // reliably flip document.visibilityState to 'hidden' while it's open,
21379
+ // so visibility-based waits fire too early. Use a fixed delay long
21380
+ // enough for Seeker to dismiss its sheet and the OS to release intent
21381
+ // state. 2.5s is empirically safe; tune from device traces if needed.
21382
+ console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);
21383
+ await new Promise(r => setTimeout(r, 2500));
21384
+ const t1 = Date.now();
21385
+ console.log(`[MWA-DEBUG] ${label} attempt=2 start`);
21386
+ try {
21387
+ const result = await fn();
21388
+ console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);
21389
+ return result;
21390
+ }
21391
+ catch (e2) {
21392
+ const info2 = findMwaError(e2);
21393
+ console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {
21394
+ outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },
21395
+ mwa: info2,
21396
+ });
21397
+ // Only mask the error with the clean Seeker message when the
21398
+ // second failure is also an association-flavored error. If it's
21399
+ // a user cancel, wallet rejection, or unknown error, rethrow
21400
+ // the original so the host app surfaces the real cause.
21401
+ if (isMwaAssociationRetryable(e2)) {
21402
+ throw new Error("Couldn't connect to your Seeker wallet. Please try again.");
21403
+ }
21404
+ throw e2;
21405
+ }
21406
+ }
21407
+ }
21408
+ /**
21409
+ * User-gesture-mediated wallet-standard sign helper.
21410
+ *
21411
+ * Why this exists: login flows that go through wallet-standard call two
21412
+ * separate transacts (standard:connect, then solana:signMessage). Each
21413
+ * transact dispatches its own `solana-wallet:` Android intent navigation
21414
+ * via `window.location.assign(associationUrl)` (see
21415
+ * @solana-mobile/mobile-wallet-adapter-protocol/lib/cjs/index.browser.js
21416
+ * `launchAssociation()` at line 459). Chrome requires **transient user
21417
+ * activation** for each custom-scheme navigation. The first transact
21418
+ * consumes the activation from the user's "Continue to Allow" tap on the
21419
+ * LNA modal; by the time the second transact (signMessage) runs as a JS
21420
+ * continuation, the activation has decayed, Chrome blocks the navigation,
21421
+ * no `blur` event fires, the protocol's `getDetectionPromise` (3000ms
21422
+ * timeout, line 433) rejects, and we get `ERROR_WALLET_NOT_FOUND`.
21423
+ *
21424
+ * Fix: show a Tarobase-controlled modal between the two transacts. When the
21425
+ * user taps the modal's "Sign in" button, that tap IS a fresh user
21426
+ * activation. We invoke the sign function directly inside the click handler
21427
+ * — no `await` between the tap and the call — so the activation propagates
21428
+ * to the protocol's `location.assign`.
21429
+ *
21430
+ * Failure recovery is also user-gesture driven: if the sign function fails
21431
+ * with a retryable association error, we re-enable the button so the user's
21432
+ * next tap is a new activation (a real retry). A timer-based retry would
21433
+ * just hit the same Chrome block. Cap at 3 attempts before giving up.
21434
+ */
21435
+ async function awaitSignInGestureAndSign(label, theme, signFn) {
21436
+ if (typeof document === 'undefined' || typeof window === 'undefined') {
21437
+ // SSR / non-browser: skip the gesture, just call (the activation
21438
+ // model doesn't apply outside the browser).
21439
+ const results = await signFn();
21440
+ if (!results || results.length === 0)
21441
+ throw new Error('MWA returned no signature');
21442
+ return results[0];
21443
+ }
21444
+ return new Promise((resolve, reject) => {
21445
+ const isDark = theme === 'dark'
21446
+ || (theme == null
21447
+ && typeof window.matchMedia === 'function'
21448
+ && window.matchMedia('(prefers-color-scheme: dark)').matches);
21449
+ // Palette
21450
+ const overlayBg = 'rgba(0, 0, 0, 0.62)';
21451
+ const cardBg = isDark ? '#1a1a1f' : '#ffffff';
21452
+ const titleColor = isDark ? '#ffffff' : '#0a0a0a';
21453
+ const subtitleColor = isDark ? '#a1a1aa' : '#52525b';
21454
+ const btnBg = isDark ? '#ffffff' : '#0a0a0a';
21455
+ const btnText = isDark ? '#0a0a0a' : '#ffffff';
21456
+ const btnDisabledBg = isDark ? '#3f3f46' : '#d4d4d8';
21457
+ const btnDisabledText = isDark ? '#71717a' : '#71717a';
21458
+ const errorColor = isDark ? '#fca5a5' : '#dc2626';
21459
+ const closeColor = isDark ? '#71717a' : '#a1a1aa';
21460
+ const fontStack = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
21461
+ const overlay = document.createElement('div');
21462
+ overlay.setAttribute('data-tarobase-mwa-gesture', 'true');
21463
+ overlay.style.cssText = [
21464
+ 'position: fixed',
21465
+ 'inset: 0',
21466
+ 'z-index: 2147483646',
21467
+ `background: ${overlayBg}`,
21468
+ 'display: flex',
21469
+ 'align-items: center',
21470
+ 'justify-content: center',
21471
+ 'padding: 20px',
21472
+ 'box-sizing: border-box',
21473
+ `font-family: ${fontStack}`,
21474
+ ].join('; ');
21475
+ const card = document.createElement('div');
21476
+ card.style.cssText = [
21477
+ `background: ${cardBg}`,
21478
+ 'border-radius: 20px',
21479
+ 'padding: 28px 24px 24px',
21480
+ 'max-width: 340px',
21481
+ 'width: 100%',
21482
+ 'box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28)',
21483
+ 'position: relative',
21484
+ 'box-sizing: border-box',
21485
+ ].join('; ');
21486
+ const closeBtn = document.createElement('button');
21487
+ closeBtn.setAttribute('aria-label', 'Close');
21488
+ closeBtn.innerHTML = '&times;';
21489
+ closeBtn.style.cssText = [
21490
+ 'position: absolute',
21491
+ 'top: 12px',
21492
+ 'right: 12px',
21493
+ 'background: transparent',
21494
+ 'border: none',
21495
+ `color: ${closeColor}`,
21496
+ 'font-size: 24px',
21497
+ 'line-height: 1',
21498
+ 'cursor: pointer',
21499
+ 'padding: 6px 10px',
21500
+ 'border-radius: 8px',
21501
+ ].join('; ');
21502
+ const title = document.createElement('div');
21503
+ title.textContent = 'Almost there';
21504
+ title.style.cssText = [
21505
+ `color: ${titleColor}`,
21506
+ 'font-size: 20px',
21507
+ 'font-weight: 600',
21508
+ 'margin-bottom: 6px',
21509
+ 'text-align: center',
21510
+ ].join('; ');
21511
+ const subtitle = document.createElement('div');
21512
+ subtitle.textContent = 'Tap to sign in with your wallet';
21513
+ subtitle.style.cssText = [
21514
+ `color: ${subtitleColor}`,
21515
+ 'font-size: 14px',
21516
+ 'line-height: 1.4',
21517
+ 'margin-bottom: 22px',
21518
+ 'text-align: center',
21519
+ ].join('; ');
21520
+ const errorRow = document.createElement('div');
21521
+ errorRow.style.cssText = [
21522
+ `color: ${errorColor}`,
21523
+ 'font-size: 13px',
21524
+ 'line-height: 1.4',
21525
+ 'margin-bottom: 14px',
21526
+ 'text-align: center',
21527
+ 'min-height: 0',
21528
+ 'transition: min-height 100ms ease',
21529
+ ].join('; ');
21530
+ const button = document.createElement('button');
21531
+ button.textContent = 'Sign in';
21532
+ const setButtonEnabledStyle = () => {
21533
+ button.style.cssText = [
21534
+ `background: ${btnBg}`,
21535
+ `color: ${btnText}`,
21536
+ 'border: none',
21537
+ 'border-radius: 14px',
21538
+ 'padding: 14px 20px',
21539
+ 'font-size: 16px',
21540
+ 'font-weight: 600',
21541
+ 'width: 100%',
21542
+ 'cursor: pointer',
21543
+ '-webkit-tap-highlight-color: transparent',
21544
+ 'box-sizing: border-box',
21545
+ `font-family: ${fontStack}`,
21546
+ ].join('; ');
21547
+ };
21548
+ const setButtonDisabledStyle = () => {
21549
+ button.style.cssText = [
21550
+ `background: ${btnDisabledBg}`,
21551
+ `color: ${btnDisabledText}`,
21552
+ 'border: none',
21553
+ 'border-radius: 14px',
21554
+ 'padding: 14px 20px',
21555
+ 'font-size: 16px',
21556
+ 'font-weight: 600',
21557
+ 'width: 100%',
21558
+ 'cursor: default',
21559
+ '-webkit-tap-highlight-color: transparent',
21560
+ 'box-sizing: border-box',
21561
+ `font-family: ${fontStack}`,
21562
+ ].join('; ');
21563
+ };
21564
+ setButtonEnabledStyle();
21565
+ card.appendChild(closeBtn);
21566
+ card.appendChild(title);
21567
+ card.appendChild(subtitle);
21568
+ card.appendChild(errorRow);
21569
+ card.appendChild(button);
21570
+ overlay.appendChild(card);
21571
+ document.body.appendChild(overlay);
21572
+ let settled = false;
21573
+ let attemptCount = 0;
21574
+ const MAX_ATTEMPTS = 3;
21575
+ const cleanup = () => {
21576
+ try {
21577
+ overlay.remove();
21578
+ }
21579
+ catch ( /* ignore */_a) { /* ignore */ }
21580
+ document.removeEventListener('keydown', onKeydown);
21581
+ };
21582
+ const finishResolve = (value) => {
21583
+ if (settled)
21584
+ return;
21585
+ settled = true;
21586
+ cleanup();
21587
+ resolve(value);
21588
+ };
21589
+ const finishReject = (err) => {
21590
+ if (settled)
21591
+ return;
21592
+ settled = true;
21593
+ cleanup();
21594
+ reject(err);
21595
+ };
21596
+ const handleCancel = () => {
21597
+ // Phrasing matches login()'s isUserRejection substring check so
21598
+ // the existing catch suppresses error-log noise.
21599
+ finishReject(new Error('User cancelled wallet sign in'));
21600
+ };
21601
+ closeBtn.addEventListener('click', () => {
21602
+ console.log(`[MWA-DEBUG] ${label} gesture: close clicked`);
21603
+ handleCancel();
21604
+ });
21605
+ overlay.addEventListener('click', (e) => {
21606
+ if (e.target === overlay) {
21607
+ console.log(`[MWA-DEBUG] ${label} gesture: overlay clicked (cancel)`);
21608
+ handleCancel();
21609
+ }
21610
+ });
21611
+ const onKeydown = (e) => {
21612
+ if (e.key === 'Escape') {
21613
+ console.log(`[MWA-DEBUG] ${label} gesture: Escape pressed (cancel)`);
21614
+ handleCancel();
21615
+ }
21616
+ };
21617
+ document.addEventListener('keydown', onKeydown);
21618
+ button.addEventListener('click', () => {
21619
+ if (settled)
21620
+ return;
21621
+ attemptCount++;
21622
+ const attempt = attemptCount;
21623
+ console.log(`[MWA-DEBUG] ${label} gesture: button click attempt=${attempt}`);
21624
+ // Disable to prevent double-clicks while the wallet popup is up.
21625
+ button.disabled = true;
21626
+ setButtonDisabledStyle();
21627
+ const originalText = 'Sign in';
21628
+ button.textContent = 'Signing in…';
21629
+ errorRow.textContent = '';
21630
+ errorRow.style.minHeight = '0';
21631
+ // CRITICAL: invoke signFn() synchronously inside the click handler
21632
+ // so Chrome's transient user activation propagates to the
21633
+ // protocol's window.location.assign(associationUrl) inside
21634
+ // launchAssociation(). Do not `await` before calling.
21635
+ const t0 = Date.now();
21636
+ console.log(`[MWA-DEBUG] ${label} gesture: signMessage start (attempt=${attempt})`);
21637
+ signFn().then((results) => {
21638
+ const elapsed = Date.now() - t0;
21639
+ if (!results || results.length === 0) {
21640
+ console.log(`[MWA-DEBUG] ${label} gesture: signMessage returned empty (attempt=${attempt}, ${elapsed}ms)`);
21641
+ finishReject(new Error('MWA returned no signature'));
21642
+ return;
21643
+ }
21644
+ console.log(`[MWA-DEBUG] ${label} gesture: signMessage ok (attempt=${attempt}, ${elapsed}ms)`);
21645
+ finishResolve(results[0]);
21646
+ }).catch((err) => {
21647
+ const elapsed = Date.now() - t0;
21648
+ const info = findMwaError(err);
21649
+ console.log(`[MWA-DEBUG] ${label} gesture: signMessage err (attempt=${attempt}, ${elapsed}ms)`, {
21650
+ outer: { name: err === null || err === void 0 ? void 0 : err.name, message: err === null || err === void 0 ? void 0 : err.message },
21651
+ mwa: info,
21652
+ });
21653
+ const retryable = isMwaAssociationRetryable(err);
21654
+ if (retryable && attempt < MAX_ATTEMPTS) {
21655
+ // Re-enable the button so the user's next tap provides a
21656
+ // fresh user activation. Show inline error text.
21657
+ console.log(`[MWA-DEBUG] ${label} gesture: retryable (${retryable.code}); awaiting user tap to retry (attempt ${attempt}/${MAX_ATTEMPTS})`);
21658
+ button.disabled = false;
21659
+ setButtonEnabledStyle();
21660
+ button.textContent = originalText;
21661
+ errorRow.textContent = "Couldn't connect — tap to try again";
21662
+ errorRow.style.minHeight = '20px';
21663
+ return;
21664
+ }
21665
+ if (retryable) {
21666
+ // Hit the attempt cap with a still-retryable failure.
21667
+ console.log(`[MWA-DEBUG] ${label} gesture: retryable but attempt cap reached (${attempt})`);
21668
+ finishReject(new Error("Couldn't connect to your Seeker wallet. Please try again."));
21669
+ return;
21670
+ }
21671
+ // Non-retryable error (user cancel inside Seeker, wallet
21672
+ // rejected sign, unknown error, etc.) — surface as-is.
21673
+ finishReject(err);
21674
+ });
21675
+ });
21676
+ console.log(`[MWA-DEBUG] ${label} gesture: modal shown`);
21677
+ });
21678
+ }
21304
21679
  /**
21305
21680
  * Normalize a chain string to a wallet-standard Solana chain identifier.
21306
21681
  *
@@ -21438,11 +21813,11 @@ function readAuthMethod() {
21438
21813
  * @param config - App identity and optional remote host authority for desktop QR code support
21439
21814
  */
21440
21815
  async function registerMobileWalletAdapter(config) {
21441
- var _a;
21816
+ var _a, _b;
21442
21817
  if (typeof window === 'undefined')
21443
21818
  return;
21444
21819
  try {
21445
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-DZCNegue.js'); });
21820
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-CZIJCtms.js'); });
21446
21821
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21447
21822
  if (!registerMwa) {
21448
21823
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21465,9 +21840,12 @@ async function registerMobileWalletAdapter(config) {
21465
21840
  if (walletStandardMobile.createDefaultChainSelector) {
21466
21841
  options.chainSelector = walletStandardMobile.createDefaultChainSelector();
21467
21842
  }
21468
- if (walletStandardMobile.createDefaultWalletNotFoundHandler) {
21469
- options.onWalletNotFound = walletStandardMobile.createDefaultWalletNotFoundHandler();
21470
- }
21843
+ // Default: suppress the "We can't find a wallet" modal — see
21844
+ // SolanaMobileWalletProvider.ensureWallet() for why. Consumers that
21845
+ // want their own UX can pass config.onWalletNotFound.
21846
+ options.onWalletNotFound = (_b = config === null || config === void 0 ? void 0 : config.onWalletNotFound) !== null && _b !== void 0 ? _b : (async () => {
21847
+ console.warn('[MWA-DEBUG] registerMobileWalletAdapter onWalletNotFound (suppressed)');
21848
+ });
21471
21849
  registerMwa(options);
21472
21850
  }
21473
21851
  catch (e) {
@@ -21531,14 +21909,22 @@ class SolanaMobileWalletProvider {
21531
21909
  async ensureWallet() {
21532
21910
  if (this.wallet)
21533
21911
  return this.wallet;
21534
- const mod = await Promise.resolve().then(function () { return require('./index.browser-DZCNegue.js'); });
21912
+ const mod = await Promise.resolve().then(function () { return require('./index.browser-CZIJCtms.js'); });
21535
21913
  const chain = mapChainToWalletStandard(this.cluster);
21536
21914
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21537
21915
  appIdentity: this.appIdentity,
21538
21916
  authorizationCache: mod.createDefaultAuthorizationCache(),
21539
21917
  chains: [chain],
21540
21918
  chainSelector: mod.createDefaultChainSelector(),
21541
- onWalletNotFound: mod.createDefaultWalletNotFoundHandler(),
21919
+ // Suppress the default "We can't find a wallet" modal — that
21920
+ // modal is misleading when ERROR_WALLET_NOT_FOUND fires during
21921
+ // a first-time-consent race on Seeker (the wallet IS installed,
21922
+ // the protocol just gave up before the user finished consenting).
21923
+ // login()'s withMwaAssociationRetry handles this case; on second
21924
+ // failure it surfaces a clean error message to the host app.
21925
+ onWalletNotFound: async () => {
21926
+ console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');
21927
+ },
21542
21928
  });
21543
21929
  return this.wallet;
21544
21930
  }
@@ -21603,8 +21989,15 @@ class SolanaMobileWalletProvider {
21603
21989
  // is where wallet-standard's checkLocalNetworkAccessPermission()
21604
21990
  // fires the three-stage LNA UX (info modal → permission prompt →
21605
21991
  // success modal) before opening the localhost WebSocket.
21992
+ //
21993
+ // Wrap with single-retry: on a Seeker origin's first MWA usage,
21994
+ // the protocol's session-establishment timer often races Seeker's
21995
+ // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before
21996
+ // the user finishes tapping. The retry hits Seeker's cached
21997
+ // consent on the second pass and completes quickly. See
21998
+ // withMwaAssociationRetry for details.
21606
21999
  const connectFeat = getConnectFeature(wallet);
21607
- const { accounts } = await connectFeat.connect();
22000
+ const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());
21608
22001
  if (!accounts || accounts.length === 0) {
21609
22002
  throw new Error('MWA returned no accounts');
21610
22003
  }
@@ -21619,14 +22012,29 @@ class SolanaMobileWalletProvider {
21619
22012
  return user;
21620
22013
  }
21621
22014
  // Wallet popup #2: sign the Tarobase nonce message.
22015
+ //
22016
+ // We cannot call signMessageFeat.signMessage() directly here:
22017
+ // it would run as a JS continuation from the connect() resolve,
22018
+ // with no fresh Chrome transient user activation. The wallet-
22019
+ // standard sign path internally dispatches a new solana-wallet:
22020
+ // Android intent via window.location.assign() (see
22021
+ // @solana-mobile/mobile-wallet-adapter-protocol launchAssociation
22022
+ // at lib/cjs/index.browser.js:459). Chrome blocks the assign
22023
+ // without activation, the blur event never fires, and the
22024
+ // protocol's 3-second getDetectionPromise rejects with
22025
+ // ERROR_WALLET_NOT_FOUND.
22026
+ //
22027
+ // Insert a Tarobase modal: the user's tap on "Sign in" provides a
22028
+ // fresh activation, and signMessage is invoked synchronously
22029
+ // inside the click handler so the activation propagates.
21622
22030
  const messageText = await genSolanaMessage(base58Addr, nonce);
21623
22031
  const messageBytes = getPlatform().textEncode(messageText);
21624
22032
  const signMessageFeat = getSignMessageFeature(wallet);
21625
- const signResults = await signMessageFeat.signMessage({ account, message: messageBytes });
21626
- if (!signResults || signResults.length === 0) {
22033
+ const signResult = await awaitSignInGestureAndSign('login:signMessage', this.config.theme, () => signMessageFeat.signMessage({ account, message: messageBytes }));
22034
+ if (!signResult) {
21627
22035
  throw new Error('MWA returned no signature');
21628
22036
  }
21629
- const { signature: sigBytes } = signResults[0];
22037
+ const { signature: sigBytes } = signResult;
21630
22038
  const signatureBase64 = bufferExports.Buffer.from(sigBytes).toString('base64');
21631
22039
  // Create Tarobase session on the server.
21632
22040
  const createSessionResult = await createSessionWithSignature(base58Addr, messageText, signatureBase64);
@@ -22436,4 +22844,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
22436
22844
  exports.signTransaction = signTransaction;
22437
22845
  exports.subscribe = subscribe;
22438
22846
  exports.useAuth = useAuth;
22439
- //# sourceMappingURL=index-R7cvXys2.js.map
22847
+ //# sourceMappingURL=index-bEXLwE7_.js.map