@pega/sdk 0.0.2 → 0.0.3

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 (222) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
  3. package/templates/react-sdk-reference/.claude/instructions/component-map.md +38 -0
  4. package/templates/react-sdk-reference/.claude/instructions/dse-component.md +75 -0
  5. package/templates/react-sdk-reference/.claude/instructions/field-component.md +71 -0
  6. package/templates/react-sdk-reference/.claude/instructions/template-component.md +92 -0
  7. package/templates/react-sdk-reference/.claude/instructions/widget-component.md +87 -0
  8. package/templates/react-sdk-reference/.claude/prompts/add-component.md +144 -0
  9. package/templates/react-sdk-reference/.claude/prompts/component-manifest.json +111 -0
  10. package/templates/react-sdk-reference/.claude/prompts/generate-all-components.md +149 -0
  11. package/templates/react-sdk-reference/.claude/prompts/generate-dse-components.md +126 -0
  12. package/templates/react-sdk-reference/.claude/prompts/generate-field-components.md +139 -0
  13. package/templates/react-sdk-reference/.claude/prompts/generate-template-components.md +151 -0
  14. package/templates/react-sdk-reference/.claude/prompts/generate-widget-components.md +124 -0
  15. package/templates/react-sdk-reference/.claude/prompts/identify-components.md +105 -0
  16. package/templates/react-sdk-reference/.claude/prompts/replace-design-system.md +519 -0
  17. package/templates/react-sdk-reference/.claude/skills/component-contracts.md +140 -0
  18. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/AlertBanner.md +135 -0
  19. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Banner.md +149 -0
  20. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
  21. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/DetailsFields.md +144 -0
  22. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroup.md +131 -0
  23. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroupList.md +111 -0
  24. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldValueList.md +115 -0
  25. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Operator.md +149 -0
  26. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Pulse.md +83 -0
  27. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/RichTextEditor.md +206 -0
  28. package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
  29. package/templates/react-sdk-reference/.claude/skills/design-system-extension.md +289 -0
  30. package/templates/react-sdk-reference/.claude/skills/field-components.md +294 -0
  31. package/templates/react-sdk-reference/.claude/skills/field-skills/AutoComplete.md +112 -0
  32. package/templates/react-sdk-reference/.claude/skills/field-skills/CancelAlert.md +203 -0
  33. package/templates/react-sdk-reference/.claude/skills/field-skills/Checkbox.md +158 -0
  34. package/templates/react-sdk-reference/.claude/skills/field-skills/Currency.md +106 -0
  35. package/templates/react-sdk-reference/.claude/skills/field-skills/Date.md +99 -0
  36. package/templates/react-sdk-reference/.claude/skills/field-skills/DateTime.md +103 -0
  37. package/templates/react-sdk-reference/.claude/skills/field-skills/Decimal.md +98 -0
  38. package/templates/react-sdk-reference/.claude/skills/field-skills/Dropdown.md +114 -0
  39. package/templates/react-sdk-reference/.claude/skills/field-skills/Email.md +107 -0
  40. package/templates/react-sdk-reference/.claude/skills/field-skills/Group.md +90 -0
  41. package/templates/react-sdk-reference/.claude/skills/field-skills/Integer.md +87 -0
  42. package/templates/react-sdk-reference/.claude/skills/field-skills/Location.md +136 -0
  43. package/templates/react-sdk-reference/.claude/skills/field-skills/Multiselect.md +164 -0
  44. package/templates/react-sdk-reference/.claude/skills/field-skills/ObjectReference.md +164 -0
  45. package/templates/react-sdk-reference/.claude/skills/field-skills/Percentage.md +92 -0
  46. package/templates/react-sdk-reference/.claude/skills/field-skills/Phone.md +110 -0
  47. package/templates/react-sdk-reference/.claude/skills/field-skills/RadioButtons.md +146 -0
  48. package/templates/react-sdk-reference/.claude/skills/field-skills/RichText.md +138 -0
  49. package/templates/react-sdk-reference/.claude/skills/field-skills/ScalarList.md +124 -0
  50. package/templates/react-sdk-reference/.claude/skills/field-skills/SelectableCard.md +216 -0
  51. package/templates/react-sdk-reference/.claude/skills/field-skills/SemanticLink.md +148 -0
  52. package/templates/react-sdk-reference/.claude/skills/field-skills/TextArea.md +96 -0
  53. package/templates/react-sdk-reference/.claude/skills/field-skills/TextContent.md +101 -0
  54. package/templates/react-sdk-reference/.claude/skills/field-skills/TextInput.md +104 -0
  55. package/templates/react-sdk-reference/.claude/skills/field-skills/Time.md +88 -0
  56. package/templates/react-sdk-reference/.claude/skills/field-skills/URL.md +85 -0
  57. package/templates/react-sdk-reference/.claude/skills/field-skills/UserReference.md +180 -0
  58. package/templates/react-sdk-reference/.claude/skills/run-and-verify.md +68 -0
  59. package/templates/react-sdk-reference/.claude/skills/template-components.md +322 -0
  60. package/templates/react-sdk-reference/.claude/skills/template-skills/AdvancedSearch.md +144 -0
  61. package/templates/react-sdk-reference/.claude/skills/template-skills/AppShell.md +122 -0
  62. package/templates/react-sdk-reference/.claude/skills/template-skills/BannerPage.md +83 -0
  63. package/templates/react-sdk-reference/.claude/skills/template-skills/CaseSummary.md +100 -0
  64. package/templates/react-sdk-reference/.claude/skills/template-skills/CaseView.md +131 -0
  65. package/templates/react-sdk-reference/.claude/skills/template-skills/CaseViewActionsMenu.md +126 -0
  66. package/templates/react-sdk-reference/.claude/skills/template-skills/Confirmation.md +107 -0
  67. package/templates/react-sdk-reference/.claude/skills/template-skills/DataReference.md +120 -0
  68. package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultForm.md +102 -0
  69. package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultPage.md +110 -0
  70. package/templates/react-sdk-reference/.claude/skills/template-skills/Details.md +88 -0
  71. package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsSubTabs.md +95 -0
  72. package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsThreeColumn.md +78 -0
  73. package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsTwoColumn.md +78 -0
  74. package/templates/react-sdk-reference/.claude/skills/template-skills/DynamicTabs.md +101 -0
  75. package/templates/react-sdk-reference/.claude/skills/template-skills/FieldGroupTemplate.md +109 -0
  76. package/templates/react-sdk-reference/.claude/skills/template-skills/HierarchicalForm.md +113 -0
  77. package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboard.md +104 -0
  78. package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboardPage.md +85 -0
  79. package/templates/react-sdk-reference/.claude/skills/template-skills/ListPage.md +68 -0
  80. package/templates/react-sdk-reference/.claude/skills/template-skills/ListView.md +139 -0
  81. package/templates/react-sdk-reference/.claude/skills/template-skills/MultiReferenceReadOnly.md +80 -0
  82. package/templates/react-sdk-reference/.claude/skills/template-skills/NarrowWide.md +141 -0
  83. package/templates/react-sdk-reference/.claude/skills/template-skills/OneColumn.md +109 -0
  84. package/templates/react-sdk-reference/.claude/skills/template-skills/PromotedFilters.md +124 -0
  85. package/templates/react-sdk-reference/.claude/skills/template-skills/SelfServiceCaseView.md +135 -0
  86. package/templates/react-sdk-reference/.claude/skills/template-skills/SimpleTable.md +127 -0
  87. package/templates/react-sdk-reference/.claude/skills/template-skills/SingleReferenceReadOnly.md +103 -0
  88. package/templates/react-sdk-reference/.claude/skills/template-skills/SubTabs.md +79 -0
  89. package/templates/react-sdk-reference/.claude/skills/template-skills/TwoColumn.md +131 -0
  90. package/templates/react-sdk-reference/.claude/skills/template-skills/WideNarrow.md +150 -0
  91. package/templates/react-sdk-reference/.claude/skills/template-skills/WssNavBar.md +135 -0
  92. package/templates/react-sdk-reference/.claude/skills/widget-components.md +271 -0
  93. package/templates/react-sdk-reference/.claude/skills/widget-skills/AppAnnouncement.md +82 -0
  94. package/templates/react-sdk-reference/.claude/skills/widget-skills/Attachment.md +146 -0
  95. package/templates/react-sdk-reference/.claude/skills/widget-skills/CaseHistory.md +107 -0
  96. package/templates/react-sdk-reference/.claude/skills/widget-skills/FileUtility.md +200 -0
  97. package/templates/react-sdk-reference/.claude/skills/widget-skills/Followers.md +99 -0
  98. package/templates/react-sdk-reference/.claude/skills/widget-skills/QuickCreate.md +114 -0
  99. package/templates/react-sdk-reference/.claude/skills/widget-skills/SummaryItem.md +167 -0
  100. package/templates/react-sdk-reference/.claude/skills/widget-skills/ToDo.md +190 -0
  101. package/templates/react-sdk-reference/.cursor/rules/component-map.mdrules +41 -0
  102. package/templates/react-sdk-reference/.cursor/rules/dse-component.mdrules +78 -0
  103. package/templates/react-sdk-reference/.cursor/rules/field-component.mdrules +74 -0
  104. package/templates/react-sdk-reference/.cursor/rules/pega-sdk.mdrules +247 -0
  105. package/templates/react-sdk-reference/.cursor/rules/prompts/add-component.mdrules +149 -0
  106. package/templates/react-sdk-reference/.cursor/rules/prompts/component-manifest.json +111 -0
  107. package/templates/react-sdk-reference/.cursor/rules/prompts/generate-all-components.mdrules +154 -0
  108. package/templates/react-sdk-reference/.cursor/rules/prompts/generate-dse-components.mdrules +131 -0
  109. package/templates/react-sdk-reference/.cursor/rules/prompts/generate-field-components.mdrules +144 -0
  110. package/templates/react-sdk-reference/.cursor/rules/prompts/generate-template-components.mdrules +156 -0
  111. package/templates/react-sdk-reference/.cursor/rules/prompts/generate-widget-components.mdrules +129 -0
  112. package/templates/react-sdk-reference/.cursor/rules/prompts/identify-components.mdrules +110 -0
  113. package/templates/react-sdk-reference/.cursor/rules/prompts/replace-design-system.mdrules +524 -0
  114. package/templates/react-sdk-reference/.cursor/rules/skills/component-contracts.mdrules +145 -0
  115. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/AlertBanner.mdrules +140 -0
  116. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Banner.mdrules +154 -0
  117. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/CaseSummaryFields.mdrules +159 -0
  118. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/DetailsFields.mdrules +149 -0
  119. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroup.mdrules +136 -0
  120. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroupList.mdrules +116 -0
  121. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldValueList.mdrules +120 -0
  122. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Operator.mdrules +154 -0
  123. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Pulse.mdrules +88 -0
  124. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/RichTextEditor.mdrules +211 -0
  125. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/WssQuickCreate.mdrules +140 -0
  126. package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension.mdrules +294 -0
  127. package/templates/react-sdk-reference/.cursor/rules/skills/field-components.mdrules +299 -0
  128. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/AutoComplete.mdrules +117 -0
  129. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/CancelAlert.mdrules +208 -0
  130. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Checkbox.mdrules +163 -0
  131. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Currency.mdrules +111 -0
  132. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Date.mdrules +104 -0
  133. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/DateTime.mdrules +108 -0
  134. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Decimal.mdrules +103 -0
  135. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Dropdown.mdrules +119 -0
  136. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Email.mdrules +112 -0
  137. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Group.mdrules +95 -0
  138. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Integer.mdrules +92 -0
  139. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Location.mdrules +141 -0
  140. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Multiselect.mdrules +169 -0
  141. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ObjectReference.mdrules +169 -0
  142. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Percentage.mdrules +97 -0
  143. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Phone.mdrules +115 -0
  144. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RadioButtons.mdrules +151 -0
  145. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RichText.mdrules +143 -0
  146. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ScalarList.mdrules +129 -0
  147. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SelectableCard.mdrules +221 -0
  148. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SemanticLink.mdrules +153 -0
  149. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextArea.mdrules +101 -0
  150. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextContent.mdrules +106 -0
  151. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextInput.mdrules +109 -0
  152. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Time.mdrules +93 -0
  153. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/URL.mdrules +90 -0
  154. package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/UserReference.mdrules +185 -0
  155. package/templates/react-sdk-reference/.cursor/rules/skills/run-and-verify.mdrules +73 -0
  156. package/templates/react-sdk-reference/.cursor/rules/skills/template-components.mdrules +327 -0
  157. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AdvancedSearch.mdrules +149 -0
  158. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AppShell.mdrules +127 -0
  159. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/BannerPage.mdrules +88 -0
  160. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseSummary.mdrules +105 -0
  161. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseView.mdrules +136 -0
  162. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseViewActionsMenu.mdrules +131 -0
  163. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Confirmation.mdrules +112 -0
  164. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DataReference.mdrules +125 -0
  165. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultForm.mdrules +107 -0
  166. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultPage.mdrules +115 -0
  167. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Details.mdrules +93 -0
  168. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsSubTabs.mdrules +100 -0
  169. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsThreeColumn.mdrules +83 -0
  170. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsTwoColumn.mdrules +83 -0
  171. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DynamicTabs.mdrules +106 -0
  172. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/FieldGroupTemplate.mdrules +114 -0
  173. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/HierarchicalForm.mdrules +118 -0
  174. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboard.mdrules +109 -0
  175. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboardPage.mdrules +90 -0
  176. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListPage.mdrules +73 -0
  177. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListView.mdrules +144 -0
  178. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/MultiReferenceReadOnly.mdrules +85 -0
  179. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/NarrowWide.mdrules +146 -0
  180. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/OneColumn.mdrules +114 -0
  181. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/PromotedFilters.mdrules +129 -0
  182. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SelfServiceCaseView.mdrules +140 -0
  183. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SimpleTable.mdrules +132 -0
  184. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SingleReferenceReadOnly.mdrules +108 -0
  185. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SubTabs.mdrules +84 -0
  186. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/TwoColumn.mdrules +136 -0
  187. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WideNarrow.mdrules +155 -0
  188. package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WssNavBar.mdrules +140 -0
  189. package/templates/react-sdk-reference/.cursor/rules/skills/widget-components.mdrules +276 -0
  190. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/AppAnnouncement.mdrules +87 -0
  191. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Attachment.mdrules +151 -0
  192. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/CaseHistory.mdrules +112 -0
  193. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/FileUtility.mdrules +205 -0
  194. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Followers.mdrules +104 -0
  195. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/QuickCreate.mdrules +119 -0
  196. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/SummaryItem.mdrules +172 -0
  197. package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/ToDo.mdrules +195 -0
  198. package/templates/react-sdk-reference/.cursor/rules/template-component.mdrules +95 -0
  199. package/templates/react-sdk-reference/.cursor/rules/widget-component.mdrules +90 -0
  200. package/templates/react-sdk-reference/.github/copilot-instructions.md +58 -0
  201. package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +144 -16
  202. package/templates/react-sdk-reference/.github/prompts/generate-all-components.prompt.md +154 -0
  203. package/templates/react-sdk-reference/.github/prompts/generate-dse-components.prompt.md +131 -0
  204. package/templates/react-sdk-reference/.github/prompts/generate-field-components.prompt.md +144 -0
  205. package/templates/react-sdk-reference/.github/prompts/generate-template-components.prompt.md +156 -0
  206. package/templates/react-sdk-reference/.github/prompts/generate-widget-components.prompt.md +129 -0
  207. package/templates/react-sdk-reference/.github/skills/design-system-extension.md +58 -18
  208. package/templates/react-sdk-reference/.github/skills/field-components.md +55 -23
  209. package/templates/react-sdk-reference/.github/skills/template-components.md +48 -11
  210. package/templates/react-sdk-reference/.github/skills/widget-components.md +49 -12
  211. package/templates/react-sdk-reference/AGENTS.md +217 -29
  212. package/templates/react-sdk-reference/package.json +1 -1
  213. package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
  214. package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
  215. package/templates/react-sdk-reference/sdk-config.json +1 -1
  216. package/templates/react-sdk-reference/vite.config.ts +1 -1
  217. package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +0 -48
  218. package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +0 -81
  219. package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +0 -41
  220. package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +0 -49
  221. package/templates/react-sdk-reference/.github/skills/swap-design-system.md +0 -105
  222. package/templates/react-sdk-reference/pega-constellationjs-0.26.2.tgz +0 -0
@@ -0,0 +1,151 @@
1
+ ---
2
+ description: Widget component skill: Attachment
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Skill: Attachment
7
+
8
+ File upload/download widget for case attachments. Behaves like a form field — binds to a case attachment property, supports multiple files, validates extensions and size, tracks upload progress, and blocks form submission during active uploads.
9
+
10
+ > **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
11
+
12
+ ---
13
+
14
+ ## Component Purpose
15
+
16
+ Renders a file attachment control within a Pega form. Users can upload one or multiple files, download existing attachments, and delete attachments. The widget validates file extensions and enforces a maximum size from environment config. Upload progress is shown per-file. Form submission is blocked while uploads are in progress via the action sequencer.
17
+
18
+ ## Pega Metadata
19
+
20
+ - **Registration key:** `Attachment` (in `component-map.ts`)
21
+ - **Category:** Widget — form field (file input)
22
+ - **Extends:** `Omit<PConnFieldProps, 'value'>` (uses `value: any` instead of the standard string value)
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Required | Description |
27
+ |------|------|----------|-------------|
28
+ | `value` | `any` | Yes | Attachment list or single attachment object (from Pega property) |
29
+ | `allowMultiple` | `boolean \| string` | No | Whether multiple files can be attached. Default `false` |
30
+ | `extensions` | `string` | No | Comma-separated list of allowed file extensions (e.g., `".pdf,.doc,.jpg"`) |
31
+ | `editMode` | `string` | No | `"tableRows"` for inline table edit mode (special multi-attachment handling) |
32
+ | `isTableFormatter` | `boolean` | No | Whether this widget is used inside a table formatter |
33
+ | `label` | `string` | Yes (from PConnFieldProps) | Field label |
34
+ | `required` | `boolean` | No | Whether a file is required |
35
+ | `disabled` | `boolean` | No | Whether the control is disabled |
36
+ | `displayMode` | `string` | No | `"DISPLAY_ONLY"` for read-only rendering |
37
+ | `validatemessage` | `string` | No | Validation error message to display |
38
+ | `helperText` | `string` | No | Helper text shown below the control |
39
+ | `getPConnect` | `function` | Yes | PConnect getter |
40
+
41
+ ## Behavioral Contract
42
+
43
+ ### Attachment Format Detection
44
+
45
+ Pega has two attachment data formats — detect which one is in use:
46
+
47
+ **Old format (annotation-based):**
48
+ ```typescript
49
+ value = { pxResults: [...], pyAttachCount: N }
50
+ ```
51
+
52
+ **New standard format:**
53
+ ```typescript
54
+ value = [{ ID, name, mimeType, category, ... }] // array
55
+ ```
56
+
57
+ Call `PCore.getAttachmentUtils().prepareAttachmentData(value)` to normalize both formats into a unified `FileObject[]` array.
58
+
59
+ ### File Validation
60
+
61
+ On file selection (via `<input type='file'>`):
62
+ 1. **Extension check:** Compare selected file's extension against `extensions` prop (split by comma). If not allowed, add an error to the file and do not upload.
63
+ 2. **Size check:** Compare file size against `PCore.getEnvironmentInfo().getMaxAttachmentSize()` (in bytes). If too large, add a size error.
64
+ 3. Valid files proceed to upload.
65
+
66
+ ### Upload Flow
67
+
68
+ 1. Call `PCore.getActionsSequencer().addAction('attachment_upload_' + fileId)` — blocks form submission.
69
+ 2. Call `PCore.getAttachmentUtils().uploadAttachment(file, onProgress, onError, context)`.
70
+ 3. On progress: update per-file `progress` value (0–100) in state.
71
+ 4. On success: add the returned attachment metadata to the local file list; update the Pega property via `pConn.setReferenceList(newAttachmentList)`.
72
+ 5. Call `PCore.getActionsSequencer().removeAction('attachment_upload_' + fileId)` — unblocks form submission.
73
+ 6. On error: set file error state; call `PCore.getMessageManager().addMessages([errorMessage])`.
74
+
75
+ ### Download
76
+
77
+ Call `PCore.getAttachmentUtils().downloadAttachment(attachmentID, context)` — triggers browser file download.
78
+
79
+ ### Delete
80
+
81
+ Remove the attachment from the local list and update `pConn.setReferenceList(updatedList)`. Do not call a separate delete API in the reference implementation — deletion is committed on form save.
82
+
83
+ ### Pub-Sub: Assignment Submission
84
+
85
+ Subscribe to `PCore.getPubSubUtils().subscribe(BEFORE_ASSIGNMENT_SUBMIT, handleBeforeSubmit, 'Attachment')`. In `handleBeforeSubmit`, validate that no uploads are still in progress.
86
+
87
+ ### Read-Only Mode (`displayMode === 'DISPLAY_ONLY'`)
88
+
89
+ Render a list of existing attachments as download links. No upload controls shown.
90
+
91
+ ### Inline Table Edit Mode (`editMode === 'tableRows'`)
92
+
93
+ Compressed display for use inside a table cell. Show attachment count and a small upload button. Clicking opens a minimal upload dialog.
94
+
95
+ ## Visual Specifications
96
+
97
+ | Element | Description |
98
+ |---------|-------------|
99
+ | Label | Standard field label above the control |
100
+ | Drop zone / Upload button | Clickable area to select files; optionally supports drag-and-drop |
101
+ | File list | Each uploaded file: icon + name + size + progress bar (during upload) + delete button |
102
+ | Error state | Red error text below the control for invalid files or upload failures |
103
+ | Helper text | Secondary text below the control |
104
+
105
+ **CSS-only implementation notes:**
106
+ - Drop zone: `border: 2px dashed var(--border-color); border-radius: 4px; padding: 1rem; text-align: center; cursor: pointer`.
107
+ - Drop zone hover: `border-color: var(--app-primary-color); background: var(--hover-bg)`.
108
+ - File row: `display: flex; align-items: center; gap: 0.5rem; padding: 4px 0`.
109
+ - Progress bar: `height: 4px; background: var(--app-primary-color); border-radius: 2px; transition: width 0.2s`.
110
+ - Error text: `color: var(--error-color); font-size: 0.75rem; margin-top: 4px`.
111
+ - Delete button: `color: var(--error-color)`.
112
+
113
+ ## Edge Cases & Special Logic
114
+
115
+ - `allowMultiple` may be a string `"true"` / `"false"` or a boolean — always coerce: `allowMultiple === true || allowMultiple === 'true'`.
116
+ - Upload progress: track per-file progress in a `Map<fileId, number>` state object.
117
+ - `isTableFormatter`: when `true`, hide the label and reduce padding for compact table display.
118
+ - Concurrent uploads: multiple files may upload simultaneously — the sequencer action must be keyed per-file.
119
+ - Max size: call `PCore.getEnvironmentInfo().getMaxAttachmentSize()` at validation time (not at mount) — size config may be dynamic.
120
+ - `extensions` may be empty string — if empty, allow all file types.
121
+
122
+ ## Dependencies
123
+
124
+ - `AttachmentUtils.ts` — `validateExtension`, `validateSize`, `getFileTypeIcon`, `buildDownloadURL`, error handling helpers
125
+ - `Attachment.types.ts` — `FileObject`, `AttachmentLinks`, `PageInstructionOptions` type definitions
126
+ - `PCore.getAttachmentUtils()` — upload, download, prepareAttachmentData
127
+ - `PCore.getActionsSequencer()` — block/unblock form submission during upload
128
+ - `PCore.getEnvironmentInfo()` — max attachment size
129
+ - `PCore.getMessageManager()` — error message display
130
+ - `PCore.getPubSubUtils()` — before-submit subscription
131
+ - `downloadjs` library — browser file download trigger
132
+
133
+ ## Design System Mapping
134
+
135
+ **UI control type:** File upload form field with progress tracking, validation, and attachment list.
136
+
137
+ Listed design systems are examples only.
138
+
139
+ | Design System | File Input | Progress | File List |
140
+ |---|---|---|---|
141
+ | Default (CSS only) | `<input type='file'>` + custom styled drop zone | `<progress>` element or CSS bar | `<ul>/<li>` rows |
142
+ | MUI | Custom styled `<Box>` drop zone + hidden `<input>` | `<LinearProgress>` | `<List>/<ListItem>` |
143
+ | Ant Design | `<Upload dragger>` | `<Progress>` | Built-in upload file list |
144
+ | Chakra UI | Custom `<Box>` with `useDropzone` | `<Progress>` | `<VStack>` rows |
145
+ | Shadcn/ui | Custom drop zone | Custom CSS progress bar | `<ul>/<li>` rows |
146
+
147
+ When implementing in a specific design system:
148
+ - Action sequencer blocking (`addAction`/`removeAction`) is mandatory — do not skip it; form submission must be blocked during uploads
149
+ - Detect and normalize both old and new attachment formats via `prepareAttachmentData`
150
+ - `allowMultiple` coercion (string vs boolean) is required
151
+ - Extension and size validation must happen client-side before calling the upload API
@@ -0,0 +1,112 @@
1
+ ---
2
+ description: Widget component skill: CaseHistory
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Skill: CaseHistory
7
+
8
+ Case history widget. Fetches and displays the full audit trail for the current case in a table with Date, Description, and Performer columns.
9
+
10
+ > **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
11
+
12
+ ---
13
+
14
+ ## Component Purpose
15
+
16
+ Renders a table of case events sourced from the `D_pyWorkHistory` data page. Shows when each event happened (`pyUpdatedDateTime`), what happened (`pyMessageKey`), and who performed it (`pyPerformer`). Uses `fast-deep-equal` to skip unnecessary re-renders when data has not changed.
17
+
18
+ ## Pega Metadata
19
+
20
+ - **Registration key:** `CaseHistory` (in `component-map.ts`)
21
+ - **Category:** Widget — case data display
22
+ - **Extends:** `PConnProps`
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Required | Description |
27
+ |------|------|----------|-------------|
28
+ | `getPConnect` | `function` | Yes | PConnect getter — used to resolve case ID and context |
29
+
30
+ No additional custom props. All data is fetched internally.
31
+
32
+ ## Behavioral Contract
33
+
34
+ ### Data Fetch
35
+
36
+ On mount, fetch history from the `D_pyWorkHistory` data page:
37
+
38
+ ```
39
+ PCore.getDataApiUtils().getData(
40
+ 'D_pyWorkHistory',
41
+ { pyCaseInsKey: caseKey },
42
+ context
43
+ )
44
+ ```
45
+
46
+ - `caseKey` = `pConn.getCaseInfo().getKey()` (the fully-qualified case key).
47
+ - `context` = `pConn.getContextName()`.
48
+ - Store result in `historyData` state array.
49
+ - On error or empty response, `historyData` stays as `[]`.
50
+
51
+ ### Re-render Optimization
52
+
53
+ Use `fast-deep-equal/react` to compare new `historyData` with previous value — only call `setHistoryData` if the data has actually changed. This prevents unnecessary re-renders caused by reference inequality.
54
+
55
+ ### Data Transformation
56
+
57
+ For each history row, map:
58
+ - **Date column:** Format `pyUpdatedDateTime` using the SDK date formatter (e.g., `formatDateTime(row.pyUpdatedDateTime)`) or display as-is.
59
+ - **Description column:** `row.pyMessageKey` — the localized event description string.
60
+ - **Performer column:** `row.pyPerformer` — the operator who performed the action.
61
+ - Missing values: display `"---"` for any undefined/null field.
62
+
63
+ ## Visual Specifications
64
+
65
+ ### Table Layout
66
+
67
+ | Column | Field | Width |
68
+ |--------|-------|-------|
69
+ | Date | `pyUpdatedDateTime` (formatted) | ~25% |
70
+ | Description | `pyMessageKey` | ~50% |
71
+ | Performer | `pyPerformer` | ~25% |
72
+
73
+ **CSS-only implementation notes:**
74
+ - Table container: `width: 100%; overflow-x: auto`.
75
+ - Table: `border-collapse: collapse; width: 100%`.
76
+ - Header cells: `background: var(--table-header-bg); font-weight: 600; padding: 8px 12px; border-bottom: 2px solid var(--divider-color)`.
77
+ - Body cells: `padding: 8px 12px; border-bottom: 1px solid var(--divider-color)`.
78
+ - Missing value placeholder `"---"`: `color: var(--secondary-text-color)`.
79
+ - No pagination in the reference implementation — all rows shown.
80
+
81
+ ## Edge Cases & Special Logic
82
+
83
+ - `D_pyWorkHistory` may return an empty array for cases with no history events — render an empty table body (or an empty-state message like `"No history available"`).
84
+ - `pyUpdatedDateTime` format varies — always run it through the SDK date formatter before display.
85
+ - `pyMessageKey` may be a locale key — resolve it via `PCore.getLocaleUtils().getLocaleValue()` if a localized string is required.
86
+ - The widget has no pagination — for cases with very long history, the table may become very tall. Consider adding pagination if needed.
87
+
88
+ ## Dependencies
89
+
90
+ - `PCore.getDataApiUtils().getData()` — fetches `D_pyWorkHistory` data page
91
+ - `fast-deep-equal/react` — prevents unnecessary re-renders
92
+ - `PCore.getConstants().CASE_INFO.CASE_INFO_ID` — resolves case ID constant
93
+ - MUI: `<Table>`, `<TableBody>`, `<TableCell>`, `<TableContainer>`, `<TableHead>`, `<TableRow>`
94
+
95
+ ## Design System Mapping
96
+
97
+ **UI control type:** Read-only case audit table with 3 columns.
98
+
99
+ Listed design systems are examples only.
100
+
101
+ | Design System | Table |
102
+ |---|---|
103
+ | Default (CSS only) | `<table>/<thead>/<tbody>/<tr>/<td>` |
104
+ | MUI | `<TableContainer>` + `<Table>` + `<TableHead>/<TableBody>/<TableRow>/<TableCell>` |
105
+ | Ant Design | `<Table dataSource={historyData} columns={...}>` |
106
+ | Chakra UI | `<Table>` + `<Thead>/<Tbody>/<Tr>/<Th>/<Td>` |
107
+ | Shadcn/ui | `<Table>` + `<TableHeader>/<TableBody>/<TableRow>/<TableHead>/<TableCell>` |
108
+
109
+ When implementing in a specific design system:
110
+ - `fast-deep-equal` comparison is a performance optimization — include it to avoid redundant renders on re-subscription
111
+ - Data page name `D_pyWorkHistory` is fixed — do not make it configurable
112
+ - Missing field fallback `"---"` should be consistent across all three columns
@@ -0,0 +1,205 @@
1
+ ---
2
+ description: Widget component skill: FileUtility
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Skill: FileUtility
7
+
8
+ File and URL management utility widget. Displays case attachments and links, supports upload/download/delete, and provides modals for adding new files or URLs. Also covers `ActionButtonsForFileUtil` sub-component.
9
+
10
+ > **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
11
+
12
+ ---
13
+
14
+ ## Component Purpose
15
+
16
+ The primary attachments management panel in the case utilities column. Shows up to 3 attachments/links in the main view with a "View all" option that opens a modal with the full list. Users can upload files, attach URLs, download, and delete items. Attachment state is kept fresh via debounced pub-sub subscriptions.
17
+
18
+ ## Pega Metadata
19
+
20
+ - **Registration key:** `FileUtility` (in `component-map.ts`)
21
+ - **Category:** Widget — file management
22
+ - **Extends:** `PConnProps`
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Required | Description |
27
+ |------|------|----------|-------------|
28
+ | `caseId` | `string` | No | Optional case ID override. If absent, resolved from `pConn.getCaseInfo().getID()` |
29
+ | `getPConnect` | `function` | Yes | PConnect getter |
30
+
31
+ ## Behavioral Contract
32
+
33
+ ### Attachment Fetch
34
+
35
+ On mount and on attachment change events:
36
+ ```
37
+ PCore.getAttachmentUtils().getCaseAttachments(caseKey, context)
38
+ ```
39
+ Returns array of attachment/link objects. Store in `attachments` state.
40
+
41
+ Debounced auto-refresh: on `CASE_ATTACHMENTS_UPDATED` pub-sub event, wait 1000ms (debounced) then re-fetch. This prevents rapid re-fetches when multiple files are uploaded simultaneously.
42
+
43
+ ### Main View — Top 3 Display
44
+
45
+ Show only the first 3 items from `attachments`. If `attachments.length > 3`, show a `"View all (N)"` button that opens the full-list modal.
46
+
47
+ ### SummaryList Integration
48
+
49
+ Map each attachment/link to a `SummaryItem`-compatible object:
50
+ ```typescript
51
+ {
52
+ id: attachment.ID,
53
+ visual: { icon: getFileIcon(attachment.mimeType) },
54
+ primary: {
55
+ type: attachment.category === 'FILE' ? 'FILE' : 'URL',
56
+ name: attachment.name,
57
+ click: () => handleDownloadOrOpen(attachment)
58
+ },
59
+ secondary: { text: attachment.createdBy + ' · ' + formatDate(attachment.createTime) }
60
+ actions: [
61
+ { id: 'delete', text: 'Delete', icon: 'trash', onClick: () => handleDelete(attachment.ID) }
62
+ ]
63
+ }
64
+ ```
65
+
66
+ Pass to `<SummaryList arItems$={summaryItems} />`.
67
+
68
+ ### File Upload
69
+
70
+ 1. User clicks "Add file" from the `<Menu>`.
71
+ 2. Opens an add-file modal (dialog).
72
+ 3. User selects a file via `<input type='file'>`.
73
+ 4. On confirm: call `PCore.getAttachmentUtils().uploadAttachment(file, onProgress, onError, context)`.
74
+ 5. On success: call `PCore.getAttachmentUtils().linkAttachmentsToCase(caseKey, [newAttachment], context)`.
75
+ 6. Refresh attachment list.
76
+
77
+ ### URL Attachment
78
+
79
+ 1. User clicks "Add link" from the `<Menu>`.
80
+ 2. Opens add-link modal with two fields: `Title` (required) and `URL` (required).
81
+ 3. The "Attach" button is enabled only when both `title` and `url` are non-empty.
82
+ 4. On confirm: call `PCore.getAttachmentUtils().linkAttachmentsToCase(caseKey, [{ name: title, url, category: 'URL' }], context)`.
83
+ 5. Refresh attachment list.
84
+
85
+ ### Download / Open
86
+
87
+ - **FILE type:** Call `PCore.getAttachmentUtils().downloadAttachment(attachmentID, context)` then trigger browser download via `downloadjs`.
88
+ - **URL type:** Open `attachment.url` in a new browser tab (`window.open(url, '_blank')`).
89
+
90
+ ### Delete
91
+
92
+ Call `PCore.getAttachmentUtils().deleteAttachment(attachmentID, context)`. Refresh attachment list after success.
93
+
94
+ ### Actions Menu
95
+
96
+ Render a `<MoreVertIcon>` `<IconButton>` that opens a `<Menu>` with:
97
+ - `"Add file"` — opens add-file modal
98
+ - `"Add link"` — opens add-link modal
99
+
100
+ ## Visual Specifications
101
+
102
+ ### Main Card
103
+
104
+ | Element | Description |
105
+ |---------|-------------|
106
+ | Card header | `"Attachments"` (or localized) + count badge |
107
+ | Actions icon | `<MoreVertIcon>` button top-right |
108
+ | Attachment rows | Up to 3 `SummaryItem` cards |
109
+ | "View all" button | Text button, shown when > 3 attachments |
110
+
111
+ ### "View all" Modal
112
+
113
+ | Element | Description |
114
+ |---------|-------------|
115
+ | Modal header | `"All attachments (N)"` |
116
+ | Attachment rows | All items in `SummaryList` |
117
+ | Close button | `X` in modal header |
118
+
119
+ ### Add File Modal
120
+
121
+ | Element | Description |
122
+ |---------|-------------|
123
+ | File picker | `<input type='file'>` |
124
+ | Progress bar | Per-file upload progress |
125
+ | Action buttons | `ActionButtonsForFileUtil` (Cancel + Attach) |
126
+
127
+ ### Add Link Modal
128
+
129
+ | Element | Description |
130
+ |---------|-------------|
131
+ | Title field | `<TextField label='Title'>` — required |
132
+ | URL field | `<TextField label='URL'>` — required |
133
+ | Attach button | Enabled only when both fields are filled |
134
+ | Action buttons | `ActionButtonsForFileUtil` (Cancel + Attach) |
135
+
136
+ **CSS-only implementation notes:**
137
+ - Main card: standard card styles.
138
+ - Modal: `position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.2); min-width: 480px; padding: 1.5rem`.
139
+ - "View all" button: text style, `color: var(--app-primary-color); cursor: pointer`.
140
+ - Progress bar: `height: 4px; background: var(--app-primary-color); transition: width 0.3s`.
141
+
142
+ ## Sub-Component: ActionButtonsForFileUtil
143
+
144
+ **Registration key:** `ActionButtonsForFileUtil`
145
+
146
+ A simple button row component used inside the FileUtility modals to render Cancel + primary action buttons.
147
+
148
+ ### Props
149
+
150
+ | Prop | Type | Required | Description |
151
+ |------|------|----------|-------------|
152
+ | `arMainButtons` | `any[]` | Yes | Primary button definitions `[{ actionID, name }]` |
153
+ | `arSecondaryButtons` | `any[]` | Yes | Secondary (cancel) button definitions `[{ actionID, name }]` |
154
+ | `primaryAction` | `function` | Yes | Callback invoked when the primary button is clicked |
155
+ | `secondaryAction` | `function` | Yes | Callback invoked when the secondary/cancel button is clicked |
156
+ | `getPConnect` | `function` | Yes | PConnect getter |
157
+
158
+ ### Layout
159
+
160
+ ```
161
+ [Secondary buttons (left)] [Primary buttons (right)]
162
+ Cancel Attach
163
+ ```
164
+
165
+ - Secondary buttons: outlined/text style.
166
+ - Primary buttons: contained/filled style with theme primary color.
167
+ - Render using `arSecondaryButtons.map(...)` and `arMainButtons.map(...)`.
168
+
169
+ ## Edge Cases & Special Logic
170
+
171
+ - **Debounce (1000ms):** Prevents excessive re-fetches when multiple attachment events fire in quick succession.
172
+ - **Add link "Attach" button disabled state:** Title and URL validation must happen on every keystroke — use controlled inputs with `!title || !url` to derive disabled state.
173
+ - **`linkAttachmentsToCase`:** After upload, the file must be explicitly linked to the case. Uploading alone does not associate the file with the case.
174
+ - **Pub-sub cleanup:** Unsubscribe from `CASE_ATTACHMENTS_UPDATED` on unmount to prevent stale callbacks.
175
+ - **Error display:** Use `PCore.getMessageManager()` or inline error state in the modal — do not silently fail on upload/link errors.
176
+
177
+ ## Dependencies
178
+
179
+ - `PCore.getAttachmentUtils()` — getCaseAttachments, uploadAttachment, downloadAttachment, deleteAttachment, linkAttachmentsToCase
180
+ - `PCore.getMessagingServiceManager()` — subscribe to attachment change events
181
+ - `PCore.getConstants()` — case info ID, summary refresh timing
182
+ - `getComponentFromRegistry('SummaryList')` — renders the attachment item list
183
+ - `getComponentFromRegistry('ActionButtonsForFileUtil')` — renders modal action buttons
184
+ - `downloadjs` — browser file download trigger
185
+ - MUI: `<Card>`, `<CardHeader>`, `<CardContent>`, `<IconButton>`, `<Menu>`, `<MenuItem>`, `<Button>`, `<TextField>`, `<Dialog>`, `<CircularProgress>`
186
+ - MUI Icons: `<MoreVertIcon>`
187
+
188
+ ## Design System Mapping
189
+
190
+ **UI control type:** File management widget — attachment list with upload/download/delete and add modals.
191
+
192
+ Listed design systems are examples only.
193
+
194
+ | Design System | Card | Action Menu | Modal | Progress |
195
+ |---|---|---|---|---|
196
+ | Default (CSS only) | `<div>` card | `<button>` + custom dropdown | `<dialog>` | CSS progress bar |
197
+ | MUI | `<Card>` | `<IconButton>` + `<Menu>/<MenuItem>` | `<Dialog>` | `<CircularProgress>` or `<LinearProgress>` |
198
+ | Ant Design | `<Card>` | `<Dropdown menu={{ items }}>` | `<Modal>` | `<Progress>` |
199
+ | Chakra UI | `<Card>` | `<Menu>/<MenuButton>/<MenuList>` | `<Modal>` | `<Progress>` |
200
+ | Shadcn/ui | `<Card>` | `<DropdownMenu>` | `<Dialog>` | Custom progress bar |
201
+
202
+ When implementing in a specific design system:
203
+ - Debounced refresh (1000ms) after pub-sub attachment events is required — prevents excessive API calls
204
+ - `linkAttachmentsToCase` must be called after upload — uploading alone does not attach to the case
205
+ - `ActionButtonsForFileUtil` receives button definition arrays — render them generically from `arMainButtons`/`arSecondaryButtons`
@@ -0,0 +1,104 @@
1
+ ---
2
+ description: Widget component skill: Followers
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Skill: Followers
7
+
8
+ Followers widget. Displays the list of users following the current case. Currently a stub/placeholder in the reference implementation — renders an "unsupported" message.
9
+
10
+ > **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
11
+
12
+ ---
13
+
14
+ ## Component Purpose
15
+
16
+ Intended to display the list of operators following a case, allowing users to follow/unfollow a case and see who else is following it. The reference implementation is a **stub** — it renders a `"Followers - unsupported"` message inside a card. A full implementation would fetch follower data from the Pega data layer and provide follow/unfollow actions.
17
+
18
+ ## Pega Metadata
19
+
20
+ - **Registration key:** `Followers` (in `component-map.ts`)
21
+ - **Category:** Widget — social / collaboration
22
+ - **Extends:** `PConnProps`
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Required | Description |
27
+ |------|------|----------|-------------|
28
+ | `getPConnect` | `function` | Yes | PConnect getter |
29
+
30
+ No additional custom props in the current stub implementation. A full implementation would likely include:
31
+ - `datasource` — data page name for follower list
32
+ - `headerText` — widget title (e.g., `"Followers"`)
33
+
34
+ ## Behavioral Contract
35
+
36
+ ### Current (Stub) Implementation
37
+
38
+ 1. Render a `<Card>` with title `"Followers"`.
39
+ 2. Show `"Followers - unsupported"` body text.
40
+ 3. No data fetching, no actions.
41
+
42
+ ### Expected Full Implementation
43
+
44
+ 1. **Fetch followers:** Call `PCore.getDataPageUtils().getDataAsync('D_pyCaseFollowers', context, { caseKey })` on mount.
45
+ 2. **Display follower list:** Render each follower's avatar (initials) and display name.
46
+ 3. **Follow/unfollow toggle:** Button to follow or unfollow the current case:
47
+ - Follow: `PCore.getRestClient().invokeCustomRestApi('/api/v1/cases/{caseID}/followers', { method: 'POST', ... })`.
48
+ - Unfollow: same endpoint with `DELETE` method.
49
+ 4. **Real-time update:** Subscribe to follower change events via pub-sub if available.
50
+
51
+ ## Visual Specifications
52
+
53
+ ### Stub Rendering
54
+
55
+ | Element | Value |
56
+ |---------|-------|
57
+ | Card title | `"Followers"` |
58
+ | Card body | `"Followers - unsupported"` plain text |
59
+
60
+ ### Expected Full Rendering
61
+
62
+ | Element | Description |
63
+ |---------|-------------|
64
+ | Card header | `"Followers"` + count badge |
65
+ | Follower avatars | Row of avatar initials circles |
66
+ | Follow button | Toggle button `"Follow"` / `"Unfollow"` |
67
+
68
+ **CSS-only implementation notes (stub):**
69
+ - Card: standard card layout — `border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.12); padding: 1rem`.
70
+ - Unsupported message: `color: var(--secondary-text-color); font-size: 0.875rem`.
71
+
72
+ **CSS-only implementation notes (full):**
73
+ - Avatar row: `display: flex; flex-wrap: wrap; gap: 4px`.
74
+ - Avatar circle: `width: 32px; height: 32px; border-radius: 50%; background: var(--avatar-bg); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600`.
75
+
76
+ ## Edge Cases & Special Logic
77
+
78
+ - If the stub message `"Followers - unsupported"` is shown in production, it means this widget has not been fully implemented yet — that is expected behavior.
79
+ - When implementing: guard against empty follower arrays — show a `"No followers yet"` state.
80
+ - Follow/unfollow toggle must reflect the current user's follow status — fetch this as part of the initial data load.
81
+
82
+ ## Dependencies
83
+
84
+ - MUI: `<Card>`, `<CardContent>`, `<CardHeader>`, `<Typography>` (current stub)
85
+ - Future full implementation would add: `<Avatar>`, `<Button>`, `<Badge>`, pub-sub subscriptions
86
+
87
+ ## Design System Mapping
88
+
89
+ **UI control type:** Social widget — follower list with follow/unfollow action.
90
+
91
+ Listed design systems are examples only.
92
+
93
+ | Design System | Card | Avatar | Toggle Button |
94
+ |---|---|---|---|
95
+ | Default (CSS only) | `<div>` with border | CSS circle with initials | `<button>` |
96
+ | MUI | `<Card>` + `<Avatar>` | `<Avatar>` | `<Button>` variant toggle |
97
+ | Ant Design | `<Card>` | `<Avatar>` | `<Button>` |
98
+ | Chakra UI | `<Card>` | `<Avatar>` | `<Button>` |
99
+ | Shadcn/ui | `<Card>` | Custom avatar | `<Button>` |
100
+
101
+ When implementing in a specific design system:
102
+ - The current stub only needs a card with a message — implement the full behavior once the Pega backend supports it
103
+ - Follow/unfollow must be scoped to the current case (`caseKey` from `pConn.getCaseInfo().getKey()`)
104
+ - Follower count badge in the card header improves scannability