@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/index.native.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Y as DEFAULT_TEST_ADDRESS, $ as InsufficientBalanceError, X as MockAuthProvider, Z as OffchainAuthProvider, _ as PrivyExpoProvider, a0 as ReactNativeSessionManager, a1 as ServerSessionManager, W as WebSessionManager, P as aggregate, b as buildSetDocumentsTransaction, a2 as clearCache, a3 as closeAllSubscriptions, c as convertRemainingAccounts, O as count, f as createSessionWithPrivy, o as createSessionWithSignature, T as deserializeTransaction, m as genAuthNonce, n as genSolanaMessage, C as get, x as getAuthLoading, B as getAuthProvider, a4 as getCachedData, A as getConfig, u as getCurrentUser, G as getFiles, U as getIdToken, a5 as getMany, g as getPlatform, t as init, y as login, z as logout, w as onAuthLoadingChanged, v as onAuthStateChanged, a6 as reconnectWithNewAuth, a7 as refreshSession, J as runExpression, K as runExpressionMany, H as runQuery, I as runQueryMany, D as set, F as setFile, E as setMany, V as setPlatform, N as signAndSubmitTransaction, L as signMessage, a8 as signSessionCreateMessage, M as signTransaction, Q as subscribe, R as useAuth } from './index.native-BqYr--vb.esm.js';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import '@solana/web3.js';
|
|
4
4
|
import '@coral-xyz/anchor';
|
package/dist/index.native.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Bdcc5821.js');
|
|
4
|
-
var index_native = require('./index.native-
|
|
4
|
+
var index_native = require('./index.native-CyA-RdvW.js');
|
|
5
5
|
var web3_js = require('@solana/web3.js');
|
|
6
6
|
var anchor = require('@coral-xyz/anchor');
|
|
7
7
|
require('axios');
|
|
@@ -73,7 +73,7 @@ async function loadDependencies() {
|
|
|
73
73
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
74
74
|
import('react'),
|
|
75
75
|
import('react-dom/client'),
|
|
76
|
-
Promise.resolve().then(function () { return require('./index-
|
|
76
|
+
Promise.resolve().then(function () { return require('./index-D_DiP8XQ.js'); })
|
|
77
77
|
]);
|
|
78
78
|
// Extract default export from ESM module namespace
|
|
79
79
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -85,6 +85,10 @@ async function loadDependencies() {
|
|
|
85
85
|
return loadingPromise;
|
|
86
86
|
}
|
|
87
87
|
class PhantomWalletProvider {
|
|
88
|
+
/** Temporarily override modal appearance for a single login() call. Cleared automatically after login settles. */
|
|
89
|
+
setLoginOverrides(opts) {
|
|
90
|
+
this.loginOverrides = opts;
|
|
91
|
+
}
|
|
88
92
|
constructor(networkUrl = null, config = {}) {
|
|
89
93
|
this.containerElement = null;
|
|
90
94
|
this.root = null;
|
|
@@ -94,6 +98,7 @@ class PhantomWalletProvider {
|
|
|
94
98
|
this.loginInProgress = false;
|
|
95
99
|
this.autoLoginInProgress = false;
|
|
96
100
|
this.initPromise = null;
|
|
101
|
+
this.loginOverrides = null;
|
|
97
102
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
98
103
|
this.onSwitchToPrivy = null;
|
|
99
104
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
@@ -116,13 +121,8 @@ class PhantomWalletProvider {
|
|
|
116
121
|
async initializeAsync() {
|
|
117
122
|
// Lazy load dependencies only when actually instantiating
|
|
118
123
|
await loadDependencies();
|
|
119
|
-
// Initialize React component
|
|
120
|
-
|
|
121
|
-
// or non-Android). Otherwise defer until ensureReady() is reached from
|
|
122
|
-
// a user-gesture flow. See shouldMountEagerly() for the rationale.
|
|
123
|
-
if (this.shouldMountEagerly()) {
|
|
124
|
-
this.initialize();
|
|
125
|
-
}
|
|
124
|
+
// Initialize React component
|
|
125
|
+
this.initialize();
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Check if social login providers are configured (non-injected providers).
|
|
@@ -130,69 +130,6 @@ class PhantomWalletProvider {
|
|
|
130
130
|
hasSocialProviders() {
|
|
131
131
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
132
132
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
|
|
135
|
-
* eagerly during init() or defer until the first user-triggered call
|
|
136
|
-
* (login / sign / etc.) reaches ensureReady().
|
|
137
|
-
*
|
|
138
|
-
* Mounting the React tree synchronously constructs BrowserSDK, which runs
|
|
139
|
-
* wallet-standard discovery in its constructor and fires sdk.autoConnect()
|
|
140
|
-
* in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
|
|
141
|
-
* pathways probe the Android intent surface to discover the Phantom mobile
|
|
142
|
-
* app, which surfaces Chrome's system "wants to access other apps and
|
|
143
|
-
* services" permission dialog *before* the PWA activity has window focus.
|
|
144
|
-
* The dialog renders with grayed-out buttons until the user backgrounds
|
|
145
|
-
* and resumes the app.
|
|
146
|
-
*
|
|
147
|
-
* Returns true when eager mount is needed (callback to handle, prior
|
|
148
|
-
* session, in-page wallet present, or non-Android). Otherwise returns
|
|
149
|
-
* false — the React tree is mounted lazily inside ensureReady() once a
|
|
150
|
-
* user gesture brings us there.
|
|
151
|
-
*/
|
|
152
|
-
shouldMountEagerly() {
|
|
153
|
-
if (typeof window === 'undefined')
|
|
154
|
-
return false;
|
|
155
|
-
// Preserve desktop behavior: always mount eagerly.
|
|
156
|
-
if (!index_native.detectAndroid())
|
|
157
|
-
return true;
|
|
158
|
-
// In-page wallet present (Phantom in-app browser / desktop extension on
|
|
159
|
-
// a desktop-mode Android UA): no Android intent probe needed, mount free.
|
|
160
|
-
// Tighten beyond truthy `window.phantom` since arbitrary stubs can land
|
|
161
|
-
// on that key — require a wallet-shaped surface.
|
|
162
|
-
const ph = window.phantom;
|
|
163
|
-
if (ph && (ph.solana || ph.ethereum || ph.app))
|
|
164
|
-
return true;
|
|
165
|
-
// Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
|
|
166
|
-
// be live to read these URL params via urlParamsAccessor.
|
|
167
|
-
const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
|
|
168
|
-
try {
|
|
169
|
-
const params = new URLSearchParams(window.location.search);
|
|
170
|
-
if (callbackKeys.some(k => params.has(k)))
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
catch (_a) {
|
|
174
|
-
return true; // conservative on URL access failure
|
|
175
|
-
}
|
|
176
|
-
// Returning user with a stored Phantom session. They've already
|
|
177
|
-
// approved the Android intent permission for this origin on first
|
|
178
|
-
// login, so the dialog is typically pre-granted by Chrome — eager
|
|
179
|
-
// mount lets autoConnect silently restore the wallet handshake.
|
|
180
|
-
// Require BOTH the marker AND a session storage entry so a stale
|
|
181
|
-
// orphaned marker doesn't keep eager-mounting forever. Note
|
|
182
|
-
// isAuthenticated() is a raw key-existence check, not a validity
|
|
183
|
-
// check — restoreSession() above clears the marker on the next load
|
|
184
|
-
// if the session is unusable, so the bug self-corrects after at
|
|
185
|
-
// most one further cold start.
|
|
186
|
-
try {
|
|
187
|
-
const stored = index_native.getPlatform().storage.getItem('tarobase_last_auth_method');
|
|
188
|
-
if (stored === 'phantom' && index_native.WebSessionManager.isAuthenticated())
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
catch (_b) {
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
133
|
static getInstance(networkUrl, config) {
|
|
197
134
|
if (!PhantomWalletProvider.instance) {
|
|
198
135
|
new PhantomWalletProvider(networkUrl, config);
|
|
@@ -268,7 +205,7 @@ class PhantomWalletProvider {
|
|
|
268
205
|
const sdkProviders = this.resolvedProviders.length > 0 ? [...this.resolvedProviders] : ['injected'];
|
|
269
206
|
// Inner component that uses hooks
|
|
270
207
|
const PhantomHooksComponent = () => {
|
|
271
|
-
var _a, _b;
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
272
209
|
const phantom = usePhantom();
|
|
273
210
|
const { connect, error: connectError } = useConnect();
|
|
274
211
|
const { disconnect, isDisconnecting } = useDisconnect();
|
|
@@ -553,20 +490,11 @@ class PhantomWalletProvider {
|
|
|
553
490
|
const handleMobileWalletClick = async () => {
|
|
554
491
|
that.loginInProgress = false;
|
|
555
492
|
walletClickedRef.current = true;
|
|
556
|
-
|
|
557
|
-
// closing the modal here triggers a React commit and a focus
|
|
558
|
-
// transition that races MWA's transact() opening a localhost
|
|
559
|
-
// WebSocket. Chrome's "Apps on Device" / Local Network Access
|
|
560
|
-
// permission dialog spawns inheriting the activity's focus
|
|
561
|
-
// state at that moment — and the in-transit focus produces a
|
|
562
|
-
// dialog with grayed-out Allow/Block buttons. Keep the modal
|
|
563
|
-
// mounted through MWA login so focus is stable when the
|
|
564
|
-
// system dialog spawns; close it after login resolves.
|
|
493
|
+
setShowWalletModal(false);
|
|
565
494
|
if (that.onSwitchToMWA) {
|
|
566
495
|
try {
|
|
567
496
|
const mwaProvider = await that.onSwitchToMWA();
|
|
568
497
|
const user = await mwaProvider.login();
|
|
569
|
-
setShowWalletModal(false);
|
|
570
498
|
if (that.pendingLogin && user) {
|
|
571
499
|
that.pendingLogin.resolve(user);
|
|
572
500
|
that.pendingLogin = null;
|
|
@@ -577,16 +505,12 @@ class PhantomWalletProvider {
|
|
|
577
505
|
}
|
|
578
506
|
}
|
|
579
507
|
catch (error) {
|
|
580
|
-
setShowWalletModal(false);
|
|
581
508
|
if (that.pendingLogin) {
|
|
582
509
|
that.pendingLogin.reject(error);
|
|
583
510
|
that.pendingLogin = null;
|
|
584
511
|
}
|
|
585
512
|
}
|
|
586
513
|
}
|
|
587
|
-
else {
|
|
588
|
-
setShowWalletModal(false);
|
|
589
|
-
}
|
|
590
514
|
};
|
|
591
515
|
const handleCloseModal = () => {
|
|
592
516
|
setShowWalletModal(false);
|
|
@@ -600,31 +524,59 @@ class PhantomWalletProvider {
|
|
|
600
524
|
if (!showWalletModal) {
|
|
601
525
|
return null;
|
|
602
526
|
}
|
|
603
|
-
const
|
|
604
|
-
const
|
|
605
|
-
const
|
|
606
|
-
const
|
|
607
|
-
const
|
|
527
|
+
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';
|
|
528
|
+
const isLight = effectiveTheme === 'light';
|
|
529
|
+
const bgColor = isLight ? '#FFFFFF' : '#111113';
|
|
530
|
+
const cardBorder = isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.07)';
|
|
531
|
+
const textColor = isLight ? '#0f0f0f' : '#f5f5f5';
|
|
532
|
+
const subTextColor = isLight ? 'rgba(0,0,0,0.45)' : 'rgba(255,255,255,0.4)';
|
|
533
|
+
const btnBg = isLight ? 'rgba(0,0,0,0.04)' : 'rgba(255,255,255,0.05)';
|
|
534
|
+
const btnHoverBg = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.09)';
|
|
535
|
+
const btnBorder = isLight ? '1px solid rgba(0,0,0,0.10)' : '1px solid rgba(255,255,255,0.09)';
|
|
536
|
+
const dividerColor = isLight ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.08)';
|
|
608
537
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
609
538
|
const buttonStyle = (id) => ({
|
|
610
539
|
display: 'flex',
|
|
611
540
|
alignItems: 'center',
|
|
612
541
|
justifyContent: 'center',
|
|
613
|
-
gap: '
|
|
542
|
+
gap: '10px',
|
|
614
543
|
width: '100%',
|
|
615
|
-
height: '
|
|
616
|
-
padding: '
|
|
617
|
-
border:
|
|
618
|
-
borderRadius: '
|
|
544
|
+
height: '52px',
|
|
545
|
+
padding: '0 20px',
|
|
546
|
+
border: btnBorder,
|
|
547
|
+
borderRadius: '12px',
|
|
619
548
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
620
549
|
color: textColor,
|
|
621
550
|
fontFamily,
|
|
622
551
|
fontSize: '14px',
|
|
623
|
-
fontWeight: '
|
|
624
|
-
lineHeight: '
|
|
625
|
-
letterSpacing: '
|
|
552
|
+
fontWeight: '500',
|
|
553
|
+
lineHeight: '1',
|
|
554
|
+
letterSpacing: '0',
|
|
626
555
|
cursor: 'pointer',
|
|
627
|
-
transition: 'background-color 0.
|
|
556
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
557
|
+
boxSizing: 'border-box',
|
|
558
|
+
});
|
|
559
|
+
const emailButtonStyle = (id) => ({
|
|
560
|
+
display: 'flex',
|
|
561
|
+
alignItems: 'center',
|
|
562
|
+
justifyContent: 'center',
|
|
563
|
+
gap: '10px',
|
|
564
|
+
width: '100%',
|
|
565
|
+
height: '52px',
|
|
566
|
+
padding: '0 20px',
|
|
567
|
+
border: isLight ? '1px solid rgba(0,0,0,0.15)' : '1px solid rgba(255,255,255,0.15)',
|
|
568
|
+
borderRadius: '12px',
|
|
569
|
+
backgroundColor: hoveredBtn === id
|
|
570
|
+
? (isLight ? 'rgba(0,0,0,0.06)' : 'rgba(255,255,255,0.12)')
|
|
571
|
+
: (isLight ? 'rgba(0,0,0,0.03)' : 'rgba(255,255,255,0.08)'),
|
|
572
|
+
color: textColor,
|
|
573
|
+
fontFamily,
|
|
574
|
+
fontSize: '14px',
|
|
575
|
+
fontWeight: '500',
|
|
576
|
+
lineHeight: '1',
|
|
577
|
+
cursor: 'pointer',
|
|
578
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
579
|
+
boxSizing: 'border-box',
|
|
628
580
|
});
|
|
629
581
|
const walletButtons = [];
|
|
630
582
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -636,7 +588,7 @@ class PhantomWalletProvider {
|
|
|
636
588
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
637
589
|
onMouseLeave: () => setHoveredBtn(null),
|
|
638
590
|
}, React.createElement('svg', {
|
|
639
|
-
width: '
|
|
591
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
640
592
|
style: { flexShrink: '0' },
|
|
641
593
|
}, React.createElement('path', {
|
|
642
594
|
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',
|
|
@@ -661,7 +613,7 @@ class PhantomWalletProvider {
|
|
|
661
613
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
662
614
|
onMouseLeave: () => setHoveredBtn(null),
|
|
663
615
|
}, React.createElement('svg', {
|
|
664
|
-
width: '
|
|
616
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
665
617
|
fill: textColor,
|
|
666
618
|
style: { flexShrink: '0' },
|
|
667
619
|
}, React.createElement('path', {
|
|
@@ -713,11 +665,9 @@ class PhantomWalletProvider {
|
|
|
713
665
|
onClick: handleMobileWalletClick,
|
|
714
666
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
715
667
|
onMouseLeave: () => setHoveredBtn(null),
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
720
|
-
style: { flexShrink: '0' },
|
|
668
|
+
}, React.createElement('svg', {
|
|
669
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
670
|
+
style: { flexShrink: '0', opacity: '0.85' },
|
|
721
671
|
},
|
|
722
672
|
// Phone outline
|
|
723
673
|
React.createElement('rect', {
|
|
@@ -739,23 +689,51 @@ class PhantomWalletProvider {
|
|
|
739
689
|
if (that.config.enablePrivyFallback) {
|
|
740
690
|
walletButtons.push(React.createElement('button', {
|
|
741
691
|
key: 'email-login',
|
|
742
|
-
style:
|
|
692
|
+
style: emailButtonStyle('email-login'),
|
|
743
693
|
onClick: handleEmailClick,
|
|
744
694
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
745
695
|
onMouseLeave: () => setHoveredBtn(null),
|
|
746
|
-
},
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
750
|
-
style: { flexShrink: '0' },
|
|
696
|
+
}, React.createElement('svg', {
|
|
697
|
+
width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none',
|
|
698
|
+
style: { flexShrink: '0', opacity: '0.7' },
|
|
751
699
|
}, React.createElement('path', {
|
|
752
700
|
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',
|
|
753
|
-
stroke: textColor, strokeWidth: '
|
|
701
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
754
702
|
}), React.createElement('path', {
|
|
755
703
|
d: 'M22 6l-10 7L2 6',
|
|
756
|
-
stroke: textColor, strokeWidth: '
|
|
757
|
-
})), '
|
|
704
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
705
|
+
})), 'Continue with email'));
|
|
758
706
|
}
|
|
707
|
+
// Split email button from the rest to insert OR divider
|
|
708
|
+
const emailBtnIndex = walletButtons.findIndex((b) => b && b.key === 'email-login');
|
|
709
|
+
const mainButtons = emailBtnIndex >= 0 ? walletButtons.slice(0, emailBtnIndex) : walletButtons;
|
|
710
|
+
const emailButton = emailBtnIndex >= 0 ? walletButtons[emailBtnIndex] : null;
|
|
711
|
+
// OR divider — shown when there are both wallet/social buttons and an email button
|
|
712
|
+
const orDivider = (mainButtons.length > 0 && emailButton)
|
|
713
|
+
? React.createElement('div', {
|
|
714
|
+
key: 'or-divider',
|
|
715
|
+
style: {
|
|
716
|
+
display: 'flex',
|
|
717
|
+
alignItems: 'center',
|
|
718
|
+
gap: '12px',
|
|
719
|
+
margin: '4px 0',
|
|
720
|
+
},
|
|
721
|
+
}, React.createElement('div', {
|
|
722
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
723
|
+
}), React.createElement('span', {
|
|
724
|
+
style: {
|
|
725
|
+
color: subTextColor,
|
|
726
|
+
fontFamily,
|
|
727
|
+
fontSize: '12px',
|
|
728
|
+
fontWeight: '500',
|
|
729
|
+
letterSpacing: '0.02em',
|
|
730
|
+
textTransform: 'uppercase',
|
|
731
|
+
userSelect: 'none',
|
|
732
|
+
},
|
|
733
|
+
}, 'or'), React.createElement('div', {
|
|
734
|
+
style: { flex: '1', height: '1px', backgroundColor: dividerColor },
|
|
735
|
+
}))
|
|
736
|
+
: null;
|
|
759
737
|
// Render custom modal
|
|
760
738
|
return React.createElement('div', {
|
|
761
739
|
// Overlay
|
|
@@ -765,12 +743,14 @@ class PhantomWalletProvider {
|
|
|
765
743
|
left: '0',
|
|
766
744
|
right: '0',
|
|
767
745
|
bottom: '0',
|
|
768
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
746
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
769
747
|
display: 'flex',
|
|
770
748
|
alignItems: 'center',
|
|
771
749
|
justifyContent: 'center',
|
|
772
750
|
zIndex: 2147483647,
|
|
773
751
|
pointerEvents: 'auto',
|
|
752
|
+
backdropFilter: 'blur(4px)',
|
|
753
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
774
754
|
},
|
|
775
755
|
onClick: (e) => {
|
|
776
756
|
if (e.target === e.currentTarget)
|
|
@@ -787,13 +767,17 @@ class PhantomWalletProvider {
|
|
|
787
767
|
React.createElement('div', {
|
|
788
768
|
style: {
|
|
789
769
|
backgroundColor: bgColor,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
770
|
+
border: cardBorder,
|
|
771
|
+
borderRadius: '20px',
|
|
772
|
+
width: '380px',
|
|
773
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
774
|
+
padding: '28px 24px 24px',
|
|
794
775
|
position: 'relative',
|
|
795
|
-
boxShadow:
|
|
776
|
+
boxShadow: isLight
|
|
777
|
+
? '0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)'
|
|
778
|
+
: '0 8px 40px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3)',
|
|
796
779
|
pointerEvents: 'auto',
|
|
780
|
+
boxSizing: 'border-box',
|
|
797
781
|
},
|
|
798
782
|
onMouseDown: (e) => {
|
|
799
783
|
e.stopPropagation();
|
|
@@ -802,26 +786,30 @@ class PhantomWalletProvider {
|
|
|
802
786
|
e.stopPropagation();
|
|
803
787
|
},
|
|
804
788
|
},
|
|
805
|
-
// Close button
|
|
789
|
+
// Close button
|
|
806
790
|
React.createElement('button', {
|
|
807
791
|
onClick: handleCloseModal,
|
|
808
792
|
style: {
|
|
809
793
|
position: 'absolute',
|
|
810
|
-
top: '
|
|
811
|
-
right: '
|
|
812
|
-
background: '
|
|
813
|
-
border: '
|
|
794
|
+
top: '14px',
|
|
795
|
+
right: '14px',
|
|
796
|
+
background: isLight ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.07)',
|
|
797
|
+
border: isLight ? '1px solid rgba(0,0,0,0.08)' : '1px solid rgba(255,255,255,0.08)',
|
|
798
|
+
borderRadius: '50%',
|
|
799
|
+
width: '28px',
|
|
800
|
+
height: '28px',
|
|
814
801
|
cursor: 'pointer',
|
|
815
|
-
padding: '4px',
|
|
816
802
|
display: 'flex',
|
|
817
803
|
alignItems: 'center',
|
|
818
804
|
justifyContent: 'center',
|
|
805
|
+
padding: '0',
|
|
806
|
+
flexShrink: '0',
|
|
819
807
|
},
|
|
820
808
|
}, React.createElement('svg', {
|
|
821
|
-
width: '
|
|
809
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
822
810
|
}, React.createElement('path', {
|
|
823
|
-
d: '
|
|
824
|
-
stroke:
|
|
811
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
812
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
825
813
|
}))),
|
|
826
814
|
// App icon (if provided)
|
|
827
815
|
that.config.appIcon ? React.createElement('div', {
|
|
@@ -829,27 +817,40 @@ class PhantomWalletProvider {
|
|
|
829
817
|
}, React.createElement('img', {
|
|
830
818
|
src: that.config.appIcon,
|
|
831
819
|
alt: that.config.appName || 'App',
|
|
832
|
-
style: { width: '
|
|
820
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
833
821
|
})) : null,
|
|
834
822
|
// Title
|
|
835
823
|
React.createElement('div', {
|
|
836
824
|
style: {
|
|
837
825
|
color: textColor,
|
|
838
826
|
fontFamily,
|
|
839
|
-
fontSize: '
|
|
827
|
+
fontSize: '17px',
|
|
840
828
|
fontWeight: '600',
|
|
841
829
|
textAlign: 'center',
|
|
830
|
+
marginBottom: '6px',
|
|
831
|
+
letterSpacing: '-0.2px',
|
|
832
|
+
},
|
|
833
|
+
}, (_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')),
|
|
834
|
+
// Subtitle
|
|
835
|
+
React.createElement('div', {
|
|
836
|
+
style: {
|
|
837
|
+
color: subTextColor,
|
|
838
|
+
fontFamily,
|
|
839
|
+
fontSize: '13px',
|
|
840
|
+
fontWeight: '400',
|
|
841
|
+
textAlign: 'center',
|
|
842
842
|
marginBottom: '24px',
|
|
843
|
+
lineHeight: '1.4',
|
|
843
844
|
},
|
|
844
|
-
}, '
|
|
845
|
-
//
|
|
845
|
+
}, (_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'),
|
|
846
|
+
// Main buttons + OR divider + email button
|
|
846
847
|
React.createElement('div', {
|
|
847
848
|
style: {
|
|
848
849
|
display: 'flex',
|
|
849
850
|
flexDirection: 'column',
|
|
850
851
|
gap: '8px',
|
|
851
852
|
},
|
|
852
|
-
}, ...
|
|
853
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
853
854
|
};
|
|
854
855
|
// Wrapper component with PhantomProvider
|
|
855
856
|
const PhantomProviderWrapper = () => {
|
|
@@ -882,13 +883,6 @@ class PhantomWalletProvider {
|
|
|
882
883
|
if (this.initPromise) {
|
|
883
884
|
await this.initPromise;
|
|
884
885
|
}
|
|
885
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
886
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
887
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
888
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
889
|
-
if (!this.containerElement) {
|
|
890
|
-
this.initialize();
|
|
891
|
-
}
|
|
892
886
|
// Wait for SDK to be ready
|
|
893
887
|
await new Promise((resolve) => {
|
|
894
888
|
const check = () => {
|
|
@@ -982,7 +976,7 @@ class PhantomWalletProvider {
|
|
|
982
976
|
this.pendingLogin.reject = reject;
|
|
983
977
|
});
|
|
984
978
|
}
|
|
985
|
-
|
|
979
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
986
980
|
this.pendingLogin = { resolve, reject };
|
|
987
981
|
this.loginInProgress = true;
|
|
988
982
|
// Always use our custom wallet modal
|
|
@@ -996,55 +990,17 @@ class PhantomWalletProvider {
|
|
|
996
990
|
}
|
|
997
991
|
}, 180000);
|
|
998
992
|
});
|
|
993
|
+
return loginPromise.finally(() => {
|
|
994
|
+
this.loginOverrides = null;
|
|
995
|
+
});
|
|
999
996
|
}
|
|
1000
997
|
async restoreSession() {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
1006
|
-
// resulting "access other apps and services" system dialog renders
|
|
1007
|
-
// with grayed-out buttons.
|
|
1008
|
-
//
|
|
1009
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
1010
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
1011
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
1012
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
1013
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
1014
|
-
// storage is recoverable on next load.
|
|
1015
|
-
let session;
|
|
1016
|
-
try {
|
|
1017
|
-
session = await index_native.WebSessionManager.getSession();
|
|
1018
|
-
}
|
|
1019
|
-
catch (_a) {
|
|
1020
|
-
session = null;
|
|
1021
|
-
}
|
|
1022
|
-
if (!session) {
|
|
1023
|
-
// Tidy up storage so we don't leave junk behind:
|
|
1024
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
1025
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
1026
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
1027
|
-
// safe to call unconditionally here.
|
|
1028
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
1029
|
-
// WebSessionManager.clearSession() only removes the session
|
|
1030
|
-
// storage key, not the marker — so without this cleanup
|
|
1031
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
1032
|
-
// future cold start.
|
|
1033
|
-
try {
|
|
1034
|
-
index_native.WebSessionManager.clearSession();
|
|
1035
|
-
}
|
|
1036
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
1037
|
-
try {
|
|
1038
|
-
if (index_native.getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
1039
|
-
index_native.getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
catch (_c) {
|
|
1043
|
-
// storage unavailable — best-effort cleanup
|
|
1044
|
-
}
|
|
1045
|
-
return null;
|
|
998
|
+
await this.ensureReady();
|
|
999
|
+
const session = await index_native.WebSessionManager.getSession();
|
|
1000
|
+
if (session) {
|
|
1001
|
+
return { provider: this, address: session.address };
|
|
1046
1002
|
}
|
|
1047
|
-
return
|
|
1003
|
+
return null;
|
|
1048
1004
|
}
|
|
1049
1005
|
async address() {
|
|
1050
1006
|
var _a, _b, _c, _d;
|
|
@@ -1501,4 +1457,4 @@ class PhantomWalletProvider {
|
|
|
1501
1457
|
PhantomWalletProvider.instance = null;
|
|
1502
1458
|
|
|
1503
1459
|
exports.PhantomWalletProvider = PhantomWalletProvider;
|
|
1504
|
-
//# sourceMappingURL=phantom-wallet-provider-
|
|
1460
|
+
//# sourceMappingURL=phantom-wallet-provider-DWCaMkyz.js.map
|