@pooflabs/web 0.0.81-rc5 → 0.0.81
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.
- package/dist/auth/index.d.ts +10 -1
- package/dist/auth/providers/phantom-wallet-provider.d.ts +20 -21
- package/dist/global.d.ts +3 -1
- package/dist/{index-Fjyk5jYL.js → index-B2WGCssJ.js} +346 -490
- package/dist/index-B2WGCssJ.js.map +1 -0
- package/dist/{index-DB9nDInp.esm.js → index-CjHbp7Dq.esm.js} +3697 -562
- package/dist/index-CjHbp7Dq.esm.js.map +1 -0
- package/dist/{index-D_ta2S2c.js → index-DXPkkq81.js} +3698 -563
- package/dist/index-DXPkkq81.js.map +1 -0
- package/dist/{index-Bg_ApFIo.js → index-D_DiP8XQ.js} +3698 -563
- package/dist/index-D_DiP8XQ.js.map +1 -0
- package/dist/{index-CZhJBWap.esm.js → index-dcJIjFrs.esm.js} +3697 -562
- package/dist/index-dcJIjFrs.esm.js.map +1 -0
- package/dist/{index-Bkr4BRoP.esm.js → index-nt_HQVrk.esm.js} +344 -490
- package/dist/index-nt_HQVrk.esm.js.map +1 -0
- package/dist/{index.browser-iqs5DlRU.esm.js → index.browser-BNdFfyIg.esm.js} +1571 -1368
- package/dist/index.browser-BNdFfyIg.esm.js.map +1 -0
- package/dist/{index.browser-DHi7UhqF.js → index.browser-CT6PUv9G.js} +1571 -1368
- package/dist/index.browser-CT6PUv9G.js.map +1 -0
- package/dist/index.browser-Cy21yaX0.esm.js +1096 -0
- package/dist/index.browser-Cy21yaX0.esm.js.map +1 -0
- package/dist/index.browser-OvGNsMPu.esm.js +1002 -0
- package/dist/index.browser-OvGNsMPu.esm.js.map +1 -0
- package/dist/index.browser-ZD7Tz2bn.js +1099 -0
- package/dist/index.browser-ZD7Tz2bn.js.map +1 -0
- package/dist/index.browser-d0PlOXpF.js +105 -0
- package/dist/index.browser-d0PlOXpF.js.map +1 -0
- package/dist/index.browser-pE1s68e9.esm.js +102 -0
- package/dist/index.browser-pE1s68e9.esm.js.map +1 -0
- package/dist/index.browser-vuTr40so.js +1008 -0
- package/dist/index.browser-vuTr40so.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{index.native-DYgJWWY4.esm.js → index.native-BqYr--vb.esm.js} +202 -178
- package/dist/index.native-BqYr--vb.esm.js.map +1 -0
- package/dist/{index.native-DJWuqJTZ.js → index.native-CyA-RdvW.js} +204 -178
- package/dist/index.native-CyA-RdvW.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +1 -1
- package/dist/{phantom-wallet-provider-fofd8BMo.js → phantom-wallet-provider-DWCaMkyz.js} +147 -238
- package/dist/phantom-wallet-provider-DWCaMkyz.js.map +1 -0
- package/dist/{phantom-wallet-provider-DSFGWSOJ.esm.js → phantom-wallet-provider-K2V96G-G.esm.js} +147 -238
- package/dist/phantom-wallet-provider-K2V96G-G.esm.js.map +1 -0
- package/dist/{privy-wallet-provider-Csv34Kcc.js → privy-wallet-provider-BMg_S_d0.js} +4 -4
- package/dist/privy-wallet-provider-BMg_S_d0.js.map +1 -0
- package/dist/{privy-wallet-provider-TRToDe4Q.esm.js → privy-wallet-provider-DoX8q99w.esm.js} +4 -4
- package/dist/privy-wallet-provider-DoX8q99w.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-L7nRuxhv.esm.js → solana-mobile-wallet-provider-Cmphb3oB.esm.js} +3 -82
- package/dist/solana-mobile-wallet-provider-Cmphb3oB.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-Cp65LfNb.js → solana-mobile-wallet-provider-t22Ie8lY.js} +3 -82
- package/dist/solana-mobile-wallet-provider-t22Ie8lY.js.map +1 -0
- package/package.json +3 -3
- package/dist/index-Bg_ApFIo.js.map +0 -1
- package/dist/index-Bkr4BRoP.esm.js.map +0 -1
- package/dist/index-CZhJBWap.esm.js.map +0 -1
- package/dist/index-DB9nDInp.esm.js.map +0 -1
- package/dist/index-D_ta2S2c.js.map +0 -1
- package/dist/index-Fjyk5jYL.js.map +0 -1
- package/dist/index.browser-BTlliHCf.esm.js +0 -119
- package/dist/index.browser-BTlliHCf.esm.js.map +0 -1
- package/dist/index.browser-C-_FEr5M.esm.js +0 -1134
- package/dist/index.browser-C-_FEr5M.esm.js.map +0 -1
- package/dist/index.browser-DHi7UhqF.js.map +0 -1
- package/dist/index.browser-DRTQuf0J.js +0 -1253
- package/dist/index.browser-DRTQuf0J.js.map +0 -1
- package/dist/index.browser-Disp7Kcb.esm.js +0 -1250
- package/dist/index.browser-Disp7Kcb.esm.js.map +0 -1
- package/dist/index.browser-DjEZSiqI.js +0 -1137
- package/dist/index.browser-DjEZSiqI.js.map +0 -1
- package/dist/index.browser-DvTeEO2r.js +0 -122
- package/dist/index.browser-DvTeEO2r.js.map +0 -1
- package/dist/index.browser-iqs5DlRU.esm.js.map +0 -1
- package/dist/index.native-DJWuqJTZ.js.map +0 -1
- package/dist/index.native-DYgJWWY4.esm.js.map +0 -1
- package/dist/phantom-wallet-provider-DSFGWSOJ.esm.js.map +0 -1
- package/dist/phantom-wallet-provider-fofd8BMo.js.map +0 -1
- package/dist/privy-wallet-provider-Csv34Kcc.js.map +0 -1
- package/dist/privy-wallet-provider-TRToDe4Q.esm.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-Cp65LfNb.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-L7nRuxhv.esm.js.map +0 -1
package/dist/{phantom-wallet-provider-DSFGWSOJ.esm.js → phantom-wallet-provider-K2V96G-G.esm.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as bufferExports } from './index-CrOVJFX9.esm.js';
|
|
2
|
-
import {
|
|
2
|
+
import { W as WebSessionManager, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, e as confirmAndCheckTransaction, s as setCurrentUser, a as SOLANA_DEVNET_RPC_URL, S as SOLANA_MAINNET_RPC_URL, h as SURFNET_RPC_URL, j as detectMobile, k as detectAndroid, l as setAuthLoading, m as genAuthNonce, n as genSolanaMessage, o as createSessionWithSignature, g as getPlatform } from './index.native-BqYr--vb.esm.js';
|
|
3
3
|
import { Connection, PublicKey, VersionedTransaction } from '@solana/web3.js';
|
|
4
4
|
import * as anchor from '@coral-xyz/anchor';
|
|
5
5
|
import 'axios';
|
|
@@ -52,7 +52,7 @@ async function loadDependencies() {
|
|
|
52
52
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
53
53
|
import('react'),
|
|
54
54
|
import('react-dom/client'),
|
|
55
|
-
import('./index-
|
|
55
|
+
import('./index-CjHbp7Dq.esm.js')
|
|
56
56
|
]);
|
|
57
57
|
// Extract default export from ESM module namespace
|
|
58
58
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -64,6 +64,10 @@ async function loadDependencies() {
|
|
|
64
64
|
return loadingPromise;
|
|
65
65
|
}
|
|
66
66
|
class PhantomWalletProvider {
|
|
67
|
+
/** Temporarily override modal appearance for a single login() call. Cleared automatically after login settles. */
|
|
68
|
+
setLoginOverrides(opts) {
|
|
69
|
+
this.loginOverrides = opts;
|
|
70
|
+
}
|
|
67
71
|
constructor(networkUrl = null, config = {}) {
|
|
68
72
|
this.containerElement = null;
|
|
69
73
|
this.root = null;
|
|
@@ -73,6 +77,7 @@ class PhantomWalletProvider {
|
|
|
73
77
|
this.loginInProgress = false;
|
|
74
78
|
this.autoLoginInProgress = false;
|
|
75
79
|
this.initPromise = null;
|
|
80
|
+
this.loginOverrides = null;
|
|
76
81
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
77
82
|
this.onSwitchToPrivy = null;
|
|
78
83
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
@@ -95,13 +100,8 @@ class PhantomWalletProvider {
|
|
|
95
100
|
async initializeAsync() {
|
|
96
101
|
// Lazy load dependencies only when actually instantiating
|
|
97
102
|
await loadDependencies();
|
|
98
|
-
// Initialize React component
|
|
99
|
-
|
|
100
|
-
// or non-Android). Otherwise defer until ensureReady() is reached from
|
|
101
|
-
// a user-gesture flow. See shouldMountEagerly() for the rationale.
|
|
102
|
-
if (this.shouldMountEagerly()) {
|
|
103
|
-
this.initialize();
|
|
104
|
-
}
|
|
103
|
+
// Initialize React component
|
|
104
|
+
this.initialize();
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Check if social login providers are configured (non-injected providers).
|
|
@@ -109,69 +109,6 @@ class PhantomWalletProvider {
|
|
|
109
109
|
hasSocialProviders() {
|
|
110
110
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
111
111
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
|
|
114
|
-
* eagerly during init() or defer until the first user-triggered call
|
|
115
|
-
* (login / sign / etc.) reaches ensureReady().
|
|
116
|
-
*
|
|
117
|
-
* Mounting the React tree synchronously constructs BrowserSDK, which runs
|
|
118
|
-
* wallet-standard discovery in its constructor and fires sdk.autoConnect()
|
|
119
|
-
* in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
|
|
120
|
-
* pathways probe the Android intent surface to discover the Phantom mobile
|
|
121
|
-
* app, which surfaces Chrome's system "wants to access other apps and
|
|
122
|
-
* services" permission dialog *before* the PWA activity has window focus.
|
|
123
|
-
* The dialog renders with grayed-out buttons until the user backgrounds
|
|
124
|
-
* and resumes the app.
|
|
125
|
-
*
|
|
126
|
-
* Returns true when eager mount is needed (callback to handle, prior
|
|
127
|
-
* session, in-page wallet present, or non-Android). Otherwise returns
|
|
128
|
-
* false — the React tree is mounted lazily inside ensureReady() once a
|
|
129
|
-
* user gesture brings us there.
|
|
130
|
-
*/
|
|
131
|
-
shouldMountEagerly() {
|
|
132
|
-
if (typeof window === 'undefined')
|
|
133
|
-
return false;
|
|
134
|
-
// Preserve desktop behavior: always mount eagerly.
|
|
135
|
-
if (!detectAndroid())
|
|
136
|
-
return true;
|
|
137
|
-
// In-page wallet present (Phantom in-app browser / desktop extension on
|
|
138
|
-
// a desktop-mode Android UA): no Android intent probe needed, mount free.
|
|
139
|
-
// Tighten beyond truthy `window.phantom` since arbitrary stubs can land
|
|
140
|
-
// on that key — require a wallet-shaped surface.
|
|
141
|
-
const ph = window.phantom;
|
|
142
|
-
if (ph && (ph.solana || ph.ethereum || ph.app))
|
|
143
|
-
return true;
|
|
144
|
-
// Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
|
|
145
|
-
// be live to read these URL params via urlParamsAccessor.
|
|
146
|
-
const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
|
|
147
|
-
try {
|
|
148
|
-
const params = new URLSearchParams(window.location.search);
|
|
149
|
-
if (callbackKeys.some(k => params.has(k)))
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
catch (_a) {
|
|
153
|
-
return true; // conservative on URL access failure
|
|
154
|
-
}
|
|
155
|
-
// Returning user with a stored Phantom session. They've already
|
|
156
|
-
// approved the Android intent permission for this origin on first
|
|
157
|
-
// login, so the dialog is typically pre-granted by Chrome — eager
|
|
158
|
-
// mount lets autoConnect silently restore the wallet handshake.
|
|
159
|
-
// Require BOTH the marker AND a session storage entry so a stale
|
|
160
|
-
// orphaned marker doesn't keep eager-mounting forever. Note
|
|
161
|
-
// isAuthenticated() is a raw key-existence check, not a validity
|
|
162
|
-
// check — restoreSession() above clears the marker on the next load
|
|
163
|
-
// if the session is unusable, so the bug self-corrects after at
|
|
164
|
-
// most one further cold start.
|
|
165
|
-
try {
|
|
166
|
-
const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
|
|
167
|
-
if (stored === 'phantom' && WebSessionManager.isAuthenticated())
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
catch (_b) {
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
112
|
static getInstance(networkUrl, config) {
|
|
176
113
|
if (!PhantomWalletProvider.instance) {
|
|
177
114
|
new PhantomWalletProvider(networkUrl, config);
|
|
@@ -247,7 +184,7 @@ class PhantomWalletProvider {
|
|
|
247
184
|
const sdkProviders = this.resolvedProviders.length > 0 ? [...this.resolvedProviders] : ['injected'];
|
|
248
185
|
// Inner component that uses hooks
|
|
249
186
|
const PhantomHooksComponent = () => {
|
|
250
|
-
var _a, _b;
|
|
187
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
251
188
|
const phantom = usePhantom();
|
|
252
189
|
const { connect, error: connectError } = useConnect();
|
|
253
190
|
const { disconnect, isDisconnecting } = useDisconnect();
|
|
@@ -530,63 +467,13 @@ class PhantomWalletProvider {
|
|
|
530
467
|
}
|
|
531
468
|
};
|
|
532
469
|
const handleMobileWalletClick = async () => {
|
|
533
|
-
var _a;
|
|
534
|
-
console.log('[MWA-DEBUG] handleMobileWalletClick: entered', {
|
|
535
|
-
documentHasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
536
|
-
visibilityState: typeof document !== 'undefined' ? document.visibilityState : 'n/a',
|
|
537
|
-
displayMode: typeof window !== 'undefined' && window.matchMedia
|
|
538
|
-
? (window.matchMedia('(display-mode: standalone)').matches ? 'standalone' : 'browser')
|
|
539
|
-
: 'n/a',
|
|
540
|
-
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'n/a',
|
|
541
|
-
timestamp: Date.now(),
|
|
542
|
-
});
|
|
543
470
|
that.loginInProgress = false;
|
|
544
471
|
walletClickedRef.current = true;
|
|
545
472
|
setShowWalletModal(false);
|
|
546
|
-
// Hide the Phantom provider container while MWA's transact()
|
|
547
|
-
// is opening the localhost WebSocket and Chrome surfaces the
|
|
548
|
-
// "Apps on Device" / Local Network Access permission dialog.
|
|
549
|
-
//
|
|
550
|
-
// The container is a singleton fixed full-viewport <div> with
|
|
551
|
-
// z-index 2147483647 + pointer-events: none parked on body.
|
|
552
|
-
// Even though pointer-events: none should let touches pass
|
|
553
|
-
// through, on Android Chrome (both PWA and regular browser)
|
|
554
|
-
// the system permission dialog rendered during MWA's
|
|
555
|
-
// handshake comes up with disabled-looking buttons until the
|
|
556
|
-
// activity is forced to re-composite (the user's
|
|
557
|
-
// background+reopen workaround).
|
|
558
|
-
//
|
|
559
|
-
// Display:none-ing the container during MWA login removes it
|
|
560
|
-
// from the layout tree entirely so there's nothing for the
|
|
561
|
-
// dialog hit-testing / compositor to get confused by. It's
|
|
562
|
-
// restored after MWA login resolves or rejects.
|
|
563
|
-
const containerEl = that.containerElement;
|
|
564
|
-
const previousDisplay = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.display) !== null && _a !== void 0 ? _a : '';
|
|
565
|
-
console.log('[MWA-DEBUG] container before hide', {
|
|
566
|
-
hasContainer: !!containerEl,
|
|
567
|
-
previousDisplay,
|
|
568
|
-
inDom: containerEl ? document.body.contains(containerEl) : false,
|
|
569
|
-
zIndex: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.zIndex,
|
|
570
|
-
pointerEvents: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.pointerEvents,
|
|
571
|
-
});
|
|
572
|
-
if (containerEl) {
|
|
573
|
-
containerEl.style.display = 'none';
|
|
574
|
-
}
|
|
575
|
-
console.log('[MWA-DEBUG] container hidden, computed display now:', containerEl ? getComputedStyle(containerEl).display : 'n/a');
|
|
576
|
-
const restoreContainer = () => {
|
|
577
|
-
if (containerEl) {
|
|
578
|
-
containerEl.style.display = previousDisplay;
|
|
579
|
-
console.log('[MWA-DEBUG] container restored, display:', containerEl.style.display);
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
473
|
if (that.onSwitchToMWA) {
|
|
583
474
|
try {
|
|
584
|
-
console.log('[MWA-DEBUG] calling onSwitchToMWA');
|
|
585
475
|
const mwaProvider = await that.onSwitchToMWA();
|
|
586
|
-
console.log('[MWA-DEBUG] onSwitchToMWA resolved, calling mwaProvider.login()');
|
|
587
476
|
const user = await mwaProvider.login();
|
|
588
|
-
console.log('[MWA-DEBUG] mwaProvider.login() resolved', { hasUser: !!user });
|
|
589
|
-
restoreContainer();
|
|
590
477
|
if (that.pendingLogin && user) {
|
|
591
478
|
that.pendingLogin.resolve(user);
|
|
592
479
|
that.pendingLogin = null;
|
|
@@ -597,22 +484,12 @@ class PhantomWalletProvider {
|
|
|
597
484
|
}
|
|
598
485
|
}
|
|
599
486
|
catch (error) {
|
|
600
|
-
console.log('[MWA-DEBUG] mwaProvider.login() threw', {
|
|
601
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
602
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
603
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
604
|
-
});
|
|
605
|
-
restoreContainer();
|
|
606
487
|
if (that.pendingLogin) {
|
|
607
488
|
that.pendingLogin.reject(error);
|
|
608
489
|
that.pendingLogin = null;
|
|
609
490
|
}
|
|
610
491
|
}
|
|
611
492
|
}
|
|
612
|
-
else {
|
|
613
|
-
console.log('[MWA-DEBUG] no onSwitchToMWA configured');
|
|
614
|
-
restoreContainer();
|
|
615
|
-
}
|
|
616
493
|
};
|
|
617
494
|
const handleCloseModal = () => {
|
|
618
495
|
setShowWalletModal(false);
|
|
@@ -626,31 +503,59 @@ class PhantomWalletProvider {
|
|
|
626
503
|
if (!showWalletModal) {
|
|
627
504
|
return null;
|
|
628
505
|
}
|
|
629
|
-
const
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
const
|
|
506
|
+
const effectiveTheme = (_c = (_b = (_a = that.loginOverrides) === null || _a === void 0 ? void 0 : _a.theme) !== null && _b !== void 0 ? _b : that.config.theme) !== null && _c !== void 0 ? _c : 'dark';
|
|
507
|
+
const isLight = effectiveTheme === 'light';
|
|
508
|
+
const bgColor = isLight ? '#FFFFFF' : '#111113';
|
|
509
|
+
const cardBorder = isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.07)';
|
|
510
|
+
const textColor = isLight ? '#0f0f0f' : '#f5f5f5';
|
|
511
|
+
const subTextColor = isLight ? 'rgba(0,0,0,0.45)' : 'rgba(255,255,255,0.4)';
|
|
512
|
+
const btnBg = isLight ? 'rgba(0,0,0,0.04)' : 'rgba(255,255,255,0.05)';
|
|
513
|
+
const btnHoverBg = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.09)';
|
|
514
|
+
const btnBorder = isLight ? '1px solid rgba(0,0,0,0.10)' : '1px solid rgba(255,255,255,0.09)';
|
|
515
|
+
const dividerColor = isLight ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.08)';
|
|
634
516
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
635
517
|
const buttonStyle = (id) => ({
|
|
636
518
|
display: 'flex',
|
|
637
519
|
alignItems: 'center',
|
|
638
520
|
justifyContent: 'center',
|
|
639
|
-
gap: '
|
|
521
|
+
gap: '10px',
|
|
640
522
|
width: '100%',
|
|
641
|
-
height: '
|
|
642
|
-
padding: '
|
|
643
|
-
border:
|
|
644
|
-
borderRadius: '
|
|
523
|
+
height: '52px',
|
|
524
|
+
padding: '0 20px',
|
|
525
|
+
border: btnBorder,
|
|
526
|
+
borderRadius: '12px',
|
|
645
527
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
646
528
|
color: textColor,
|
|
647
529
|
fontFamily,
|
|
648
530
|
fontSize: '14px',
|
|
649
|
-
fontWeight: '
|
|
650
|
-
lineHeight: '
|
|
651
|
-
letterSpacing: '
|
|
531
|
+
fontWeight: '500',
|
|
532
|
+
lineHeight: '1',
|
|
533
|
+
letterSpacing: '0',
|
|
534
|
+
cursor: 'pointer',
|
|
535
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
536
|
+
boxSizing: 'border-box',
|
|
537
|
+
});
|
|
538
|
+
const emailButtonStyle = (id) => ({
|
|
539
|
+
display: 'flex',
|
|
540
|
+
alignItems: 'center',
|
|
541
|
+
justifyContent: 'center',
|
|
542
|
+
gap: '10px',
|
|
543
|
+
width: '100%',
|
|
544
|
+
height: '52px',
|
|
545
|
+
padding: '0 20px',
|
|
546
|
+
border: isLight ? '1px solid rgba(0,0,0,0.15)' : '1px solid rgba(255,255,255,0.15)',
|
|
547
|
+
borderRadius: '12px',
|
|
548
|
+
backgroundColor: hoveredBtn === id
|
|
549
|
+
? (isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.12)')
|
|
550
|
+
: (isLight ? 'rgba(0,0,0,0.03)' : 'rgba(255,255,255,0.08)'),
|
|
551
|
+
color: textColor,
|
|
552
|
+
fontFamily,
|
|
553
|
+
fontSize: '14px',
|
|
554
|
+
fontWeight: '500',
|
|
555
|
+
lineHeight: '1',
|
|
652
556
|
cursor: 'pointer',
|
|
653
|
-
transition: 'background-color 0.
|
|
557
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
558
|
+
boxSizing: 'border-box',
|
|
654
559
|
});
|
|
655
560
|
const walletButtons = [];
|
|
656
561
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -662,7 +567,7 @@ class PhantomWalletProvider {
|
|
|
662
567
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
663
568
|
onMouseLeave: () => setHoveredBtn(null),
|
|
664
569
|
}, React.createElement('svg', {
|
|
665
|
-
width: '
|
|
570
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
666
571
|
style: { flexShrink: '0' },
|
|
667
572
|
}, React.createElement('path', {
|
|
668
573
|
d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z',
|
|
@@ -687,7 +592,7 @@ class PhantomWalletProvider {
|
|
|
687
592
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
688
593
|
onMouseLeave: () => setHoveredBtn(null),
|
|
689
594
|
}, React.createElement('svg', {
|
|
690
|
-
width: '
|
|
595
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
691
596
|
fill: textColor,
|
|
692
597
|
style: { flexShrink: '0' },
|
|
693
598
|
}, React.createElement('path', {
|
|
@@ -739,11 +644,9 @@ class PhantomWalletProvider {
|
|
|
739
644
|
onClick: handleMobileWalletClick,
|
|
740
645
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
741
646
|
onMouseLeave: () => setHoveredBtn(null),
|
|
742
|
-
},
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
746
|
-
style: { flexShrink: '0' },
|
|
647
|
+
}, React.createElement('svg', {
|
|
648
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
649
|
+
style: { flexShrink: '0', opacity: '0.85' },
|
|
747
650
|
},
|
|
748
651
|
// Phone outline
|
|
749
652
|
React.createElement('rect', {
|
|
@@ -765,23 +668,51 @@ class PhantomWalletProvider {
|
|
|
765
668
|
if (that.config.enablePrivyFallback) {
|
|
766
669
|
walletButtons.push(React.createElement('button', {
|
|
767
670
|
key: 'email-login',
|
|
768
|
-
style:
|
|
671
|
+
style: emailButtonStyle('email-login'),
|
|
769
672
|
onClick: handleEmailClick,
|
|
770
673
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
771
674
|
onMouseLeave: () => setHoveredBtn(null),
|
|
772
|
-
},
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
776
|
-
style: { flexShrink: '0' },
|
|
675
|
+
}, React.createElement('svg', {
|
|
676
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
677
|
+
style: { flexShrink: '0', opacity: '0.7' },
|
|
777
678
|
}, React.createElement('path', {
|
|
778
679
|
d: 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z',
|
|
779
|
-
stroke: textColor, strokeWidth: '
|
|
680
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
780
681
|
}), React.createElement('path', {
|
|
781
682
|
d: 'M22 6l-10 7L2 6',
|
|
782
|
-
stroke: textColor, strokeWidth: '
|
|
783
|
-
})), '
|
|
683
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
684
|
+
})), 'Continue with email'));
|
|
784
685
|
}
|
|
686
|
+
// Split email button from the rest to insert OR divider
|
|
687
|
+
const emailBtnIndex = walletButtons.findIndex((b) => b && b.key === 'email-login');
|
|
688
|
+
const mainButtons = emailBtnIndex >= 0 ? walletButtons.slice(0, emailBtnIndex) : walletButtons;
|
|
689
|
+
const emailButton = emailBtnIndex >= 0 ? walletButtons[emailBtnIndex] : null;
|
|
690
|
+
// OR divider — shown when there are both wallet/social buttons and an email button
|
|
691
|
+
const orDivider = (mainButtons.length > 0 && emailButton)
|
|
692
|
+
? React.createElement('div', {
|
|
693
|
+
key: 'or-divider',
|
|
694
|
+
style: {
|
|
695
|
+
display: 'flex',
|
|
696
|
+
alignItems: 'center',
|
|
697
|
+
gap: '12px',
|
|
698
|
+
margin: '4px 0',
|
|
699
|
+
},
|
|
700
|
+
}, React.createElement('div', {
|
|
701
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
702
|
+
}), React.createElement('span', {
|
|
703
|
+
style: {
|
|
704
|
+
color: subTextColor,
|
|
705
|
+
fontFamily,
|
|
706
|
+
fontSize: '12px',
|
|
707
|
+
fontWeight: '500',
|
|
708
|
+
letterSpacing: '0.02em',
|
|
709
|
+
textTransform: 'uppercase',
|
|
710
|
+
userSelect: 'none',
|
|
711
|
+
},
|
|
712
|
+
}, 'or'), React.createElement('div', {
|
|
713
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
714
|
+
}))
|
|
715
|
+
: null;
|
|
785
716
|
// Render custom modal
|
|
786
717
|
return React.createElement('div', {
|
|
787
718
|
// Overlay
|
|
@@ -791,12 +722,14 @@ class PhantomWalletProvider {
|
|
|
791
722
|
left: '0',
|
|
792
723
|
right: '0',
|
|
793
724
|
bottom: '0',
|
|
794
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
725
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
795
726
|
display: 'flex',
|
|
796
727
|
alignItems: 'center',
|
|
797
728
|
justifyContent: 'center',
|
|
798
729
|
zIndex: 2147483647,
|
|
799
730
|
pointerEvents: 'auto',
|
|
731
|
+
backdropFilter: 'blur(4px)',
|
|
732
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
800
733
|
},
|
|
801
734
|
onClick: (e) => {
|
|
802
735
|
if (e.target === e.currentTarget)
|
|
@@ -813,13 +746,17 @@ class PhantomWalletProvider {
|
|
|
813
746
|
React.createElement('div', {
|
|
814
747
|
style: {
|
|
815
748
|
backgroundColor: bgColor,
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
749
|
+
border: cardBorder,
|
|
750
|
+
borderRadius: '20px',
|
|
751
|
+
width: '380px',
|
|
752
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
753
|
+
padding: '28px 24px 24px',
|
|
820
754
|
position: 'relative',
|
|
821
|
-
boxShadow:
|
|
755
|
+
boxShadow: isLight
|
|
756
|
+
? '0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)'
|
|
757
|
+
: '0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3)',
|
|
822
758
|
pointerEvents: 'auto',
|
|
759
|
+
boxSizing: 'border-box',
|
|
823
760
|
},
|
|
824
761
|
onMouseDown: (e) => {
|
|
825
762
|
e.stopPropagation();
|
|
@@ -828,26 +765,30 @@ class PhantomWalletProvider {
|
|
|
828
765
|
e.stopPropagation();
|
|
829
766
|
},
|
|
830
767
|
},
|
|
831
|
-
// Close button
|
|
768
|
+
// Close button
|
|
832
769
|
React.createElement('button', {
|
|
833
770
|
onClick: handleCloseModal,
|
|
834
771
|
style: {
|
|
835
772
|
position: 'absolute',
|
|
836
|
-
top: '
|
|
837
|
-
right: '
|
|
838
|
-
background: '
|
|
839
|
-
border: '
|
|
773
|
+
top: '14px',
|
|
774
|
+
right: '14px',
|
|
775
|
+
background: isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.07)',
|
|
776
|
+
border: isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.08)',
|
|
777
|
+
borderRadius: '50%',
|
|
778
|
+
width: '28px',
|
|
779
|
+
height: '28px',
|
|
840
780
|
cursor: 'pointer',
|
|
841
|
-
padding: '4px',
|
|
842
781
|
display: 'flex',
|
|
843
782
|
alignItems: 'center',
|
|
844
783
|
justifyContent: 'center',
|
|
784
|
+
padding: '0',
|
|
785
|
+
flexShrink: '0',
|
|
845
786
|
},
|
|
846
787
|
}, React.createElement('svg', {
|
|
847
|
-
width: '
|
|
788
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
848
789
|
}, React.createElement('path', {
|
|
849
|
-
d: '
|
|
850
|
-
stroke:
|
|
790
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
791
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
851
792
|
}))),
|
|
852
793
|
// App icon (if provided)
|
|
853
794
|
that.config.appIcon ? React.createElement('div', {
|
|
@@ -855,27 +796,40 @@ class PhantomWalletProvider {
|
|
|
855
796
|
}, React.createElement('img', {
|
|
856
797
|
src: that.config.appIcon,
|
|
857
798
|
alt: that.config.appName || 'App',
|
|
858
|
-
style: { width: '
|
|
799
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
859
800
|
})) : null,
|
|
860
801
|
// Title
|
|
861
802
|
React.createElement('div', {
|
|
862
803
|
style: {
|
|
863
804
|
color: textColor,
|
|
864
805
|
fontFamily,
|
|
865
|
-
fontSize: '
|
|
806
|
+
fontSize: '17px',
|
|
866
807
|
fontWeight: '600',
|
|
867
808
|
textAlign: 'center',
|
|
809
|
+
marginBottom: '6px',
|
|
810
|
+
letterSpacing: '-0.2px',
|
|
811
|
+
},
|
|
812
|
+
}, (_f = (_e = (_d = that.loginOverrides) === null || _d === void 0 ? void 0 : _d.modalTitle) !== null && _e !== void 0 ? _e : that.config.modalTitle) !== null && _f !== void 0 ? _f : (that.config.appName ? `Log in to ${that.config.appName}` : 'Log in to your account')),
|
|
813
|
+
// Subtitle
|
|
814
|
+
React.createElement('div', {
|
|
815
|
+
style: {
|
|
816
|
+
color: subTextColor,
|
|
817
|
+
fontFamily,
|
|
818
|
+
fontSize: '13px',
|
|
819
|
+
fontWeight: '400',
|
|
820
|
+
textAlign: 'center',
|
|
868
821
|
marginBottom: '24px',
|
|
822
|
+
lineHeight: '1.4',
|
|
869
823
|
},
|
|
870
|
-
}, '
|
|
871
|
-
//
|
|
824
|
+
}, (_j = (_h = (_g = that.loginOverrides) === null || _g === void 0 ? void 0 : _g.modalSubtitle) !== null && _h !== void 0 ? _h : that.config.modalSubtitle) !== null && _j !== void 0 ? _j : 'Choose how you\'d like to continue'),
|
|
825
|
+
// Main buttons + OR divider + email button
|
|
872
826
|
React.createElement('div', {
|
|
873
827
|
style: {
|
|
874
828
|
display: 'flex',
|
|
875
829
|
flexDirection: 'column',
|
|
876
830
|
gap: '8px',
|
|
877
831
|
},
|
|
878
|
-
}, ...
|
|
832
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
879
833
|
};
|
|
880
834
|
// Wrapper component with PhantomProvider
|
|
881
835
|
const PhantomProviderWrapper = () => {
|
|
@@ -908,13 +862,6 @@ class PhantomWalletProvider {
|
|
|
908
862
|
if (this.initPromise) {
|
|
909
863
|
await this.initPromise;
|
|
910
864
|
}
|
|
911
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
912
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
913
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
914
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
915
|
-
if (!this.containerElement) {
|
|
916
|
-
this.initialize();
|
|
917
|
-
}
|
|
918
865
|
// Wait for SDK to be ready
|
|
919
866
|
await new Promise((resolve) => {
|
|
920
867
|
const check = () => {
|
|
@@ -1008,7 +955,7 @@ class PhantomWalletProvider {
|
|
|
1008
955
|
this.pendingLogin.reject = reject;
|
|
1009
956
|
});
|
|
1010
957
|
}
|
|
1011
|
-
|
|
958
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
1012
959
|
this.pendingLogin = { resolve, reject };
|
|
1013
960
|
this.loginInProgress = true;
|
|
1014
961
|
// Always use our custom wallet modal
|
|
@@ -1022,55 +969,17 @@ class PhantomWalletProvider {
|
|
|
1022
969
|
}
|
|
1023
970
|
}, 180000);
|
|
1024
971
|
});
|
|
972
|
+
return loginPromise.finally(() => {
|
|
973
|
+
this.loginOverrides = null;
|
|
974
|
+
});
|
|
1025
975
|
}
|
|
1026
976
|
async restoreSession() {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
1032
|
-
// resulting "access other apps and services" system dialog renders
|
|
1033
|
-
// with grayed-out buttons.
|
|
1034
|
-
//
|
|
1035
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
1036
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
1037
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
1038
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
1039
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
1040
|
-
// storage is recoverable on next load.
|
|
1041
|
-
let session;
|
|
1042
|
-
try {
|
|
1043
|
-
session = await WebSessionManager.getSession();
|
|
1044
|
-
}
|
|
1045
|
-
catch (_a) {
|
|
1046
|
-
session = null;
|
|
1047
|
-
}
|
|
1048
|
-
if (!session) {
|
|
1049
|
-
// Tidy up storage so we don't leave junk behind:
|
|
1050
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
1051
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
1052
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
1053
|
-
// safe to call unconditionally here.
|
|
1054
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
1055
|
-
// WebSessionManager.clearSession() only removes the session
|
|
1056
|
-
// storage key, not the marker — so without this cleanup
|
|
1057
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
1058
|
-
// future cold start.
|
|
1059
|
-
try {
|
|
1060
|
-
WebSessionManager.clearSession();
|
|
1061
|
-
}
|
|
1062
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
1063
|
-
try {
|
|
1064
|
-
if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
1065
|
-
getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
catch (_c) {
|
|
1069
|
-
// storage unavailable — best-effort cleanup
|
|
1070
|
-
}
|
|
1071
|
-
return null;
|
|
977
|
+
await this.ensureReady();
|
|
978
|
+
const session = await WebSessionManager.getSession();
|
|
979
|
+
if (session) {
|
|
980
|
+
return { provider: this, address: session.address };
|
|
1072
981
|
}
|
|
1073
|
-
return
|
|
982
|
+
return null;
|
|
1074
983
|
}
|
|
1075
984
|
async address() {
|
|
1076
985
|
var _a, _b, _c, _d;
|
|
@@ -1527,4 +1436,4 @@ class PhantomWalletProvider {
|
|
|
1527
1436
|
PhantomWalletProvider.instance = null;
|
|
1528
1437
|
|
|
1529
1438
|
export { PhantomWalletProvider };
|
|
1530
|
-
//# sourceMappingURL=phantom-wallet-provider-
|
|
1439
|
+
//# sourceMappingURL=phantom-wallet-provider-K2V96G-G.esm.js.map
|