nt) {
      return false;
    }
    return await this.isSignedIn();
  },

  async promptSignIn(browser) {
    try {
      const data = {
        autoClose: false,
        entrypoint: "aiwindow",
        extraParams: {
          service: "aiwindow",
        },
      };
      const signedIn = await lazy.SpecialMessageActions.fxaSignInFlow(
        data,
        browser
      );
      if (signedIn) {
        this.hasToSConsent = true;
      }
      return signedIn;
    } catch (error) {
      lazy.log.error("Error prompting sign-in:", error);
      throw error;
    }
  },

  async launchAIWindow(browser) {
    if (!(await this.canAccessAIWindow())) {
      const signedIn = await this.promptSignIn(browser);
      if (!signedIn) {
        lazy.log.error("User did not sign in successfully.");
        return false;
      }
    }
    // Proceed with launching the AI window
    // Tobe updated with window switching toggleWindow call implemented with fix of bug 2006469
    browser.ownerGlobal.OpenBrowserWindow({ aiWindow: true });
    return true;
  },
};
PK