import {ShopActions} from '@shopify/shop-minis-platform/actions'

import {useShopActions} from '../../internal/useShopActions'

interface UseErrorScreenReturns {
  /**
   * Show an error screen with the given error message.
   */
  showErrorScreen: ShopActions['showErrorScreen']
}

export const useErrorScreen = (): UseErrorScreenReturns => {
  const {showErrorScreen} = useShopActions()

  return {showErrorScreen}
}
