{"version":3,"file":"CloudPluginInstallDialog.mjs","names":[],"sources":["../../../../src/web/features/plugins/CloudPluginInstallDialog.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/web';\nimport {\n  Button,\n  Dialog,\n  DialogBody,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n} from '@agimon-ai/po-web-components';\nimport { useRef } from 'react';\n\nexport interface CloudPluginInstallDialogProps {\n  name: string;\n  version: string;\n  publisher: string;\n  organization: string;\n  description: string;\n  pending?: boolean;\n  returnFocusTo?: Element | null;\n  onClose: () => void;\n  onInstall: () => void;\n}\n\n/** The approved permission review. Its container owns release validation and the actual write. */\nexport function CloudPluginInstallDialog({\n  name,\n  version,\n  publisher,\n  organization,\n  description,\n  pending,\n  returnFocusTo,\n  onClose,\n  onInstall,\n}: CloudPluginInstallDialogProps) {\n  const t = useT();\n  const previousFocus = useRef(returnFocusTo ?? (typeof document === 'undefined' ? null : document.activeElement));\n  return (\n    <Dialog open onOpenChange={(open) => !open && onClose()}>\n      <DialogContent\n        width=\"md\"\n        onCloseAutoFocus={(event) => {\n          event.preventDefault();\n          if (previousFocus.current instanceof HTMLElement && previousFocus.current.isConnected)\n            previousFocus.current.focus();\n        }}\n      >\n        <DialogHeader>\n          <div className=\"flex min-w-0 flex-col gap-1\">\n            <DialogTitle>{t('webDashboard.plugins.cloudInstall.title', 'Install {name}?', { name })}</DialogTitle>\n            <DialogDescription>\n              {t('webDashboard.plugins.cloudInstall.version', 'Version {version} · Published by {publisher}', {\n                version,\n                publisher,\n              })}\n            </DialogDescription>\n          </div>\n        </DialogHeader>\n        <DialogBody className=\"gap-4\">\n          <p className=\"text-base leading-relaxed\">{description}</p>\n          <div className=\"flex flex-col gap-1\">\n            <h2 className=\"text-base font-semibold text-po-hi\">\n              {t('webDashboard.plugins.cloudInstall.availableTo', 'Available to {organization}', { organization })}\n            </h2>\n            <p className=\"text-base leading-relaxed text-po-dim\">\n              {t(\n                'webDashboard.plugins.cloudInstall.everyone',\n                'Everyone in this organization can use this plugin in cloud sessions.',\n              )}\n            </p>\n          </div>\n          <section className=\"flex flex-col gap-2\" aria-labelledby=\"cloud-plugin-permission-title\">\n            <h2 id=\"cloud-plugin-permission-title\" className=\"text-base font-semibold text-po-hi\">\n              {t('webDashboard.plugins.cloudInstall.allow', 'Allow this plugin to')}\n            </h2>\n            <ul className=\"list-disc space-y-1 pl-5 text-base leading-relaxed\">\n              <li>{t('webDashboard.plugins.cloudInstall.feedback', 'Ask people for feedback in their sessions')}</li>\n            </ul>\n          </section>\n          <div className=\"flex flex-col gap-2 rounded border border-po-border bg-po-deep p-3\">\n            <h2 className=\"text-base font-semibold text-po-hi\">\n              {t('webDashboard.plugins.cloudInstall.screensTitle', 'About plugin screens')}\n            </h2>\n            <p className=\"text-base leading-relaxed text-po-dim\">\n              {t(\n                'webDashboard.plugins.cloudInstall.screensBody',\n                'This plugin’s screens run inside signed-in Po web. They can access what you can access there. Install only code you trust.',\n              )}\n            </p>\n          </div>\n          <p className=\"text-sm leading-relaxed text-po-dim\">\n            {t(\n              'webDashboard.plugins.cloudInstall.reviewed',\n              'This exact release was manually reviewed. It stays on version {version} until you choose to update it.',\n              { version },\n            )}\n          </p>\n        </DialogBody>\n        <DialogFooter className=\"justify-end px-4 pb-4\">\n          <Button variant=\"ghost\" disabled={pending} onClick={onClose}>\n            {t('webDashboard.common.cancel', 'Cancel')}\n          </Button>\n          <Button variant=\"primary\" loading={pending} onClick={onInstall}>\n            {t('webDashboard.plugins.install', 'Install')}\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  );\n}\n"],"mappings":";;;;;;AA0BA,SAAgB,yBAAyB,EACvC,MACA,SACA,WACA,cACA,aACA,SACA,eACA,SACA,aACgC;CAChC,MAAM,IAAI,KAAK;CACf,MAAM,gBAAgB,OAAO,kBAAkB,OAAO,aAAa,cAAc,OAAO,SAAS,cAAc;CAC/G,OACE,oBAAC,QAAD;EAAQ,MAAA;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