@bounded-sh/client 0.0.39 → 0.0.41

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/index.mjs CHANGED
@@ -5018,6 +5018,19 @@ function getCurrentAuthMethod() {
5018
5018
  }
5019
5019
  async function logout$1() {
5020
5020
  var _a;
5021
+ // Re-initialize the provider if it was cleared by a prior logout — the exact mirror
5022
+ // of login()'s self-heal above. A hosted popup/redirect login (loginWithPopup /
5023
+ // completeLoginFromRedirect) establishes a session WITHOUT touching the provider
5024
+ // singleton, so after a logout → hosted re-login cycle the provider is still null
5025
+ // and logging out the NEW session would otherwise throw "not initialized" at the
5026
+ // user. Rebuilding from initConfig is idempotent and cheap (same config key).
5027
+ if (!currentAuthProvider && initConfig) {
5028
+ currentAuthProvider = await getAuthProvider(initConfig);
5029
+ const coreConfig = await getConfig();
5030
+ coreConfig.authProvider = currentAuthProvider;
5031
+ coreConfig.authMethod = currentAuthMethod;
5032
+ setAuthProviderInstance(currentAuthProvider);
5033
+ }
5021
5034
  if (!currentAuthProvider) {
5022
5035
  throw new Error("Auth provider not initialized. Please call init() first.");
5023
5036
  }