@happyvertical/smrt-content 0.30.0

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 (291) hide show
  1. package/AGENTS.md +194 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +634 -0
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/asset-associable.d.ts +115 -0
  8. package/dist/asset-associable.d.ts.map +1 -0
  9. package/dist/body-format.d.ts +29 -0
  10. package/dist/body-format.d.ts.map +1 -0
  11. package/dist/body-format.js +604 -0
  12. package/dist/body-format.js.map +1 -0
  13. package/dist/content-asset.d.ts +17 -0
  14. package/dist/content-asset.d.ts.map +1 -0
  15. package/dist/content-assets.d.ts +10 -0
  16. package/dist/content-assets.d.ts.map +1 -0
  17. package/dist/content-chat-handlers.d.ts +115 -0
  18. package/dist/content-chat-handlers.d.ts.map +1 -0
  19. package/dist/content-chat-prompts.d.ts +3 -0
  20. package/dist/content-chat-prompts.d.ts.map +1 -0
  21. package/dist/content-chat-session.d.ts +26 -0
  22. package/dist/content-chat-session.d.ts.map +1 -0
  23. package/dist/content-contribution-attachment.d.ts +42 -0
  24. package/dist/content-contribution-attachment.d.ts.map +1 -0
  25. package/dist/content-contribution-attachments.d.ts +8 -0
  26. package/dist/content-contribution-attachments.d.ts.map +1 -0
  27. package/dist/content-contribution-config.d.ts +84 -0
  28. package/dist/content-contribution-config.d.ts.map +1 -0
  29. package/dist/content-contribution-revision.d.ts +38 -0
  30. package/dist/content-contribution-revision.d.ts.map +1 -0
  31. package/dist/content-contribution-revisions.d.ts +8 -0
  32. package/dist/content-contribution-revisions.d.ts.map +1 -0
  33. package/dist/content-contribution-type.d.ts +51 -0
  34. package/dist/content-contribution-type.d.ts.map +1 -0
  35. package/dist/content-contribution-types.d.ts +7 -0
  36. package/dist/content-contribution-types.d.ts.map +1 -0
  37. package/dist/content-contribution.d.ts +161 -0
  38. package/dist/content-contribution.d.ts.map +1 -0
  39. package/dist/content-contributions.d.ts +53 -0
  40. package/dist/content-contributions.d.ts.map +1 -0
  41. package/dist/content-contributor.d.ts +30 -0
  42. package/dist/content-contributor.d.ts.map +1 -0
  43. package/dist/content-contributors.d.ts +13 -0
  44. package/dist/content-contributors.d.ts.map +1 -0
  45. package/dist/content-correction.d.ts +39 -0
  46. package/dist/content-correction.d.ts.map +1 -0
  47. package/dist/content-corrections.d.ts +9 -0
  48. package/dist/content-corrections.d.ts.map +1 -0
  49. package/dist/content-editor-assistant.d.ts +68 -0
  50. package/dist/content-editor-assistant.d.ts.map +1 -0
  51. package/dist/content-editor-assistant.js +97 -0
  52. package/dist/content-editor-assistant.js.map +1 -0
  53. package/dist/content-feed-parser.d.ts +19 -0
  54. package/dist/content-feed-parser.d.ts.map +1 -0
  55. package/dist/content-feed-source.d.ts +52 -0
  56. package/dist/content-feed-source.d.ts.map +1 -0
  57. package/dist/content-feed-sources.d.ts +11 -0
  58. package/dist/content-feed-sources.d.ts.map +1 -0
  59. package/dist/content-feed-sync.d.ts +23 -0
  60. package/dist/content-feed-sync.d.ts.map +1 -0
  61. package/dist/content-governance-assignment.d.ts +42 -0
  62. package/dist/content-governance-assignment.d.ts.map +1 -0
  63. package/dist/content-governance-assignments.d.ts +11 -0
  64. package/dist/content-governance-assignments.d.ts.map +1 -0
  65. package/dist/content-governance-policies.d.ts +7 -0
  66. package/dist/content-governance-policies.d.ts.map +1 -0
  67. package/dist/content-governance-policy.d.ts +29 -0
  68. package/dist/content-governance-policy.d.ts.map +1 -0
  69. package/dist/content-governance-profile.d.ts +31 -0
  70. package/dist/content-governance-profile.d.ts.map +1 -0
  71. package/dist/content-governance-profiles.d.ts +7 -0
  72. package/dist/content-governance-profiles.d.ts.map +1 -0
  73. package/dist/content-governance.d.ts +188 -0
  74. package/dist/content-governance.d.ts.map +1 -0
  75. package/dist/content-prompts.d.ts +10 -0
  76. package/dist/content-prompts.d.ts.map +1 -0
  77. package/dist/content-reference.d.ts +17 -0
  78. package/dist/content-reference.d.ts.map +1 -0
  79. package/dist/content-references.d.ts +55 -0
  80. package/dist/content-references.d.ts.map +1 -0
  81. package/dist/content-review.d.ts +34 -0
  82. package/dist/content-review.d.ts.map +1 -0
  83. package/dist/content-reviews.d.ts +21 -0
  84. package/dist/content-reviews.d.ts.map +1 -0
  85. package/dist/content-transparency.d.ts +72 -0
  86. package/dist/content-transparency.d.ts.map +1 -0
  87. package/dist/content-types.d.ts +51 -0
  88. package/dist/content-types.d.ts.map +1 -0
  89. package/dist/content-version.d.ts +38 -0
  90. package/dist/content-version.d.ts.map +1 -0
  91. package/dist/content-versions.d.ts +16 -0
  92. package/dist/content-versions.d.ts.map +1 -0
  93. package/dist/content.d.ts +736 -0
  94. package/dist/content.d.ts.map +1 -0
  95. package/dist/contents.d.ts +292 -0
  96. package/dist/contents.d.ts.map +1 -0
  97. package/dist/database-utils.d.ts +3 -0
  98. package/dist/database-utils.d.ts.map +1 -0
  99. package/dist/index.d.ts +78 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +11602 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/manifest.json +12308 -0
  104. package/dist/mock-smrt-client.d.ts +493 -0
  105. package/dist/mock-smrt-client.d.ts.map +1 -0
  106. package/dist/mock-smrt-client.js +390 -0
  107. package/dist/mock-smrt-client.js.map +1 -0
  108. package/dist/playground.d.ts +2 -0
  109. package/dist/playground.d.ts.map +1 -0
  110. package/dist/playground.js +454 -0
  111. package/dist/playground.js.map +1 -0
  112. package/dist/publish-readiness.d.ts +30 -0
  113. package/dist/publish-readiness.d.ts.map +1 -0
  114. package/dist/publish-readiness.js +74 -0
  115. package/dist/publish-readiness.js.map +1 -0
  116. package/dist/safe-remote-url.d.ts +52 -0
  117. package/dist/safe-remote-url.d.ts.map +1 -0
  118. package/dist/serialization.d.ts +78 -0
  119. package/dist/serialization.d.ts.map +1 -0
  120. package/dist/smrt-knowledge.json +6130 -0
  121. package/dist/svelte/api.d.ts +3 -0
  122. package/dist/svelte/api.d.ts.map +1 -0
  123. package/dist/svelte/api.js +10 -0
  124. package/dist/svelte/components/ArticleCard.svelte +159 -0
  125. package/dist/svelte/components/ArticleCard.svelte.d.ts +17 -0
  126. package/dist/svelte/components/ArticleCard.svelte.d.ts.map +1 -0
  127. package/dist/svelte/components/ArticleList.svelte +75 -0
  128. package/dist/svelte/components/ArticleList.svelte.d.ts +21 -0
  129. package/dist/svelte/components/ArticleList.svelte.d.ts.map +1 -0
  130. package/dist/svelte/components/ContentAgentChat.svelte +652 -0
  131. package/dist/svelte/components/ContentAgentChat.svelte.d.ts +17 -0
  132. package/dist/svelte/components/ContentAgentChat.svelte.d.ts.map +1 -0
  133. package/dist/svelte/components/ContentBodyEditor.svelte +1446 -0
  134. package/dist/svelte/components/ContentBodyEditor.svelte.d.ts +25 -0
  135. package/dist/svelte/components/ContentBodyEditor.svelte.d.ts.map +1 -0
  136. package/dist/svelte/components/ContentBodyRenderer.svelte +152 -0
  137. package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts +10 -0
  138. package/dist/svelte/components/ContentBodyRenderer.svelte.d.ts.map +1 -0
  139. package/dist/svelte/components/ContentClaimAuditTool.svelte +441 -0
  140. package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts +12 -0
  141. package/dist/svelte/components/ContentClaimAuditTool.svelte.d.ts.map +1 -0
  142. package/dist/svelte/components/ContentContributionForm.svelte +226 -0
  143. package/dist/svelte/components/ContentContributionForm.svelte.d.ts +23 -0
  144. package/dist/svelte/components/ContentContributionForm.svelte.d.ts.map +1 -0
  145. package/dist/svelte/components/ContentContributionInbox.svelte +322 -0
  146. package/dist/svelte/components/ContentContributionInbox.svelte.d.ts +22 -0
  147. package/dist/svelte/components/ContentContributionInbox.svelte.d.ts.map +1 -0
  148. package/dist/svelte/components/ContentContributionPortal.svelte +182 -0
  149. package/dist/svelte/components/ContentContributionPortal.svelte.d.ts +12 -0
  150. package/dist/svelte/components/ContentContributionPortal.svelte.d.ts.map +1 -0
  151. package/dist/svelte/components/ContentContributionTypeManager.svelte +281 -0
  152. package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts +10 -0
  153. package/dist/svelte/components/ContentContributionTypeManager.svelte.d.ts.map +1 -0
  154. package/dist/svelte/components/ContentContributorManager.svelte +140 -0
  155. package/dist/svelte/components/ContentContributorManager.svelte.d.ts +10 -0
  156. package/dist/svelte/components/ContentContributorManager.svelte.d.ts.map +1 -0
  157. package/dist/svelte/components/ContentCorrectionsTool.svelte +361 -0
  158. package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts +11 -0
  159. package/dist/svelte/components/ContentCorrectionsTool.svelte.d.ts.map +1 -0
  160. package/dist/svelte/components/ContentEditor.svelte +2166 -0
  161. package/dist/svelte/components/ContentEditor.svelte.d.ts +26 -0
  162. package/dist/svelte/components/ContentEditor.svelte.d.ts.map +1 -0
  163. package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte +199 -0
  164. package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts +11 -0
  165. package/dist/svelte/components/ContentGovernanceAssignmentEditor.svelte.d.ts.map +1 -0
  166. package/dist/svelte/components/ContentGovernanceManager.svelte +340 -0
  167. package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts +11 -0
  168. package/dist/svelte/components/ContentGovernanceManager.svelte.d.ts.map +1 -0
  169. package/dist/svelte/components/ContentGovernancePanel.svelte +2244 -0
  170. package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts +26 -0
  171. package/dist/svelte/components/ContentGovernancePanel.svelte.d.ts.map +1 -0
  172. package/dist/svelte/components/ContentGovernancePolicyEditor.svelte +110 -0
  173. package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts +10 -0
  174. package/dist/svelte/components/ContentGovernancePolicyEditor.svelte.d.ts.map +1 -0
  175. package/dist/svelte/components/ContentGovernanceProfileEditor.svelte +185 -0
  176. package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts +11 -0
  177. package/dist/svelte/components/ContentGovernanceProfileEditor.svelte.d.ts.map +1 -0
  178. package/dist/svelte/components/ContentGovernanceTool.svelte +56 -0
  179. package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts +13 -0
  180. package/dist/svelte/components/ContentGovernanceTool.svelte.d.ts.map +1 -0
  181. package/dist/svelte/components/ContentImageBrowser.svelte +243 -0
  182. package/dist/svelte/components/ContentImageBrowser.svelte.d.ts +18 -0
  183. package/dist/svelte/components/ContentImageBrowser.svelte.d.ts.map +1 -0
  184. package/dist/svelte/components/ContentImageChooser.svelte +134 -0
  185. package/dist/svelte/components/ContentImageChooser.svelte.d.ts +11 -0
  186. package/dist/svelte/components/ContentImageChooser.svelte.d.ts.map +1 -0
  187. package/dist/svelte/components/ContentList.svelte +906 -0
  188. package/dist/svelte/components/ContentList.svelte.d.ts +16 -0
  189. package/dist/svelte/components/ContentList.svelte.d.ts.map +1 -0
  190. package/dist/svelte/components/ContentMetadataFields.svelte +107 -0
  191. package/dist/svelte/components/ContentMetadataFields.svelte.d.ts +8 -0
  192. package/dist/svelte/components/ContentMetadataFields.svelte.d.ts.map +1 -0
  193. package/dist/svelte/components/ContentReferencesPanel.svelte +221 -0
  194. package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts +20 -0
  195. package/dist/svelte/components/ContentReferencesPanel.svelte.d.ts.map +1 -0
  196. package/dist/svelte/components/ContentReviewStatusTray.svelte +151 -0
  197. package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts +20 -0
  198. package/dist/svelte/components/ContentReviewStatusTray.svelte.d.ts.map +1 -0
  199. package/dist/svelte/components/ContentStatusFields.svelte +85 -0
  200. package/dist/svelte/components/ContentStatusFields.svelte.d.ts +8 -0
  201. package/dist/svelte/components/ContentStatusFields.svelte.d.ts.map +1 -0
  202. package/dist/svelte/components/ContentTitleField.svelte +54 -0
  203. package/dist/svelte/components/ContentTitleField.svelte.d.ts +10 -0
  204. package/dist/svelte/components/ContentTitleField.svelte.d.ts.map +1 -0
  205. package/dist/svelte/components/ContentTransparencyReport.svelte +322 -0
  206. package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts +10 -0
  207. package/dist/svelte/components/ContentTransparencyReport.svelte.d.ts.map +1 -0
  208. package/dist/svelte/components/ContentTransparencyTool.svelte +314 -0
  209. package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts +10 -0
  210. package/dist/svelte/components/ContentTransparencyTool.svelte.d.ts.map +1 -0
  211. package/dist/svelte/components/ContentVersionsTool.svelte +291 -0
  212. package/dist/svelte/components/ContentVersionsTool.svelte.d.ts +10 -0
  213. package/dist/svelte/components/ContentVersionsTool.svelte.d.ts.map +1 -0
  214. package/dist/svelte/components/GovernedContentEditor.svelte +409 -0
  215. package/dist/svelte/components/GovernedContentEditor.svelte.d.ts +35 -0
  216. package/dist/svelte/components/GovernedContentEditor.svelte.d.ts.map +1 -0
  217. package/dist/svelte/components/ImageThumbnail.cache.d.ts +14 -0
  218. package/dist/svelte/components/ImageThumbnail.cache.d.ts.map +1 -0
  219. package/dist/svelte/components/ImageThumbnail.cache.js +36 -0
  220. package/dist/svelte/components/ImageThumbnail.svelte +159 -0
  221. package/dist/svelte/components/ImageThumbnail.svelte.d.ts +8 -0
  222. package/dist/svelte/components/ImageThumbnail.svelte.d.ts.map +1 -0
  223. package/dist/svelte/components/Markdown.svelte +125 -0
  224. package/dist/svelte/components/Markdown.svelte.d.ts +11 -0
  225. package/dist/svelte/components/Markdown.svelte.d.ts.map +1 -0
  226. package/dist/svelte/content-editor-form.d.ts +63 -0
  227. package/dist/svelte/content-editor-form.d.ts.map +1 -0
  228. package/dist/svelte/content-editor-form.js +94 -0
  229. package/dist/svelte/content-editor-media.d.ts +12 -0
  230. package/dist/svelte/content-editor-media.d.ts.map +1 -0
  231. package/dist/svelte/content-editor-media.js +84 -0
  232. package/dist/svelte/content-editor-state.svelte.d.ts +35 -0
  233. package/dist/svelte/content-editor-state.svelte.d.ts.map +1 -0
  234. package/dist/svelte/content-editor-state.svelte.js +141 -0
  235. package/dist/svelte/governance-manager-client.d.ts +22 -0
  236. package/dist/svelte/governance-manager-client.d.ts.map +1 -0
  237. package/dist/svelte/governance-manager-client.js +1 -0
  238. package/dist/svelte/i18n.contribution.d.ts +57 -0
  239. package/dist/svelte/i18n.contribution.d.ts.map +1 -0
  240. package/dist/svelte/i18n.contribution.js +64 -0
  241. package/dist/svelte/i18n.editor.d.ts +71 -0
  242. package/dist/svelte/i18n.editor.d.ts.map +1 -0
  243. package/dist/svelte/i18n.editor.js +87 -0
  244. package/dist/svelte/i18n.governance.d.ts +66 -0
  245. package/dist/svelte/i18n.governance.d.ts.map +1 -0
  246. package/dist/svelte/i18n.governance.js +66 -0
  247. package/dist/svelte/i18n.routes.d.ts +66 -0
  248. package/dist/svelte/i18n.routes.d.ts.map +1 -0
  249. package/dist/svelte/i18n.routes.js +75 -0
  250. package/dist/svelte/i18n.tools.d.ts +81 -0
  251. package/dist/svelte/i18n.tools.d.ts.map +1 -0
  252. package/dist/svelte/i18n.tools.js +90 -0
  253. package/dist/svelte/index.d.ts +101 -0
  254. package/dist/svelte/index.d.ts.map +1 -0
  255. package/dist/svelte/index.js +63 -0
  256. package/dist/svelte/playground.d.ts +281 -0
  257. package/dist/svelte/playground.d.ts.map +1 -0
  258. package/dist/svelte/playground.js +438 -0
  259. package/dist/svelte/routes/ContentContributionsRoute.svelte +809 -0
  260. package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts +10 -0
  261. package/dist/svelte/routes/ContentContributionsRoute.svelte.d.ts.map +1 -0
  262. package/dist/svelte/routes/ContentFactsRoute.svelte +612 -0
  263. package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts +11 -0
  264. package/dist/svelte/routes/ContentFactsRoute.svelte.d.ts.map +1 -0
  265. package/dist/svelte/routes/ContentGovernanceRoute.svelte +218 -0
  266. package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts +10 -0
  267. package/dist/svelte/routes/ContentGovernanceRoute.svelte.d.ts.map +1 -0
  268. package/dist/svelte/routes/ContentWorkspaceRoute.svelte +431 -0
  269. package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts +12 -0
  270. package/dist/svelte/routes/ContentWorkspaceRoute.svelte.d.ts.map +1 -0
  271. package/dist/svelte/routes/PublishedArticleRoute.svelte +194 -0
  272. package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts +10 -0
  273. package/dist/svelte/routes/PublishedArticleRoute.svelte.d.ts.map +1 -0
  274. package/dist/svelte/routes/index.d.ts +8 -0
  275. package/dist/svelte/routes/index.d.ts.map +1 -0
  276. package/dist/svelte/routes/index.js +6 -0
  277. package/dist/svelte/routes/shared.d.ts +90 -0
  278. package/dist/svelte/routes/shared.d.ts.map +1 -0
  279. package/dist/svelte/routes/shared.js +104 -0
  280. package/dist/svelte/types.d.ts +69 -0
  281. package/dist/svelte/types.d.ts.map +1 -0
  282. package/dist/svelte/types.js +6 -0
  283. package/dist/thumbnail-generator.d.ts +174 -0
  284. package/dist/thumbnail-generator.d.ts.map +1 -0
  285. package/dist/ui.d.ts +10 -0
  286. package/dist/ui.d.ts.map +1 -0
  287. package/dist/ui.js +42 -0
  288. package/dist/ui.js.map +1 -0
  289. package/dist/utils.d.ts +18 -0
  290. package/dist/utils.d.ts.map +1 -0
  291. package/package.json +119 -0
@@ -0,0 +1,809 @@
1
+ <script lang="ts">
2
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
3
+ import { onMount } from 'svelte';
4
+ import {
5
+ type ContentContributionData,
6
+ type ContentContributionTypeConfigStateData,
7
+ type ContentContributorData,
8
+ createClient,
9
+ } from '../../mock-smrt-client.js';
10
+ import ContentContributionForm, {
11
+ type ContentContributionFormSubmitData,
12
+ } from '../components/ContentContributionForm.svelte';
13
+ import ContentContributionInbox from '../components/ContentContributionInbox.svelte';
14
+ import ContentContributionPortal from '../components/ContentContributionPortal.svelte';
15
+ import ContentContributionTypeManager from '../components/ContentContributionTypeManager.svelte';
16
+ import ContentContributorManager from '../components/ContentContributorManager.svelte';
17
+ import { M } from '../i18n.routes.js';
18
+ import {
19
+ CONTENT_DEFAULT_ROUTE_NAVIGATION,
20
+ CONTENT_ROUTE_IDS,
21
+ type ContentRouteNavigationItem,
22
+ } from './shared.js';
23
+
24
+ interface ContentContributionsRouteProps {
25
+ navigation?: ContentRouteNavigationItem[];
26
+ apiBaseUrl?: string;
27
+ embedded?: boolean;
28
+ }
29
+
30
+ let {
31
+ navigation = CONTENT_DEFAULT_ROUTE_NAVIGATION,
32
+ apiBaseUrl = '/api/v1',
33
+ embedded = false,
34
+ }: ContentContributionsRouteProps = $props();
35
+
36
+ const client = $derived(createClient(apiBaseUrl));
37
+ const { t } = useI18n();
38
+
39
+ let contributionTypes = $state<ContentContributionTypeConfigStateData | null>(
40
+ null,
41
+ );
42
+ let contributors = $state<ContentContributorData[]>([]);
43
+ let inboxContributions = $state<ContentContributionData[]>([]);
44
+ let portalContributions = $state<ContentContributionData[]>([]);
45
+ let selectedInboxId = $state<string | null>(null);
46
+ let selectedPortalId = $state<string | null>(null);
47
+ let portalEmail = $state('');
48
+ let loading = $state(true);
49
+ let refreshingPortal = $state(false);
50
+ let busyMessage = $state<string | null>(null);
51
+ let error = $state<string | null>(null);
52
+ let notice = $state<string | null>(null);
53
+
54
+ onMount(async () => {
55
+ await refreshContributionOperations();
56
+ });
57
+
58
+ function pickPortalEmail(nextContributors: ContentContributorData[]) {
59
+ return (
60
+ portalEmail ||
61
+ nextContributors.find((item) => Boolean(item.email))?.email ||
62
+ ''
63
+ );
64
+ }
65
+
66
+ function mapFilesToAttachments(files: File[]) {
67
+ return files.map((file) => ({
68
+ filename: file.name,
69
+ mimeType: file.type || 'application/octet-stream',
70
+ size: file.size || 0,
71
+ metadata: {
72
+ source: 'content-route',
73
+ sourceType: 'browser',
74
+ },
75
+ }));
76
+ }
77
+
78
+ async function loadContributionTypes() {
79
+ const response = await client.contentContributions.getContributionTypes();
80
+ contributionTypes = response.data;
81
+ }
82
+
83
+ async function loadContributors() {
84
+ const response = await client.contentContributors.list();
85
+ contributors = response.data;
86
+
87
+ if (!portalEmail) {
88
+ portalEmail = pickPortalEmail(response.data);
89
+ }
90
+ }
91
+
92
+ async function loadInbox() {
93
+ const response = await client.contentContributions.listInbox();
94
+ inboxContributions = response.data;
95
+ selectedInboxId = response.data[0]?.id || null;
96
+ }
97
+
98
+ async function loadPortal() {
99
+ if (!portalEmail) {
100
+ portalContributions = [];
101
+ selectedPortalId = null;
102
+ return;
103
+ }
104
+
105
+ const response = await client.contentContributions.listForContributor({
106
+ contributorEmail: portalEmail,
107
+ });
108
+ portalContributions = response.data;
109
+ selectedPortalId = response.data[0]?.id || null;
110
+ }
111
+
112
+ async function refreshContributionOperations() {
113
+ loading = true;
114
+ error = null;
115
+
116
+ try {
117
+ await Promise.all([
118
+ loadContributionTypes(),
119
+ loadContributors(),
120
+ loadInbox(),
121
+ ]);
122
+ await loadPortal();
123
+ } catch (err: any) {
124
+ error = err.message || 'Failed to load contribution operations.';
125
+ } finally {
126
+ loading = false;
127
+ }
128
+ }
129
+
130
+ async function refreshPortalOnly() {
131
+ refreshingPortal = true;
132
+ error = null;
133
+
134
+ try {
135
+ await loadPortal();
136
+ } catch (err: any) {
137
+ error = err.message || 'Failed to load contributor submissions.';
138
+ } finally {
139
+ refreshingPortal = false;
140
+ }
141
+ }
142
+
143
+ async function runContributionAction(
144
+ message: string,
145
+ action: () => Promise<void>,
146
+ options: { refreshTypes?: boolean; refreshContributors?: boolean } = {},
147
+ ) {
148
+ busyMessage = message;
149
+ error = null;
150
+
151
+ try {
152
+ await action();
153
+ if (options.refreshTypes) {
154
+ await loadContributionTypes();
155
+ }
156
+ if (options.refreshContributors) {
157
+ await loadContributors();
158
+ }
159
+ await loadInbox();
160
+ await loadPortal();
161
+ } catch (err: any) {
162
+ error = err.message || message;
163
+ } finally {
164
+ busyMessage = null;
165
+ }
166
+ }
167
+
168
+ async function handleSubmitContribution(
169
+ payload: ContentContributionFormSubmitData,
170
+ ) {
171
+ await runContributionAction(
172
+ 'Submitting contribution...',
173
+ async () => {
174
+ const response = await client.contentContributions.submitWebContribution({
175
+ typeKey: payload.typeKey,
176
+ contributorEmail: payload.contributorEmail,
177
+ contributorName: payload.contributorName,
178
+ title: payload.title || null,
179
+ description: payload.description || null,
180
+ body: payload.body || null,
181
+ attachments: mapFilesToAttachments(payload.files),
182
+ metadata: {
183
+ source: 'content-route',
184
+ },
185
+ });
186
+
187
+ portalEmail = payload.contributorEmail || portalEmail;
188
+ const contribution =
189
+ response.data?.contribution ||
190
+ response.data?.data?.contribution ||
191
+ response.data;
192
+ selectedPortalId = contribution?.id || null;
193
+ notice = `Submitted "${payload.title || payload.typeKey}" for ${portalEmail}.`;
194
+ },
195
+ { refreshContributors: true },
196
+ );
197
+ }
198
+
199
+ async function handleWithdraw(contribution: ContentContributionData) {
200
+ await runContributionAction('Withdrawing contribution...', async () => {
201
+ await client.contentContributions.withdraw(contribution.id || '', {
202
+ reason: 'Withdrawn from the contribution route.',
203
+ });
204
+ notice = `Withdrew "${contribution.title || contribution.id}".`;
205
+ });
206
+ }
207
+
208
+ async function handleApprove(
209
+ contribution: ContentContributionData,
210
+ options: { targetStatus: 'draft' | 'review'; note: string },
211
+ ) {
212
+ await runContributionAction('Approving contribution...', async () => {
213
+ await client.contentContributions.approve(contribution.id || '', {
214
+ editorNote: options.note,
215
+ targetStatus: options.targetStatus,
216
+ });
217
+ notice = `Approved "${contribution.title || contribution.id}" into ${options.targetStatus}.`;
218
+ });
219
+ }
220
+
221
+ async function handleRequestChanges(
222
+ contribution: ContentContributionData,
223
+ options: { note: string },
224
+ ) {
225
+ await runContributionAction('Requesting changes...', async () => {
226
+ await client.contentContributions.requestChanges(contribution.id || '', {
227
+ editorNote: options.note,
228
+ });
229
+ notice = `Requested changes for "${contribution.title || contribution.id}".`;
230
+ });
231
+ }
232
+
233
+ async function handleReject(
234
+ contribution: ContentContributionData,
235
+ options: { note: string },
236
+ ) {
237
+ await runContributionAction('Rejecting contribution...', async () => {
238
+ await client.contentContributions.reject(contribution.id || '', {
239
+ editorNote: options.note,
240
+ });
241
+ notice = `Rejected "${contribution.title || contribution.id}".`;
242
+ });
243
+ }
244
+
245
+ async function handleSaveType(data: Record<string, any>) {
246
+ await runContributionAction(
247
+ 'Saving contribution type...',
248
+ async () => {
249
+ if (data.id) {
250
+ await client.contentContributionTypes.update(data.id, data);
251
+ } else {
252
+ await client.contentContributionTypes.create(data);
253
+ }
254
+ notice = `Saved contribution type "${data.label || data.key}".`;
255
+ },
256
+ { refreshTypes: true },
257
+ );
258
+ }
259
+
260
+ async function handleDeleteType(data: Record<string, any>) {
261
+ await runContributionAction(
262
+ 'Deleting contribution type...',
263
+ async () => {
264
+ await client.contentContributionTypes.delete(data.id || '');
265
+ notice = `Deleted contribution type "${data.label || data.key}".`;
266
+ },
267
+ { refreshTypes: true },
268
+ );
269
+ }
270
+
271
+ async function handleSaveContributor(data: Record<string, any>) {
272
+ await runContributionAction(
273
+ 'Saving contributor...',
274
+ async () => {
275
+ if (data.id) {
276
+ await client.contentContributors.update(data.id, data);
277
+ } else {
278
+ await client.contentContributors.create(data);
279
+ }
280
+ portalEmail = data.email || portalEmail;
281
+ notice = `Saved contributor "${data.name || data.email}".`;
282
+ },
283
+ { refreshContributors: true },
284
+ );
285
+ }
286
+
287
+ async function handleDeleteContributor(data: Record<string, any>) {
288
+ await runContributionAction(
289
+ 'Deleting contributor...',
290
+ async () => {
291
+ await client.contentContributors.delete(data.id || '');
292
+ if (portalEmail === data.email) {
293
+ portalEmail = '';
294
+ }
295
+ notice = `Deleted contributor "${data.name || data.email}".`;
296
+ },
297
+ { refreshContributors: true },
298
+ );
299
+ }
300
+ </script>
301
+
302
+ <div class:page={true} class:page--embedded={embedded}>
303
+ <header class="page-header">
304
+ <div class="container">
305
+ <div class="page-header__copy">
306
+ <div class="eyebrow">{t(M['content.contributions.eyebrow'])}</div>
307
+ <h1>{t(M['content.contributions.heading'])}</h1>
308
+ <p>
309
+ {t(M['content.contributions.intro'])}
310
+ </p>
311
+ </div>
312
+
313
+ <nav class="page-nav" aria-label={t(M['content.contributions.nav_aria'])}>
314
+ {#each navigation as item (item.routeId)}
315
+ <a
316
+ href={item.href}
317
+ aria-current={item.routeId === CONTENT_ROUTE_IDS.contributions
318
+ ? 'page'
319
+ : undefined}
320
+ >
321
+ {item.label}
322
+ </a>
323
+ {/each}
324
+ </nav>
325
+ </div>
326
+ </header>
327
+
328
+ <main class="container page-main">
329
+ <section class="callout">
330
+ <div class="callout__header">
331
+ <div>
332
+ <strong>{t(M['content.contributions.callout_title'])}</strong>
333
+ <p>
334
+ {t(M['content.contributions.callout_body'])}
335
+ </p>
336
+ </div>
337
+ <span class="pill">Live</span>
338
+ </div>
339
+
340
+ <div class="callout__chips" aria-label={t(M['content.contributions.chips_aria'])}>
341
+ <span>{t(M['content.contributions.chip_held_intake'])}</span>
342
+ <span>{t(M['content.contributions.chip_portal_actions'])}</span>
343
+ <span>{t(M['content.contributions.chip_inbox_decisions'])}</span>
344
+ <span>{t(M['content.contributions.chip_type_trust'])}</span>
345
+ </div>
346
+
347
+ <p class="callout__note">
348
+ {t(M['content.contributions.email_note_prefix'])}
349
+ <code>/api/v1/contentcontributions/ingest-email</code> {t(M['content.contributions.email_note_suffix'])}
350
+ </p>
351
+ </section>
352
+
353
+ {#if loading}
354
+ <section class="panel">
355
+ <p>{t(M['content.contributions.loading'])}</p>
356
+ </section>
357
+ {:else}
358
+ {#if error}
359
+ <section class="panel panel--error">
360
+ <strong>Error</strong>
361
+ <p>{error}</p>
362
+ </section>
363
+ {/if}
364
+
365
+ {#if notice}
366
+ <section class="panel panel--notice">
367
+ <strong>{t(M['content.contributions.latest_action'])}</strong>
368
+ <p>{notice}</p>
369
+ </section>
370
+ {/if}
371
+
372
+ {#if busyMessage}
373
+ <section class="panel">
374
+ <p>{busyMessage}</p>
375
+ </section>
376
+ {/if}
377
+
378
+ <div class="qa-grid">
379
+ <section class="panel">
380
+ <div class="section-heading">
381
+ <div>
382
+ <h2>{t(M['content.contributions.submission_title'])}</h2>
383
+ <p>
384
+ {t(M['content.contributions.submission_body'])}
385
+ </p>
386
+ </div>
387
+ </div>
388
+
389
+ <ContentContributionForm
390
+ types={contributionTypes?.effective || []}
391
+ submitLabel="Submit to holding queue"
392
+ onSubmit={handleSubmitContribution}
393
+ />
394
+ </section>
395
+
396
+ <section class="panel">
397
+ <div class="section-heading">
398
+ <div>
399
+ <h2>{t(M['content.contributions.portal_title'])}</h2>
400
+ <p>
401
+ {t(M['content.contributions.portal_body'])}
402
+ </p>
403
+ </div>
404
+ <form
405
+ class="inline-form"
406
+ onsubmit={(event) => {
407
+ event.preventDefault();
408
+ void refreshPortalOnly();
409
+ }}
410
+ >
411
+ <input
412
+ type="email"
413
+ bind:value={portalEmail}
414
+ placeholder={t(M['content.contributions.portal_email_placeholder'])}
415
+ />
416
+ <button
417
+ type="submit"
418
+ class="secondary"
419
+ disabled={refreshingPortal}
420
+ >
421
+ {refreshingPortal ? 'Loading...' : 'Load'}
422
+ </button>
423
+ </form>
424
+ </div>
425
+
426
+ <ContentContributionPortal
427
+ contributions={portalContributions}
428
+ selectedId={selectedPortalId}
429
+ emptyMessage="No submissions found for that contributor yet."
430
+ onSelect={(contribution) => {
431
+ selectedPortalId = contribution.id || null;
432
+ }}
433
+ onWithdraw={handleWithdraw}
434
+ />
435
+ </section>
436
+ </div>
437
+
438
+ <section class="panel">
439
+ <div class="section-heading">
440
+ <div>
441
+ <h2>{t(M['content.contributions.inbox_title'])}</h2>
442
+ <p>
443
+ {t(M['content.contributions.inbox_body'])}
444
+ </p>
445
+ </div>
446
+ </div>
447
+
448
+ <ContentContributionInbox
449
+ contributions={inboxContributions}
450
+ selectedId={selectedInboxId}
451
+ onSelect={(contribution) => {
452
+ selectedInboxId = contribution.id || null;
453
+ }}
454
+ onApprove={handleApprove}
455
+ onRequestChanges={handleRequestChanges}
456
+ onReject={handleReject}
457
+ />
458
+ </section>
459
+
460
+ <div class="qa-grid">
461
+ <section class="panel">
462
+ <div class="section-heading">
463
+ <div>
464
+ <h2>{t(M['content.contributions.types_title'])}</h2>
465
+ <p>
466
+ {t(M['content.contributions.types_body'])}
467
+ </p>
468
+ </div>
469
+ <span class="pill">{contributionTypes?.effective.length || 0}</span>
470
+ </div>
471
+
472
+ <ContentContributionTypeManager
473
+ types={contributionTypes?.effective || []}
474
+ onSave={handleSaveType}
475
+ onDelete={handleDeleteType}
476
+ />
477
+ </section>
478
+
479
+ <section class="panel">
480
+ <div class="section-heading">
481
+ <div>
482
+ <h2>{t(M['content.contributions.trust_title'])}</h2>
483
+ <p>
484
+ {t(M['content.contributions.trust_body'])}
485
+ </p>
486
+ </div>
487
+ <span class="pill">{contributors.length}</span>
488
+ </div>
489
+
490
+ <ContentContributorManager
491
+ contributors={contributors}
492
+ onSave={handleSaveContributor}
493
+ onDelete={handleDeleteContributor}
494
+ />
495
+ </section>
496
+ </div>
497
+ {/if}
498
+ </main>
499
+ </div>
500
+
501
+ <style>
502
+ :global(body:has(.page:not(.page--embedded))) {
503
+ margin: 0;
504
+ font-family:
505
+ var(--smrt-font-family, 'Inter', -apple-system, BlinkMacSystemFont,
506
+ 'Segoe UI', Roboto, sans-serif);
507
+ background:
508
+ radial-gradient(
509
+ circle at top,
510
+ color-mix(in srgb, var(--smrt-color-primary) 10%, transparent),
511
+ transparent 36%
512
+ ),
513
+ var(--smrt-color-background);
514
+ color: var(--smrt-color-on-background);
515
+ min-height: 100vh;
516
+ }
517
+
518
+ .page {
519
+ min-height: 100vh;
520
+ padding: 2rem 1.25rem 3rem;
521
+ }
522
+
523
+ .page--embedded {
524
+ min-height: auto;
525
+ padding: 0;
526
+ }
527
+
528
+ .container {
529
+ max-width: 1400px;
530
+ margin: 0 auto;
531
+ }
532
+
533
+ .page-header {
534
+ margin-bottom: 1.5rem;
535
+ }
536
+
537
+ .page-header .container {
538
+ display: flex;
539
+ justify-content: space-between;
540
+ gap: 1rem;
541
+ align-items: flex-start;
542
+ flex-wrap: wrap;
543
+ }
544
+
545
+ .page-header__copy {
546
+ max-width: 56rem;
547
+ }
548
+
549
+ .eyebrow {
550
+ color: var(--smrt-color-on-surface-variant);
551
+ text-transform: uppercase;
552
+ letter-spacing: var(--smrt-typography-label-medium-tracking, 0.08em);
553
+ font-size: var(--smrt-typography-label-medium-size, 0.78rem);
554
+ font-weight: var(--smrt-typography-weight-bold, 700);
555
+ }
556
+
557
+ .page-header h1 {
558
+ margin: 0.35rem 0 0.65rem;
559
+ font-size: clamp(2rem, 5vw, 3rem);
560
+ line-height: 1.05;
561
+ }
562
+
563
+ .page-header p {
564
+ margin: 0;
565
+ color: var(--smrt-color-on-surface-variant);
566
+ font-size: var(--smrt-typography-body-large-size, 1rem);
567
+ max-width: 52rem;
568
+ }
569
+
570
+ .page-nav {
571
+ display: flex;
572
+ gap: 0.75rem;
573
+ flex-wrap: wrap;
574
+ align-items: center;
575
+ }
576
+
577
+ .page-nav a {
578
+ display: inline-flex;
579
+ align-items: center;
580
+ justify-content: center;
581
+ min-height: 2.5rem;
582
+ padding: 0 1rem;
583
+ border-radius: var(--smrt-radius-full, 9999px);
584
+ border: 1px solid var(--smrt-color-outline-variant);
585
+ background: color-mix(
586
+ in srgb,
587
+ var(--smrt-color-surface) 92%,
588
+ transparent
589
+ );
590
+ color: var(--smrt-color-on-surface);
591
+ text-decoration: none;
592
+ font-weight: var(--smrt-typography-weight-semibold, 600);
593
+ }
594
+
595
+ .page-nav a[aria-current='page'] {
596
+ color: var(--smrt-color-primary);
597
+ border-color: color-mix(
598
+ in srgb,
599
+ var(--smrt-color-primary) 28%,
600
+ transparent
601
+ );
602
+ background: color-mix(
603
+ in srgb,
604
+ var(--smrt-color-primary) 10%,
605
+ var(--smrt-color-surface)
606
+ );
607
+ }
608
+
609
+ .page-main {
610
+ display: grid;
611
+ gap: 1rem;
612
+ }
613
+
614
+ .callout,
615
+ .panel {
616
+ border: 1px solid var(--smrt-color-outline-variant);
617
+ background: color-mix(
618
+ in srgb,
619
+ var(--smrt-color-surface) 95%,
620
+ transparent
621
+ );
622
+ box-shadow: var(--smrt-elevation-1, 0 8px 24px rgba(15, 23, 42, 0.05));
623
+ border-radius: 1rem;
624
+ padding: 1.25rem;
625
+ }
626
+
627
+ .panel--error {
628
+ border-color: color-mix(in srgb, var(--smrt-color-error) 30%, transparent);
629
+ }
630
+
631
+ .panel--notice {
632
+ border-color: color-mix(in srgb, var(--smrt-color-primary) 30%, transparent);
633
+ }
634
+
635
+ .callout {
636
+ display: grid;
637
+ gap: 0.8rem;
638
+ }
639
+
640
+ .callout__header {
641
+ display: flex;
642
+ gap: 1rem;
643
+ justify-content: space-between;
644
+ align-items: flex-start;
645
+ flex-wrap: wrap;
646
+ }
647
+
648
+ .callout__header p,
649
+ .callout__note {
650
+ margin: 0;
651
+ color: var(--smrt-color-on-surface-variant);
652
+ }
653
+
654
+ .callout__chips {
655
+ display: flex;
656
+ gap: 0.6rem;
657
+ flex-wrap: wrap;
658
+ }
659
+
660
+ .callout__chips span {
661
+ display: inline-flex;
662
+ align-items: center;
663
+ min-height: 2rem;
664
+ padding: 0 0.8rem;
665
+ border-radius: var(--smrt-radius-full, 9999px);
666
+ background: color-mix(
667
+ in srgb,
668
+ var(--smrt-color-surface-container-low) 90%,
669
+ transparent
670
+ );
671
+ color: var(--smrt-color-on-surface);
672
+ font-size: var(--smrt-typography-label-large-size, 0.83rem);
673
+ font-weight: var(--smrt-typography-weight-semibold, 600);
674
+ }
675
+
676
+ .callout code {
677
+ font-family: var(
678
+ --smrt-font-family-mono,
679
+ 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
680
+ 'Liberation Mono', 'Courier New', monospace
681
+ );
682
+ font-size: 0.9em;
683
+ }
684
+
685
+ .qa-grid {
686
+ display: grid;
687
+ gap: 1rem;
688
+ }
689
+
690
+ .section-heading {
691
+ display: flex;
692
+ gap: 1rem;
693
+ justify-content: space-between;
694
+ align-items: flex-start;
695
+ margin-bottom: 1rem;
696
+ flex-wrap: wrap;
697
+ }
698
+
699
+ .section-heading h2 {
700
+ margin: 0 0 0.25rem;
701
+ }
702
+
703
+ .section-heading p {
704
+ margin: 0;
705
+ color: var(--smrt-color-on-surface-variant);
706
+ }
707
+
708
+ .inline-form {
709
+ display: flex;
710
+ gap: 0.5rem;
711
+ flex-wrap: wrap;
712
+ align-items: center;
713
+ }
714
+
715
+ .inline-form input {
716
+ min-width: min(22rem, 100%);
717
+ padding: 0.7rem 0.85rem;
718
+ border-radius: 0.75rem;
719
+ border: 1px solid var(--smrt-color-outline-variant);
720
+ background: var(--smrt-color-surface);
721
+ color: var(--smrt-color-on-surface);
722
+ }
723
+
724
+ .inline-form button,
725
+ .secondary {
726
+ border-radius: var(--smrt-radius-full, 9999px);
727
+ border: 1px solid color-mix(
728
+ in srgb,
729
+ var(--smrt-color-primary) 35%,
730
+ transparent
731
+ );
732
+ background: transparent;
733
+ color: var(--smrt-color-primary);
734
+ font-weight: var(--smrt-typography-weight-semibold, 600);
735
+ padding: 0.65rem 0.95rem;
736
+ cursor: pointer;
737
+ }
738
+
739
+ .pill {
740
+ display: inline-flex;
741
+ align-items: center;
742
+ justify-content: center;
743
+ min-width: 2rem;
744
+ min-height: 2rem;
745
+ border-radius: var(--smrt-radius-full, 9999px);
746
+ background: color-mix(
747
+ in srgb,
748
+ var(--smrt-color-primary) 14%,
749
+ transparent
750
+ );
751
+ color: var(--smrt-color-primary);
752
+ font-weight: var(--smrt-typography-weight-bold, 700);
753
+ padding: 0 0.8rem;
754
+ }
755
+
756
+ @media (min-width: 1024px) {
757
+ .qa-grid {
758
+ grid-template-columns: repeat(2, minmax(0, 1fr));
759
+ }
760
+ }
761
+
762
+ @media (max-width: 720px) {
763
+ .page {
764
+ padding: 1rem 0.85rem 2rem;
765
+ }
766
+
767
+ .page-header {
768
+ margin-bottom: 1rem;
769
+ }
770
+
771
+ .page-header h1 {
772
+ margin-top: 0.25rem;
773
+ font-size: clamp(1.6rem, 9vw, 2.2rem);
774
+ }
775
+
776
+ .callout,
777
+ .panel {
778
+ padding: 1rem;
779
+ border-radius: 0.85rem;
780
+ }
781
+
782
+ .callout__chips {
783
+ display: none;
784
+ }
785
+
786
+ .callout__header {
787
+ gap: 0.5rem;
788
+ align-items: center;
789
+ }
790
+
791
+ .callout__header p,
792
+ .callout__note {
793
+ font-size: var(--smrt-typography-body-medium-size, 0.82rem);
794
+ line-height: var(--smrt-typography-body-medium-line-height, 1.5);
795
+ }
796
+
797
+ .pill {
798
+ min-height: 1.7rem;
799
+ min-width: 0;
800
+ padding: 0 0.65rem;
801
+ font-size: var(--smrt-typography-label-medium-size, 0.78rem);
802
+ }
803
+
804
+ .section-heading {
805
+ gap: 0.75rem;
806
+ margin-bottom: 0.85rem;
807
+ }
808
+ }
809
+ </style>