{
  "name": "animated-toast-promise-demo",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "animated-toast"
  ],
  "files": [
    {
      "path": "examples/animated-toast-promise-demo.tsx",
      "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport {\n  AnimatedToastProvider,\n  usePromiseToast,\n} from \"@/registry/default/ui/animated-toast\";\n\nfunction PromiseToastDemoContent() {\n  const promiseToast = usePromiseToast();\n  const [result, setResult] = useState<string>(\"\");\n\n  const simulateAsyncOperation = (shouldSucceed: boolean): Promise<string> => {\n    return new Promise((resolve, reject) => {\n      setTimeout(() => {\n        if (shouldSucceed) {\n          resolve(\"Operation completed successfully!\");\n        } else {\n          reject(new Error(\"Operation failed!\"));\n        }\n      }, 2000);\n    });\n  };\n\n  const handleSuccess = async () => {\n    try {\n      const data = await promiseToast({\n        promise: simulateAsyncOperation(true),\n        loading: \"Processing your request...\",\n        success: (result) => `Success: ${result}`,\n        error: (err) => `Error: ${err.message}`,\n      });\n      setResult(data);\n    } catch (_error) {\n      // Error already handled by toast\n    }\n  };\n\n  const handleError = async () => {\n    try {\n      const data = await promiseToast({\n        promise: simulateAsyncOperation(false),\n        loading: \"Processing your request...\",\n        success: (result) => `Success: ${result}`,\n        error: (err) => `Error: ${err.message}`,\n      });\n      setResult(data);\n    } catch (_error) {\n      // Error already handled by toast\n    }\n  };\n\n  return (\n    <div className=\"p-8\">\n      <p className=\"mb-4 text-muted-foreground\">\n        Click buttons to simulate async operations with toast feedback.\n      </p>\n\n      <div className=\"mb-4 flex flex-wrap gap-4\">\n        <button\n          onClick={handleSuccess}\n          className=\"rounded-md bg-green-500 px-4 py-2 text-white transition-colors hover:bg-green-600\"\n        >\n          Simulate Success\n        </button>\n        <button\n          onClick={handleError}\n          className=\"rounded-md bg-red-500 px-4 py-2 text-white transition-colors hover:bg-red-600\"\n        >\n          Simulate Error\n        </button>\n      </div>\n\n      {result && (\n        <div className=\"rounded-md bg-muted p-4\">\n          <p className=\"font-medium text-sm\">Result:</p>\n          <p className=\"text-muted-foreground text-sm\">{result}</p>\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default function AnimatedToastPromiseDemo() {\n  return (\n    <AnimatedToastProvider position=\"top-center\">\n      <PromiseToastDemoContent />\n    </AnimatedToastProvider>\n  );\n}\n",
      "type": "registry:example",
      "target": ""
    }
  ],
  "type": "registry:example"
}