@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/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();
|
|
@@ -551,63 +488,13 @@ class PhantomWalletProvider {
|
|
|
551
488
|
}
|
|
552
489
|
};
|
|
553
490
|
const handleMobileWalletClick = async () => {
|
|
554
|
-
var _a;
|
|
555
|
-
console.log('[MWA-DEBUG] handleMobileWalletClick: entered', {
|
|
556
|
-
documentHasFocus: typeof document !== 'undefined' ? document.hasFocus() : 'n/a',
|
|
557
|
-
visibilityState: typeof document !== 'undefined' ? document.visibilityState : 'n/a',
|
|
558
|
-
displayMode: typeof window !== 'undefined' && window.matchMedia
|
|
559
|
-
? (window.matchMedia('(display-mode: standalone)').matches ? 'standalone' : 'browser')
|
|
560
|
-
: 'n/a',
|
|
561
|
-
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : 'n/a',
|
|
562
|
-
timestamp: Date.now(),
|
|
563
|
-
});
|
|
564
491
|
that.loginInProgress = false;
|
|
565
492
|
walletClickedRef.current = true;
|
|
566
493
|
setShowWalletModal(false);
|
|
567
|
-
// Hide the Phantom provider container while MWA's transact()
|
|
568
|
-
// is opening the localhost WebSocket and Chrome surfaces the
|
|
569
|
-
// "Apps on Device" / Local Network Access permission dialog.
|
|
570
|
-
//
|
|
571
|
-
// The container is a singleton fixed full-viewport <div> with
|
|
572
|
-
// z-index 2147483647 + pointer-events: none parked on body.
|
|
573
|
-
// Even though pointer-events: none should let touches pass
|
|
574
|
-
// through, on Android Chrome (both PWA and regular browser)
|
|
575
|
-
// the system permission dialog rendered during MWA's
|
|
576
|
-
// handshake comes up with disabled-looking buttons until the
|
|
577
|
-
// activity is forced to re-composite (the user's
|
|
578
|
-
// background+reopen workaround).
|
|
579
|
-
//
|
|
580
|
-
// Display:none-ing the container during MWA login removes it
|
|
581
|
-
// from the layout tree entirely so there's nothing for the
|
|
582
|
-
// dialog hit-testing / compositor to get confused by. It's
|
|
583
|
-
// restored after MWA login resolves or rejects.
|
|
584
|
-
const containerEl = that.containerElement;
|
|
585
|
-
const previousDisplay = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.display) !== null && _a !== void 0 ? _a : '';
|
|
586
|
-
console.log('[MWA-DEBUG] container before hide', {
|
|
587
|
-
hasContainer: !!containerEl,
|
|
588
|
-
previousDisplay,
|
|
589
|
-
inDom: containerEl ? document.body.contains(containerEl) : false,
|
|
590
|
-
zIndex: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.zIndex,
|
|
591
|
-
pointerEvents: containerEl === null || containerEl === void 0 ? void 0 : containerEl.style.pointerEvents,
|
|
592
|
-
});
|
|
593
|
-
if (containerEl) {
|
|
594
|
-
containerEl.style.display = 'none';
|
|
595
|
-
}
|
|
596
|
-
console.log('[MWA-DEBUG] container hidden, computed display now:', containerEl ? getComputedStyle(containerEl).display : 'n/a');
|
|
597
|
-
const restoreContainer = () => {
|
|
598
|
-
if (containerEl) {
|
|
599
|
-
containerEl.style.display = previousDisplay;
|
|
600
|
-
console.log('[MWA-DEBUG] container restored, display:', containerEl.style.display);
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
494
|
if (that.onSwitchToMWA) {
|
|
604
495
|
try {
|
|
605
|
-
console.log('[MWA-DEBUG] calling onSwitchToMWA');
|
|
606
496
|
const mwaProvider = await that.onSwitchToMWA();
|
|
607
|
-
console.log('[MWA-DEBUG] onSwitchToMWA resolved, calling mwaProvider.login()');
|
|
608
497
|
const user = await mwaProvider.login();
|
|
609
|
-
console.log('[MWA-DEBUG] mwaProvider.login() resolved', { hasUser: !!user });
|
|
610
|
-
restoreContainer();
|
|
611
498
|
if (that.pendingLogin && user) {
|
|
612
499
|
that.pendingLogin.resolve(user);
|
|
613
500
|
that.pendingLogin = null;
|
|
@@ -618,22 +505,12 @@ class PhantomWalletProvider {
|
|
|
618
505
|
}
|
|
619
506
|
}
|
|
620
507
|
catch (error) {
|
|
621
|
-
console.log('[MWA-DEBUG] mwaProvider.login() threw', {
|
|
622
|
-
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
623
|
-
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
624
|
-
errorCode: error === null || error === void 0 ? void 0 : error.code,
|
|
625
|
-
});
|
|
626
|
-
restoreContainer();
|
|
627
508
|
if (that.pendingLogin) {
|
|
628
509
|
that.pendingLogin.reject(error);
|
|
629
510
|
that.pendingLogin = null;
|
|
630
511
|
}
|
|
631
512
|
}
|
|
632
513
|
}
|
|
633
|
-
else {
|
|
634
|
-
console.log('[MWA-DEBUG] no onSwitchToMWA configured');
|
|
635
|
-
restoreContainer();
|
|
636
|
-
}
|
|
637
514
|
};
|
|
638
515
|
const handleCloseModal = () => {
|
|
639
516
|
setShowWalletModal(false);
|
|
@@ -647,31 +524,59 @@ class PhantomWalletProvider {
|
|
|
647
524
|
if (!showWalletModal) {
|
|
648
525
|
return null;
|
|
649
526
|
}
|
|
650
|
-
const
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
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)';
|
|
655
537
|
const fontFamily = '"SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif';
|
|
656
538
|
const buttonStyle = (id) => ({
|
|
657
539
|
display: 'flex',
|
|
658
540
|
alignItems: 'center',
|
|
659
541
|
justifyContent: 'center',
|
|
660
|
-
gap: '
|
|
542
|
+
gap: '10px',
|
|
661
543
|
width: '100%',
|
|
662
|
-
height: '
|
|
663
|
-
padding: '
|
|
664
|
-
border:
|
|
665
|
-
borderRadius: '
|
|
544
|
+
height: '52px',
|
|
545
|
+
padding: '0 20px',
|
|
546
|
+
border: btnBorder,
|
|
547
|
+
borderRadius: '12px',
|
|
666
548
|
backgroundColor: hoveredBtn === id ? btnHoverBg : btnBg,
|
|
667
549
|
color: textColor,
|
|
668
550
|
fontFamily,
|
|
669
551
|
fontSize: '14px',
|
|
670
|
-
fontWeight: '
|
|
671
|
-
lineHeight: '
|
|
672
|
-
letterSpacing: '
|
|
552
|
+
fontWeight: '500',
|
|
553
|
+
lineHeight: '1',
|
|
554
|
+
letterSpacing: '0',
|
|
555
|
+
cursor: 'pointer',
|
|
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',
|
|
673
577
|
cursor: 'pointer',
|
|
674
|
-
transition: 'background-color 0.
|
|
578
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
579
|
+
boxSizing: 'border-box',
|
|
675
580
|
});
|
|
676
581
|
const walletButtons = [];
|
|
677
582
|
// Google OAuth button — shown when 'google' is in resolved providers
|
|
@@ -683,7 +588,7 @@ class PhantomWalletProvider {
|
|
|
683
588
|
onMouseEnter: () => setHoveredBtn('google-oauth'),
|
|
684
589
|
onMouseLeave: () => setHoveredBtn(null),
|
|
685
590
|
}, React.createElement('svg', {
|
|
686
|
-
width: '
|
|
591
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
687
592
|
style: { flexShrink: '0' },
|
|
688
593
|
}, React.createElement('path', {
|
|
689
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',
|
|
@@ -708,7 +613,7 @@ class PhantomWalletProvider {
|
|
|
708
613
|
onMouseEnter: () => setHoveredBtn('apple-oauth'),
|
|
709
614
|
onMouseLeave: () => setHoveredBtn(null),
|
|
710
615
|
}, React.createElement('svg', {
|
|
711
|
-
width: '
|
|
616
|
+
width: '18', height: '18', viewBox: '0 0 24 24',
|
|
712
617
|
fill: textColor,
|
|
713
618
|
style: { flexShrink: '0' },
|
|
714
619
|
}, React.createElement('path', {
|
|
@@ -760,11 +665,9 @@ class PhantomWalletProvider {
|
|
|
760
665
|
onClick: handleMobileWalletClick,
|
|
761
666
|
onMouseEnter: () => setHoveredBtn('mobile-wallet'),
|
|
762
667
|
onMouseLeave: () => setHoveredBtn(null),
|
|
763
|
-
},
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
767
|
-
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' },
|
|
768
671
|
},
|
|
769
672
|
// Phone outline
|
|
770
673
|
React.createElement('rect', {
|
|
@@ -786,23 +689,51 @@ class PhantomWalletProvider {
|
|
|
786
689
|
if (that.config.enablePrivyFallback) {
|
|
787
690
|
walletButtons.push(React.createElement('button', {
|
|
788
691
|
key: 'email-login',
|
|
789
|
-
style:
|
|
692
|
+
style: emailButtonStyle('email-login'),
|
|
790
693
|
onClick: handleEmailClick,
|
|
791
694
|
onMouseEnter: () => setHoveredBtn('email-login'),
|
|
792
695
|
onMouseLeave: () => setHoveredBtn(null),
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
width: '20', height: '20', viewBox: '0 0 24 24', fill: 'none',
|
|
797
|
-
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' },
|
|
798
699
|
}, React.createElement('path', {
|
|
799
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',
|
|
800
|
-
stroke: textColor, strokeWidth: '
|
|
701
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
801
702
|
}), React.createElement('path', {
|
|
802
703
|
d: 'M22 6l-10 7L2 6',
|
|
803
|
-
stroke: textColor, strokeWidth: '
|
|
804
|
-
})), '
|
|
704
|
+
stroke: textColor, strokeWidth: '1.75', strokeLinecap: 'round', strokeLinejoin: 'round', fill: 'none',
|
|
705
|
+
})), 'Continue with email'));
|
|
805
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;
|
|
806
737
|
// Render custom modal
|
|
807
738
|
return React.createElement('div', {
|
|
808
739
|
// Overlay
|
|
@@ -812,12 +743,14 @@ class PhantomWalletProvider {
|
|
|
812
743
|
left: '0',
|
|
813
744
|
right: '0',
|
|
814
745
|
bottom: '0',
|
|
815
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
746
|
+
backgroundColor: isLight ? 'rgba(0,0,0,0.35)' : 'rgba(0,0,0,0.65)',
|
|
816
747
|
display: 'flex',
|
|
817
748
|
alignItems: 'center',
|
|
818
749
|
justifyContent: 'center',
|
|
819
750
|
zIndex: 2147483647,
|
|
820
751
|
pointerEvents: 'auto',
|
|
752
|
+
backdropFilter: 'blur(4px)',
|
|
753
|
+
WebkitBackdropFilter: 'blur(4px)',
|
|
821
754
|
},
|
|
822
755
|
onClick: (e) => {
|
|
823
756
|
if (e.target === e.currentTarget)
|
|
@@ -834,13 +767,17 @@ class PhantomWalletProvider {
|
|
|
834
767
|
React.createElement('div', {
|
|
835
768
|
style: {
|
|
836
769
|
backgroundColor: bgColor,
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
770
|
+
border: cardBorder,
|
|
771
|
+
borderRadius: '20px',
|
|
772
|
+
width: '380px',
|
|
773
|
+
maxWidth: 'calc(100vw - 32px)',
|
|
774
|
+
padding: '28px 24px 24px',
|
|
841
775
|
position: 'relative',
|
|
842
|
-
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)',
|
|
843
779
|
pointerEvents: 'auto',
|
|
780
|
+
boxSizing: 'border-box',
|
|
844
781
|
},
|
|
845
782
|
onMouseDown: (e) => {
|
|
846
783
|
e.stopPropagation();
|
|
@@ -849,26 +786,30 @@ class PhantomWalletProvider {
|
|
|
849
786
|
e.stopPropagation();
|
|
850
787
|
},
|
|
851
788
|
},
|
|
852
|
-
// Close button
|
|
789
|
+
// Close button
|
|
853
790
|
React.createElement('button', {
|
|
854
791
|
onClick: handleCloseModal,
|
|
855
792
|
style: {
|
|
856
793
|
position: 'absolute',
|
|
857
|
-
top: '
|
|
858
|
-
right: '
|
|
859
|
-
background: '
|
|
860
|
-
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',
|
|
861
801
|
cursor: 'pointer',
|
|
862
|
-
padding: '4px',
|
|
863
802
|
display: 'flex',
|
|
864
803
|
alignItems: 'center',
|
|
865
804
|
justifyContent: 'center',
|
|
805
|
+
padding: '0',
|
|
806
|
+
flexShrink: '0',
|
|
866
807
|
},
|
|
867
808
|
}, React.createElement('svg', {
|
|
868
|
-
width: '
|
|
809
|
+
width: '12', height: '12', viewBox: '0 0 12 12', fill: 'none',
|
|
869
810
|
}, React.createElement('path', {
|
|
870
|
-
d: '
|
|
871
|
-
stroke:
|
|
811
|
+
d: 'M11 1L1 11M1 1l10 10',
|
|
812
|
+
stroke: subTextColor, strokeWidth: '1.75', strokeLinecap: 'round',
|
|
872
813
|
}))),
|
|
873
814
|
// App icon (if provided)
|
|
874
815
|
that.config.appIcon ? React.createElement('div', {
|
|
@@ -876,27 +817,40 @@ class PhantomWalletProvider {
|
|
|
876
817
|
}, React.createElement('img', {
|
|
877
818
|
src: that.config.appIcon,
|
|
878
819
|
alt: that.config.appName || 'App',
|
|
879
|
-
style: { width: '
|
|
820
|
+
style: { width: '44px', height: '44px', borderRadius: '10px' },
|
|
880
821
|
})) : null,
|
|
881
822
|
// Title
|
|
882
823
|
React.createElement('div', {
|
|
883
824
|
style: {
|
|
884
825
|
color: textColor,
|
|
885
826
|
fontFamily,
|
|
886
|
-
fontSize: '
|
|
827
|
+
fontSize: '17px',
|
|
887
828
|
fontWeight: '600',
|
|
888
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',
|
|
889
842
|
marginBottom: '24px',
|
|
843
|
+
lineHeight: '1.4',
|
|
890
844
|
},
|
|
891
|
-
}, '
|
|
892
|
-
//
|
|
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
|
|
893
847
|
React.createElement('div', {
|
|
894
848
|
style: {
|
|
895
849
|
display: 'flex',
|
|
896
850
|
flexDirection: 'column',
|
|
897
851
|
gap: '8px',
|
|
898
852
|
},
|
|
899
|
-
}, ...
|
|
853
|
+
}, ...mainButtons, orDivider, emailButton)));
|
|
900
854
|
};
|
|
901
855
|
// Wrapper component with PhantomProvider
|
|
902
856
|
const PhantomProviderWrapper = () => {
|
|
@@ -929,13 +883,6 @@ class PhantomWalletProvider {
|
|
|
929
883
|
if (this.initPromise) {
|
|
930
884
|
await this.initPromise;
|
|
931
885
|
}
|
|
932
|
-
// Lazy-mount path: if initializeAsync deferred the React mount (e.g.
|
|
933
|
-
// first-time visitor on Android Chrome PWA), do it now. We're being
|
|
934
|
-
// called from a user-gesture flow like login(), so any Android intent
|
|
935
|
-
// dialog that surfaces will appear with the activity already focused.
|
|
936
|
-
if (!this.containerElement) {
|
|
937
|
-
this.initialize();
|
|
938
|
-
}
|
|
939
886
|
// Wait for SDK to be ready
|
|
940
887
|
await new Promise((resolve) => {
|
|
941
888
|
const check = () => {
|
|
@@ -1029,7 +976,7 @@ class PhantomWalletProvider {
|
|
|
1029
976
|
this.pendingLogin.reject = reject;
|
|
1030
977
|
});
|
|
1031
978
|
}
|
|
1032
|
-
|
|
979
|
+
const loginPromise = new Promise((resolve, reject) => {
|
|
1033
980
|
this.pendingLogin = { resolve, reject };
|
|
1034
981
|
this.loginInProgress = true;
|
|
1035
982
|
// Always use our custom wallet modal
|
|
@@ -1043,55 +990,17 @@ class PhantomWalletProvider {
|
|
|
1043
990
|
}
|
|
1044
991
|
}, 180000);
|
|
1045
992
|
});
|
|
993
|
+
return loginPromise.finally(() => {
|
|
994
|
+
this.loginOverrides = null;
|
|
995
|
+
});
|
|
1046
996
|
}
|
|
1047
997
|
async restoreSession() {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
// before the PWA activity has window focus on Solana Seeker. The
|
|
1053
|
-
// resulting "access other apps and services" system dialog renders
|
|
1054
|
-
// with grayed-out buttons.
|
|
1055
|
-
//
|
|
1056
|
-
// Wrap getSession() in try/catch: WebSessionManager.getSession() runs
|
|
1057
|
-
// JSON.parse on the stored session *outside* its internal try/catch,
|
|
1058
|
-
// so genuinely malformed JSON in localStorage would propagate through
|
|
1059
|
-
// restoreSession() and break init() entirely. Treat any throw as
|
|
1060
|
-
// "no session" and fall through to the cleanup path so corrupted
|
|
1061
|
-
// storage is recoverable on next load.
|
|
1062
|
-
let session;
|
|
1063
|
-
try {
|
|
1064
|
-
session = await index_native.WebSessionManager.getSession();
|
|
1065
|
-
}
|
|
1066
|
-
catch (_a) {
|
|
1067
|
-
session = null;
|
|
1068
|
-
}
|
|
1069
|
-
if (!session) {
|
|
1070
|
-
// Tidy up storage so we don't leave junk behind:
|
|
1071
|
-
// (a) clearSession() removes any stale or unparseable session
|
|
1072
|
-
// storage entry. WebSessionManager.getSession() can't reach
|
|
1073
|
-
// its own clearSession() if JSON.parse threw. Idempotent —
|
|
1074
|
-
// safe to call unconditionally here.
|
|
1075
|
-
// (b) Drop the auth-method marker if it's stale.
|
|
1076
|
-
// WebSessionManager.clearSession() only removes the session
|
|
1077
|
-
// storage key, not the marker — so without this cleanup
|
|
1078
|
-
// shouldMountEagerly() would keep eager-mounting on every
|
|
1079
|
-
// future cold start.
|
|
1080
|
-
try {
|
|
1081
|
-
index_native.WebSessionManager.clearSession();
|
|
1082
|
-
}
|
|
1083
|
-
catch ( /* best-effort */_b) { /* best-effort */ }
|
|
1084
|
-
try {
|
|
1085
|
-
if (index_native.getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
|
|
1086
|
-
index_native.getPlatform().storage.removeItem('tarobase_last_auth_method');
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
catch (_c) {
|
|
1090
|
-
// storage unavailable — best-effort cleanup
|
|
1091
|
-
}
|
|
1092
|
-
return null;
|
|
998
|
+
await this.ensureReady();
|
|
999
|
+
const session = await index_native.WebSessionManager.getSession();
|
|
1000
|
+
if (session) {
|
|
1001
|
+
return { provider: this, address: session.address };
|
|
1093
1002
|
}
|
|
1094
|
-
return
|
|
1003
|
+
return null;
|
|
1095
1004
|
}
|
|
1096
1005
|
async address() {
|
|
1097
1006
|
var _a, _b, _c, _d;
|
|
@@ -1548,4 +1457,4 @@ class PhantomWalletProvider {
|
|
|
1548
1457
|
PhantomWalletProvider.instance = null;
|
|
1549
1458
|
|
|
1550
1459
|
exports.PhantomWalletProvider = PhantomWalletProvider;
|
|
1551
|
-
//# sourceMappingURL=phantom-wallet-provider-
|
|
1460
|
+
//# sourceMappingURL=phantom-wallet-provider-DWCaMkyz.js.map
|