@pooflabs/web 0.0.32 → 0.0.34
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/global.d.ts +3 -0
- package/dist/{index-CclX1hTc.esm.js → index-B4flwOh0.esm.js} +151 -36
- package/dist/{index-CclX1hTc.esm.js.map → index-B4flwOh0.esm.js.map} +1 -1
- package/dist/{index-ev48HLj5.esm.js → index-C4NtEZJY.esm.js} +2 -2
- package/dist/{index-ev48HLj5.esm.js.map → index-C4NtEZJY.esm.js.map} +1 -1
- package/dist/{index-DhF1Kbht.js → index-CvOWbIKV.js} +2 -2
- package/dist/{index-DhF1Kbht.js.map → index-CvOWbIKV.js.map} +1 -1
- package/dist/{index-BnFIg6Xc.js → index-QjDqogbz.js} +152 -35
- package/dist/{index-BnFIg6Xc.js.map → index-QjDqogbz.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/global.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { User, ClientConfig } from '@pooflabs/core';
|
|
2
2
|
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
3
3
|
export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
|
|
4
|
+
export declare function onAuthLoadingChanged(callback: (loading: boolean) => void): void;
|
|
5
|
+
export declare function setAuthLoading(loading: boolean): void;
|
|
6
|
+
export declare function getAuthLoading(): boolean;
|
|
4
7
|
export declare function login(): Promise<User | null>;
|
|
5
8
|
export declare function logout(): Promise<void>;
|
|
6
9
|
export declare function setCurrentUser(user: User | null): void;
|
|
@@ -12632,7 +12632,7 @@ async function loadDependencies() {
|
|
|
12632
12632
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
12633
12633
|
import('react'),
|
|
12634
12634
|
import('react-dom/client'),
|
|
12635
|
-
import('./index-
|
|
12635
|
+
import('./index-C4NtEZJY.esm.js')
|
|
12636
12636
|
]);
|
|
12637
12637
|
React$1 = reactModule;
|
|
12638
12638
|
ReactDOM$1 = reactDomModule;
|
|
@@ -12743,16 +12743,19 @@ class PhantomWalletProvider {
|
|
|
12743
12743
|
isModalOpen: modal.isOpened,
|
|
12744
12744
|
connectError,
|
|
12745
12745
|
solana: solana && solanaHook.isAvailable ? {
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
|
|
12746
|
+
// Wrap methods to preserve 'this' context - direct references lose binding
|
|
12747
|
+
signMessage: (message) => solana.signMessage(message),
|
|
12748
|
+
signTransaction: (tx) => solana.signTransaction(tx),
|
|
12749
|
+
signAllTransactions: (txs) => solana.signAllTransactions(txs),
|
|
12750
|
+
signAndSendTransaction: (tx) => solana.signAndSendTransaction(tx),
|
|
12751
|
+
getPublicKey: () => solana.getPublicKey(),
|
|
12751
12752
|
isAvailable: solanaHook.isAvailable,
|
|
12753
|
+
connected: solana.connected,
|
|
12754
|
+
connect: (options) => solana.connect(options),
|
|
12752
12755
|
} : null,
|
|
12753
12756
|
};
|
|
12754
12757
|
}
|
|
12755
|
-
}, [phantom, phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, phantom === null || phantom === void 0 ? void 0 : phantom.isLoading, connect, disconnect, isDisconnecting, modal, modal.isOpened, solana, solanaHook.isAvailable, connectError]);
|
|
12758
|
+
}, [phantom, phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, phantom === null || phantom === void 0 ? void 0 : phantom.isLoading, connect, disconnect, isDisconnecting, modal, modal.isOpened, solana, solana === null || solana === void 0 ? void 0 : solana.connected, solanaHook.isAvailable, connectError]);
|
|
12756
12759
|
// Auto-login: If connected but no Tarobase session, try to create one.
|
|
12757
12760
|
// This handles social login callbacks where user returns from OAuth already connected.
|
|
12758
12761
|
React$1.useEffect(() => {
|
|
@@ -12762,8 +12765,8 @@ class PhantomWalletProvider {
|
|
|
12762
12765
|
if (!(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected) || (phantom === null || phantom === void 0 ? void 0 : phantom.isLoading) || that.loginInProgress || that.autoLoginInProgress || that.pendingLogin) {
|
|
12763
12766
|
return;
|
|
12764
12767
|
}
|
|
12765
|
-
// Need solana to be available for signing
|
|
12766
|
-
if (!solana || !solanaHook.isAvailable) {
|
|
12768
|
+
// Need solana to be available AND connected for signing
|
|
12769
|
+
if (!solana || !solanaHook.isAvailable || !solana.connected) {
|
|
12767
12770
|
return;
|
|
12768
12771
|
}
|
|
12769
12772
|
// Find Solana address
|
|
@@ -12781,6 +12784,7 @@ class PhantomWalletProvider {
|
|
|
12781
12784
|
}
|
|
12782
12785
|
// No valid session - try to create one automatically
|
|
12783
12786
|
that.autoLoginInProgress = true;
|
|
12787
|
+
setAuthLoading(true);
|
|
12784
12788
|
try {
|
|
12785
12789
|
const nonce = await genAuthNonce();
|
|
12786
12790
|
const messageText = await genSolanaMessage(publicKey, nonce);
|
|
@@ -12804,10 +12808,11 @@ class PhantomWalletProvider {
|
|
|
12804
12808
|
}
|
|
12805
12809
|
finally {
|
|
12806
12810
|
that.autoLoginInProgress = false;
|
|
12811
|
+
setAuthLoading(false);
|
|
12807
12812
|
}
|
|
12808
12813
|
};
|
|
12809
12814
|
autoCreateSession();
|
|
12810
|
-
}, [phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.isLoading, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, solana, solanaHook.isAvailable, disconnect]);
|
|
12815
|
+
}, [phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.isLoading, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, solana, solana === null || solana === void 0 ? void 0 : solana.connected, solanaHook.isAvailable, disconnect]);
|
|
12811
12816
|
// Handle modal close without connection
|
|
12812
12817
|
React$1.useEffect(() => {
|
|
12813
12818
|
// Detect when modal was open and is now closed
|
|
@@ -12838,9 +12843,9 @@ class PhantomWalletProvider {
|
|
|
12838
12843
|
if (!(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected) || !((_a = phantom === null || phantom === void 0 ? void 0 : phantom.addresses) === null || _a === void 0 ? void 0 : _a.length) || !that.pendingLogin || !that.loginInProgress) {
|
|
12839
12844
|
return;
|
|
12840
12845
|
}
|
|
12841
|
-
// Solana must be available for signing
|
|
12842
|
-
// If not ready yet, just return - this effect will re-run when
|
|
12843
|
-
if (!solana || !solanaHook.isAvailable) {
|
|
12846
|
+
// Solana must be available AND connected for signing
|
|
12847
|
+
// If not ready yet, just return - this effect will re-run when solana.connected changes
|
|
12848
|
+
if (!solana || !solanaHook.isAvailable || !solana.connected) {
|
|
12844
12849
|
return;
|
|
12845
12850
|
}
|
|
12846
12851
|
try {
|
|
@@ -12895,7 +12900,7 @@ class PhantomWalletProvider {
|
|
|
12895
12900
|
}
|
|
12896
12901
|
};
|
|
12897
12902
|
handleConnectionSuccess();
|
|
12898
|
-
}, [phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, solana, solanaHook.isAvailable]);
|
|
12903
|
+
}, [phantom === null || phantom === void 0 ? void 0 : phantom.isConnected, phantom === null || phantom === void 0 ? void 0 : phantom.addresses, solana, solana === null || solana === void 0 ? void 0 : solana.connected, solanaHook.isAvailable]);
|
|
12899
12904
|
return null; // Invisible component
|
|
12900
12905
|
};
|
|
12901
12906
|
// Wrapper component with PhantomProvider
|
|
@@ -12953,20 +12958,47 @@ class PhantomWalletProvider {
|
|
|
12953
12958
|
async ensureSolanaReady() {
|
|
12954
12959
|
var _a;
|
|
12955
12960
|
await this.ensureReady();
|
|
12956
|
-
// If connected
|
|
12961
|
+
// If connected at the Phantom level, ensure solana methods are ready
|
|
12957
12962
|
if ((_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.isConnected) {
|
|
12958
|
-
|
|
12963
|
+
const timeoutMs = 10000; // 10 second timeout
|
|
12964
|
+
const startTime = Date.now();
|
|
12965
|
+
// First, wait for solana to be available
|
|
12966
|
+
await new Promise((resolve, reject) => {
|
|
12959
12967
|
const check = () => {
|
|
12960
12968
|
var _a, _b;
|
|
12961
12969
|
if ((_b = (_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.solana) === null || _b === void 0 ? void 0 : _b.isAvailable) {
|
|
12962
12970
|
resolve();
|
|
12963
12971
|
}
|
|
12972
|
+
else if (Date.now() - startTime > timeoutMs) {
|
|
12973
|
+
reject(new Error('Timeout waiting for Solana provider to be available'));
|
|
12974
|
+
}
|
|
12964
12975
|
else {
|
|
12965
12976
|
setTimeout(check, 100);
|
|
12966
12977
|
}
|
|
12967
12978
|
};
|
|
12968
12979
|
check();
|
|
12969
12980
|
});
|
|
12981
|
+
// Now check if the solana provider is connected, if not try to reconnect
|
|
12982
|
+
// Note: We check our wrapper's `connected` which may be stale, but this is just
|
|
12983
|
+
// an optimization to skip reconnect if we know we're already connected.
|
|
12984
|
+
// The actual signing methods use the SDK's bound methods which check live state.
|
|
12985
|
+
if (!this.phantomMethods.solana.connected) {
|
|
12986
|
+
console.log('Solana provider not connected, attempting to reconnect...');
|
|
12987
|
+
try {
|
|
12988
|
+
// onlyIfTrusted: true means it will reconnect silently if previously approved
|
|
12989
|
+
// If not trusted, it will throw and we'll catch it below
|
|
12990
|
+
await this.phantomMethods.solana.connect({ onlyIfTrusted: true });
|
|
12991
|
+
console.log('Solana provider reconnected successfully');
|
|
12992
|
+
}
|
|
12993
|
+
catch (error) {
|
|
12994
|
+
// If onlyIfTrusted fails, the user may need to re-approve via modal
|
|
12995
|
+
console.error('Failed to reconnect solana provider (silent reconnect failed):', error === null || error === void 0 ? void 0 : error.message);
|
|
12996
|
+
throw new Error('Failed to reconnect Solana provider. Please try logging in again.');
|
|
12997
|
+
}
|
|
12998
|
+
}
|
|
12999
|
+
// Note: We don't do a final connected check here because our wrapper's `connected`
|
|
13000
|
+
// is a snapshot that won't update until React re-renders. If connect() succeeded,
|
|
13001
|
+
// the SDK is connected and signing will work.
|
|
12970
13002
|
}
|
|
12971
13003
|
}
|
|
12972
13004
|
/**
|
|
@@ -13038,11 +13070,19 @@ class PhantomWalletProvider {
|
|
|
13038
13070
|
return (solAddress === null || solAddress === void 0 ? void 0 : solAddress.address) || null;
|
|
13039
13071
|
}
|
|
13040
13072
|
async runTransaction(_evmTransactionData, solTransactionData, options) {
|
|
13041
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
13073
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
13042
13074
|
if (!solTransactionData) {
|
|
13043
13075
|
throw new Error("Solana transaction data is required for Phantom wallet");
|
|
13044
13076
|
}
|
|
13045
|
-
|
|
13077
|
+
try {
|
|
13078
|
+
await this.ensureSolanaReady();
|
|
13079
|
+
}
|
|
13080
|
+
catch (error) {
|
|
13081
|
+
// Reconnection failed - log user out and throw
|
|
13082
|
+
console.error('Solana provider reconnection failed, logging out:', error.message);
|
|
13083
|
+
await this.logout();
|
|
13084
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13085
|
+
}
|
|
13046
13086
|
// Ensure connected
|
|
13047
13087
|
if (!((_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
13048
13088
|
const user = await this.login();
|
|
@@ -13050,7 +13090,14 @@ class PhantomWalletProvider {
|
|
|
13050
13090
|
throw new Error('Failed to connect wallet');
|
|
13051
13091
|
}
|
|
13052
13092
|
// Wait for solana to be ready after login
|
|
13053
|
-
|
|
13093
|
+
try {
|
|
13094
|
+
await this.ensureSolanaReady();
|
|
13095
|
+
}
|
|
13096
|
+
catch (error) {
|
|
13097
|
+
console.error('Solana provider reconnection failed after login, logging out:', error.message);
|
|
13098
|
+
await this.logout();
|
|
13099
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13100
|
+
}
|
|
13054
13101
|
}
|
|
13055
13102
|
if (!((_b = this.phantomMethods) === null || _b === void 0 ? void 0 : _b.solana)) {
|
|
13056
13103
|
throw new Error('Solana signing not available');
|
|
@@ -13145,11 +13192,17 @@ class PhantomWalletProvider {
|
|
|
13145
13192
|
};
|
|
13146
13193
|
}
|
|
13147
13194
|
catch (error) {
|
|
13195
|
+
// Check if this is a connection error - if so, log out
|
|
13196
|
+
if (((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes('not connected')) || ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.includes('connect first'))) {
|
|
13197
|
+
console.error('Solana provider connection lost during transaction, logging out');
|
|
13198
|
+
await this.logout();
|
|
13199
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13200
|
+
}
|
|
13148
13201
|
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
13149
|
-
((
|
|
13150
|
-
((
|
|
13151
|
-
((
|
|
13152
|
-
((
|
|
13202
|
+
((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.toLowerCase().includes('user rejected')) ||
|
|
13203
|
+
((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.toLowerCase().includes('user denied')) ||
|
|
13204
|
+
((_h = error === null || error === void 0 ? void 0 : error.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes('user cancelled')) ||
|
|
13205
|
+
((_j = error === null || error === void 0 ? void 0 : error.message) === null || _j === void 0 ? void 0 : _j.toLowerCase().includes('user canceled'));
|
|
13153
13206
|
if (!isUserRejection) {
|
|
13154
13207
|
console.error('Failed to execute transaction', error);
|
|
13155
13208
|
}
|
|
@@ -13157,14 +13210,29 @@ class PhantomWalletProvider {
|
|
|
13157
13210
|
}
|
|
13158
13211
|
}
|
|
13159
13212
|
async signTransaction(transaction) {
|
|
13160
|
-
var _a, _b;
|
|
13161
|
-
|
|
13213
|
+
var _a, _b, _c, _d;
|
|
13214
|
+
try {
|
|
13215
|
+
await this.ensureSolanaReady();
|
|
13216
|
+
}
|
|
13217
|
+
catch (error) {
|
|
13218
|
+
// Reconnection failed - log user out and throw
|
|
13219
|
+
console.error('Solana provider reconnection failed, logging out:', error.message);
|
|
13220
|
+
await this.logout();
|
|
13221
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13222
|
+
}
|
|
13162
13223
|
if (!((_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
13163
13224
|
const user = await this.login();
|
|
13164
13225
|
if (!user) {
|
|
13165
13226
|
throw new Error('Failed to connect wallet');
|
|
13166
13227
|
}
|
|
13167
|
-
|
|
13228
|
+
try {
|
|
13229
|
+
await this.ensureSolanaReady();
|
|
13230
|
+
}
|
|
13231
|
+
catch (error) {
|
|
13232
|
+
console.error('Solana provider reconnection failed after login, logging out:', error.message);
|
|
13233
|
+
await this.logout();
|
|
13234
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13235
|
+
}
|
|
13168
13236
|
}
|
|
13169
13237
|
if (!((_b = this.phantomMethods) === null || _b === void 0 ? void 0 : _b.solana)) {
|
|
13170
13238
|
throw new Error('Solana signing not available');
|
|
@@ -13173,18 +13241,39 @@ class PhantomWalletProvider {
|
|
|
13173
13241
|
return await this.phantomMethods.solana.signTransaction(transaction);
|
|
13174
13242
|
}
|
|
13175
13243
|
catch (error) {
|
|
13244
|
+
// Check if this is a connection error - if so, log out
|
|
13245
|
+
if (((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.includes('not connected')) || ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes('connect first'))) {
|
|
13246
|
+
console.error('Solana provider connection lost during signing, logging out');
|
|
13247
|
+
await this.logout();
|
|
13248
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13249
|
+
}
|
|
13176
13250
|
throw new Error(`Failed to sign transaction: ${error.message}`);
|
|
13177
13251
|
}
|
|
13178
13252
|
}
|
|
13179
13253
|
async signMessage(message) {
|
|
13180
|
-
var _a, _b, _c, _d, _e, _f;
|
|
13181
|
-
|
|
13254
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13255
|
+
try {
|
|
13256
|
+
await this.ensureSolanaReady();
|
|
13257
|
+
}
|
|
13258
|
+
catch (error) {
|
|
13259
|
+
// Reconnection failed - log user out and throw
|
|
13260
|
+
console.error('Solana provider reconnection failed, logging out:', error.message);
|
|
13261
|
+
await this.logout();
|
|
13262
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13263
|
+
}
|
|
13182
13264
|
if (!((_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
13183
13265
|
const user = await this.login();
|
|
13184
13266
|
if (!user) {
|
|
13185
13267
|
throw new Error('Failed to connect wallet');
|
|
13186
13268
|
}
|
|
13187
|
-
|
|
13269
|
+
try {
|
|
13270
|
+
await this.ensureSolanaReady();
|
|
13271
|
+
}
|
|
13272
|
+
catch (error) {
|
|
13273
|
+
console.error('Solana provider reconnection failed after login, logging out:', error.message);
|
|
13274
|
+
await this.logout();
|
|
13275
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13276
|
+
}
|
|
13188
13277
|
}
|
|
13189
13278
|
if (!((_b = this.phantomMethods) === null || _b === void 0 ? void 0 : _b.solana)) {
|
|
13190
13279
|
throw new Error('Solana signing not available');
|
|
@@ -13195,11 +13284,17 @@ class PhantomWalletProvider {
|
|
|
13195
13284
|
return bufferExports$1.Buffer.from(result.signature).toString('base64');
|
|
13196
13285
|
}
|
|
13197
13286
|
catch (error) {
|
|
13287
|
+
// Check if this is a connection error - if so, log out
|
|
13288
|
+
if (((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.includes('not connected')) || ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes('connect first'))) {
|
|
13289
|
+
console.error('Solana provider connection lost during signing, logging out');
|
|
13290
|
+
await this.logout();
|
|
13291
|
+
throw new Error('Wallet connection lost. Please reconnect.');
|
|
13292
|
+
}
|
|
13198
13293
|
const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
|
|
13199
|
-
((
|
|
13200
|
-
((
|
|
13201
|
-
((
|
|
13202
|
-
((
|
|
13294
|
+
((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user rejected')) ||
|
|
13295
|
+
((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.toLowerCase().includes('user denied')) ||
|
|
13296
|
+
((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.toLowerCase().includes('user cancelled')) ||
|
|
13297
|
+
((_h = error === null || error === void 0 ? void 0 : error.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes('user canceled'));
|
|
13203
13298
|
if (!isUserRejection) {
|
|
13204
13299
|
console.error('Failed to sign message', error);
|
|
13205
13300
|
}
|
|
@@ -31350,7 +31445,9 @@ async function logout$1() {
|
|
|
31350
31445
|
let authProviderInstance = null;
|
|
31351
31446
|
let currentUser = null;
|
|
31352
31447
|
let authStateListeners = [];
|
|
31448
|
+
let authLoadingListeners = [];
|
|
31353
31449
|
let initCompleted = false;
|
|
31450
|
+
let isAuthLoading = false;
|
|
31354
31451
|
// This file acts as a middleware for the global state of the SDK
|
|
31355
31452
|
// This mostly involves setting up the AuthProvider and managing the current user
|
|
31356
31453
|
async function init(newConfig) {
|
|
@@ -31374,6 +31471,20 @@ function onAuthStateChanged(callback) {
|
|
|
31374
31471
|
callback(currentUser);
|
|
31375
31472
|
}
|
|
31376
31473
|
}
|
|
31474
|
+
function onAuthLoadingChanged(callback) {
|
|
31475
|
+
authLoadingListeners.push(callback);
|
|
31476
|
+
// Call immediately with current loading state
|
|
31477
|
+
callback(isAuthLoading);
|
|
31478
|
+
}
|
|
31479
|
+
function setAuthLoading(loading) {
|
|
31480
|
+
if (isAuthLoading !== loading) {
|
|
31481
|
+
isAuthLoading = loading;
|
|
31482
|
+
authLoadingListeners.forEach((callback) => callback(loading));
|
|
31483
|
+
}
|
|
31484
|
+
}
|
|
31485
|
+
function getAuthLoading() {
|
|
31486
|
+
return isAuthLoading;
|
|
31487
|
+
}
|
|
31377
31488
|
async function login() {
|
|
31378
31489
|
if (!authProviderInstance) {
|
|
31379
31490
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
@@ -31416,11 +31527,15 @@ function useAuth() {
|
|
|
31416
31527
|
}
|
|
31417
31528
|
const [user, setUser] = React$2.useState(null);
|
|
31418
31529
|
const [loading, setLoading] = React$2.useState(true);
|
|
31530
|
+
const [sdkLoading, setSdkLoading] = React$2.useState(false);
|
|
31419
31531
|
React$2.useEffect(() => {
|
|
31420
31532
|
onAuthStateChanged((user) => {
|
|
31421
31533
|
setUser(user);
|
|
31422
31534
|
setLoading(false);
|
|
31423
31535
|
});
|
|
31536
|
+
onAuthLoadingChanged((loading) => {
|
|
31537
|
+
setSdkLoading(loading);
|
|
31538
|
+
});
|
|
31424
31539
|
return () => {
|
|
31425
31540
|
};
|
|
31426
31541
|
}, []);
|
|
@@ -31457,7 +31572,7 @@ function useAuth() {
|
|
|
31457
31572
|
return {
|
|
31458
31573
|
login: login$1,
|
|
31459
31574
|
logout: logout$1,
|
|
31460
|
-
loading,
|
|
31575
|
+
loading: loading || sdkLoading,
|
|
31461
31576
|
user,
|
|
31462
31577
|
};
|
|
31463
31578
|
}
|
|
@@ -31467,5 +31582,5 @@ async function getIdToken() {
|
|
|
31467
31582
|
return getIdToken$1(false);
|
|
31468
31583
|
}
|
|
31469
31584
|
|
|
31470
|
-
export {
|
|
31471
|
-
//# sourceMappingURL=index-
|
|
31585
|
+
export { createSessionWithPrivy as A, createSessionWithSignature as B, genAuthNonce as C, DEFAULT_TEST_ADDRESS as D, genSolanaMessage as E, refreshSession as F, signSessionCreateMessage as G, MockAuthProvider as M, OffchainAuthProvider as O, PhantomWalletProvider as P, ServerSessionManager as S, WebSessionManager as W, getCurrentUser as a, bufferExports$1 as b, onAuthLoadingChanged as c, getAuthLoading as d, logout as e, getConfig as f, getDefaultExportFromCjs$1 as g, getAuthProvider as h, init as i, get$2 as j, setMany as k, login as l, setFile as m, getFiles as n, onAuthStateChanged as o, runQueryMany as p, runExpression as q, runQuery as r, set$1 as s, runExpressionMany as t, subscribe as u, useAuth as v, getIdToken as w, PrivyWalletProvider as x, buildSetDocumentsTransaction as y, convertRemainingAccounts as z };
|
|
31586
|
+
//# sourceMappingURL=index-B4flwOh0.esm.js.map
|