import { useLoginToken } from "@contember/react-client";
import { useMemo } from "react";
import { GQLVariable } from "../../lib/variables.js";
import { useSingleTenantMutation } from "../../lib/useSingleTenantMutation.js";
const INIT_SIGN_IN_IDP_MUTATION = `
initSignInIDP(redirectUrl: $redirectUrl, identityProvider: $identityProvider) {
	ok
	error {
		code
		developerMessage
	}
	result {
		authUrl
		sessionData
	}
}
`;
const initSignInIdpVariables = {
  redirectUrl: GQLVariable.Required(GQLVariable.String),
  identityProvider: GQLVariable.Required(GQLVariable.String)
};
const useInitSignInIDP = () => {
  const loginToken = useLoginToken();
  return useSingleTenantMutation(
    INIT_SIGN_IN_IDP_MUTATION,
    initSignInIdpVariables,
    useMemo(() => ({
      apiTokenOverride: loginToken
    }), [loginToken])
  );
};
export {
  useInitSignInIDP
};
//# sourceMappingURL=initSignInIDP.js.map
