import addonAPI from '@storybook/addons'
import {
  STORIES_CONFIGURED,
  STORY_MISSING,
} from '@storybook/core-events'

const FIRST_STORY = 'CSS variables'

addonAPI.register('my-organisation/first-page', storybookAPI => {
  storybookAPI.on(STORIES_CONFIGURED, (kind, story) => {
    if (storybookAPI.getUrlState().path === '/story/*') {
      storybookAPI.selectStory(FIRST_STORY)
    }
  })
})
