{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "toast-promise-example",
  "title": "Toast Promise",
  "description": "toast-promise-example",
  "dependencies": [
    "sonner"
  ],
  "registryDependencies": [
    "https://intentui.com/r/button"
  ],
  "files": [
    {
      "path": "src/components/examples/statuses/toast/toast-promise-example.tsx",
      "content": "\"use client\"\n\nimport { toast } from \"sonner\"\nimport { Button } from \"@/components/ui/button\"\n\nfunction simulateApiCall(): Promise<string> {\n  return new Promise((resolve, reject) => {\n    setTimeout(() => {\n      if (Math.random() > 0.3) {\n        resolve(\"Data successfully saved!\")\n      } else {\n        reject(new Error(\"Failed to save data\"))\n      }\n    }, 2000)\n  })\n}\n\nexport default function ToastPromiseDemo() {\n  const handleSuccess = () => {\n    toast.promise(simulateApiCall(), {\n      loading: \"Saving your data...\",\n      success: (data) => data,\n      error: (error) => error.message,\n    })\n  }\n\n  const handleCustomSuccess = () => {\n    toast.promise(simulateApiCall(), {\n      loading: \"Uploading file...\",\n      success: (data) => `${data} File uploaded successfully!`,\n      error: \"Upload failed. Please try again.\",\n    })\n  }\n\n  return (\n    <div className=\"flex flex-col gap-1.5\">\n      <Button intent=\"outline\" size=\"sm\" onPress={handleSuccess}>\n        Promise Toast\n      </Button>\n      <Button intent=\"outline\" size=\"sm\" onPress={handleCustomSuccess}>\n        Custom Promise Toast\n      </Button>\n    </div>\n  )\n}\n",
      "type": "registry:page",
      "target": "app/toast-promise-example/page.tsx"
    }
  ],
  "type": "registry:page"
}