import {ShopActions} from '@shopify/shop-minis-platform/actions' import {useShopActions} from '../../internal/useShopActions' export interface UseErrorToastReturns { /** * Show an error toast with the given error message. */ showErrorToast: ShopActions['showErrorToast'] } export const useErrorToast = (): UseErrorToastReturns => { const {showErrorToast} = useShopActions() return {showErrorToast} } /** * The `useErrorToast` hook displays a non-blocking error notification. Use this for recoverable errors, warnings, or informational messages that don't prevent users from continuing their workflow. The toast appears temporarily at the top or bottom of the screen, auto-dismisses, and allows users to keep interacting with the Mini. * * > Note: Use `useErrorToast` for recoverable errors or warnings (e.g., failed to save preference, item out of stock, temporary network issues, validation errors). This shows a non-blocking notification that auto-dismisses and doesn't interrupt the user's current task. Use `useErrorScreen` for critical failures that block the user workflow (e.g., authentication failures, data corruption, network timeouts that prevent the app from functioning). This provides a full-screen error UI that the user must acknowledge before continuing. * @publicDocs */ export type UseErrorToastGeneratedType = () => UseErrorToastReturns