@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.
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/templates/react-sdk-reference/.claude/instructions/component-map.md +38 -0
- package/templates/react-sdk-reference/.claude/instructions/dse-component.md +75 -0
- package/templates/react-sdk-reference/.claude/instructions/field-component.md +71 -0
- package/templates/react-sdk-reference/.claude/instructions/template-component.md +92 -0
- package/templates/react-sdk-reference/.claude/instructions/widget-component.md +87 -0
- package/templates/react-sdk-reference/.claude/prompts/add-component.md +144 -0
- package/templates/react-sdk-reference/.claude/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-all-components.md +149 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-dse-components.md +126 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-field-components.md +139 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-template-components.md +151 -0
- package/templates/react-sdk-reference/.claude/prompts/generate-widget-components.md +124 -0
- package/templates/react-sdk-reference/.claude/prompts/identify-components.md +105 -0
- package/templates/react-sdk-reference/.claude/prompts/replace-design-system.md +519 -0
- package/templates/react-sdk-reference/.claude/skills/component-contracts.md +140 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/AlertBanner.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Banner.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/DetailsFields.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroup.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldGroupList.md +111 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/FieldValueList.md +115 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Operator.md +149 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/Pulse.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/RichTextEditor.md +206 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/design-system-extension.md +289 -0
- package/templates/react-sdk-reference/.claude/skills/field-components.md +294 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/AutoComplete.md +112 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/CancelAlert.md +203 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Checkbox.md +158 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Currency.md +106 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Date.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/DateTime.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Decimal.md +98 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Dropdown.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Email.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Group.md +90 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Integer.md +87 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Location.md +136 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Multiselect.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ObjectReference.md +164 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Percentage.md +92 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Phone.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RadioButtons.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/RichText.md +138 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/ScalarList.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SelectableCard.md +216 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/SemanticLink.md +148 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextArea.md +96 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextContent.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/TextInput.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/Time.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/URL.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/field-skills/UserReference.md +180 -0
- package/templates/react-sdk-reference/.claude/skills/run-and-verify.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-components.md +322 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AdvancedSearch.md +144 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/AppShell.md +122 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/BannerPage.md +83 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseSummary.md +100 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseView.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/CaseViewActionsMenu.md +126 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Confirmation.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DataReference.md +120 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultForm.md +102 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DefaultPage.md +110 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/Details.md +88 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsSubTabs.md +95 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsThreeColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DetailsTwoColumn.md +78 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/DynamicTabs.md +101 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/FieldGroupTemplate.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/HierarchicalForm.md +113 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboard.md +104 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/InlineDashboardPage.md +85 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListPage.md +68 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/ListView.md +139 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/MultiReferenceReadOnly.md +80 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/NarrowWide.md +141 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/OneColumn.md +109 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/PromotedFilters.md +124 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SelfServiceCaseView.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SimpleTable.md +127 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SingleReferenceReadOnly.md +103 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/SubTabs.md +79 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/TwoColumn.md +131 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WideNarrow.md +150 -0
- package/templates/react-sdk-reference/.claude/skills/template-skills/WssNavBar.md +135 -0
- package/templates/react-sdk-reference/.claude/skills/widget-components.md +271 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/AppAnnouncement.md +82 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Attachment.md +146 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/CaseHistory.md +107 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/FileUtility.md +200 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/Followers.md +99 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/QuickCreate.md +114 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/SummaryItem.md +167 -0
- package/templates/react-sdk-reference/.claude/skills/widget-skills/ToDo.md +190 -0
- package/templates/react-sdk-reference/.cursor/rules/component-map.mdrules +41 -0
- package/templates/react-sdk-reference/.cursor/rules/dse-component.mdrules +78 -0
- package/templates/react-sdk-reference/.cursor/rules/field-component.mdrules +74 -0
- package/templates/react-sdk-reference/.cursor/rules/pega-sdk.mdrules +247 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/add-component.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/component-manifest.json +111 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-all-components.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-dse-components.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-field-components.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-template-components.mdrules +156 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/generate-widget-components.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/identify-components.mdrules +110 -0
- package/templates/react-sdk-reference/.cursor/rules/prompts/replace-design-system.mdrules +524 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/component-contracts.mdrules +145 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/AlertBanner.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Banner.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/CaseSummaryFields.mdrules +159 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/DetailsFields.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroup.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldGroupList.mdrules +116 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/FieldValueList.mdrules +120 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Operator.mdrules +154 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/Pulse.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/RichTextEditor.mdrules +211 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension-skills/WssQuickCreate.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/design-system-extension.mdrules +294 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-components.mdrules +299 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/AutoComplete.mdrules +117 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/CancelAlert.mdrules +208 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Checkbox.mdrules +163 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Currency.mdrules +111 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Date.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/DateTime.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Decimal.mdrules +103 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Dropdown.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Email.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Group.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Integer.mdrules +92 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Location.mdrules +141 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Multiselect.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ObjectReference.mdrules +169 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Percentage.mdrules +97 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Phone.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RadioButtons.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/RichText.mdrules +143 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/ScalarList.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SelectableCard.mdrules +221 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/SemanticLink.mdrules +153 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextArea.mdrules +101 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextContent.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/TextInput.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/Time.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/URL.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/field-skills/UserReference.mdrules +185 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/run-and-verify.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-components.mdrules +327 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AdvancedSearch.mdrules +149 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/AppShell.mdrules +127 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/BannerPage.mdrules +88 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseSummary.mdrules +105 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseView.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/CaseViewActionsMenu.mdrules +131 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Confirmation.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DataReference.mdrules +125 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultForm.mdrules +107 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DefaultPage.mdrules +115 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/Details.mdrules +93 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsSubTabs.mdrules +100 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsThreeColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DetailsTwoColumn.mdrules +83 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/DynamicTabs.mdrules +106 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/FieldGroupTemplate.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/HierarchicalForm.mdrules +118 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboard.mdrules +109 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/InlineDashboardPage.mdrules +90 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListPage.mdrules +73 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/ListView.mdrules +144 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/MultiReferenceReadOnly.mdrules +85 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/NarrowWide.mdrules +146 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/OneColumn.mdrules +114 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/PromotedFilters.mdrules +129 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SelfServiceCaseView.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SimpleTable.mdrules +132 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SingleReferenceReadOnly.mdrules +108 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/SubTabs.mdrules +84 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/TwoColumn.mdrules +136 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WideNarrow.mdrules +155 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/template-skills/WssNavBar.mdrules +140 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-components.mdrules +276 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/AppAnnouncement.mdrules +87 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Attachment.mdrules +151 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/CaseHistory.mdrules +112 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/FileUtility.mdrules +205 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/Followers.mdrules +104 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/QuickCreate.mdrules +119 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/SummaryItem.mdrules +172 -0
- package/templates/react-sdk-reference/.cursor/rules/skills/widget-skills/ToDo.mdrules +195 -0
- package/templates/react-sdk-reference/.cursor/rules/template-component.mdrules +95 -0
- package/templates/react-sdk-reference/.cursor/rules/widget-component.mdrules +90 -0
- package/templates/react-sdk-reference/.github/copilot-instructions.md +58 -0
- package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +144 -16
- package/templates/react-sdk-reference/.github/prompts/generate-all-components.prompt.md +154 -0
- package/templates/react-sdk-reference/.github/prompts/generate-dse-components.prompt.md +131 -0
- package/templates/react-sdk-reference/.github/prompts/generate-field-components.prompt.md +144 -0
- package/templates/react-sdk-reference/.github/prompts/generate-template-components.prompt.md +156 -0
- package/templates/react-sdk-reference/.github/prompts/generate-widget-components.prompt.md +129 -0
- package/templates/react-sdk-reference/.github/skills/design-system-extension.md +58 -18
- package/templates/react-sdk-reference/.github/skills/field-components.md +55 -23
- package/templates/react-sdk-reference/.github/skills/template-components.md +48 -11
- package/templates/react-sdk-reference/.github/skills/widget-components.md +49 -12
- package/templates/react-sdk-reference/AGENTS.md +217 -29
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/sdk-config.json +1 -1
- package/templates/react-sdk-reference/vite.config.ts +1 -1
- package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +0 -48
- package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +0 -81
- package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +0 -41
- package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +0 -49
- package/templates/react-sdk-reference/.github/skills/swap-design-system.md +0 -105
- package/templates/react-sdk-reference/pega-constellationjs-0.26.2.tgz +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Skill: WssNavBar
|
|
2
|
+
|
|
3
|
+
WSS (Web Self-Service) navigation bar template. Renders the app bar for WSS portal with responsive hamburger menu, navigation links, operator avatar, and logout.
|
|
4
|
+
|
|
5
|
+
> **Prerequisite skill:** [`template-components.md`](../template-components.md) — covers architecture, child rendering patterns, and registration conventions common to ALL template components.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Component Purpose
|
|
10
|
+
|
|
11
|
+
Provides the top navigation bar for WSS (Web Self-Service) portals. Responsive: shows a hamburger menu on mobile, full nav links on desktop. Navigation position and alignment are configurable. Includes operator avatar with initials and a logout action.
|
|
12
|
+
|
|
13
|
+
## Pega Metadata
|
|
14
|
+
|
|
15
|
+
- **Registration key:** `WssNavBar` (in `component-map.ts`)
|
|
16
|
+
- **Category:** Navigation template — WSS portal
|
|
17
|
+
- **Extends:** `PConnProps`
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Required | Description |
|
|
22
|
+
|------|------|----------|-------------|
|
|
23
|
+
| `links` | `array` | Yes | Array of `{ label, url, id }` navigation link objects |
|
|
24
|
+
| `navDisplayOptions` | `object` | No | `{ alignment: 'left'|'right'|'center', position: 'inline'|'below' }` |
|
|
25
|
+
| `portalLogoUrl` | `string` | No | URL for the portal logo image |
|
|
26
|
+
| `operatorInfo` | `object` | No | `{ displayName: string }` — for avatar initials |
|
|
27
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
28
|
+
|
|
29
|
+
## Behavioral Contract
|
|
30
|
+
|
|
31
|
+
### Responsive Layout
|
|
32
|
+
|
|
33
|
+
- **Mobile (xs breakpoint):** Hamburger menu button (`<MenuIcon>`) shown; nav links hidden.
|
|
34
|
+
- On click: opens a `<Drawer>` or dropdown menu with nav links.
|
|
35
|
+
- CSS: `display: { xs: 'flex', md: 'none' }` on hamburger; `display: { xs: 'none', md: 'flex' }` on nav links.
|
|
36
|
+
- **Desktop (md+ breakpoint):** Nav links shown inline; hamburger hidden.
|
|
37
|
+
|
|
38
|
+
### Navigation Position
|
|
39
|
+
|
|
40
|
+
From `navDisplayOptions.position`:
|
|
41
|
+
- `'inline'` — nav links appear in the same row as the logo.
|
|
42
|
+
- `'below'` — nav links appear in a second row below the logo/title row.
|
|
43
|
+
|
|
44
|
+
### Navigation Alignment
|
|
45
|
+
|
|
46
|
+
From `navDisplayOptions.alignment`:
|
|
47
|
+
- `'left'` — links flush left.
|
|
48
|
+
- `'right'` — links pushed to the right (flex with `ml: 'auto'`).
|
|
49
|
+
- `'center'` — links centered.
|
|
50
|
+
|
|
51
|
+
### Operator Avatar
|
|
52
|
+
|
|
53
|
+
- Extract initials from `operatorInfo.displayName`:
|
|
54
|
+
- Split by space, take first letter of first and last word.
|
|
55
|
+
- E.g. `"John Smith"` → `"JS"`.
|
|
56
|
+
- Render as `<Avatar>{initials}</Avatar>`.
|
|
57
|
+
- Clicking avatar opens a menu with a Logout option.
|
|
58
|
+
|
|
59
|
+
### Logout
|
|
60
|
+
|
|
61
|
+
- Import `logout` from `@pega/auth/lib/sdk-auth-manager`.
|
|
62
|
+
- Call `logout()` when the Logout menu item is clicked.
|
|
63
|
+
|
|
64
|
+
### Render Structure
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
<AppBar position='static'>
|
|
68
|
+
<Toolbar>
|
|
69
|
+
{/* Logo */}
|
|
70
|
+
{portalLogoUrl && <img src={portalLogoUrl} alt='logo' />}
|
|
71
|
+
|
|
72
|
+
{/* Hamburger (mobile) */}
|
|
73
|
+
<IconButton sx={{ display: { xs: 'flex', md: 'none' } }} onClick={openMobileMenu}>
|
|
74
|
+
<MenuIcon />
|
|
75
|
+
</IconButton>
|
|
76
|
+
|
|
77
|
+
{/* Nav links (desktop) */}
|
|
78
|
+
<Box sx={{ display: { xs: 'none', md: 'flex' }, ...alignmentStyles }}>
|
|
79
|
+
{links.map(link => <Button key={link.id} href={link.url}>{link.label}</Button>)}
|
|
80
|
+
</Box>
|
|
81
|
+
|
|
82
|
+
{/* Operator avatar */}
|
|
83
|
+
<Avatar onClick={openUserMenu}>{initials}</Avatar>
|
|
84
|
+
</Toolbar>
|
|
85
|
+
</AppBar>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Visual Specifications
|
|
89
|
+
|
|
90
|
+
| Element | Mobile | Desktop |
|
|
91
|
+
|---------|--------|---------|
|
|
92
|
+
| Logo | Shown | Shown |
|
|
93
|
+
| Nav links | Hidden (hamburger menu) | Shown inline or below |
|
|
94
|
+
| Avatar | Shown | Shown |
|
|
95
|
+
| Hamburger | Shown | Hidden |
|
|
96
|
+
|
|
97
|
+
**CSS-only implementation notes:**
|
|
98
|
+
- App bar: `background: var(--app-primary-color); color: white`.
|
|
99
|
+
- Toolbar: `display: flex; align-items: center; gap: 1rem; padding: 0 1rem`.
|
|
100
|
+
- Hamburger: `display: none`. At mobile breakpoint: `display: flex`.
|
|
101
|
+
- Nav links: `display: flex; gap: 0.5rem`. At mobile breakpoint: `display: none`.
|
|
102
|
+
- Avatar: `width: 36px; height: 36px; border-radius: 50%; background: var(--avatar-bg); cursor: pointer`.
|
|
103
|
+
- Logout menu: `position: absolute; top: 100%; right: 0; background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2)`.
|
|
104
|
+
|
|
105
|
+
## Edge Cases & Special Logic
|
|
106
|
+
|
|
107
|
+
- `portalLogoUrl` is async — show fallback text until resolved.
|
|
108
|
+
- `operatorInfo.displayName` may be undefined — guard and show a default avatar (single letter or icon).
|
|
109
|
+
- `navDisplayOptions` may be absent — default to `{ alignment: 'left', position: 'inline' }`.
|
|
110
|
+
- Mobile drawer state must be managed separately from the user menu state.
|
|
111
|
+
|
|
112
|
+
## Dependencies
|
|
113
|
+
|
|
114
|
+
- `logout` from `@pega/auth/lib/sdk-auth-manager` — logout handler
|
|
115
|
+
- MUI: `<AppBar>`, `<Toolbar>`, `<IconButton>`, `<Avatar>`, `<Menu>`, `<MenuItem>`, `<Button>`, `<Box>`
|
|
116
|
+
- MUI Icons: `<MenuIcon>`
|
|
117
|
+
|
|
118
|
+
## Design System Mapping
|
|
119
|
+
|
|
120
|
+
**UI control type:** Responsive application navigation bar with avatar and logout.
|
|
121
|
+
|
|
122
|
+
Listed design systems are examples only.
|
|
123
|
+
|
|
124
|
+
| Design System | App Bar | Avatar | Mobile Menu |
|
|
125
|
+
|---|---|---|---|
|
|
126
|
+
| Default (CSS only) | `<header>` + CSS | `<div class='avatar'>` | CSS hamburger + dropdown |
|
|
127
|
+
| MUI | `<AppBar>` + `<Toolbar>` | `<Avatar>` | `<Drawer>` or `<Menu>` |
|
|
128
|
+
| Ant Design | `<Layout.Header>` | `<Avatar>` | `<Drawer>` |
|
|
129
|
+
| Chakra UI | `<Box as='header'>` | `<Avatar>` | `<Drawer>` |
|
|
130
|
+
| Shadcn/ui | Custom `<header>` | Custom initials avatar | `<Sheet>` (drawer) |
|
|
131
|
+
|
|
132
|
+
When implementing in a specific design system:
|
|
133
|
+
- `logout` from `@pega/auth/lib/sdk-auth-manager` is mandatory — always call the SDK logout, not a custom one
|
|
134
|
+
- Responsive breakpoints for hamburger/nav visibility must be implemented
|
|
135
|
+
- `navDisplayOptions.alignment` and `.position` must be respected
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Skill: Widget Components
|
|
2
|
+
|
|
3
|
+
Create or replace widget components in the react-sdk-reference application. Widgets are self-contained UI blocks that fetch their own data from Pega APIs (data pages, case info) and render interactive features (ToDo lists, attachments, case history, etc.).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Architecture Overview
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
src/components/widget/<ComponentName>/
|
|
11
|
+
├── <ComponentName>.tsx # Component implementation
|
|
12
|
+
├── index.tsx # Re-export (if present)
|
|
13
|
+
├── <ComponentName>.css # Styles (optional)
|
|
14
|
+
├── <ComponentName>Utils.ts # Widget-specific utilities (optional)
|
|
15
|
+
├── <ComponentName>.types.ts # Type definitions (optional)
|
|
16
|
+
└── config-ext.json # Metadata (optional)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Props Interface
|
|
22
|
+
|
|
23
|
+
Widget components extend `PConnProps`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import type { PConnProps } from '../../../types/PConnProps';
|
|
27
|
+
|
|
28
|
+
interface MyWidgetProps extends PConnProps {
|
|
29
|
+
// Widget-specific props provided by the platform
|
|
30
|
+
datasource?: any;
|
|
31
|
+
headerText?: string;
|
|
32
|
+
context?: string;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Some widgets extend `PConnFieldProps` when they behave like form fields (e.g., Attachment):
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import type { PConnFieldProps } from '../../../types/PConnProps';
|
|
40
|
+
|
|
41
|
+
interface AttachmentProps extends Omit<PConnFieldProps, 'value'> {
|
|
42
|
+
value: any; // Attachment list (not a string)
|
|
43
|
+
allowMultiple: boolean;
|
|
44
|
+
extensions: string;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Implementation Pattern
|
|
51
|
+
|
|
52
|
+
### Data-Fetching Widget
|
|
53
|
+
|
|
54
|
+
Widgets typically fetch data from Pega data pages on mount. This pattern is design-system agnostic. The `// [DS RENDER]` section must be replaced with your design system's presentation primitives (card, list, table, etc.) — see "Design System Adaptation" below.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { useState, useEffect } from 'react';
|
|
58
|
+
// Import your design system components here:
|
|
59
|
+
// e.g. import { Card, List } from 'antd';
|
|
60
|
+
// e.g. import { Card, UnorderedList } from '@chakra-ui/react';
|
|
61
|
+
import type { PConnProps } from '@pega/sdk-react';
|
|
62
|
+
|
|
63
|
+
interface MyWidgetProps extends PConnProps {
|
|
64
|
+
datasource?: any;
|
|
65
|
+
headerText?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default function MyWidget(props: MyWidgetProps) {
|
|
69
|
+
const { getPConnect, datasource, headerText = 'My Widget' } = props;
|
|
70
|
+
const pConn = getPConnect();
|
|
71
|
+
|
|
72
|
+
const [data, setData] = useState<any[]>([]);
|
|
73
|
+
const [loading, setLoading] = useState(true);
|
|
74
|
+
|
|
75
|
+
// 1. Fetch data from a Pega data page on mount
|
|
76
|
+
// This block is always the same regardless of design system
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const context = pConn.getContextName();
|
|
79
|
+
PCore.getDataPageUtils()
|
|
80
|
+
.getDataAsync(
|
|
81
|
+
datasource?.source, // Data page name (e.g., 'D_WorkList')
|
|
82
|
+
context,
|
|
83
|
+
{}, // Parameters
|
|
84
|
+
{ pageNumber: 1, pageSize: 10 },
|
|
85
|
+
{ select: [{ field: 'pyID' }, { field: 'pyLabel' }] },
|
|
86
|
+
{ invalidateCache: true }
|
|
87
|
+
)
|
|
88
|
+
.then(response => {
|
|
89
|
+
setData(Array.isArray(response?.data) ? response.data : []);
|
|
90
|
+
setLoading(false);
|
|
91
|
+
})
|
|
92
|
+
.catch(() => setLoading(false));
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
// 2. Loading state — replace with your DS loading indicator if available
|
|
96
|
+
if (loading) return <div>Loading...</div>;
|
|
97
|
+
|
|
98
|
+
// 3. [DS RENDER] — replace with your design system's card/list/table primitives
|
|
99
|
+
// See "Design System Adaptation" section below for guidance
|
|
100
|
+
return (
|
|
101
|
+
<YourDesignSystemCard>
|
|
102
|
+
<YourDesignSystemCardHeader title={headerText} />
|
|
103
|
+
<YourDesignSystemCardContent>
|
|
104
|
+
<YourDesignSystemList>
|
|
105
|
+
{data.map((item, i) => (
|
|
106
|
+
<YourDesignSystemListItem key={i}>{item.pyLabel}</YourDesignSystemListItem>
|
|
107
|
+
))}
|
|
108
|
+
</YourDesignSystemList>
|
|
109
|
+
</YourDesignSystemCardContent>
|
|
110
|
+
</YourDesignSystemCard>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Design System Adaptation
|
|
118
|
+
|
|
119
|
+
The PCore data-fetching logic (all `PCore.*` calls) is always identical regardless of design system. Only the `// [DS RENDER]` section changes.
|
|
120
|
+
|
|
121
|
+
**1. Check the component-specific skill file** — `.claude/skills/widget-skills/<ComponentName>.md` contains a **Design System Mapping** table where available. Use it as a starting point.
|
|
122
|
+
|
|
123
|
+
**2. If the chosen design system is not listed** — use the component purpose description to identify the appropriate DS primitives (card, list, table, button, badge, etc.).
|
|
124
|
+
|
|
125
|
+
**3. Discover the API from installed packages** — confirm component names and props from `.d.ts` before writing JSX:
|
|
126
|
+
```bash
|
|
127
|
+
find node_modules/<ds-package> -name "*.d.ts" | xargs grep -l "Card\|List\|Table" | head -5
|
|
128
|
+
grep -A 30 "interface.*Props" <path-to-file>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**4. Common widget UI primitive mapping:**
|
|
132
|
+
|
|
133
|
+
| Widget pattern | Typical DS equivalent |
|
|
134
|
+
|---|---|
|
|
135
|
+
| Container with title | `Card` + header/title prop, or `Panel`, `Box` |
|
|
136
|
+
| Item list | `List`, `UnorderedList`, or `Table` rows |
|
|
137
|
+
| Loading indicator | `Spinner`, `Skeleton`, `Loading` |
|
|
138
|
+
| Action button | `Button` with `onClick` |
|
|
139
|
+
| Status badge | `Badge`, `Tag`, `Chip` |
|
|
140
|
+
| Empty state | DS empty/placeholder component or plain `<div>` |
|
|
141
|
+
|
|
142
|
+
**5. Icons** — if the DS has a companion icon package, read its exports before using any icon name. Never guess icon names.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Action Widget (opens assignments/cases)
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
function openAssignment(assignment) {
|
|
150
|
+
const { classname, ID } = assignment;
|
|
151
|
+
const context = getPConnect().getContextName();
|
|
152
|
+
const options = { containerName: 'primary', channelName: '' };
|
|
153
|
+
|
|
154
|
+
PCore.getMashupApi().openAssignment(ID, classname, options);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function createCase(caseType) {
|
|
158
|
+
PCore.getMashupApi().createCase(caseType, PCore.getConstants().APP.APP);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Common Pega APIs Used in Widgets
|
|
165
|
+
|
|
166
|
+
### Data Pages
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// Fetch list data
|
|
170
|
+
PCore.getDataPageUtils().getDataAsync(
|
|
171
|
+
dataPageName,
|
|
172
|
+
context,
|
|
173
|
+
params,
|
|
174
|
+
paging,
|
|
175
|
+
query,
|
|
176
|
+
options,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// Get page data (single record)
|
|
180
|
+
PCore.getDataPageUtils().getPageDataAsync(dataPageName, context, params);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Case Info
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
const pConn = getPConnect();
|
|
187
|
+
const caseKey = pConn.getCaseInfo().getKey();
|
|
188
|
+
const caseID = pConn.getCaseInfo().getID();
|
|
189
|
+
const caseName = pConn.getCaseInfo().getName();
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Attachments
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
PCore.getAttachmentUtils().prepareAttachmentData(value);
|
|
196
|
+
PCore.getAttachmentUtils().uploadAttachment(
|
|
197
|
+
file,
|
|
198
|
+
onProgress,
|
|
199
|
+
errorHandler,
|
|
200
|
+
context,
|
|
201
|
+
);
|
|
202
|
+
PCore.getAttachmentUtils().downloadAttachment(attachmentID, context);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Actions
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
const actionsApi = pConn.getActionsApi();
|
|
209
|
+
actionsApi.updateFieldValue(propName, value);
|
|
210
|
+
actionsApi.triggerFieldChange(propName, value);
|
|
211
|
+
actionsApi.openLocalAction(actionName, options);
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Container Management
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const containerManager = pConn.getContainerManager();
|
|
218
|
+
containerManager.addContainerItem({
|
|
219
|
+
semanticURL,
|
|
220
|
+
key,
|
|
221
|
+
flowName,
|
|
222
|
+
caseViewMode,
|
|
223
|
+
resourceType,
|
|
224
|
+
data,
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Registration
|
|
231
|
+
|
|
232
|
+
Register widgets in `src/components/component-map.ts`:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import MyWidget from './widget/MyWidget';
|
|
236
|
+
|
|
237
|
+
// In getSampleComponentMap():
|
|
238
|
+
{
|
|
239
|
+
...sdkComponents,
|
|
240
|
+
MyWidget, // Key must match the Pega component name
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Existing Widget Components
|
|
247
|
+
|
|
248
|
+
| Component | Description | Key APIs |
|
|
249
|
+
| --------------- | --------------------------- | ------------------------------------------------------------------- |
|
|
250
|
+
| AppAnnouncement | System-wide announcements | `PCore.getMessagingServiceUtils()` |
|
|
251
|
+
| Attachment | File upload/download | `PCore.getAttachmentUtils()` |
|
|
252
|
+
| CaseHistory | Case audit trail | `PCore.getDataPageUtils()` |
|
|
253
|
+
| FileUtility | File management utility | `PCore.getAttachmentUtils()` |
|
|
254
|
+
| Followers | Case followers list | `PCore.getDataPageUtils()` |
|
|
255
|
+
| QuickCreate | Quick case creation buttons | `PCore.getMashupApi().createCase()` |
|
|
256
|
+
| SummaryItem | Single summary card | Props from parent |
|
|
257
|
+
| SummaryList | List of summary cards | Props from parent |
|
|
258
|
+
| ToDo | Assignment worklist | `PCore.getDataPageUtils()`, `PCore.getMashupApi().openAssignment()` |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Key Conventions
|
|
263
|
+
|
|
264
|
+
1. **Default export** — `export default function WidgetName`.
|
|
265
|
+
2. **Self-contained data** — Widgets fetch their own data (don't rely on parent passing data down).
|
|
266
|
+
3. **Loading states** — Always handle loading/error states when fetching data.
|
|
267
|
+
4. **PCore globals** — Access `PCore` directly (declared globally by `@pega/pcore-pconnect-typedefs`).
|
|
268
|
+
5. **Localization** — Use `pConn.getLocalizationService()` for translated strings when available.
|
|
269
|
+
6. **Context** — Use `pConn.getContextName()` as the context parameter for data page calls.
|
|
270
|
+
7. **Card layout** — Widgets typically render inside MUI `Card` with `CardHeader` and `CardContent`.
|
|
271
|
+
8. **Action handling** — Use `PCore.getMashupApi()` for case/assignment operations, `actionsApi` for field updates.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Skill: AppAnnouncement
|
|
2
|
+
|
|
3
|
+
Card-based announcement widget. Displays a system-wide or application announcement with an optional bullet list of items and a "See what's new" external link button.
|
|
4
|
+
|
|
5
|
+
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Component Purpose
|
|
10
|
+
|
|
11
|
+
Renders an announcement card with a heading, description text, optional bullet list of items sourced from a `datasource` prop, and an optional external link button. Styled with a left accent border to visually distinguish it from other cards.
|
|
12
|
+
|
|
13
|
+
## Pega Metadata
|
|
14
|
+
|
|
15
|
+
- **Registration key:** `AppAnnouncement` (in `component-map.ts`)
|
|
16
|
+
- **Category:** Widget — informational display
|
|
17
|
+
- **Extends:** `PConnProps`
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Required | Description |
|
|
22
|
+
|------|------|----------|-------------|
|
|
23
|
+
| `header` | `string` | No | Announcement card title |
|
|
24
|
+
| `description` | `string` | No | Announcement body text |
|
|
25
|
+
| `datasource` | `object` | No | Data source object — `datasource.source` is an array of item objects |
|
|
26
|
+
| `whatsnewlink` | `string` | No | URL for the "See what's new" button; if absent, button is not rendered |
|
|
27
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
28
|
+
|
|
29
|
+
## Behavioral Contract
|
|
30
|
+
|
|
31
|
+
1. **Item list extraction:** If `datasource` is provided and `datasource.source` is a non-empty array, extract item names and render them as a bullet list. Each array item is expected to have a `name` property.
|
|
32
|
+
2. **Button:** If `whatsnewlink` is non-empty, render a button labeled `"See what's new"` (or localized equivalent). On click, open the URL in a new browser tab (`window.open(whatsnewlink, '_blank')`).
|
|
33
|
+
3. **Description:** Render the `description` string as plain text below the header.
|
|
34
|
+
4. **No data fetching:** This widget is purely prop-driven — it does not call any PCore data APIs.
|
|
35
|
+
|
|
36
|
+
## Visual Specifications
|
|
37
|
+
|
|
38
|
+
### Card Layout
|
|
39
|
+
|
|
40
|
+
| Element | Position |
|
|
41
|
+
|---------|----------|
|
|
42
|
+
| Left accent border | 6px solid, primary light color |
|
|
43
|
+
| Card header | `header` prop as title |
|
|
44
|
+
| Card content | Description text + optional bullet list |
|
|
45
|
+
| "See what's new" button | Below description / bullet list |
|
|
46
|
+
|
|
47
|
+
**CSS-only implementation notes:**
|
|
48
|
+
- Card: `border-left: 6px solid var(--app-primary-light-color); border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.12)`.
|
|
49
|
+
- Card header: `padding: 12px 16px; font-weight: 600`.
|
|
50
|
+
- Card content: `padding: 0 16px 16px`.
|
|
51
|
+
- Bullet list: `padding-left: 1.5rem; margin: 0.5rem 0`.
|
|
52
|
+
- "See what's new" button: `margin-top: 0.75rem; text-transform: none`.
|
|
53
|
+
|
|
54
|
+
## Edge Cases & Special Logic
|
|
55
|
+
|
|
56
|
+
- `datasource` may be `undefined` or `datasource.source` may be an empty array — in both cases, render no bullet list (not even an empty `<ul>`).
|
|
57
|
+
- `whatsnewlink` may be an empty string — treat the same as absent (no button rendered).
|
|
58
|
+
- `header` and `description` may both be absent — render the card with empty/placeholder content without crashing.
|
|
59
|
+
- Item objects in `datasource.source` are expected to have `name` — guard against items where `name` is `undefined`.
|
|
60
|
+
|
|
61
|
+
## Dependencies
|
|
62
|
+
|
|
63
|
+
- MUI: `<Card>`, `<CardHeader>`, `<CardContent>`, `<Typography>`, `<Button>`
|
|
64
|
+
|
|
65
|
+
## Design System Mapping
|
|
66
|
+
|
|
67
|
+
**UI control type:** Announcement / informational card with bullet list and external link.
|
|
68
|
+
|
|
69
|
+
Listed design systems are examples only.
|
|
70
|
+
|
|
71
|
+
| Design System | Card | Bullet List | Button |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| Default (CSS only) | `<div>` with left border + box-shadow | `<ul>/<li>` | `<button>` opening new tab |
|
|
74
|
+
| MUI | `<Card>` + `<CardHeader>` + `<CardContent>` | `<List>/<ListItem>` or `<ul>` | `<Button>` |
|
|
75
|
+
| Ant Design | `<Card>` with `title` prop | `<ul>/<li>` | `<Button>` |
|
|
76
|
+
| Chakra UI | `<Card>` + `<CardHeader>` + `<CardBody>` | `<UnorderedList>/<ListItem>` | `<Button>` |
|
|
77
|
+
| Shadcn/ui | `<Card>` + `<CardHeader>` + `<CardContent>` | `<ul>/<li>` | `<Button>` |
|
|
78
|
+
|
|
79
|
+
When implementing in a specific design system:
|
|
80
|
+
- Left accent border is a key visual identifier — implement it via CSS or the design system's border utilities
|
|
81
|
+
- "See what's new" must open in a new tab (`target='_blank'` + `rel='noopener noreferrer'`)
|
|
82
|
+
- The widget is entirely prop-driven — no data fetching needed
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Skill: Attachment
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
> **Prerequisite skill:** [`widget-components.md`](../widget-components.md) — covers architecture, props interface, data-fetching patterns, and registration conventions common to ALL widget components.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Component Purpose
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
## Pega Metadata
|
|
14
|
+
|
|
15
|
+
- **Registration key:** `Attachment` (in `component-map.ts`)
|
|
16
|
+
- **Category:** Widget — form field (file input)
|
|
17
|
+
- **Extends:** `Omit<PConnFieldProps, 'value'>` (uses `value: any` instead of the standard string value)
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Required | Description |
|
|
22
|
+
|------|------|----------|-------------|
|
|
23
|
+
| `value` | `any` | Yes | Attachment list or single attachment object (from Pega property) |
|
|
24
|
+
| `allowMultiple` | `boolean \| string` | No | Whether multiple files can be attached. Default `false` |
|
|
25
|
+
| `extensions` | `string` | No | Comma-separated list of allowed file extensions (e.g., `".pdf,.doc,.jpg"`) |
|
|
26
|
+
| `editMode` | `string` | No | `"tableRows"` for inline table edit mode (special multi-attachment handling) |
|
|
27
|
+
| `isTableFormatter` | `boolean` | No | Whether this widget is used inside a table formatter |
|
|
28
|
+
| `label` | `string` | Yes (from PConnFieldProps) | Field label |
|
|
29
|
+
| `required` | `boolean` | No | Whether a file is required |
|
|
30
|
+
| `disabled` | `boolean` | No | Whether the control is disabled |
|
|
31
|
+
| `displayMode` | `string` | No | `"DISPLAY_ONLY"` for read-only rendering |
|
|
32
|
+
| `validatemessage` | `string` | No | Validation error message to display |
|
|
33
|
+
| `helperText` | `string` | No | Helper text shown below the control |
|
|
34
|
+
| `getPConnect` | `function` | Yes | PConnect getter |
|
|
35
|
+
|
|
36
|
+
## Behavioral Contract
|
|
37
|
+
|
|
38
|
+
### Attachment Format Detection
|
|
39
|
+
|
|
40
|
+
Pega has two attachment data formats — detect which one is in use:
|
|
41
|
+
|
|
42
|
+
**Old format (annotation-based):**
|
|
43
|
+
```typescript
|
|
44
|
+
value = { pxResults: [...], pyAttachCount: N }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**New standard format:**
|
|
48
|
+
```typescript
|
|
49
|
+
value = [{ ID, name, mimeType, category, ... }] // array
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Call `PCore.getAttachmentUtils().prepareAttachmentData(value)` to normalize both formats into a unified `FileObject[]` array.
|
|
53
|
+
|
|
54
|
+
### File Validation
|
|
55
|
+
|
|
56
|
+
On file selection (via `<input type='file'>`):
|
|
57
|
+
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.
|
|
58
|
+
2. **Size check:** Compare file size against `PCore.getEnvironmentInfo().getMaxAttachmentSize()` (in bytes). If too large, add a size error.
|
|
59
|
+
3. Valid files proceed to upload.
|
|
60
|
+
|
|
61
|
+
### Upload Flow
|
|
62
|
+
|
|
63
|
+
1. Call `PCore.getActionsSequencer().addAction('attachment_upload_' + fileId)` — blocks form submission.
|
|
64
|
+
2. Call `PCore.getAttachmentUtils().uploadAttachment(file, onProgress, onError, context)`.
|
|
65
|
+
3. On progress: update per-file `progress` value (0–100) in state.
|
|
66
|
+
4. On success: add the returned attachment metadata to the local file list; update the Pega property via `pConn.setReferenceList(newAttachmentList)`.
|
|
67
|
+
5. Call `PCore.getActionsSequencer().removeAction('attachment_upload_' + fileId)` — unblocks form submission.
|
|
68
|
+
6. On error: set file error state; call `PCore.getMessageManager().addMessages([errorMessage])`.
|
|
69
|
+
|
|
70
|
+
### Download
|
|
71
|
+
|
|
72
|
+
Call `PCore.getAttachmentUtils().downloadAttachment(attachmentID, context)` — triggers browser file download.
|
|
73
|
+
|
|
74
|
+
### Delete
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
### Pub-Sub: Assignment Submission
|
|
79
|
+
|
|
80
|
+
Subscribe to `PCore.getPubSubUtils().subscribe(BEFORE_ASSIGNMENT_SUBMIT, handleBeforeSubmit, 'Attachment')`. In `handleBeforeSubmit`, validate that no uploads are still in progress.
|
|
81
|
+
|
|
82
|
+
### Read-Only Mode (`displayMode === 'DISPLAY_ONLY'`)
|
|
83
|
+
|
|
84
|
+
Render a list of existing attachments as download links. No upload controls shown.
|
|
85
|
+
|
|
86
|
+
### Inline Table Edit Mode (`editMode === 'tableRows'`)
|
|
87
|
+
|
|
88
|
+
Compressed display for use inside a table cell. Show attachment count and a small upload button. Clicking opens a minimal upload dialog.
|
|
89
|
+
|
|
90
|
+
## Visual Specifications
|
|
91
|
+
|
|
92
|
+
| Element | Description |
|
|
93
|
+
|---------|-------------|
|
|
94
|
+
| Label | Standard field label above the control |
|
|
95
|
+
| Drop zone / Upload button | Clickable area to select files; optionally supports drag-and-drop |
|
|
96
|
+
| File list | Each uploaded file: icon + name + size + progress bar (during upload) + delete button |
|
|
97
|
+
| Error state | Red error text below the control for invalid files or upload failures |
|
|
98
|
+
| Helper text | Secondary text below the control |
|
|
99
|
+
|
|
100
|
+
**CSS-only implementation notes:**
|
|
101
|
+
- Drop zone: `border: 2px dashed var(--border-color); border-radius: 4px; padding: 1rem; text-align: center; cursor: pointer`.
|
|
102
|
+
- Drop zone hover: `border-color: var(--app-primary-color); background: var(--hover-bg)`.
|
|
103
|
+
- File row: `display: flex; align-items: center; gap: 0.5rem; padding: 4px 0`.
|
|
104
|
+
- Progress bar: `height: 4px; background: var(--app-primary-color); border-radius: 2px; transition: width 0.2s`.
|
|
105
|
+
- Error text: `color: var(--error-color); font-size: 0.75rem; margin-top: 4px`.
|
|
106
|
+
- Delete button: `color: var(--error-color)`.
|
|
107
|
+
|
|
108
|
+
## Edge Cases & Special Logic
|
|
109
|
+
|
|
110
|
+
- `allowMultiple` may be a string `"true"` / `"false"` or a boolean — always coerce: `allowMultiple === true || allowMultiple === 'true'`.
|
|
111
|
+
- Upload progress: track per-file progress in a `Map<fileId, number>` state object.
|
|
112
|
+
- `isTableFormatter`: when `true`, hide the label and reduce padding for compact table display.
|
|
113
|
+
- Concurrent uploads: multiple files may upload simultaneously — the sequencer action must be keyed per-file.
|
|
114
|
+
- Max size: call `PCore.getEnvironmentInfo().getMaxAttachmentSize()` at validation time (not at mount) — size config may be dynamic.
|
|
115
|
+
- `extensions` may be empty string — if empty, allow all file types.
|
|
116
|
+
|
|
117
|
+
## Dependencies
|
|
118
|
+
|
|
119
|
+
- `AttachmentUtils.ts` — `validateExtension`, `validateSize`, `getFileTypeIcon`, `buildDownloadURL`, error handling helpers
|
|
120
|
+
- `Attachment.types.ts` — `FileObject`, `AttachmentLinks`, `PageInstructionOptions` type definitions
|
|
121
|
+
- `PCore.getAttachmentUtils()` — upload, download, prepareAttachmentData
|
|
122
|
+
- `PCore.getActionsSequencer()` — block/unblock form submission during upload
|
|
123
|
+
- `PCore.getEnvironmentInfo()` — max attachment size
|
|
124
|
+
- `PCore.getMessageManager()` — error message display
|
|
125
|
+
- `PCore.getPubSubUtils()` — before-submit subscription
|
|
126
|
+
- `downloadjs` library — browser file download trigger
|
|
127
|
+
|
|
128
|
+
## Design System Mapping
|
|
129
|
+
|
|
130
|
+
**UI control type:** File upload form field with progress tracking, validation, and attachment list.
|
|
131
|
+
|
|
132
|
+
Listed design systems are examples only.
|
|
133
|
+
|
|
134
|
+
| Design System | File Input | Progress | File List |
|
|
135
|
+
|---|---|---|---|
|
|
136
|
+
| Default (CSS only) | `<input type='file'>` + custom styled drop zone | `<progress>` element or CSS bar | `<ul>/<li>` rows |
|
|
137
|
+
| MUI | Custom styled `<Box>` drop zone + hidden `<input>` | `<LinearProgress>` | `<List>/<ListItem>` |
|
|
138
|
+
| Ant Design | `<Upload dragger>` | `<Progress>` | Built-in upload file list |
|
|
139
|
+
| Chakra UI | Custom `<Box>` with `useDropzone` | `<Progress>` | `<VStack>` rows |
|
|
140
|
+
| Shadcn/ui | Custom drop zone | Custom CSS progress bar | `<ul>/<li>` rows |
|
|
141
|
+
|
|
142
|
+
When implementing in a specific design system:
|
|
143
|
+
- Action sequencer blocking (`addAction`/`removeAction`) is mandatory — do not skip it; form submission must be blocked during uploads
|
|
144
|
+
- Detect and normalize both old and new attachment formats via `prepareAttachmentData`
|
|
145
|
+
- `allowMultiple` coercion (string vs boolean) is required
|
|
146
|
+
- Extension and size validation must happen client-side before calling the upload API
|