{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "request-recovery-notices",
  "title": "Request recovery notices",
  "description": "Warns when a request's review is cancelling, uncertain, or waiting on an operator, so the holder is not left assuming their review is proceeding normally.",
  "dependencies": [
    "@registrystack/app-runtime@~0.43.0-next.0"
  ],
  "registryDependencies": [
    "@registrystack/lib-notice"
  ],
  "files": [
    {
      "path": "request/request-recovery-notices.tsx",
      "content": "import type { RequestView } from \"@registrystack/app-runtime\";\nimport { Notice } from \"@/blocks/lib/notice\";\n\n/**\n * The review's recovery states, each in the reviewing service's own words: a\n * withdrawal it has not confirmed, a submission whose receipt is uncertain,\n * and a recovery that stopped for an operator. Each keeps the request where\n * it is; none offers an action. The titles and bodies are the caller's own,\n * since they may name the reviewing service and the record kind. The\n * operator-attention body is taken from `operatorAttentionBodies` by the\n * recovery's code when it has one, and from `operatorAttentionBody` otherwise.\n * A no-review request uses the same operator notice when native automatic\n * application stops blocked.\n */\nexport function ReviewRecoveryNotices({\n  request,\n  withdrawalPendingTitle,\n  withdrawalPendingBody,\n  submissionUnknownTitle,\n  submissionUnknownBody,\n  operatorAttentionTitle,\n  operatorAttentionBody,\n  operatorAttentionBodies = {},\n}: {\n  request: RequestView | undefined;\n  withdrawalPendingTitle: string;\n  withdrawalPendingBody: string;\n  submissionUnknownTitle: string;\n  submissionUnknownBody: string;\n  operatorAttentionTitle: string;\n  operatorAttentionBody: string;\n  operatorAttentionBodies?: Readonly<Record<string, string>>;\n}) {\n  const review = request?.review;\n  const recovery =\n    review?.recovery ??\n    (request?.application?.state === \"blocked\"\n      ? { state: \"operatorAttention\", code: request.application.reason }\n      : undefined);\n  if (!review && !recovery) return null;\n  const code = recovery?.code;\n  const keyedBody =\n    code !== undefined && Object.hasOwn(operatorAttentionBodies, code)\n      ? operatorAttentionBodies[code]\n      : undefined;\n  return (\n    <>\n      {review?.submission.state === \"cancelling\" && (\n        <Notice tone=\"warning\" title={withdrawalPendingTitle}>\n          <p>{withdrawalPendingBody}</p>\n        </Notice>\n      )}\n      {review?.submission.state === \"uncertain\" && (\n        <Notice tone=\"warning\" title={submissionUnknownTitle}>\n          <p>{submissionUnknownBody}</p>\n        </Notice>\n      )}\n      {recovery?.state === \"operatorAttention\" && (\n        <Notice tone=\"warning\" title={operatorAttentionTitle}>\n          <p>{keyedBody ?? operatorAttentionBody}</p>\n        </Notice>\n      )}\n    </>\n  );\n}\n",
      "type": "registry:block",
      "target": "@components/request/request-recovery-notices.tsx"
    }
  ],
  "type": "registry:block"
}