@burdenoff/microfe-buildmyiq 2026.1101.1 → 2026.1102.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/buildmyiq/BuildmyiqRoot.d.ts.map +1 -1
  2. package/dist/buildmyiq/BuildmyiqRoot.js +85 -77
  3. package/dist/buildmyiq/BuildmyiqRoot.js.map +1 -1
  4. package/dist/buildmyiq/BuildmyiqRoutes.d.ts.map +1 -1
  5. package/dist/buildmyiq/BuildmyiqRoutes.js +38 -34
  6. package/dist/buildmyiq/BuildmyiqRoutes.js.map +1 -1
  7. package/dist/buildmyiq/components/BuiDiscussion.d.ts +8 -4
  8. package/dist/buildmyiq/components/BuiDiscussion.d.ts.map +1 -1
  9. package/dist/buildmyiq/components/BuiDiscussion.js +190 -87
  10. package/dist/buildmyiq/components/BuiDiscussion.js.map +1 -1
  11. package/dist/buildmyiq/hooks/index.d.ts +1 -0
  12. package/dist/buildmyiq/hooks/index.d.ts.map +1 -1
  13. package/dist/buildmyiq/hooks/index.js +1 -0
  14. package/dist/buildmyiq/hooks/useBuiComments.d.ts +50 -10
  15. package/dist/buildmyiq/hooks/useBuiComments.d.ts.map +1 -1
  16. package/dist/buildmyiq/hooks/useBuiComments.js +67 -23
  17. package/dist/buildmyiq/hooks/useBuiComments.js.map +1 -1
  18. package/dist/buildmyiq/hooks/useBuiLearningObjects.d.ts +71 -0
  19. package/dist/buildmyiq/hooks/useBuiLearningObjects.d.ts.map +1 -0
  20. package/dist/buildmyiq/hooks/useBuiLearningObjects.js +168 -0
  21. package/dist/buildmyiq/hooks/useBuiLearningObjects.js.map +1 -0
  22. package/dist/buildmyiq/hooks/useBuildmyiqApi.d.ts +86 -1
  23. package/dist/buildmyiq/hooks/useBuildmyiqApi.d.ts.map +1 -1
  24. package/dist/buildmyiq/hooks/useBuildmyiqApi.js +383 -336
  25. package/dist/buildmyiq/hooks/useBuildmyiqApi.js.map +1 -1
  26. package/dist/buildmyiq/pages/authoring/CourseBuilderPage.d.ts.map +1 -1
  27. package/dist/buildmyiq/pages/authoring/CourseBuilderPage.js +393 -277
  28. package/dist/buildmyiq/pages/authoring/CourseBuilderPage.js.map +1 -1
  29. package/dist/buildmyiq/pages/catalog/CatalogPage.d.ts.map +1 -1
  30. package/dist/buildmyiq/pages/catalog/CatalogPage.js +97 -68
  31. package/dist/buildmyiq/pages/catalog/CatalogPage.js.map +1 -1
  32. package/dist/buildmyiq/pages/catalog/CourseDetailPage.d.ts.map +1 -1
  33. package/dist/buildmyiq/pages/catalog/CourseDetailPage.js +270 -208
  34. package/dist/buildmyiq/pages/catalog/CourseDetailPage.js.map +1 -1
  35. package/dist/buildmyiq/pages/repository/RepositoryDialogs.d.ts +27 -0
  36. package/dist/buildmyiq/pages/repository/RepositoryDialogs.d.ts.map +1 -0
  37. package/dist/buildmyiq/pages/repository/RepositoryDialogs.js +379 -0
  38. package/dist/buildmyiq/pages/repository/RepositoryDialogs.js.map +1 -0
  39. package/dist/buildmyiq/pages/repository/RepositoryPage.d.ts +3 -0
  40. package/dist/buildmyiq/pages/repository/RepositoryPage.d.ts.map +1 -0
  41. package/dist/buildmyiq/pages/repository/RepositoryPage.js +445 -0
  42. package/dist/buildmyiq/pages/repository/RepositoryPage.js.map +1 -0
  43. package/dist/buildmyiq/pages/repository/repositoryModel.d.ts +26 -0
  44. package/dist/buildmyiq/pages/repository/repositoryModel.d.ts.map +1 -0
  45. package/dist/buildmyiq/pages/repository/repositoryModel.js +30 -0
  46. package/dist/buildmyiq/pages/repository/repositoryModel.js.map +1 -0
  47. package/dist/buildmyiq/types/index.d.ts +98 -0
  48. package/dist/buildmyiq/types/index.d.ts.map +1 -1
  49. package/dist/buildmyiq/types/index.js +26 -1
  50. package/dist/buildmyiq/types/index.js.map +1 -1
  51. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BuildmyiqRoutes.js","names":[],"sources":["../../src/buildmyiq/BuildmyiqRoutes.tsx"],"sourcesContent":["/**\n * Buildmyiq Routes\n * @module buildmyiq\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `bui*` backend capability.\n * All product routes are gated by feature flags that default to enabled.\n */\n\nimport React, { type FC, lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useBuildmyiq } from './context';\nimport { useTr } from './shared/hooks/useTr';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/DashboardPage';\n\n// Catalog (learner-facing course discovery + detail + enrol)\nconst CatalogPage = lazy(() =>\n import('./pages/catalog/CatalogPage').then((m) => ({ default: m.CatalogPage }))\n);\nconst CourseDetailPage = lazy(() =>\n import('./pages/catalog/CourseDetailPage').then((m) => ({ default: m.CourseDetailPage }))\n);\n\n// My Learning (enrollments + progress + lesson player)\nconst MyLearningPage = lazy(() =>\n import('./pages/learning/MyLearningPage').then((m) => ({ default: m.MyLearningPage }))\n);\nconst LessonPlayerPage = lazy(() =>\n import('./pages/learning/LessonPlayerPage').then((m) => ({ default: m.LessonPlayerPage }))\n);\n\n// Authoring (instructor course management + builder)\nconst AuthoringPage = lazy(() =>\n import('./pages/authoring/AuthoringPage').then((m) => ({ default: m.AuthoringPage }))\n);\nconst CourseBuilderPage = lazy(() =>\n import('./pages/authoring/CourseBuilderPage').then((m) => ({ default: m.CourseBuilderPage }))\n);\n\n// Assessments (list + builder/questions/detail)\nconst AssessmentsPage = lazy(() =>\n import('./pages/assessments/AssessmentsPage').then((m) => ({ default: m.AssessmentsPage }))\n);\nconst AssessmentDetailPage = lazy(() =>\n import('./pages/assessments/AssessmentDetailPage').then((m) => ({\n default: m.AssessmentDetailPage,\n }))\n);\n// Learner-facing: take a published assessment (answer + submit)\nconst TakeAssessmentPage = lazy(() =>\n import('./pages/assessments/TakeAssessmentPage').then((m) => ({ default: m.TakeAssessmentPage }))\n);\n\n// Insights (educator analytics, derived from real data)\nconst InsightsPage = lazy(() =>\n import('./pages/insights/InsightsPage').then((m) => ({ default: m.InsightsPage }))\n);\n\n// Skill Journeys (derived guided paths)\nconst PathsPage = lazy(() =>\n import('./pages/paths/PathsPage').then((m) => ({ default: m.PathsPage }))\n);\n\n// Grading (submissions queue)\nconst SubmissionsPage = lazy(() =>\n import('./pages/submissions/SubmissionsPage').then((m) => ({ default: m.SubmissionsPage }))\n);\nconst BulkGradingPage = lazy(() =>\n import('./pages/submissions/BulkGradingPage').then((m) => ({ default: m.BulkGradingPage }))\n);\n\n// Proctoring review queue — high-stakes exam identity checks (BOFF-4431)\nconst ProctoringReviewPage = lazy(() =>\n import('./pages/proctoring/ProctoringReviewPage').then((m) => ({\n default: m.ProctoringReviewPage,\n }))\n);\n\n// Educator review of AI tutor answers (BOFF-9663)\nconst TutorReviewPage = lazy(() =>\n import('./pages/tutorReview/TutorReviewPage').then((m) => ({ default: m.TutorReviewPage }))\n);\n\n// Cohorts\nconst CohortsPage = lazy(() =>\n import('./pages/cohorts/CohortsPage').then((m) => ({ default: m.CohortsPage }))\n);\n\n// Skills taxonomy\nconst SkillsPage = lazy(() =>\n import('./pages/skills/SkillsPage').then((m) => ({ default: m.SkillsPage }))\n);\n\n// Certificates\nconst CertificatesPage = lazy(() =>\n import('./pages/certificates/CertificatesPage').then((m) => ({ default: m.CertificatesPage }))\n);\n\n// AI Admin Copilot (BOFF-4434) — read-only workspace Q&A\nconst AdminCopilotPage = lazy(() =>\n import('./pages/copilot/AdminCopilotPage').then((m) => ({ default: m.AdminCopilotPage }))\n);\n\n// LMS launch handoff — where a validated LTI 1.3 launch lands (BOFF-9680)\nconst LtiLaunchPage = lazy(() =>\n import('./pages/lti/LtiLaunchPage').then((m) => ({ default: m.LtiLaunchPage }))\n);\n// LMS integrations — LTI 1.3 Advantage platform registry (BOFF-4419)\nconst LtiPlatformsPage = lazy(() =>\n import('./pages/integrations/LtiPlatformsPage').then((m) => ({ default: m.LtiPlatformsPage }))\n);\n\n// L&D workflow automation via FluidGrids (BOFF-9688)\nconst AutomationsPage = lazy(() =>\n import('./pages/automations/AutomationsPage').then((m) => ({ default: m.AutomationsPage }))\n);\n\n// Workspace AI content controls (BOFF-9689)\nconst AiSettingsPage = lazy(() =>\n import('./pages/aiSettings/AiSettingsPage').then((m) => ({ default: m.AiSettingsPage }))\n);\n// Enterprise user provisioning — SCIM 2.0 tokens + IdP setup (BOFF-4438)\nconst ProvisioningPage = lazy(() =>\n import('./pages/provisioning/ProvisioningPage').then((m) => ({ default: m.ProvisioningPage }))\n);\n\n// Course migration — Common Cartridge import, open-standards export (BOFF-4437)\nconst MigrationCenterPage = lazy(() =>\n import('./pages/migration/MigrationCenterPage').then((m) => ({ default: m.MigrationCenterPage }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nfunction FeatureDisabledFallback() {\n const tr = useTr();\n return (\n <div className=\"flex h-full min-h-[200px] items-center justify-center text-sm text-text-secondary\">\n {tr(\n 'buildmyiq.pages.featureDisabled',\n 'This feature is currently disabled. You can enable it from Feature Previews.'\n )}\n </div>\n );\n}\n\nfunction gated(flag: string, element: React.ReactNode, defaultValue = true): React.ReactElement {\n return (\n <FeatureGate flag={flag} defaultValue={defaultValue} fallback={<FeatureDisabledFallback />}>\n {element}\n </FeatureGate>\n );\n}\n\nexport const BuildmyiqRoutes: FC = () => {\n const { basePath, isStandalone } = useBuildmyiq();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated('buildmyiq.overview', <DashboardPage />)} />\n\n <Route path=\"catalog\" element={gated('buildmyiq.catalog', <CatalogPage />)} />\n <Route\n path=\"catalog/:courseId\"\n element={gated('buildmyiq.catalog', <CourseDetailPage />)}\n />\n\n <Route path=\"learning\" element={gated('buildmyiq.learning', <MyLearningPage />)} />\n <Route\n path=\"learning/:enrollmentId\"\n element={gated('buildmyiq.learning', <LessonPlayerPage />)}\n />\n\n <Route path=\"paths\" element={gated('buildmyiq.paths', <PathsPage />)} />\n\n <Route path=\"authoring\" element={gated('buildmyiq.authoring', <AuthoringPage />)} />\n <Route\n path=\"authoring/:courseId\"\n element={gated('buildmyiq.authoring', <CourseBuilderPage />)}\n />\n\n <Route path=\"assessments\" element={gated('buildmyiq.assessments', <AssessmentsPage />)} />\n <Route\n path=\"assessments/:assessmentId\"\n element={gated('buildmyiq.assessments', <AssessmentDetailPage />)}\n />\n <Route\n path=\"assessments/:assessmentId/take\"\n element={gated('buildmyiq.assessments', <TakeAssessmentPage />)}\n />\n\n <Route path=\"insights\" element={gated('buildmyiq.insights', <InsightsPage />)} />\n\n <Route path=\"submissions\" element={gated('buildmyiq.submissions', <SubmissionsPage />)} />\n <Route\n path=\"submissions/bulk\"\n element={gated('buildmyiq.submissions', <BulkGradingPage />)}\n />\n <Route\n path=\"submissions/:submissionId\"\n element={gated('buildmyiq.submissions', <SubmissionsPage />)}\n />\n <Route\n path=\"proctoring\"\n element={gated('buildmyiq.proctoring', <ProctoringReviewPage />)}\n />\n <Route\n path=\"tutor-review\"\n element={gated('buildmyiq.tutor-review', <TutorReviewPage />)}\n />\n <Route path=\"cohorts\" element={gated('buildmyiq.cohorts', <CohortsPage />)} />\n <Route path=\"skills\" element={gated('buildmyiq.skills', <SkillsPage />)} />\n <Route\n path=\"certificates\"\n element={gated('buildmyiq.certificates', <CertificatesPage />)}\n />\n\n <Route\n path=\"admin-copilot\"\n element={gated('buildmyiq.admin-copilot', <AdminCopilotPage />)}\n />\n <Route\n path=\"integrations\"\n element={gated('buildmyiq.integrations', <LtiPlatformsPage />)}\n />\n <Route path=\"migration\" element={gated('buildmyiq.migration', <MigrationCenterPage />)} />\n <Route path=\"automations\" element={gated('buildmyiq.automations', <AutomationsPage />)} />\n <Route path=\"ai-settings\" element={gated('buildmyiq.ai-settings', <AiSettingsPage />)} />\n <Route\n path=\"provisioning\"\n element={gated('buildmyiq.provisioning', <ProvisioningPage />)}\n />\n {/* Not feature-gated: learners arrive here from their LMS, and the\n launch only exists because a workspace admin registered it. */}\n <Route path=\"lti/launch/:ticketId\" element={<LtiLaunchPage />} />\n\n <Route path=\"*\" element={<Navigate to={normalizedBasePath || '/'} replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,IAAc,QAClB,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAChF,GACM,IAAmB,QACvB,OAAO,uCAAoC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAC1F,GAGM,IAAiB,QACrB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACvF,GACM,IAAmB,QACvB,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAC3F,GAGM,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CACtF,GACM,IAAoB,QACxB,OAAO,0CAAuC,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAC9F,GAGM,IAAkB,QACtB,OAAO,0CAAuC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAC5F,GACM,IAAuB,QAC3B,OAAO,+CAA4C,MAAM,OAAO,EAC9D,SAAS,EAAE,qBACb,EAAE,CACJ,GAEM,IAAqB,QACzB,OAAO,6CAA0C,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EA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":"BuildmyiqRoutes.js","names":[],"sources":["../../src/buildmyiq/BuildmyiqRoutes.tsx"],"sourcesContent":["/**\n * Buildmyiq Routes\n * @module buildmyiq\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `bui*` backend capability.\n * All product routes are gated by feature flags that default to enabled.\n */\n\nimport React, { type FC, lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useBuildmyiq } from './context';\nimport { useTr } from './shared/hooks/useTr';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/DashboardPage';\n\n// Catalog (learner-facing course discovery + detail + enrol)\nconst CatalogPage = lazy(() =>\n import('./pages/catalog/CatalogPage').then((m) => ({ default: m.CatalogPage }))\n);\nconst CourseDetailPage = lazy(() =>\n import('./pages/catalog/CourseDetailPage').then((m) => ({ default: m.CourseDetailPage }))\n);\n\n// My Learning (enrollments + progress + lesson player)\nconst MyLearningPage = lazy(() =>\n import('./pages/learning/MyLearningPage').then((m) => ({ default: m.MyLearningPage }))\n);\nconst LessonPlayerPage = lazy(() =>\n import('./pages/learning/LessonPlayerPage').then((m) => ({ default: m.LessonPlayerPage }))\n);\n\n// Authoring (instructor course management + builder)\nconst AuthoringPage = lazy(() =>\n import('./pages/authoring/AuthoringPage').then((m) => ({ default: m.AuthoringPage }))\n);\nconst CourseBuilderPage = lazy(() =>\n import('./pages/authoring/CourseBuilderPage').then((m) => ({ default: m.CourseBuilderPage }))\n);\n\n// Content repository — reusable lessons and assessments (BOFF-10563)\nconst RepositoryPage = lazy(() =>\n import('./pages/repository/RepositoryPage').then((m) => ({ default: m.RepositoryPage }))\n);\n\n// Assessments (list + builder/questions/detail)\nconst AssessmentsPage = lazy(() =>\n import('./pages/assessments/AssessmentsPage').then((m) => ({ default: m.AssessmentsPage }))\n);\nconst AssessmentDetailPage = lazy(() =>\n import('./pages/assessments/AssessmentDetailPage').then((m) => ({\n default: m.AssessmentDetailPage,\n }))\n);\n// Learner-facing: take a published assessment (answer + submit)\nconst TakeAssessmentPage = lazy(() =>\n import('./pages/assessments/TakeAssessmentPage').then((m) => ({ default: m.TakeAssessmentPage }))\n);\n\n// Insights (educator analytics, derived from real data)\nconst InsightsPage = lazy(() =>\n import('./pages/insights/InsightsPage').then((m) => ({ default: m.InsightsPage }))\n);\n\n// Skill Journeys (derived guided paths)\nconst PathsPage = lazy(() =>\n import('./pages/paths/PathsPage').then((m) => ({ default: m.PathsPage }))\n);\n\n// Grading (submissions queue)\nconst SubmissionsPage = lazy(() =>\n import('./pages/submissions/SubmissionsPage').then((m) => ({ default: m.SubmissionsPage }))\n);\nconst BulkGradingPage = lazy(() =>\n import('./pages/submissions/BulkGradingPage').then((m) => ({ default: m.BulkGradingPage }))\n);\n\n// Proctoring review queue — high-stakes exam identity checks (BOFF-4431)\nconst ProctoringReviewPage = lazy(() =>\n import('./pages/proctoring/ProctoringReviewPage').then((m) => ({\n default: m.ProctoringReviewPage,\n }))\n);\n\n// Educator review of AI tutor answers (BOFF-9663)\nconst TutorReviewPage = lazy(() =>\n import('./pages/tutorReview/TutorReviewPage').then((m) => ({ default: m.TutorReviewPage }))\n);\n\n// Cohorts\nconst CohortsPage = lazy(() =>\n import('./pages/cohorts/CohortsPage').then((m) => ({ default: m.CohortsPage }))\n);\n\n// Skills taxonomy\nconst SkillsPage = lazy(() =>\n import('./pages/skills/SkillsPage').then((m) => ({ default: m.SkillsPage }))\n);\n\n// Certificates\nconst CertificatesPage = lazy(() =>\n import('./pages/certificates/CertificatesPage').then((m) => ({ default: m.CertificatesPage }))\n);\n\n// AI Admin Copilot (BOFF-4434) — read-only workspace Q&A\nconst AdminCopilotPage = lazy(() =>\n import('./pages/copilot/AdminCopilotPage').then((m) => ({ default: m.AdminCopilotPage }))\n);\n\n// LMS launch handoff — where a validated LTI 1.3 launch lands (BOFF-9680)\nconst LtiLaunchPage = lazy(() =>\n import('./pages/lti/LtiLaunchPage').then((m) => ({ default: m.LtiLaunchPage }))\n);\n// LMS integrations — LTI 1.3 Advantage platform registry (BOFF-4419)\nconst LtiPlatformsPage = lazy(() =>\n import('./pages/integrations/LtiPlatformsPage').then((m) => ({ default: m.LtiPlatformsPage }))\n);\n\n// L&D workflow automation via FluidGrids (BOFF-9688)\nconst AutomationsPage = lazy(() =>\n import('./pages/automations/AutomationsPage').then((m) => ({ default: m.AutomationsPage }))\n);\n\n// Workspace AI content controls (BOFF-9689)\nconst AiSettingsPage = lazy(() =>\n import('./pages/aiSettings/AiSettingsPage').then((m) => ({ default: m.AiSettingsPage }))\n);\n// Enterprise user provisioning — SCIM 2.0 tokens + IdP setup (BOFF-4438)\nconst ProvisioningPage = lazy(() =>\n import('./pages/provisioning/ProvisioningPage').then((m) => ({ default: m.ProvisioningPage }))\n);\n\n// Course migration — Common Cartridge import, open-standards export (BOFF-4437)\nconst MigrationCenterPage = lazy(() =>\n import('./pages/migration/MigrationCenterPage').then((m) => ({ default: m.MigrationCenterPage }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nfunction FeatureDisabledFallback() {\n const tr = useTr();\n return (\n <div className=\"flex h-full min-h-[200px] items-center justify-center text-sm text-text-secondary\">\n {tr(\n 'buildmyiq.pages.featureDisabled',\n 'This feature is currently disabled. You can enable it from Feature Previews.'\n )}\n </div>\n );\n}\n\nfunction gated(flag: string, element: React.ReactNode, defaultValue = true): React.ReactElement {\n return (\n <FeatureGate flag={flag} defaultValue={defaultValue} fallback={<FeatureDisabledFallback />}>\n {element}\n </FeatureGate>\n );\n}\n\nexport const BuildmyiqRoutes: FC = () => {\n const { basePath, isStandalone } = useBuildmyiq();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated('buildmyiq.overview', <DashboardPage />)} />\n\n <Route path=\"catalog\" element={gated('buildmyiq.catalog', <CatalogPage />)} />\n <Route\n path=\"catalog/:courseId\"\n element={gated('buildmyiq.catalog', <CourseDetailPage />)}\n />\n\n <Route path=\"learning\" element={gated('buildmyiq.learning', <MyLearningPage />)} />\n <Route\n path=\"learning/:enrollmentId\"\n element={gated('buildmyiq.learning', <LessonPlayerPage />)}\n />\n\n <Route path=\"paths\" element={gated('buildmyiq.paths', <PathsPage />)} />\n\n <Route path=\"authoring\" element={gated('buildmyiq.authoring', <AuthoringPage />)} />\n <Route\n path=\"authoring/:courseId\"\n element={gated('buildmyiq.authoring', <CourseBuilderPage />)}\n />\n\n {/* Same flag as Authoring: the repository is an authoring tool. */}\n <Route path=\"repository\" element={gated('buildmyiq.authoring', <RepositoryPage />)} />\n\n <Route path=\"assessments\" element={gated('buildmyiq.assessments', <AssessmentsPage />)} />\n <Route\n path=\"assessments/:assessmentId\"\n element={gated('buildmyiq.assessments', <AssessmentDetailPage />)}\n />\n <Route\n path=\"assessments/:assessmentId/take\"\n element={gated('buildmyiq.assessments', <TakeAssessmentPage />)}\n />\n\n <Route path=\"insights\" element={gated('buildmyiq.insights', <InsightsPage />)} />\n\n <Route path=\"submissions\" element={gated('buildmyiq.submissions', <SubmissionsPage />)} />\n <Route\n path=\"submissions/bulk\"\n element={gated('buildmyiq.submissions', <BulkGradingPage />)}\n />\n <Route\n path=\"submissions/:submissionId\"\n element={gated('buildmyiq.submissions', <SubmissionsPage />)}\n />\n <Route\n path=\"proctoring\"\n element={gated('buildmyiq.proctoring', <ProctoringReviewPage />)}\n />\n <Route\n path=\"tutor-review\"\n element={gated('buildmyiq.tutor-review', <TutorReviewPage />)}\n />\n <Route path=\"cohorts\" element={gated('buildmyiq.cohorts', <CohortsPage />)} />\n <Route path=\"skills\" element={gated('buildmyiq.skills', <SkillsPage />)} />\n <Route\n path=\"certificates\"\n element={gated('buildmyiq.certificates', <CertificatesPage />)}\n />\n\n <Route\n path=\"admin-copilot\"\n element={gated('buildmyiq.admin-copilot', <AdminCopilotPage />)}\n />\n <Route\n path=\"integrations\"\n element={gated('buildmyiq.integrations', <LtiPlatformsPage />)}\n />\n <Route path=\"migration\" element={gated('buildmyiq.migration', <MigrationCenterPage />)} />\n <Route path=\"automations\" element={gated('buildmyiq.automations', <AutomationsPage />)} />\n <Route path=\"ai-settings\" element={gated('buildmyiq.ai-settings', <AiSettingsPage />)} />\n <Route\n path=\"provisioning\"\n element={gated('buildmyiq.provisioning', <ProvisioningPage />)}\n />\n {/* Not feature-gated: learners arrive here from their LMS, and the\n launch only exists because a workspace admin registered it. */}\n <Route path=\"lti/launch/:ticketId\" element={<LtiLaunchPage />} />\n\n <Route path=\"*\" element={<Navigate to={normalizedBasePath || '/'} replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,IAAc,QAClB,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAChF,GACM,IAAmB,QACvB,OAAO,uCAAoC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAC1F,GAGM,IAAiB,QACrB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACvF,GACM,IAAmB,QACvB,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAC3F,GAGM,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CACtF,GACM,IAAoB,QACxB,OAAO,0CAAuC,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAA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O,MAAK;KAAc,SAAS,EAAM,yBAAyB,kBAAC,GAAD,CAAiB,CAAA,CAAC;IAAI,CAAA;IACxF,kBAAC,GAAD;KACE,MAAK;KACL,SAAS,EAAM,0BAA0B,kBAAC,GAAD,CAAmB,CAAA,CAAC;IAC9D,CAAA;IAGD,kBAAC,GAAD;KAAO,MAAK;KAAuB,SAAS,kBAAC,GAAD,CAAgB,CAAA;IAAI,CAAA;IAEhE,kBAAC,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAC,GAAD;MAAU,IAAI,KAAsB;MAAK,SAAA;KAAS,CAAA;IAAI,CAAA;GACzE,EAAA,CAAA;EACA,CAAA;CACP,CAAA;AAET"}
@@ -1,11 +1,15 @@
1
1
  /**
2
- * BuiDiscussion — a comment thread on any Buildmyiq entity (Integration B).
2
+ * BuiDiscussion — a threaded comment discussion on any Buildmyiq entity (Integration B).
3
3
  * @module buildmyiq/components/BuiDiscussion
4
4
  *
5
5
  * Reuses the platform EntityComment API (`getEntityComments` /
6
- * `createEntityComment`) keyed by `(entityType, entityId)` — no buildmyiq-svc change.
7
- * Renders root comments (author, body, time) + a composer. Robust to empty
8
- * state and errors.
6
+ * `createEntityComment` / `add|removeEntityCommentReaction`) keyed by
7
+ * `(entityType, entityId)` — no buildmyiq-svc change. Renders the discussion
8
+ * as threads: every comment can be replied to (replies nest beneath their
9
+ * parent, indentation capped so deep threads stay readable) and liked.
10
+ * Posting and reacting are enforced by the workspace gateway's `@rbac`
11
+ * directives on the conversations subgraph; a refused write shows its error
12
+ * inline. Robust to empty state and errors.
9
13
  */
10
14
  interface BuiDiscussionProps {
11
15
  entityType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BuiDiscussion.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/components/BuiDiscussion.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,QAAQ,EACR,KAAoB,EACpB,WAAkE,GACnE,EAAE,kBAAkB,+BAyGpB"}
1
+ {"version":3,"file":"BuiDiscussion.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/components/BuiDiscussion.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAuGD,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,QAAQ,EACR,KAAoB,EACpB,WAAkE,GACnE,EAAE,kBAAkB,+BA0LpB"}
@@ -1,111 +1,214 @@
1
1
  import { useBuildmyiq as e } from "../context/BuildmyiqContext.js";
2
2
  import "../context/index.js";
3
- import { formatDateTime as t } from "../utils/formatters.js";
4
- import { EmptyState as n } from "./EmptyState.js";
5
- import { ErrorView as r, LoadingView as i, Section as a } from "./StateViews.js";
6
- import { useBuiComments as o, useEcoCreateComment as s } from "../hooks/useBuiComments.js";
3
+ import { useTr as t } from "../shared/hooks/useTr.js";
4
+ import { cn as n } from "../utils/cn.js";
5
+ import { formatDateTime as r } from "../utils/formatters.js";
6
+ import { EmptyState as i } from "./EmptyState.js";
7
+ import { ErrorView as a, LoadingView as o, Section as s } from "./StateViews.js";
8
+ import { countComments as c, likeState as l, useBuiComments as u, useBuiToggleCommentLike as d, useEcoCreateComment as f } from "../hooks/useBuiComments.js";
7
9
  import "../hooks/index.js";
8
- import { useState as c } from "react";
9
- import { MessageSquare as l, Send as u } from "lucide-react";
10
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
11
- import { Button as p, Textarea as m } from "@burdenoff/fe-libs/ui";
10
+ import { useState as p } from "react";
11
+ import { MessageSquare as m, Reply as h, Send as g, ThumbsUp as _ } from "lucide-react";
12
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
13
+ import { Button as x, Textarea as S } from "@burdenoff/fe-libs/ui";
12
14
  //#region src/buildmyiq/components/BuiDiscussion.tsx
13
- function h(e) {
15
+ var C = 3;
16
+ function w(e) {
14
17
  if (!e) return "You";
15
18
  let t = [e.firstName, e.lastName].filter(Boolean).join(" ").trim();
16
19
  return e.name || t || e.username || e.email || "You";
17
20
  }
18
- function g(e) {
21
+ function T(e) {
19
22
  let t = e.trim();
20
23
  return t ? t[0].toUpperCase() : "?";
21
24
  }
22
- function _({ entityType: _, entityId: v, title: y = "Discussion", description: b = "Coordinate review and verification with your team." }) {
23
- let { currentUser: x } = e(), { data: S, isLoading: C, isError: w, refetch: T } = o(_, v), E = s(_, v), [D, O] = c(""), [k, A] = c(null), j = h(x), M = (e) => x?.id && e.authorId === x.id ? j : "Workspace member", N = async () => {
24
- let e = D.trim();
25
- if (e) {
26
- A(null);
27
- try {
28
- await E.mutateAsync(e), O("");
29
- } catch (e) {
30
- A(e instanceof Error ? e.message : "Failed to post comment.");
31
- }
25
+ var E = (e, t) => e instanceof Error ? e.message : t, D = ({ initial: e, placeholder: t, ariaLabel: n, submitLabel: r, pendingLabel: i, errorFallback: a, autoFocus: o, onSubmit: s, onCancel: c, cancelLabel: l }) => {
26
+ let [u, d] = p(""), [f, m] = p(null), [h, _] = p(!1);
27
+ return /* @__PURE__ */ b("div", {
28
+ className: "flex gap-3",
29
+ children: [/* @__PURE__ */ y("div", {
30
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/15 text-sm font-semibold text-action-primary-bg",
31
+ children: e
32
+ }), /* @__PURE__ */ b("div", {
33
+ className: "min-w-0 flex-1",
34
+ children: [/* @__PURE__ */ y(S, {
35
+ value: u,
36
+ onChange: (e) => d(e.target.value),
37
+ placeholder: t,
38
+ "aria-label": n,
39
+ rows: 2,
40
+ autoFocus: o
41
+ }), /* @__PURE__ */ b("div", {
42
+ className: "mt-2 flex items-center justify-end gap-2",
43
+ children: [
44
+ f && /* @__PURE__ */ y("span", {
45
+ role: "alert",
46
+ className: "me-auto text-xs text-status-error-text",
47
+ children: f
48
+ }),
49
+ c && /* @__PURE__ */ y(x, {
50
+ size: "sm",
51
+ variant: "ghost",
52
+ onClick: c,
53
+ disabled: h,
54
+ children: l
55
+ }),
56
+ /* @__PURE__ */ b(x, {
57
+ size: "sm",
58
+ onClick: async () => {
59
+ let e = u.trim();
60
+ if (!(!e || h)) {
61
+ m(null), _(!0);
62
+ try {
63
+ await s(e), d("");
64
+ } catch (e) {
65
+ m(E(e, a));
66
+ } finally {
67
+ _(!1);
68
+ }
69
+ }
70
+ },
71
+ disabled: !u.trim() || h,
72
+ children: [/* @__PURE__ */ y(g, { className: "me-1.5 h-4 w-4" }), h ? i : r]
73
+ })
74
+ ]
75
+ })]
76
+ })]
77
+ });
78
+ };
79
+ function O({ entityType: g, entityId: S, title: O = "Discussion", description: k = "Coordinate review and verification with your team." }) {
80
+ let { currentUser: A } = e(), j = t(), { data: M, isLoading: N, isError: P, refetch: F } = u(g, S), I = f(g, S), L = d(g, S), [R, z] = p(null), [B, V] = p(null), H = w(A), U = A?.id, W = (e) => U && e.authorId === U ? H : j("buildmyiq.discussion.workspaceMember", "Workspace member"), G = M?.threads ?? [], K = c(G), q = async (e, t) => {
81
+ V(null);
82
+ try {
83
+ await L.mutateAsync({
84
+ commentId: e.id,
85
+ like: !t
86
+ });
87
+ } catch (e) {
88
+ V(E(e, j("buildmyiq.discussion.likeError", "Could not update the like.")));
32
89
  }
33
- }, P = S?.items ?? [];
34
- return /* @__PURE__ */ d(a, {
35
- title: y,
36
- description: b,
37
- children: /* @__PURE__ */ f("div", {
38
- className: "rounded-xl border border-border-seam bg-bg-surface/40 p-4",
39
- children: [/* @__PURE__ */ f("div", {
90
+ }, J = (e, t) => {
91
+ let i = W(e), a = e.content.text ?? e.content.markdown ?? "", { count: o, likedByMe: s } = l(e, U), c = L.isPending && L.variables?.commentId === e.id, u = t < C;
92
+ return /* @__PURE__ */ b("li", {
93
+ className: "flex flex-col gap-3",
94
+ "data-testid": "bui-discussion-comment",
95
+ children: [/* @__PURE__ */ b("div", {
40
96
  className: "flex gap-3",
41
- children: [/* @__PURE__ */ d("div", {
42
- className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/15 text-sm font-semibold text-action-primary-bg",
43
- children: g(j)
44
- }), /* @__PURE__ */ f("div", {
45
- className: "flex-1",
46
- children: [/* @__PURE__ */ d(m, {
47
- value: D,
48
- onChange: (e) => O(e.target.value),
49
- placeholder: "Add a comment for your team…",
50
- "aria-label": "Comment",
51
- rows: 2
52
- }), /* @__PURE__ */ f("div", {
53
- className: "mt-2 flex items-center justify-end gap-2",
54
- children: [k && /* @__PURE__ */ d("span", {
55
- role: "alert",
56
- className: "me-auto text-xs text-status-error-text",
57
- children: k
58
- }), /* @__PURE__ */ f(p, {
59
- size: "sm",
60
- onClick: N,
61
- disabled: !D.trim() || E.isPending,
62
- children: [/* @__PURE__ */ d(u, { className: "me-1.5 h-4 w-4" }), E.isPending ? "Posting…" : "Comment"]
63
- })]
64
- })]
97
+ children: [/* @__PURE__ */ y("div", {
98
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-secondary",
99
+ children: T(i)
100
+ }), /* @__PURE__ */ b("div", {
101
+ className: "min-w-0 flex-1",
102
+ children: [
103
+ /* @__PURE__ */ b("div", {
104
+ className: "flex flex-wrap items-baseline gap-x-2",
105
+ children: [/* @__PURE__ */ y("span", {
106
+ className: "text-sm font-semibold text-text-primary",
107
+ children: i
108
+ }), /* @__PURE__ */ b("span", {
109
+ className: "text-xs text-text-tertiary",
110
+ children: [r(e.createdAt), e.edited ? ` · ${j("buildmyiq.discussion.edited", "edited")}` : ""]
111
+ })]
112
+ }),
113
+ /* @__PURE__ */ y("p", {
114
+ className: "mt-0.5 whitespace-pre-wrap break-words text-sm text-text-secondary",
115
+ children: a
116
+ }),
117
+ /* @__PURE__ */ b("div", {
118
+ className: "mt-1.5 flex items-center gap-1",
119
+ children: [/* @__PURE__ */ b(x, {
120
+ size: "sm",
121
+ variant: "ghost",
122
+ className: n("h-7 px-2 text-xs", s && "text-action-primary-bg"),
123
+ "aria-pressed": s,
124
+ "aria-label": s ? j("buildmyiq.discussion.unlikeAria", "Unlike comment") : j("buildmyiq.discussion.likeAria", "Like comment"),
125
+ disabled: !U || c,
126
+ onClick: () => q(e, s),
127
+ children: [/* @__PURE__ */ y(_, { className: n("me-1 h-3.5 w-3.5", s && "fill-current") }), o > 0 ? /* @__PURE__ */ y("span", {
128
+ className: "tabular-nums",
129
+ children: o
130
+ }) : j("buildmyiq.discussion.like", "Like")]
131
+ }), /* @__PURE__ */ b(x, {
132
+ size: "sm",
133
+ variant: "ghost",
134
+ className: "h-7 px-2 text-xs",
135
+ "aria-expanded": R === e.id,
136
+ onClick: () => z(R === e.id ? null : e.id),
137
+ children: [/* @__PURE__ */ y(h, { className: "me-1 h-3.5 w-3.5 rtl:-scale-x-100" }), j("buildmyiq.discussion.reply", "Reply")]
138
+ })]
139
+ })
140
+ ]
65
141
  })]
66
- }), /* @__PURE__ */ d("div", {
142
+ }), (R === e.id || e.replies.length > 0) && /* @__PURE__ */ b("div", {
143
+ className: n("flex flex-col gap-3", u && "ms-4 border-s border-border-seam ps-4 sm:ms-11"),
144
+ children: [R === e.id && /* @__PURE__ */ y(D, {
145
+ initial: T(H),
146
+ placeholder: j("buildmyiq.discussion.replyPlaceholder", "Write a reply…"),
147
+ ariaLabel: j("buildmyiq.discussion.replyAria", "Reply"),
148
+ submitLabel: j("buildmyiq.discussion.replyButton", "Reply"),
149
+ pendingLabel: j("buildmyiq.discussion.posting", "Posting…"),
150
+ cancelLabel: j("buildmyiq.discussion.cancel", "Cancel"),
151
+ errorFallback: j("buildmyiq.discussion.postError", "Failed to post comment."),
152
+ autoFocus: !0,
153
+ onCancel: () => z(null),
154
+ onSubmit: async (t) => {
155
+ await I.mutateAsync({
156
+ text: t,
157
+ parentCommentId: e.id
158
+ }), z((t) => t === e.id ? null : t);
159
+ }
160
+ }), e.replies.length > 0 && /* @__PURE__ */ y("ul", {
161
+ className: "flex flex-col gap-4",
162
+ children: e.replies.map((e) => J(e, t + 1))
163
+ })]
164
+ })]
165
+ }, e.id);
166
+ };
167
+ return /* @__PURE__ */ y(s, {
168
+ title: O,
169
+ description: k,
170
+ children: /* @__PURE__ */ b("div", {
171
+ className: "rounded-xl border border-border-seam bg-bg-surface/40 p-4",
172
+ children: [/* @__PURE__ */ y(D, {
173
+ initial: T(H),
174
+ placeholder: j("buildmyiq.discussion.placeholder", "Add a comment for your team…"),
175
+ ariaLabel: j("buildmyiq.discussion.commentAria", "Comment"),
176
+ submitLabel: j("buildmyiq.discussion.commentButton", "Comment"),
177
+ pendingLabel: j("buildmyiq.discussion.posting", "Posting…"),
178
+ errorFallback: j("buildmyiq.discussion.postError", "Failed to post comment."),
179
+ onSubmit: async (e) => {
180
+ await I.mutateAsync({ text: e });
181
+ }
182
+ }), /* @__PURE__ */ y("div", {
67
183
  className: "mt-4 border-t border-border-seam pt-4",
68
- children: C ? /* @__PURE__ */ d(i, { label: "Loading discussion…" }) : w ? /* @__PURE__ */ d(r, {
69
- message: "Couldn't load the discussion.",
70
- onRetry: () => T()
71
- }) : P.length === 0 ? /* @__PURE__ */ d(n, {
184
+ children: N ? /* @__PURE__ */ y(o, { label: j("buildmyiq.discussion.loading", "Loading discussion…") }) : P ? /* @__PURE__ */ y(a, {
185
+ message: j("buildmyiq.discussion.loadError", "Couldn't load the discussion."),
186
+ onRetry: () => F()
187
+ }) : G.length === 0 ? /* @__PURE__ */ y(i, {
72
188
  illustration: "empty-data",
73
- icon: /* @__PURE__ */ d(l, { className: "h-9 w-9" }),
74
- title: "No comments yet",
75
- description: "Start the discussion by adding the first comment."
76
- }) : /* @__PURE__ */ d("ul", {
77
- className: "flex flex-col gap-4",
78
- children: P.map((e) => {
79
- let n = M(e), r = e.content.text ?? e.content.markdown ?? "";
80
- return /* @__PURE__ */ f("li", {
81
- className: "flex gap-3",
82
- children: [/* @__PURE__ */ d("div", {
83
- className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-secondary",
84
- children: g(n)
85
- }), /* @__PURE__ */ f("div", {
86
- className: "min-w-0 flex-1",
87
- children: [/* @__PURE__ */ f("div", {
88
- className: "flex flex-wrap items-baseline gap-x-2",
89
- children: [/* @__PURE__ */ d("span", {
90
- className: "text-sm font-semibold text-text-primary",
91
- children: n
92
- }), /* @__PURE__ */ f("span", {
93
- className: "text-xs text-text-tertiary",
94
- children: [t(e.createdAt), e.edited ? " · edited" : ""]
95
- })]
96
- }), /* @__PURE__ */ d("p", {
97
- className: "mt-0.5 whitespace-pre-wrap break-words text-sm text-text-secondary",
98
- children: r
99
- })]
100
- })]
101
- }, e.id);
189
+ icon: /* @__PURE__ */ y(m, { className: "h-9 w-9" }),
190
+ title: j("buildmyiq.discussion.emptyTitle", "No comments yet"),
191
+ description: j("buildmyiq.discussion.emptyDescription", "Start the discussion by adding the first comment.")
192
+ }) : /* @__PURE__ */ b(v, { children: [
193
+ /* @__PURE__ */ y("p", {
194
+ className: "mb-3 text-xs text-text-tertiary",
195
+ children: j(K === 1 ? "buildmyiq.discussion.countSingular" : "buildmyiq.discussion.countPlural", K === 1 ? "{{n}} comment" : "{{n}} comments", { n: K })
196
+ }),
197
+ B && /* @__PURE__ */ y("p", {
198
+ role: "alert",
199
+ className: "mb-3 text-xs text-status-error-text",
200
+ children: B
201
+ }),
202
+ /* @__PURE__ */ y("ul", {
203
+ className: "flex flex-col gap-4",
204
+ children: G.map((e) => J(e, 0))
102
205
  })
103
- })
206
+ ] })
104
207
  })]
105
208
  })
106
209
  });
107
210
  }
108
211
  //#endregion
109
- export { _ as BuiDiscussion };
212
+ export { O as BuiDiscussion };
110
213
 
111
214
  //# sourceMappingURL=BuiDiscussion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuiDiscussion.js","names":[],"sources":["../../../src/buildmyiq/components/BuiDiscussion.tsx"],"sourcesContent":["/**\n * BuiDiscussion — a comment thread on any Buildmyiq entity (Integration B).\n * @module buildmyiq/components/BuiDiscussion\n *\n * Reuses the platform EntityComment API (`getEntityComments` /\n * `createEntityComment`) keyed by `(entityType, entityId)` — no buildmyiq-svc change.\n * Renders root comments (author, body, time) + a composer. Robust to empty\n * state and errors.\n */\n\nimport { useState } from 'react';\nimport { MessageSquare, Send } from 'lucide-react';\nimport { Button, Textarea } from '@burdenoff/fe-libs/ui';\nimport { Section, LoadingView, ErrorView } from './StateViews';\nimport { EmptyState } from './EmptyState';\nimport { useBuildmyiq } from '../context';\nimport { useBuiComments, useEcoCreateComment, type BuiComment } from '../hooks';\nimport { formatDateTime } from '../utils/formatters';\n\ninterface BuiDiscussionProps {\n entityType: string;\n entityId: string;\n title?: string;\n description?: string;\n}\n\nfunction displayName(user: ReturnType<typeof useBuildmyiq>['currentUser']): string {\n if (!user) return 'You';\n const full = [user.firstName, user.lastName].filter(Boolean).join(' ').trim();\n return user.name || full || user.username || user.email || 'You';\n}\n\nfunction initialFor(label: string): string {\n const trimmed = label.trim();\n return trimmed ? trimmed[0]!.toUpperCase() : '?';\n}\n\nexport function BuiDiscussion({\n entityType,\n entityId,\n title = 'Discussion',\n description = 'Coordinate review and verification with your team.',\n}: BuiDiscussionProps) {\n const { currentUser } = useBuildmyiq();\n const { data, isLoading, isError, refetch } = useBuiComments(entityType, entityId);\n const createComment = useEcoCreateComment(entityType, entityId);\n\n const [draft, setDraft] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const selfName = displayName(currentUser);\n\n const authorLabel = (comment: BuiComment): string =>\n currentUser?.id && comment.authorId === currentUser.id ? selfName : 'Workspace member';\n\n const handleSubmit = async () => {\n const text = draft.trim();\n if (!text) return;\n setError(null);\n try {\n await createComment.mutateAsync(text);\n setDraft('');\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to post comment.');\n }\n };\n\n const comments = data?.items ?? [];\n\n return (\n <Section title={title} description={description}>\n <div className=\"rounded-xl border border-border-seam bg-bg-surface/40 p-4\">\n {/* Composer */}\n <div className=\"flex gap-3\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/15 text-sm font-semibold text-action-primary-bg\">\n {initialFor(selfName)}\n </div>\n <div className=\"flex-1\">\n <Textarea\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n placeholder=\"Add a comment for your team…\"\n aria-label=\"Comment\"\n rows={2}\n />\n <div className=\"mt-2 flex items-center justify-end gap-2\">\n {error && (\n <span role=\"alert\" className=\"me-auto text-xs text-status-error-text\">\n {error}\n </span>\n )}\n <Button\n size=\"sm\"\n onClick={handleSubmit}\n disabled={!draft.trim() || createComment.isPending}\n >\n <Send className=\"me-1.5 h-4 w-4\" />\n {createComment.isPending ? 'Posting…' : 'Comment'}\n </Button>\n </div>\n </div>\n </div>\n\n {/* Thread */}\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n {isLoading ? (\n <LoadingView label=\"Loading discussion…\" />\n ) : isError ? (\n <ErrorView message=\"Couldn't load the discussion.\" onRetry={() => refetch()} />\n ) : comments.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<MessageSquare className=\"h-9 w-9\" />}\n title=\"No comments yet\"\n description=\"Start the discussion by adding the first comment.\"\n />\n ) : (\n <ul className=\"flex flex-col gap-4\">\n {comments.map((comment) => {\n const label = authorLabel(comment);\n const body = comment.content.text ?? comment.content.markdown ?? '';\n return (\n <li key={comment.id} className=\"flex gap-3\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-secondary\">\n {initialFor(label)}\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-baseline gap-x-2\">\n <span className=\"text-sm font-semibold text-text-primary\">{label}</span>\n <span className=\"text-xs text-text-tertiary\">\n {formatDateTime(comment.createdAt)}\n {comment.edited ? ' · edited' : ''}\n </span>\n </div>\n <p className=\"mt-0.5 whitespace-pre-wrap break-words text-sm text-text-secondary\">\n {body}\n </p>\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,SAAS,EAAY,GAA8D;CACjF,IAAI,CAAC,GAAM,OAAO;CAClB,IAAM,IAAO,CAAC,EAAK,WAAW,EAAK,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK;CAC5E,OAAO,EAAK,QAAQ,KAAQ,EAAK,YAAY,EAAK,SAAS;AAC7D;AAEA,SAAS,EAAW,GAAuB;CACzC,IAAM,IAAU,EAAM,KAAK;CAC3B,OAAO,IAAU,EAAQ,GAAI,YAAY,IAAI;AAC/C;AAEA,SAAgB,EAAc,EAC5B,eACA,aACA,WAAQ,cACR,iBAAc,wDACO;CACrB,IAAM,EAAE,mBAAgB,EAAa,GAC/B,EAAE,SAAM,cAAW,YAAS,eAAY,EAAe,GAAY,CAAQ,GAC3E,IAAgB,EAAoB,GAAY,CAAQ,GAExD,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,CAAC,GAAO,KAAY,EAAwB,IAAI,GAEhD,IAAW,EAAY,CAAW,GAElC,KAAe,MACnB,GAAa,MAAM,EAAQ,aAAa,EAAY,KAAK,IAAW,oBAEhE,IAAe,YAAY;EAC/B,IAAM,IAAO,EAAM,KAAK;EACnB,OACL;KAAS,IAAI;GACb,IAAI;IAEF,AADA,MAAM,EAAc,YAAY,CAAI,GACpC,EAAS,EAAE;GACb,SAAS,GAAK;IACZ,EAAS,aAAe,QAAQ,EAAI,UAAU,yBAAyB;GACzE;EANa;CAOf,GAEM,IAAW,GAAM,SAAS,CAAC;CAEjC,OACE,kBAAC,GAAD;EAAgB;EAAoB;YAClC,kBAAC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;UAAM,WAAU;oBAAhB,CACG,EAAe,EAAQ,SAAS,GAChC,EAAQ,SAAS,cAAc,EAC5B;WACH;YACL,kBAAC,KAAD;SAAG,WAAU;mBACV;QACA,CAAA,CACA;SACH;SAhBK,EAAQ,EAgBb;KAER,CAAC;IACC,CAAA;GAEH,CAAA,CACF;;CACE,CAAA;AAEb"}
1
+ {"version":3,"file":"BuiDiscussion.js","names":[],"sources":["../../../src/buildmyiq/components/BuiDiscussion.tsx"],"sourcesContent":["/**\n * BuiDiscussion — a threaded comment discussion on any Buildmyiq entity (Integration B).\n * @module buildmyiq/components/BuiDiscussion\n *\n * Reuses the platform EntityComment API (`getEntityComments` /\n * `createEntityComment` / `add|removeEntityCommentReaction`) keyed by\n * `(entityType, entityId)` — no buildmyiq-svc change. Renders the discussion\n * as threads: every comment can be replied to (replies nest beneath their\n * parent, indentation capped so deep threads stay readable) and liked.\n * Posting and reacting are enforced by the workspace gateway's `@rbac`\n * directives on the conversations subgraph; a refused write shows its error\n * inline. Robust to empty state and errors.\n */\n\nimport type { FC } from 'react';\nimport { useState } from 'react';\nimport { MessageSquare, Reply, Send, ThumbsUp } from 'lucide-react';\nimport { Button, Textarea } from '@burdenoff/fe-libs/ui';\nimport { Section, LoadingView, ErrorView } from './StateViews';\nimport { EmptyState } from './EmptyState';\nimport { useBuildmyiq } from '../context';\nimport {\n countComments,\n likeState,\n useBuiComments,\n useBuiToggleCommentLike,\n useEcoCreateComment,\n type BuiCommentNode,\n} from '../hooks';\nimport { useTr } from '../shared/hooks/useTr';\nimport { cn } from '../utils/cn';\nimport { formatDateTime } from '../utils/formatters';\n\ninterface BuiDiscussionProps {\n entityType: string;\n entityId: string;\n title?: string;\n description?: string;\n}\n\n/** Replies deeper than this render at the same indentation as this level. */\nconst MAX_INDENT_DEPTH = 3;\n\nfunction displayName(user: ReturnType<typeof useBuildmyiq>['currentUser']): string {\n if (!user) return 'You';\n const full = [user.firstName, user.lastName].filter(Boolean).join(' ').trim();\n return user.name || full || user.username || user.email || 'You';\n}\n\nfunction initialFor(label: string): string {\n const trimmed = label.trim();\n return trimmed ? trimmed[0]!.toUpperCase() : '?';\n}\n\nconst errorText = (err: unknown, fallback: string): string =>\n err instanceof Error ? err.message : fallback;\n\n/**\n * A textarea + submit button, used for the root composer and inline replies.\n * Each composer tracks its own in-flight submission, so opening an inline reply\n * while a top-level comment is posting never re-enables that composer's submit\n * button (the comment mutation is shared, so its `isPending` cannot tell them apart).\n */\nconst Composer: FC<{\n initial: string;\n placeholder: string;\n ariaLabel: string;\n submitLabel: string;\n pendingLabel: string;\n /** Translated message shown when the post fails without an error message. */\n errorFallback: string;\n autoFocus?: boolean;\n onSubmit: (text: string) => Promise<void>;\n onCancel?: () => void;\n cancelLabel?: string;\n}> = ({\n initial,\n placeholder,\n ariaLabel,\n submitLabel,\n pendingLabel,\n errorFallback,\n autoFocus,\n onSubmit,\n onCancel,\n cancelLabel,\n}) => {\n const [draft, setDraft] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [isPending, setIsPending] = useState(false);\n\n const submit = async (): Promise<void> => {\n const text = draft.trim();\n if (!text || isPending) return;\n setError(null);\n setIsPending(true);\n try {\n await onSubmit(text);\n setDraft('');\n } catch (err) {\n setError(errorText(err, errorFallback));\n } finally {\n setIsPending(false);\n }\n };\n\n return (\n <div className=\"flex gap-3\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/15 text-sm font-semibold text-action-primary-bg\">\n {initial}\n </div>\n <div className=\"min-w-0 flex-1\">\n <Textarea\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n placeholder={placeholder}\n aria-label={ariaLabel}\n rows={2}\n autoFocus={autoFocus}\n />\n <div className=\"mt-2 flex items-center justify-end gap-2\">\n {error && (\n <span role=\"alert\" className=\"me-auto text-xs text-status-error-text\">\n {error}\n </span>\n )}\n {onCancel && (\n <Button size=\"sm\" variant=\"ghost\" onClick={onCancel} disabled={isPending}>\n {cancelLabel}\n </Button>\n )}\n <Button size=\"sm\" onClick={submit} disabled={!draft.trim() || isPending}>\n <Send className=\"me-1.5 h-4 w-4\" />\n {isPending ? pendingLabel : submitLabel}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n\nexport function BuiDiscussion({\n entityType,\n entityId,\n title = 'Discussion',\n description = 'Coordinate review and verification with your team.',\n}: BuiDiscussionProps) {\n const { currentUser } = useBuildmyiq();\n const tr = useTr();\n const { data, isLoading, isError, refetch } = useBuiComments(entityType, entityId);\n const createComment = useEcoCreateComment(entityType, entityId);\n const toggleLike = useBuiToggleCommentLike(entityType, entityId);\n\n const [replyingTo, setReplyingTo] = useState<string | null>(null);\n const [likeError, setLikeError] = useState<string | null>(null);\n\n const selfName = displayName(currentUser);\n const userId = currentUser?.id;\n\n const authorLabel = (comment: BuiCommentNode): string =>\n userId && comment.authorId === userId\n ? selfName\n : tr('buildmyiq.discussion.workspaceMember', 'Workspace member');\n\n const threads = data?.threads ?? [];\n const total = countComments(threads);\n\n const handleLike = async (comment: BuiCommentNode, liked: boolean): Promise<void> => {\n setLikeError(null);\n try {\n await toggleLike.mutateAsync({ commentId: comment.id, like: !liked });\n } catch (err) {\n setLikeError(\n errorText(err, tr('buildmyiq.discussion.likeError', 'Could not update the like.'))\n );\n }\n };\n\n const renderComment = (comment: BuiCommentNode, depth: number) => {\n const label = authorLabel(comment);\n const body = comment.content.text ?? comment.content.markdown ?? '';\n const { count, likedByMe } = likeState(comment, userId);\n const likePending = toggleLike.isPending && toggleLike.variables?.commentId === comment.id;\n const nested = depth < MAX_INDENT_DEPTH;\n\n return (\n <li key={comment.id} className=\"flex flex-col gap-3\" data-testid=\"bui-discussion-comment\">\n <div className=\"flex gap-3\">\n <div className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-secondary\">\n {initialFor(label)}\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-baseline gap-x-2\">\n <span className=\"text-sm font-semibold text-text-primary\">{label}</span>\n <span className=\"text-xs text-text-tertiary\">\n {formatDateTime(comment.createdAt)}\n {comment.edited ? ` · ${tr('buildmyiq.discussion.edited', 'edited')}` : ''}\n </span>\n </div>\n <p className=\"mt-0.5 whitespace-pre-wrap break-words text-sm text-text-secondary\">\n {body}\n </p>\n <div className=\"mt-1.5 flex items-center gap-1\">\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className={cn('h-7 px-2 text-xs', likedByMe && 'text-action-primary-bg')}\n aria-pressed={likedByMe}\n aria-label={\n likedByMe\n ? tr('buildmyiq.discussion.unlikeAria', 'Unlike comment')\n : tr('buildmyiq.discussion.likeAria', 'Like comment')\n }\n disabled={!userId || likePending}\n onClick={() => handleLike(comment, likedByMe)}\n >\n <ThumbsUp className={cn('me-1 h-3.5 w-3.5', likedByMe && 'fill-current')} />\n {count > 0 ? (\n <span className=\"tabular-nums\">{count}</span>\n ) : (\n tr('buildmyiq.discussion.like', 'Like')\n )}\n </Button>\n <Button\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-7 px-2 text-xs\"\n aria-expanded={replyingTo === comment.id}\n onClick={() => setReplyingTo(replyingTo === comment.id ? null : comment.id)}\n >\n <Reply className=\"me-1 h-3.5 w-3.5 rtl:-scale-x-100\" />\n {tr('buildmyiq.discussion.reply', 'Reply')}\n </Button>\n </div>\n </div>\n </div>\n\n {(replyingTo === comment.id || comment.replies.length > 0) && (\n <div\n className={cn(\n 'flex flex-col gap-3',\n nested && 'ms-4 border-s border-border-seam ps-4 sm:ms-11'\n )}\n >\n {replyingTo === comment.id && (\n <Composer\n initial={initialFor(selfName)}\n placeholder={tr('buildmyiq.discussion.replyPlaceholder', 'Write a reply…')}\n ariaLabel={tr('buildmyiq.discussion.replyAria', 'Reply')}\n submitLabel={tr('buildmyiq.discussion.replyButton', 'Reply')}\n pendingLabel={tr('buildmyiq.discussion.posting', 'Posting…')}\n cancelLabel={tr('buildmyiq.discussion.cancel', 'Cancel')}\n errorFallback={tr('buildmyiq.discussion.postError', 'Failed to post comment.')}\n autoFocus\n onCancel={() => setReplyingTo(null)}\n onSubmit={async (text) => {\n await createComment.mutateAsync({ text, parentCommentId: comment.id });\n // Close only this composer: the learner may have opened another\n // reply while this one was posting, and that draft must survive.\n setReplyingTo((current) => (current === comment.id ? null : current));\n }}\n />\n )}\n {comment.replies.length > 0 && (\n <ul className=\"flex flex-col gap-4\">\n {comment.replies.map((reply) => renderComment(reply, depth + 1))}\n </ul>\n )}\n </div>\n )}\n </li>\n );\n };\n\n return (\n <Section title={title} description={description}>\n <div className=\"rounded-xl border border-border-seam bg-bg-surface/40 p-4\">\n <Composer\n initial={initialFor(selfName)}\n placeholder={tr('buildmyiq.discussion.placeholder', 'Add a comment for your team…')}\n ariaLabel={tr('buildmyiq.discussion.commentAria', 'Comment')}\n submitLabel={tr('buildmyiq.discussion.commentButton', 'Comment')}\n pendingLabel={tr('buildmyiq.discussion.posting', 'Posting…')}\n errorFallback={tr('buildmyiq.discussion.postError', 'Failed to post comment.')}\n onSubmit={async (text) => {\n await createComment.mutateAsync({ text });\n }}\n />\n\n <div className=\"mt-4 border-t border-border-seam pt-4\">\n {isLoading ? (\n <LoadingView label={tr('buildmyiq.discussion.loading', 'Loading discussion…')} />\n ) : isError ? (\n <ErrorView\n message={tr('buildmyiq.discussion.loadError', \"Couldn't load the discussion.\")}\n onRetry={() => refetch()}\n />\n ) : threads.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<MessageSquare className=\"h-9 w-9\" />}\n title={tr('buildmyiq.discussion.emptyTitle', 'No comments yet')}\n description={tr(\n 'buildmyiq.discussion.emptyDescription',\n 'Start the discussion by adding the first comment.'\n )}\n />\n ) : (\n <>\n <p className=\"mb-3 text-xs text-text-tertiary\">\n {tr(\n total === 1\n ? 'buildmyiq.discussion.countSingular'\n : 'buildmyiq.discussion.countPlural',\n total === 1 ? '{{n}} comment' : '{{n}} comments',\n { n: total }\n )}\n </p>\n {likeError && (\n <p role=\"alert\" className=\"mb-3 text-xs text-status-error-text\">\n {likeError}\n </p>\n )}\n <ul className=\"flex flex-col gap-4\">\n {threads.map((comment) => renderComment(comment, 0))}\n </ul>\n </>\n )}\n </div>\n </div>\n </Section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,IAAM,IAAmB;AAEzB,SAAS,EAAY,GAA8D;CACjF,IAAI,CAAC,GAAM,OAAO;CAClB,IAAM,IAAO,CAAC,EAAK,WAAW,EAAK,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK;CAC5E,OAAO,EAAK,QAAQ,KAAQ,EAAK,YAAY,EAAK,SAAS;AAC7D;AAEA,SAAS,EAAW,GAAuB;CACzC,IAAM,IAAU,EAAM,KAAK;CAC3B,OAAO,IAAU,EAAQ,GAAI,YAAY,IAAI;AAC/C;AAEA,IAAM,KAAa,GAAc,MAC/B,aAAe,QAAQ,EAAI,UAAU,GAQjC,KAYA,EACJ,YACA,gBACA,cACA,gBACA,iBACA,kBACA,cACA,aACA,aACA,qBACI;CACJ,IAAM,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,CAAC,GAAO,KAAY,EAAwB,IAAI,GAChD,CAAC,GAAW,KAAgB,EAAS,EAAK;CAiBhD,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aACZ;EACE,CAAA,GACL,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IACE,OAAO;IACP,WAAW,MAAM,EAAS,EAAE,OAAO,KAAK;IAC3B;IACb,cAAY;IACZ,MAAM;IACK;GACZ,CAAA,GACD,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,KACC,kBAAC,QAAD;MAAM,MAAK;MAAQ,WAAU;gBAC1B;KACG,CAAA;KAEP,KACC,kBAAC,GAAD;MAAQ,MAAK;MAAK,SAAQ;MAAQ,SAAS;MAAU,UAAU;gBAC5D;KACK,CAAA;KAEV,kBAAC,GAAD;MAAQ,MAAK;MAA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AD;KACE,SAAS,EAAG,kCAAkC,+BAA+B;KAC7E,eAAe,EAAQ;IACxB,CAAA,IACC,EAAQ,WAAW,IACrB,kBAAC,GAAD;KACE,cAAa;KACb,MAAM,kBAAC,GAAD,EAAe,WAAU,UAAW,CAAA;KAC1C,OAAO,EAAG,mCAAmC,iBAAiB;KAC9D,aAAa,EACX,yCACA,mDACF;IACD,CAAA,IAED,kBAAA,GAAA,EAAA,UAAA;KACE,kBAAC,KAAD;MAAG,WAAU;gBACV,EACC,MAAU,IACN,uCACA,oCACJ,MAAU,IAAI,kBAAkB,kBAChC,EAAE,GAAG,EAAM,CACb;KACC,CAAA;KACF,KACC,kBAAC,KAAD;MAAG,MAAK;MAAQ,WAAU;gBACvB;KACA,CAAA;KAEL,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAQ,KAAK,MAAY,EAAc,GAAS,CAAC,CAAC;KACjD,CAAA;IACJ,EAAA,CAAA;GAED,CAAA,CACF;;CACE,CAAA;AAEb"}
@@ -15,4 +15,5 @@ export * from './useBuiCredentials';
15
15
  export * from './useBuiAccessibility';
16
16
  export * from './useBuiMigration';
17
17
  export * from './useScimProvisioning';
18
+ export * from './useBuiLearningObjects';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
@@ -12,3 +12,4 @@ import "./accessibilityDraft.js";
12
12
  import "./useBuiAccessibility.js";
13
13
  import "./useBuiMigration.js";
14
14
  import "./useScimProvisioning.js";
15
+ import "./useBuiLearningObjects.js";
@@ -2,16 +2,29 @@
2
2
  * Buildmyiq — wspace-conversations-svc EntityComment REUSE hooks (Integration B).
3
3
  * @module buildmyiq/hooks/useBuiComments
4
4
  *
5
- * Adds a discussion surface to Buildmyiq entities WITHOUT any buildmyiq-svc change by
6
- * reusing the generic EntityComment API composed into the WORKSPACE supergraph.
7
- * Comments attach to any entity by `(entityType, entityId)`:
8
- * - `getEntityComments(input): EntityCommentConnection!`
9
- * - `createEntityComment(input): EntityComment!`
5
+ * Adds a threaded discussion surface to Buildmyiq entities WITHOUT any
6
+ * buildmyiq-svc change by reusing the generic EntityComment API composed into
7
+ * the WORKSPACE supergraph. Comments attach to any entity by
8
+ * `(entityType, entityId)`:
9
+ * - `getEntityComments(input): EntityCommentConnection!` — every comment on
10
+ * the entity (roots and replies); the thread tree is built client-side
11
+ * from `parentCommentId` (see `buildCommentTree`).
12
+ * - `createEntityComment(input)` — a root comment, or a reply when
13
+ * `parentCommentId` is set.
14
+ * - `addEntityCommentReaction` / `removeEntityCommentReaction` — the "like"
15
+ * reaction. The service always records the reaction for the authenticated
16
+ * actor, so no user id is sent.
10
17
  *
11
18
  * Transport reuses `wspaceFetch` from `useBuiFiles` (workspace gateway +
12
- * workspace token). Lives in a separate file; `useBuildmyiqApi.ts` is
13
- * untouched.
19
+ * workspace token).
14
20
  */
21
+ /** The emoji stored for a "like" on a comment. */
22
+ export declare const LIKE_EMOJI = "\uD83D\uDC4D";
23
+ export interface BuiCommentReaction {
24
+ emoji: string;
25
+ count: number;
26
+ userIds: string[];
27
+ }
15
28
  export interface BuiComment {
16
29
  id: string;
17
30
  authorId: string;
@@ -24,13 +37,40 @@ export interface BuiComment {
24
37
  edited: boolean;
25
38
  parentCommentId: string | null;
26
39
  replyCount: number;
40
+ reactionSummary: BuiCommentReaction[];
41
+ }
42
+ /** A comment with its replies nested beneath it, oldest first at every level. */
43
+ export interface BuiCommentNode extends BuiComment {
44
+ replies: BuiCommentNode[];
27
45
  }
28
- /** Top-level (root) comments for an Buildmyiq entity, oldest first. */
46
+ /**
47
+ * Nest a flat comment list into threads by `parentCommentId`. A reply whose
48
+ * parent is not in the list (deleted, or beyond the load ceiling) is shown as a
49
+ * root so it never silently disappears. Siblings are ordered oldest first.
50
+ */
51
+ export declare function buildCommentTree(comments: readonly BuiComment[]): BuiCommentNode[];
52
+ /** Likes on a comment and whether the given user is one of them. */
53
+ export declare function likeState(comment: Pick<BuiComment, 'reactionSummary'>, userId: string | undefined): {
54
+ count: number;
55
+ likedByMe: boolean;
56
+ };
57
+ /** Total comments in a thread tree (roots and every nested reply). */
58
+ export declare function countComments(nodes: readonly BuiCommentNode[]): number;
59
+ /** Every comment (roots and replies) on a Buildmyiq entity, nested into threads. */
29
60
  export declare const useBuiComments: (entityType: string, entityId: string | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<{
30
- items: BuiComment[];
61
+ threads: BuiCommentNode[];
31
62
  total: number;
32
63
  }>, Error>;
64
+ /** Post a root comment, or a reply when `parentCommentId` is given. */
33
65
  export declare const useEcoCreateComment: (entityType: string, entityId: string) => import('@tanstack/react-query').UseMutationResult<{
34
66
  id: string;
35
- }, Error, string, unknown>;
67
+ }, Error, string | {
68
+ text: string;
69
+ parentCommentId?: string;
70
+ }, unknown>;
71
+ /** Like or unlike a comment as the signed-in user. */
72
+ export declare const useBuiToggleCommentLike: (entityType: string, entityId: string) => import('@tanstack/react-query').UseMutationResult<boolean, Error, {
73
+ commentId: string;
74
+ like: boolean;
75
+ }, unknown>;
36
76
  //# sourceMappingURL=useBuiComments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBuiComments.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useBuiComments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,uEAAuE;AACvE,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS;;;UAwC9E,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM;QAKN,MAAM;0BAmBvE,CAAC"}
1
+ {"version":3,"file":"useBuiComments.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useBuiComments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,kDAAkD;AAClD,eAAO,MAAM,UAAU,iBAAO,CAAC;AAO/B,MAAM,WAAW,kBAAkB;IACjC,KAAK,E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