@pooflabs/web 0.0.81-rc2 → 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-DHm4usay.js → index-B2WGCssJ.js} +347 -414
- package/dist/index-B2WGCssJ.js.map +1 -0
- package/dist/{index-CHqM9n4K.esm.js → index-CjHbp7Dq.esm.js} +3697 -562
- package/dist/index-CjHbp7Dq.esm.js.map +1 -0
- package/dist/{index-CL4JIAAR.js → index-DXPkkq81.js} +3698 -563
- package/dist/index-DXPkkq81.js.map +1 -0
- package/dist/{index-BjlCinic.js → index-D_DiP8XQ.js} +3698 -563
- package/dist/index-D_DiP8XQ.js.map +1 -0
- package/dist/{index-DCo85UGg.esm.js → index-dcJIjFrs.esm.js} +3697 -562
- package/dist/index-dcJIjFrs.esm.js.map +1 -0
- package/dist/{index-Bx_lLXRT.esm.js → index-nt_HQVrk.esm.js} +345 -414
- package/dist/index-nt_HQVrk.esm.js.map +1 -0
- package/dist/{index.browser-7dDfRU5G.esm.js → index.browser-BNdFfyIg.esm.js} +1571 -1368
- package/dist/index.browser-BNdFfyIg.esm.js.map +1 -0
- package/dist/{index.browser-CmlqbyPr.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-TLhfXfe6.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-DJA9_K3i.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-BegJFoWW.js → phantom-wallet-provider-DWCaMkyz.js} +148 -192
- package/dist/phantom-wallet-provider-DWCaMkyz.js.map +1 -0
- package/dist/{phantom-wallet-provider-DzUAMhbm.esm.js → phantom-wallet-provider-K2V96G-G.esm.js} +148 -192
- package/dist/phantom-wallet-provider-K2V96G-G.esm.js.map +1 -0
- package/dist/{privy-wallet-provider-Du-QHaaG.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-BspbiyOr.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-Bh7SBFpQ.esm.js → solana-mobile-wallet-provider-Cmphb3oB.esm.js} +3 -52
- package/dist/solana-mobile-wallet-provider-Cmphb3oB.esm.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-DPp4SYem.js → solana-mobile-wallet-provider-t22Ie8lY.js} +3 -52
- package/dist/solana-mobile-wallet-provider-t22Ie8lY.js.map +1 -0
- package/package.json +3 -3
- package/dist/index-BjlCinic.js.map +0 -1
- package/dist/index-Bx_lLXRT.esm.js.map +0 -1
- package/dist/index-CHqM9n4K.esm.js.map +0 -1
- package/dist/index-CL4JIAAR.js.map +0 -1
- package/dist/index-DCo85UGg.esm.js.map +0 -1
- package/dist/index-DHm4usay.js.map +0 -1
- package/dist/index.browser-7dDfRU5G.esm.js.map +0 -1
- package/dist/index.browser-Bg_-PAgT.esm.js +0 -1250
- package/dist/index.browser-Bg_-PAgT.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-CmlqbyPr.js.map +0 -1
- package/dist/index.browser-CxXQ2RhF.js +0 -122
- package/dist/index.browser-CxXQ2RhF.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-DuVkpEzB.js +0 -1253
- package/dist/index.browser-DuVkpEzB.js.map +0 -1
- package/dist/index.browser-xJkO73vw.esm.js +0 -119
- package/dist/index.browser-xJkO73vw.esm.js.map +0 -1
- package/dist/index.native-DJA9_K3i.js.map +0 -1
- package/dist/index.native-TLhfXfe6.esm.js.map +0 -1
- package/dist/phantom-wallet-provider-BegJFoWW.js.map +0 -1
- package/dist/phantom-wallet-provider-DzUAMhbm.esm.js.map +0 -1
- package/dist/privy-wallet-provider-BspbiyOr.esm.js.map +0 -1
- package/dist/privy-wallet-provider-Du-QHaaG.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-Bh7SBFpQ.esm.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-DPp4SYem.js.map +0 -1
package/dist/{phantom-wallet-provider-DzUAMhbm.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();
|
|
@@ -532,20 +469,11 @@ class PhantomWalletProvider {
|
|
|
532
469
|
const handleMobileWalletClick = async () => {
|
|
533
470
|
that.loginInProgress = false;
|
|
534
471
|
walletClickedRef.current = true;
|
|
535
|
-
|
|
536
|
-
// closing the modal here triggers a React commit and a focus
|
|
537
|
-
// transition that races MWA's transact() opening a localhost
|
|
538
|
-
// WebSocket. Chrome's "Apps on Device" / Local Network Access
|
|
539
|
-
// permission dialog spawns inheriting the activity's focus
|
|
540
|
-
// state at that moment — and the in-transit focus produces a
|
|
541
|
-
// dialog with grayed-out Allow/Block buttons. Keep the modal
|
|
542
|
-
// mounted through MWA login so focus is stable when the
|
|
543
|
-
// system dialog spawns; close it after login resolves.
|
|
472
|
+
setShowWalletModal(false);
|
|
544
473
|
if (that.onSwitchToMWA) {
|
|
545
474
|
try {
|
|
546
475
|
const mwaProvider = await that.onSwitchToMWA();
|
|
547
476
|
const user = await mwaProvider.login();
|
|
548
|
-
setShowWalletModal(false);
|
|
549
477
|
if (that.pendingLogin && user) {
|
|
550
478
|
that.pendingLogin.resolve(user);
|
|
551
479
|
that.pendingLogin = null;
|
|
@@ -556,16 +484,12 @@ class PhantomWalletProvider {
|
|
|
556
484
|
}
|
|
557
485
|
}
|
|
558
486
|
catch (error) {
|
|
559
|
-
setShowWalletModal(false);
|
|
560
487
|
if (that.pendingLogin) {
|
|
561
488
|
that.pendingLogin.reject(error);
|
|
562
489
|
that.pendingLogin = null;
|
|
563
490
|
}
|
|
564
491
|
}
|
|
565
492
|
}
|
|
566
|
-
else {
|
|
567
|
-
setShowWalletModal(false);
|
|
568
|
-
}
|
|
569
493
|
};
|
|
570
494
|
const handleCloseModal = () => {
|
|
571
495
|
setShowWalletModal(false);
|
|
@@ -579,31 +503,59 @@ class PhantomWalletProvider {
|
|
|
579
503
|
if (!showWalletModal) {
|
|
580
504
|
return null;
|
|
581
505
|
}
|
|
582
|
-
const
|
|
583
|
-
const
|
|
584
|
-
const
|
|
585
|
-
const
|
|
586
|
-
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)';
|
|
587
516
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
588
517
|
const buttonStyle = (id) => ({
|
|
589
518
|
display: 'flex',
|
|
590
519
|
alignItems: 'center',
|
|
591
520
|
justifyContent: 'center',
|
|
592
|
-
gap: '
|
|
521
|
+
gap: '10px',
|
|
593
522
|
width: '100%',
|
|
594
|
-
height: '
|
|
595
|
-
padding: '
|
|
596
|
-
border:
|
|
597
|
-
borderRadius: '
|
|
523
|
+
height: '52px',
|
|
524
|
+
padding: '0 20px',
|
|
525
|
+
border: btnBorder,
|
|
526
|
+
borderRadius: '12px',
|
|
598
527
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
599
528
|
color: textColor,
|
|
600
529
|
fontFamily,
|
|
601
530
|
fontSize: '14px',
|
|
602
|
-
fontWeight: '
|
|
603
|
-
lineHeight: '
|
|
604
|
-
letterSpacing: '
|
|
531
|
+
fontWeight: '500',
|
|
532
|
+
lineHeight: '1',
|
|
533
|
+
letterSpacing: '0',
|
|
605
534
|
cursor: 'pointer',
|
|
606
|
-
transition: 'background-color 0.
|
|
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',
|
|
556
|
+
cursor: 'pointer',
|
|
557
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
558
|
+
boxSizing: 'border-box',
|
|
607
559
|
});
|
|
608
560
|
const walletButtons = [];
|
|
609
561
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -615,7 +567,7 @@ class PhantomWalletProvider {
|
|
|
615
567
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
616
568
|
onMouseLeave: () => setHoveredBtn(null),
|
|
617
569
|
}, React.createElement('svg', {
|
|
618
|
-
width: '
|
|
570
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
619
571
|
style: { flexShrink: '0' },
|
|
620
572
|
}, React.createElement('path', {
|
|
621
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',
|
|
@@ -640,7 +592,7 @@ class PhantomWalletProvider {
|
|
|
640
592
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
641
593
|
onMouseLeave: () => setHoveredBtn(null),
|
|
642
594
|
}, React.createElement('svg', {
|
|
643
|
-
width: '
|
|
595
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
644
596
|
fill: textColor,
|
|
645
597
|
style: { flexShrink: '0' },
|
|
646
598
|
}, React.createElement('path', {
|
|
@@ -692,11 +644,9 @@ class PhantomWalletProvider {
|
|
|
692
644
|
onClick: handleMobileWalletClick,
|
|
693
645
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
694
646
|
onMouseLeave: () => setHoveredBtn(null),
|
|
695
|
-
},
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
699
|
-
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' },
|
|
700
650
|
},
|
|
701
651
|
// Phone outline
|
|
702
652
|
React.createElement('rect', {
|
|
@@ -718,23 +668,51 @@ class PhantomWalletProvider {
|
|
|
718
668
|
if (that.config.enablePrivyFallback) {
|
|
719
669
|
walletButtons.push(React.createElement('button', {
|
|
720
670
|
key: 'email-login',
|
|
721
|
-
style:
|
|
671
|
+
style: emailButtonStyle('email-login'),
|
|
722
672
|
onClick: handleEmailClick,
|
|
723
673
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
724
674
|
onMouseLeave: () => setHoveredBtn(null),
|
|
725
|
-
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
729
|
-
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' },
|
|
730
678
|
}, React.createElement('path', {
|
|
731
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',
|
|
732
|
-
stroke: textColor, strokeWidth: '
|
|
680
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
733
681
|
}), React.createElement('path', {
|
|
734
682
|
d: 'M22 6l-10 7L2 6',
|
|
735
|
-
stroke: textColor, strokeWidth: '
|
|
736
|
-
})), '
|
|
683
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
684
|
+
})), 'Continue with email'));
|
|
737
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;
|
|
738
716
|
// Render custom modal
|
|
739
717
|
return React.createElement('div', {
|
|
740
718
|
// Overlay
|
|
@@ -744,12 +722,14 @@ class PhantomWalletProvider {
|
|
|
744
722
|
left: '0',
|
|
745
723
|
right: '0',
|
|
746
724
|
bottom: '0',
|
|
747
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
725
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
748
726
|
display: 'flex',
|
|
749
727
|
alignItems: 'center',
|
|
750
728
|
justifyContent: 'center',
|
|
751
729
|
zIndex: 2147483647,
|
|
752
730
|
pointerEvents: 'auto',
|
|
731
|
+
backdropFilter: 'blur(4px)',
|
|
732
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
753
733
|
},
|
|
754
734
|
onClick: (e) => {
|
|
755
735
|
if (e.target === e.currentTarget)
|
|
@@ -766,13 +746,17 @@ class PhantomWalletProvider {
|
|
|
766
746
|
React.createElement('div', {
|
|
767
747
|
style: {
|
|
768
748
|
backgroundColor: bgColor,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
749
|
+
border: cardBorder,
|
|
750
|
+
borderRadius: '20px',
|
|
751
|
+
width: '380px',
|
|
752
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
753
|
+
padding: '28px 24px 24px',
|
|
773
754
|
position: 'relative',
|
|
774
|
-
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)',
|
|
775
758
|
pointerEvents: 'auto',
|
|
759
|
+
boxSizing: 'border-box',
|
|
776
760
|
},
|
|
777
761
|
onMouseDown: (e) => {
|
|
778
762
|
e.stopPropagation();
|
|
@@ -781,26 +765,30 @@ class PhantomWalletProvider {
|
|
|
781
765
|
e.stopPropagation();
|
|
782
766
|
},
|
|
783
767
|
},
|
|
784
|
-
// Close button
|
|
768
|
+
// Close button
|
|
785
769
|
React.createElement('button', {
|
|
786
770
|
onClick: handleCloseModal,
|
|
787
771
|
style: {
|
|
788
772
|
position: 'absolute',
|
|
789
|
-
top: '
|
|
790
|
-
right: '
|
|
791
|
-
background: '
|
|
792
|
-
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',
|
|
793
780
|
cursor: 'pointer',
|
|
794
|
-
padding: '4px',
|
|
795
781
|
display: 'flex',
|
|
796
782
|
alignItems: 'center',
|
|
797
783
|
justifyContent: 'center',
|
|
784
|
+
padding: '0',
|
|
785
|
+
flexShrink: '0',
|
|
798
786
|
},
|
|
799
787
|
}, React.createElement('svg', {
|
|
800
|
-
width: '
|
|
788
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
801
789
|
}, React.createElement('path', {
|
|
802
|
-
d: '
|
|
803
|
-
stroke:
|
|
790
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
791
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
804
792
|
}))),
|
|
805
793
|
// App icon (if provided)
|
|
806
794
|
that.config.appIcon ? React.createElement('div', {
|
|
@@ -808,27 +796,40 @@ class PhantomWalletProvider {
|
|
|
808
796
|
}, React.createElement('img', {
|
|
809
797
|
src: that.config.appIcon,
|
|
810
798
|
alt: that.config.appName || 'App',
|
|
811
|
-
style: { width: '
|
|
799
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
812
800
|
})) : null,
|
|
813
801
|
// Title
|
|
814
802
|
React.createElement('div', {
|
|
815
803
|
style: {
|
|
816
804
|
color: textColor,
|
|
817
805
|
fontFamily,
|
|
818
|
-
fontSize: '
|
|
806
|
+
fontSize: '17px',
|
|
819
807
|
fontWeight: '600',
|
|
820
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',
|
|
821
821
|
marginBottom: '24px',
|
|
822
|
+
lineHeight: '1.4',
|
|
822
823
|
},
|
|
823
|
-
}, '
|
|
824
|
-
//
|
|
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
|
|
825
826
|
React.createElement('div', {
|
|
826
827
|
style: {
|
|
827
828
|
display: 'flex',
|
|
828
829
|
flexDirection: 'column',
|
|
829
830
|
gap: '8px',
|
|
830
831
|
},
|
|
831
|
-
}, ...
|
|
832
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
832
833
|
};
|
|
833
834
|
// Wrapper component with PhantomProvider
|
|
834
835
|
const PhantomProviderWrapper = () => {
|
|
@@ -861,13 +862,6 @@ class PhantomWalletProvider {
|
|
|
861
862
|
if (this.initPromise) {
|
|
862
863
|
await this.initPromise;
|
|
863
864
|
}
|
|
864
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
865
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
866
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
867
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
868
|
-
if (!this.containerElement) {
|
|
869
|
-
this.initialize();
|
|
870
|
-
}
|
|
871
865
|
// Wait for SDK to be ready
|
|
872
866
|
await new Promise((resolve) => {
|
|
873
867
|
const check = () => {
|
|
@@ -961,7 +955,7 @@ class PhantomWalletProvider {
|
|
|
961
955
|
this.pendingLogin.reject = reject;
|
|
962
956
|
});
|
|
963
957
|
}
|
|
964
|
-
|
|
958
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
965
959
|
this.pendingLogin = { resolve, reject };
|
|
966
960
|
this.loginInProgress = true;
|
|
967
961
|
// Always use our custom wallet modal
|
|
@@ -975,55 +969,17 @@ class PhantomWalletProvider {
|
|
|
975
969
|
}
|
|
976
970
|
}, 180000);
|
|
977
971
|
});
|
|
972
|
+
return loginPromise.finally(() => {
|
|
973
|
+
this.loginOverrides = null;
|
|
974
|
+
});
|
|
978
975
|
}
|
|
979
976
|
async restoreSession() {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
985
|
-
// resulting "access other apps and services" system dialog renders
|
|
986
|
-
// with grayed-out buttons.
|
|
987
|
-
//
|
|
988
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
989
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
990
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
991
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
992
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
993
|
-
// storage is recoverable on next load.
|
|
994
|
-
let session;
|
|
995
|
-
try {
|
|
996
|
-
session = await WebSessionManager.getSession();
|
|
997
|
-
}
|
|
998
|
-
catch (_a) {
|
|
999
|
-
session = null;
|
|
1000
|
-
}
|
|
1001
|
-
if (!session) {
|
|
1002
|
-
// Tidy up storage so we don't leave junk behind:
|
|
1003
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
1004
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
1005
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
1006
|
-
// safe to call unconditionally here.
|
|
1007
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
1008
|
-
// WebSessionManager.clearSession() only removes the session
|
|
1009
|
-
// storage key, not the marker — so without this cleanup
|
|
1010
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
1011
|
-
// future cold start.
|
|
1012
|
-
try {
|
|
1013
|
-
WebSessionManager.clearSession();
|
|
1014
|
-
}
|
|
1015
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
1016
|
-
try {
|
|
1017
|
-
if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
1018
|
-
getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
catch (_c) {
|
|
1022
|
-
// storage unavailable — best-effort cleanup
|
|
1023
|
-
}
|
|
1024
|
-
return null;
|
|
977
|
+
await this.ensureReady();
|
|
978
|
+
const session = await WebSessionManager.getSession();
|
|
979
|
+
if (session) {
|
|
980
|
+
return { provider: this, address: session.address };
|
|
1025
981
|
}
|
|
1026
|
-
return
|
|
982
|
+
return null;
|
|
1027
983
|
}
|
|
1028
984
|
async address() {
|
|
1029
985
|
var _a, _b, _c, _d;
|
|
@@ -1480,4 +1436,4 @@ class PhantomWalletProvider {
|
|
|
1480
1436
|
PhantomWalletProvider.instance = null;
|
|
1481
1437
|
|
|
1482
1438
|
export { PhantomWalletProvider };
|
|
1483
|
-
//# sourceMappingURL=phantom-wallet-provider-
|
|
1439
|
+
//# sourceMappingURL=phantom-wallet-provider-K2V96G-G.esm.js.map
|