@pooflabs/web 0.0.85-rc2 → 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 (50) hide show
  1. package/dist/{index-DyRIXw-l.js → index-B5qYY4YM.js} +2 -2
  2. package/dist/index-B5qYY4YM.js.map +1 -0
  3. package/dist/{index-B7tJ8TAn.esm.js → index-BE-VWSJT.esm.js} +2 -2
  4. package/dist/{index-B7tJ8TAn.esm.js.map → index-BE-VWSJT.esm.js.map} +1 -1
  5. package/dist/{index-B1_Q49qQ.js → index-BaKs3A8s.js} +2 -2
  6. package/dist/{index-B1_Q49qQ.js.map → index-BaKs3A8s.js.map} +1 -1
  7. package/dist/{index-DflG_JAB.js → index-BzeiIIwF.js} +3 -3
  8. package/dist/{index-DflG_JAB.js.map → index-BzeiIIwF.js.map} +1 -1
  9. package/dist/{index-QukWgaIi.esm.js → index-C4AnWFs_.esm.js} +294 -11
  10. package/dist/{index-QukWgaIi.esm.js.map → index-C4AnWFs_.esm.js.map} +1 -1
  11. package/dist/index-TzHXEf3-.esm.js +6 -0
  12. package/dist/index-TzHXEf3-.esm.js.map +1 -0
  13. package/dist/{index-BeFR3-cf.js → index-bEXLwE7_.js} +294 -11
  14. package/dist/{index-BeFR3-cf.js.map → index-bEXLwE7_.js.map} +1 -1
  15. package/dist/{index-agGmWBn4.esm.js → index-dqqR5q7b.esm.js} +3 -3
  16. package/dist/{index-agGmWBn4.esm.js.map → index-dqqR5q7b.esm.js.map} +1 -1
  17. package/dist/{index.browser-DZtZWdul.js → index.browser-CN6obNQM.js} +2 -2
  18. package/dist/{index.browser-DZtZWdul.js.map → index.browser-CN6obNQM.js.map} +1 -1
  19. package/dist/{index.browser-BJmFjY2f.js → index.browser-CZIJCtms.js} +2 -2
  20. package/dist/{index.browser-BJmFjY2f.js.map → index.browser-CZIJCtms.js.map} +1 -1
  21. package/dist/{index.browser-p-pgsxxW.esm.js → index.browser-D8ttddP4.esm.js} +2 -2
  22. package/dist/{index.browser-p-pgsxxW.esm.js.map → index.browser-D8ttddP4.esm.js.map} +1 -1
  23. package/dist/{index.browser-lHP9glAW.esm.js → index.browser-DQIwLToJ.esm.js} +2 -2
  24. package/dist/{index.browser-lHP9glAW.esm.js.map → index.browser-DQIwLToJ.esm.js.map} +1 -1
  25. package/dist/index.esm.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/{index.native-a3mhu9HP.esm.js → index.native-DLziTime.esm.js} +4 -4
  28. package/dist/{index.native-a3mhu9HP.esm.js.map → index.native-DLziTime.esm.js.map} +1 -1
  29. package/dist/{index.native-ANhb4jEB.js → index.native-pG1NTZ0f.js} +4 -4
  30. package/dist/{index.native-ANhb4jEB.js.map → index.native-pG1NTZ0f.js.map} +1 -1
  31. package/dist/index.native.esm.js +1 -1
  32. package/dist/index.native.js +1 -1
  33. package/dist/{phantom-wallet-provider-Dsza6TBv.esm.js → phantom-wallet-provider-CP6NXRwG.esm.js} +4 -4
  34. package/dist/{phantom-wallet-provider-Dsza6TBv.esm.js.map → phantom-wallet-provider-CP6NXRwG.esm.js.map} +1 -1
  35. package/dist/{phantom-wallet-provider-BOdn0D1Q.js → phantom-wallet-provider-zBp7-uEw.js} +4 -4
  36. package/dist/{phantom-wallet-provider-BOdn0D1Q.js.map → phantom-wallet-provider-zBp7-uEw.js.map} +1 -1
  37. package/dist/{privy-wallet-provider-bwwhkFjL.esm.js → privy-wallet-provider-CGYvf3-r.esm.js} +3 -3
  38. package/dist/{privy-wallet-provider-bwwhkFjL.esm.js.map → privy-wallet-provider-CGYvf3-r.esm.js.map} +1 -1
  39. package/dist/{privy-wallet-provider-BlPh3Gn_.js → privy-wallet-provider-CoyW5Gdg.js} +3 -3
  40. package/dist/{privy-wallet-provider-BlPh3Gn_.js.map → privy-wallet-provider-CoyW5Gdg.js.map} +1 -1
  41. package/dist/{solana-mobile-wallet-provider-fzLIgJBf.esm.js → solana-mobile-wallet-provider-B8rHfsPN.esm.js} +294 -11
  42. package/dist/solana-mobile-wallet-provider-B8rHfsPN.esm.js.map +1 -0
  43. package/dist/{solana-mobile-wallet-provider-S8yWHG6i.js → solana-mobile-wallet-provider-CN-D_H4l.js} +294 -11
  44. package/dist/solana-mobile-wallet-provider-CN-D_H4l.js.map +1 -0
  45. package/package.json +1 -1
  46. package/dist/index-DbJCCvVN.esm.js +0 -6
  47. package/dist/index-DbJCCvVN.esm.js.map +0 -1
  48. package/dist/index-DyRIXw-l.js.map +0 -1
  49. package/dist/solana-mobile-wallet-provider-S8yWHG6i.js.map +0 -1
  50. package/dist/solana-mobile-wallet-provider-fzLIgJBf.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-B1_Q49qQ.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
@@ -21405,6 +21405,277 @@ async function withMwaAssociationRetry(label, fn) {
21405
21405
  }
21406
21406
  }
21407
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 = '×';
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
+ }
21408
21679
  /**
21409
21680
  * Normalize a chain string to a wallet-standard Solana chain identifier.
21410
21681
  *
@@ -21546,7 +21817,7 @@ async function registerMobileWalletAdapter(config) {
21546
21817
  if (typeof window === 'undefined')
21547
21818
  return;
21548
21819
  try {
21549
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-BJmFjY2f.js'); });
21820
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-CZIJCtms.js'); });
21550
21821
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21551
21822
  if (!registerMwa) {
21552
21823
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21638,7 +21909,7 @@ class SolanaMobileWalletProvider {
21638
21909
  async ensureWallet() {
21639
21910
  if (this.wallet)
21640
21911
  return this.wallet;
21641
- const mod = await Promise.resolve().then(function () { return require('./index.browser-BJmFjY2f.js'); });
21912
+ const mod = await Promise.resolve().then(function () { return require('./index.browser-CZIJCtms.js'); });
21642
21913
  const chain = mapChainToWalletStandard(this.cluster);
21643
21914
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21644
21915
  appIdentity: this.appIdentity,
@@ -21740,18 +22011,30 @@ class SolanaMobileWalletProvider {
21740
22011
  setCurrentUser(user);
21741
22012
  return user;
21742
22013
  }
21743
- // Wallet popup #2: sign the Tarobase nonce message. Wrap with the
21744
- // same retry for defense in depth — by now Seeker has cached the
21745
- // consent so this rarely hits the retry path, but if the
21746
- // protocol's session timer fires here too we recover transparently.
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.
21747
22030
  const messageText = await genSolanaMessage(base58Addr, nonce);
21748
22031
  const messageBytes = getPlatform().textEncode(messageText);
21749
22032
  const signMessageFeat = getSignMessageFeature(wallet);
21750
- const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));
21751
- if (!signResults || signResults.length === 0) {
22033
+ const signResult = await awaitSignInGestureAndSign('login:signMessage', this.config.theme, () => signMessageFeat.signMessage({ account, message: messageBytes }));
22034
+ if (!signResult) {
21752
22035
  throw new Error('MWA returned no signature');
21753
22036
  }
21754
- const { signature: sigBytes } = signResults[0];
22037
+ const { signature: sigBytes } = signResult;
21755
22038
  const signatureBase64 = bufferExports.Buffer.from(sigBytes).toString('base64');
21756
22039
  // Create Tarobase session on the server.
21757
22040
  const createSessionResult = await createSessionWithSignature(base58Addr, messageText, signatureBase64);
@@ -22561,4 +22844,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
22561
22844
  exports.signTransaction = signTransaction;
22562
22845
  exports.subscribe = subscribe;
22563
22846
  exports.useAuth = useAuth;
22564
- //# sourceMappingURL=index-BeFR3-cf.js.map
22847
+ //# sourceMappingURL=index-bEXLwE7_.js.map