try:
    from ocyan.plugin.wagtail_oscar_integration.blocks import (
        CategoryChooserBlock,
        ProductChooserBlock,
    )
except ImportError:
    # this is a barebone using roadrunner bs5, there is no wagtail_oscar_integration
    # so there is nothing to register. I would rather do it in the extension's
    # __init__.py to keep everything together and make sure this code is only loaded
    # when the extension is activated but there is nu such luck unfortunately.
    # It will trigger a cyclic import error :(
    pass
else:
    from rr.telepath import register

    from ocyan.plugin.roadrunner_bs5.bs5_wagtail_oscar_integrations_extension.adapters import (
        PreviewAdminChooserAdapter,
    )

    register(PreviewAdminChooserAdapter(), ProductChooserBlock)
    register(PreviewAdminChooserAdapter(), CategoryChooserBlock)
