feat(plug-in): factor out some components + add test coverage