@bounded-sh/client 0.0.39 → 0.0.40

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.js CHANGED
@@ -5038,6 +5038,19 @@ function getCurrentAuthMethod() {
5038
5038
  }
5039
5039
  async function logout$1() {
5040
5040
  var _a;
5041
+ // Re-initialize the provider if it was cleared by a prior logout — the exact mirror
5042
+ // of login()'s self-heal above. A hosted popup/redirect login (loginWithPopup /
5043
+ // completeLoginFromRedirect) establishes a session WITHOUT touching the provider
5044
+ // singleton, so after a logout → hosted re-login cycle the provider is still null
5045
+ // and logging out the NEW session would otherwise throw "not initialized" at the
5046
+ // user. Rebuilding from initConfig is idempotent and cheap (same config key).
5047
+ if (!currentAuthProvider && initConfig) {
5048
+ currentAuthProvider = await getAuthProvider(initConfig);
5049
+ const coreConfig = await core.getConfig();
5050
+ coreConfig.authProvider = currentAuthProvider;
5051
+ coreConfig.authMethod = currentAuthMethod;
5052
+ setAuthProviderInstance(currentAuthProvider);
5053
+ }
5041
5054
  if (!currentAuthProvider) {
5042
5055
  throw new Error("Auth provider not initialized. Please call init() first.");
5043
5056
  }