@pooflabs/web 0.0.32 → 0.0.33
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-BnFIg6Xc.js → index-CyYOGixN.js} +27 -3
- package/dist/{index-BnFIg6Xc.js.map → index-CyYOGixN.js.map} +1 -1
- package/dist/{index-DhF1Kbht.js → index-DVFbwTxe.js} +2 -2
- package/dist/{index-DhF1Kbht.js.map → index-DVFbwTxe.js.map} +1 -1
- package/dist/{index-ev48HLj5.esm.js → index-DtGP-cwj.esm.js} +2 -2
- package/dist/{index-ev48HLj5.esm.js.map → index-DtGP-cwj.esm.js.map} +1 -1
- package/dist/{index-CclX1hTc.esm.js → index-GsU0usWB.esm.js} +26 -4
- package/dist/{index-CclX1hTc.esm.js.map → index-GsU0usWB.esm.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;
|
|
@@ -12652,7 +12652,7 @@ async function loadDependencies() {
|
|
|
12652
12652
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
12653
12653
|
import('react'),
|
|
12654
12654
|
import('react-dom/client'),
|
|
12655
|
-
Promise.resolve().then(function () { return require('./index-
|
|
12655
|
+
Promise.resolve().then(function () { return require('./index-DVFbwTxe.js'); })
|
|
12656
12656
|
]);
|
|
12657
12657
|
React$1 = reactModule;
|
|
12658
12658
|
ReactDOM$1 = reactDomModule;
|
|
@@ -12801,6 +12801,7 @@ class PhantomWalletProvider {
|
|
|
12801
12801
|
}
|
|
12802
12802
|
// No valid session - try to create one automatically
|
|
12803
12803
|
that.autoLoginInProgress = true;
|
|
12804
|
+
setAuthLoading(true);
|
|
12804
12805
|
try {
|
|
12805
12806
|
const nonce = await genAuthNonce();
|
|
12806
12807
|
const messageText = await genSolanaMessage(publicKey, nonce);
|
|
@@ -12824,6 +12825,7 @@ class PhantomWalletProvider {
|
|
|
12824
12825
|
}
|
|
12825
12826
|
finally {
|
|
12826
12827
|
that.autoLoginInProgress = false;
|
|
12828
|
+
setAuthLoading(false);
|
|
12827
12829
|
}
|
|
12828
12830
|
};
|
|
12829
12831
|
autoCreateSession();
|
|
@@ -31370,7 +31372,9 @@ async function logout$1() {
|
|
|
31370
31372
|
let authProviderInstance = null;
|
|
31371
31373
|
let currentUser = null;
|
|
31372
31374
|
let authStateListeners = [];
|
|
31375
|
+
let authLoadingListeners = [];
|
|
31373
31376
|
let initCompleted = false;
|
|
31377
|
+
let isAuthLoading = false;
|
|
31374
31378
|
// This file acts as a middleware for the global state of the SDK
|
|
31375
31379
|
// This mostly involves setting up the AuthProvider and managing the current user
|
|
31376
31380
|
async function init(newConfig) {
|
|
@@ -31394,6 +31398,20 @@ function onAuthStateChanged(callback) {
|
|
|
31394
31398
|
callback(currentUser);
|
|
31395
31399
|
}
|
|
31396
31400
|
}
|
|
31401
|
+
function onAuthLoadingChanged(callback) {
|
|
31402
|
+
authLoadingListeners.push(callback);
|
|
31403
|
+
// Call immediately with current loading state
|
|
31404
|
+
callback(isAuthLoading);
|
|
31405
|
+
}
|
|
31406
|
+
function setAuthLoading(loading) {
|
|
31407
|
+
if (isAuthLoading !== loading) {
|
|
31408
|
+
isAuthLoading = loading;
|
|
31409
|
+
authLoadingListeners.forEach((callback) => callback(loading));
|
|
31410
|
+
}
|
|
31411
|
+
}
|
|
31412
|
+
function getAuthLoading() {
|
|
31413
|
+
return isAuthLoading;
|
|
31414
|
+
}
|
|
31397
31415
|
async function login() {
|
|
31398
31416
|
if (!authProviderInstance) {
|
|
31399
31417
|
throw new Error('SDK not initialized. Please call init() first.');
|
|
@@ -31436,11 +31454,15 @@ function useAuth() {
|
|
|
31436
31454
|
}
|
|
31437
31455
|
const [user, setUser] = React__namespace.useState(null);
|
|
31438
31456
|
const [loading, setLoading] = React__namespace.useState(true);
|
|
31457
|
+
const [sdkLoading, setSdkLoading] = React__namespace.useState(false);
|
|
31439
31458
|
React__namespace.useEffect(() => {
|
|
31440
31459
|
onAuthStateChanged((user) => {
|
|
31441
31460
|
setUser(user);
|
|
31442
31461
|
setLoading(false);
|
|
31443
31462
|
});
|
|
31463
|
+
onAuthLoadingChanged((loading) => {
|
|
31464
|
+
setSdkLoading(loading);
|
|
31465
|
+
});
|
|
31444
31466
|
return () => {
|
|
31445
31467
|
};
|
|
31446
31468
|
}, []);
|
|
@@ -31477,7 +31499,7 @@ function useAuth() {
|
|
|
31477
31499
|
return {
|
|
31478
31500
|
login: login$1,
|
|
31479
31501
|
logout: logout$1,
|
|
31480
|
-
loading,
|
|
31502
|
+
loading: loading || sdkLoading,
|
|
31481
31503
|
user,
|
|
31482
31504
|
};
|
|
31483
31505
|
}
|
|
@@ -31502,6 +31524,7 @@ exports.createSessionWithSignature = createSessionWithSignature;
|
|
|
31502
31524
|
exports.genAuthNonce = genAuthNonce;
|
|
31503
31525
|
exports.genSolanaMessage = genSolanaMessage;
|
|
31504
31526
|
exports.get = get$2;
|
|
31527
|
+
exports.getAuthLoading = getAuthLoading;
|
|
31505
31528
|
exports.getAuthProvider = getAuthProvider;
|
|
31506
31529
|
exports.getConfig = getConfig;
|
|
31507
31530
|
exports.getCurrentUser = getCurrentUser;
|
|
@@ -31511,6 +31534,7 @@ exports.getIdToken = getIdToken;
|
|
|
31511
31534
|
exports.init = init;
|
|
31512
31535
|
exports.login = login;
|
|
31513
31536
|
exports.logout = logout;
|
|
31537
|
+
exports.onAuthLoadingChanged = onAuthLoadingChanged;
|
|
31514
31538
|
exports.onAuthStateChanged = onAuthStateChanged;
|
|
31515
31539
|
exports.refreshSession = refreshSession;
|
|
31516
31540
|
exports.runExpression = runExpression;
|
|
@@ -31523,4 +31547,4 @@ exports.setMany = setMany;
|
|
|
31523
31547
|
exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
31524
31548
|
exports.subscribe = subscribe;
|
|
31525
31549
|
exports.useAuth = useAuth;
|
|
31526
|
-
//# sourceMappingURL=index-
|
|
31550
|
+
//# sourceMappingURL=index-CyYOGixN.js.map
|