@pega/sdk 0.0.5 → 0.0.6
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/README.md +10 -3
- package/dist/index.js +764 -165
- package/package.json +1 -1
- package/templates/react-native-sdk-reference/.claude/settings.json +5 -0
- package/templates/react-native-sdk-reference/.prettierignore +17 -0
- package/templates/react-native-sdk-reference/.vscode/extensions.json +1 -0
- package/templates/react-native-sdk-reference/.vscode/settings.json +7 -0
- package/templates/react-native-sdk-reference/AGENTS.md +3 -0
- package/templates/react-native-sdk-reference/CLAUDE.md +1 -0
- package/templates/react-native-sdk-reference/README.md +56 -0
- package/templates/react-native-sdk-reference/app.json +40 -5
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/Assets/grid.png +0 -0
- package/templates/react-native-sdk-reference/assets/expo.icon/icon.json +35 -0
- package/templates/react-native-sdk-reference/assets/icons/bell.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/clock.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/cross.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/donut.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/gear.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/globe.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/internet.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/music.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/right-arrow.png +0 -0
- package/templates/react-native-sdk-reference/assets/icons/speed.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/MediaCo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/adaptive-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-background.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-foreground.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/android-icon-monochrome.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge-white.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-badge.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/expo-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/favicon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/logo-glow.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/partial-react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@2x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/react-logo@3x.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/splash-icon.png +0 -0
- package/templates/react-native-sdk-reference/assets/images/tutorial-web.png +0 -0
- package/templates/react-native-sdk-reference/eslint.config.mjs +68 -0
- package/templates/react-native-sdk-reference/package.json +59 -14
- package/templates/react-native-sdk-reference/pega-constellationjs-0.26.3.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/pega-sdk-types-0.1.0.tgz +0 -0
- package/templates/react-native-sdk-reference/sdk-config.json +31 -9
- package/templates/react-native-sdk-reference/src/app/_layout.tsx +38 -0
- package/templates/react-native-sdk-reference/src/app/home/_layout.tsx +39 -0
- package/templates/react-native-sdk-reference/src/app/home/contact.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/index.tsx +36 -0
- package/templates/react-native-sdk-reference/src/app/home/shop.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/home/your-services.tsx +11 -0
- package/templates/react-native-sdk-reference/src/app/index.tsx +72 -0
- package/templates/react-native-sdk-reference/src/app/workarea.tsx +135 -0
- package/templates/react-native-sdk-reference/src/bridge/Context/StoreContext.ts +4 -0
- package/templates/react-native-sdk-reference/src/bridge/RootComponent.tsx +12 -0
- package/templates/react-native-sdk-reference/src/bridge/react_pconnect.jsx +334 -0
- package/templates/react-native-sdk-reference/src/components/common/DisplayField.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/common/FormFieldWrapper.tsx +5 -0
- package/templates/react-native-sdk-reference/src/components/common/HelperText.tsx +11 -0
- package/templates/react-native-sdk-reference/src/components/common/LabelText.tsx +22 -0
- package/templates/react-native-sdk-reference/src/components/common/inputTheme.ts +17 -0
- package/templates/react-native-sdk-reference/src/components/design-system/AutoComplete.tsx +126 -0
- package/templates/react-native-sdk-reference/src/components/design-system/FieldGroup.tsx +72 -0
- package/templates/react-native-sdk-reference/src/components/design-system/Radio.tsx +61 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +196 -0
- package/templates/react-native-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +89 -0
- package/templates/react-native-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/Currency.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Currency/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/Date.tsx +94 -0
- package/templates/react-native-sdk-reference/src/components/field/Date/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +211 -0
- package/templates/react-native-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/Email.tsx +81 -0
- package/templates/react-native-sdk-reference/src/components/field/Email/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/Group.tsx +47 -0
- package/templates/react-native-sdk-reference/src/components/field/Group/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/Integer.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/Integer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/Phone.tsx +85 -0
- package/templates/react-native-sdk-reference/src/components/field/Phone/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +118 -0
- package/templates/react-native-sdk-reference/src/components/field/RadioButtons/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/TextArea.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/TextInput.tsx +84 -0
- package/templates/react-native-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/URL.tsx +86 -0
- package/templates/react-native-sdk-reference/src/components/field/URL/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/helpers/data_page.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/event-utils.ts +20 -0
- package/templates/react-native-sdk-reference/src/components/helpers/instructions-utils.ts +57 -0
- package/templates/react-native-sdk-reference/src/components/helpers/state-utils.tsx +46 -0
- package/templates/react-native-sdk-reference/src/components/helpers/template-utils.ts +75 -0
- package/templates/react-native-sdk-reference/src/components/helpers/utils.ts +339 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/ActionButtons.tsx +63 -0
- package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/Assignment.tsx +348 -0
- package/templates/react-native-sdk-reference/src/components/infra/Assignment/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx +56 -0
- package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/FlowContainer.tsx +57 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/helpers.ts +137 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/RootContainer.tsx +52 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/helper.ts +128 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/index.tsx +59 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/ViewContainer.tsx +31 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/helper.ts +39 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Containers/helper.ts +9 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/ErrorBoundary.tsx +53 -0
- package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/MultiStep.tsx +24 -0
- package/templates/react-native-sdk-reference/src/components/infra/MultiStep/index.ts +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/Reference.tsx +68 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/Reference/utils.ts +16 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/Region.tsx +10 -0
- package/templates/react-native-sdk-reference/src/components/infra/Region/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/infra/View/View.tsx +49 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +38 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/DefaultForm/utils/index.ts +28 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/Details.tsx +82 -0
- package/templates/react-native-sdk-reference/src/components/template/Details/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/OneColumn.tsx +29 -0
- package/templates/react-native-sdk-reference/src/components/template/OneColumn/index.tsx +1 -0
- package/templates/react-native-sdk-reference/src/context/LoaderContext.tsx +42 -0
- package/templates/react-native-sdk-reference/src/mediaco/AdvBanner.tsx +62 -0
- package/templates/react-native-sdk-reference/src/mediaco/Header.tsx +60 -0
- package/templates/react-native-sdk-reference/src/mediaco/HomeScreen.tsx +78 -0
- package/templates/react-native-sdk-reference/src/mediaco/QuickActions.tsx +68 -0
- package/templates/react-native-sdk-reference/src/mediaco/ResolutionScreen.tsx +48 -0
- package/templates/react-native-sdk-reference/src/mediaco/SafeArea.tsx +11 -0
- package/templates/react-native-sdk-reference/src/mediaco/TabBar.tsx +102 -0
- package/templates/react-native-sdk-reference/src/mediaco/YourServices.tsx +90 -0
- package/templates/react-native-sdk-reference/src/sdk-pega-component-map.ts +64 -0
- package/templates/react-native-sdk-reference/src/types/PConnProps.d.ts +41 -0
- package/templates/react-native-sdk-reference/src/utils/auth.ts +62 -0
- package/templates/react-native-sdk-reference/src/utils/init-pcore.ts +37 -0
- package/templates/react-native-sdk-reference/src/utils/pcore-polyfills.ts +66 -0
- package/templates/react-native-sdk-reference/tsconfig.json +9 -8
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +171 -0
- package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +25 -26
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +119 -0
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +70 -121
- package/templates/react-sdk-reference/.ai-common/instructions/component-map.md +7 -19
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +10 -40
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +134 -0
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +15 -43
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +11 -63
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +12 -57
- package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +45 -71
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +98 -0
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +155 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +67 -237
- package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +26 -77
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +315 -0
- package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +31 -80
- package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +43 -99
- package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +33 -83
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AlertBanner.md +60 -74
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Banner.md +64 -84
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/CaseSummaryFields.md +76 -109
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/DetailsFields.md +84 -101
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroup.md +62 -87
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroupList.md +56 -76
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldValueList.md +61 -85
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Operator.md +84 -107
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Pulse.md +36 -44
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/RichTextEditor.md +125 -189
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/WssQuickCreate.md +34 -50
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +57 -179
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +130 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +311 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +156 -0
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +476 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +120 -242
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +71 -212
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/CancelAlert.md +47 -209
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Checkbox.md +90 -259
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Currency.md +75 -169
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Date.md +65 -160
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/DateTime.md +59 -157
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Decimal.md +55 -134
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Dropdown.md +61 -185
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Email.md +60 -138
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Group.md +40 -99
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Integer.md +44 -111
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Location.md +57 -165
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Multiselect.md +41 -122
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +32 -130
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Percentage.md +48 -112
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Phone.md +43 -153
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RadioButtons.md +76 -183
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/RichText.md +59 -176
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ScalarList.md +30 -123
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SelectableCard.md +47 -178
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/SemanticLink.md +31 -117
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextArea.md +51 -106
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextContent.md +22 -75
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextInput.md +54 -116
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/Time.md +46 -100
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/URL.md +44 -93
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +40 -167
- package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +165 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/ActionButtons.md +122 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/MultiStep.md +178 -0
- package/templates/react-sdk-reference/.ai-common/skills/infra-skills/Stages.md +140 -0
- package/templates/react-sdk-reference/.ai-common/skills/template-components.md +74 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AdvancedSearch.md +66 -167
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/AppShell.md +57 -170
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/BannerPage.md +41 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseSummary.md +53 -109
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseView.md +86 -289
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseViewActionsMenu.md +60 -185
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Confirmation.md +66 -115
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DataReference.md +33 -68
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultForm.md +53 -133
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultPage.md +39 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/Details.md +38 -91
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsSubTabs.md +47 -101
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsThreeColumn.md +27 -34
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsTwoColumn.md +25 -40
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/DynamicTabs.md +34 -104
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/FieldGroupTemplate.md +46 -147
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/HierarchicalForm.md +139 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboard.md +43 -82
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboardPage.md +47 -80
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListPage.md +16 -29
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +43 -228
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/MultiReferenceReadOnly.md +20 -65
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/NarrowWide.md +49 -97
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/OneColumn.md +37 -71
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/PromotedFilters.md +58 -148
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SelfServiceCaseView.md +82 -107
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +21 -60
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SingleReferenceReadOnly.md +43 -100
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SubTabs.md +36 -76
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/TwoColumn.md +41 -90
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WideNarrow.md +36 -43
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/WssNavBar.md +25 -115
- package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +38 -174
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/AppAnnouncement.md +30 -57
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Attachment.md +55 -101
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/CaseHistory.md +38 -121
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/FileUtility.md +37 -98
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Followers.md +18 -33
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/QuickCreate.md +26 -91
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/SummaryItem.md +28 -120
- package/templates/react-sdk-reference/.ai-common/skills/widget-skills/ToDo.md +41 -272
- package/templates/react-sdk-reference/package.json +1 -1
- package/templates/react-sdk-reference/pega-auth-0.2.44.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
- package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +13 -3
- package/templates/react-native-sdk-reference/.github/AGENTS.md +0 -23
- package/templates/react-native-sdk-reference/.github/copilot-instructions.md +0 -40
- package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +0 -48
- package/templates/react-native-sdk-reference/App.tsx +0 -49
- package/templates/react-native-sdk-reference/expo-env.d.ts +0 -3
- package/templates/react-sdk-reference/pega-auth-0.2.42.tgz +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Card-style radio or checkbox selection grid with optional image support.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -14,11 +14,11 @@ Renders a grid of selectable cards. Each card contains a radio button or checkbo
|
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `SelectableCard`
|
|
16
16
|
- **Type / Subtype:** Internal design system extension
|
|
17
|
-
- **Registration key:** `SelectableCard` (in
|
|
17
|
+
- **Registration key:** `SelectableCard` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
> This component does NOT have a
|
|
19
|
+
> This component does NOT have a metadata file and does NOT extend the project's field input contract — it's a design system component used internally by `RadioButtons` and `Checkbox`.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Inputs
|
|
22
22
|
|
|
23
23
|
| Prop | Type | Default | Description |
|
|
24
24
|
| ------------------------ | ----------------------- | ------- | ---------------------------------------------------------------------------------- |
|
|
@@ -44,70 +44,30 @@ Renders a grid of selectable cards. Each card contains a radio button or checkbo
|
|
|
44
44
|
| `setIsRadioCardSelected` | `function` | — | Callback to inform parent whether radio selection matched |
|
|
45
45
|
| `showNoValue` | `boolean` | `false` | When true (read-only + no selected items), render "No Value" text |
|
|
46
46
|
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
This component does NOT extend
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const pConn = getPConnect();
|
|
66
|
-
|
|
67
|
-
// 2. "No Value" guard
|
|
68
|
-
if (showNoValue) return <Typography>No Value</Typography>;
|
|
69
|
-
|
|
70
|
-
// 3. Data source selection
|
|
71
|
-
const cardDataSource = (readOnly || displayMode === 'DISPLAY_ONLY')
|
|
72
|
-
? readOnlyList || [] : dataSource?.source;
|
|
73
|
-
const imageDescriptionKey = showImageDescription ? imageDescription : undefined;
|
|
74
|
-
|
|
75
|
-
// 4. Card click handler — makes entire card clickable
|
|
76
|
-
const handleCardClick = (event) => {
|
|
77
|
-
if (disabled || readOnly) return;
|
|
78
|
-
if (event.target.closest?.('label, input')) return;
|
|
79
|
-
const input = event.currentTarget.querySelector('input[type="radio"], input[type="checkbox"]');
|
|
80
|
-
if (input) input.click();
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// 5. Track radio selection state
|
|
84
|
-
let radioItemSelected = false;
|
|
85
|
-
|
|
86
|
-
// 6. Map cards
|
|
87
|
-
return (
|
|
88
|
-
<>
|
|
89
|
-
{(cardDataSource || []).map((item) => {
|
|
90
|
-
const resolvedFields = resolveReferenceFields(item, hideFieldLabels, recordKey, pConn);
|
|
91
|
-
// Build image object if item[imageField] exists
|
|
92
|
-
// Display mode: render simple read-only card (no input)
|
|
93
|
-
// Editable mode: render card with Radio or Checkbox inside
|
|
94
|
-
// Track: if type==='radio' && radioBtnValue === item[recordKey], radioItemSelected=true
|
|
95
|
-
})}
|
|
96
|
-
{type === 'radio' && setIsRadioCardSelected && setIsRadioCardSelected(radioItemSelected)}
|
|
97
|
-
</>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
```
|
|
47
|
+
## Implementation Structure
|
|
48
|
+
|
|
49
|
+
This component does NOT extend the project's field input contract — it defines its own inputs directly.
|
|
50
|
+
|
|
51
|
+
**Module Setup:** The component depends on two local helper functions:
|
|
52
|
+
|
|
53
|
+
1. **`prepareComponentInCaseSummary(pConnectMeta, getPConnect)`** — creates a display-only component from field metadata. Receives the field's metadata object (containing `config`, `type`, and optional `children`) and a `getPConnect` function. Resolves the field label via `getPConnect().resolveConfigProps({ label: config.label })`, then creates the field component via `getPConnect().createComponent({ type, children, config })`. Sets `displayMode` to `'DISPLAY_ONLY'` and `readOnly` to `true` on the created component's inherited props. Returns `{ name, value }` where `name` is the resolved label string and `value` is the created component (a renderable UI node).
|
|
54
|
+
|
|
55
|
+
2. **`resolveReferenceFields(item, hideFieldLabels, recordKey, pConnect)`** — resolves additional display fields for a card record using the PConnect presets pattern. Gets `presets` from `pConnect.getRawMetadata().config.presets`, then extracts field definitions from `presets[0].children[0].children` (limiting to a maximum of 5 fields). For each field preset, creates a PConnect configuration with `meta` set to the preset (with `displayMode: 'DISPLAY_ONLY'` and `contextName` from the parent PConnect added to `config`) and `useCustomContext` set to the current data item. Calls `PCore.createPConnect(fieldMeta)` to create a live PConnect instance for that field, retrieves its metadata via `configObj.getPConnect().getMetadata()`, then passes it to `prepareComponentInCaseSummary` to obtain the rendered component. Returns an array of objects: when `hideFieldLabels` is true, each entry is `{ id, value }`; otherwise `{ id, name, value, type }` — where `id` is a unique string combining `item[recordKey]` and the field index, `name` is the resolved label, `value` is the rendered field component, and `type` is the preset's field type string.
|
|
56
|
+
|
|
57
|
+
**Main Component Logic** — steps in order:
|
|
58
|
+
|
|
59
|
+
1. **Receive all inputs** (`image` is a nested object) — `getPConnect`, `type`; from `image` receive `imagePosition`, `imageSize`, `showImageDescription`, `imageField` (default `''`), `imageDescription` (default `''`); also `dataSource`, `recordKey` (default `''`), `className`, `cardLabel`, `hideFieldLabels` (default `false`), `readOnly`, `disabled`, `readOnlyList` (default `[]`), `displayMode`, `radioBtnValue`, `onChange`, `onBlur`, `onClick`, `onKeyDown`, `additionalProps`, `testId`, `setIsRadioCardSelected`, `showNoValue` (default `false`); also `pConn` via `getPConnect()`.
|
|
60
|
+
2. **"No Value" guard** — when `showNoValue` is true, return a text element reading "No Value" and stop.
|
|
61
|
+
3. **Data source selection** — `cardDataSource` is `readOnlyList` (or `[]`) when `readOnly` or `displayMode === 'DISPLAY_ONLY'`, otherwise `dataSource?.source`; `imageDescriptionKey` is `imageDescription` when `showImageDescription` is true, otherwise `undefined`.
|
|
62
|
+
4. **Card click handler** (`handleCardClick`) — makes the entire card clickable: returns early when `disabled || readOnly`; returns early when the click target is inside a `label` or `input` (native click already handled); otherwise finds the radio/checkbox input inside the current card and programmatically clicks it.
|
|
63
|
+
5. **Track radio selection state** — a local `radioItemSelected` flag, initialized to `false`.
|
|
64
|
+
6. **Map cards** — render a container iterating `cardDataSource ?? []`; for each `item`, resolve additional fields via `resolveReferenceFields(item, hideFieldLabels, recordKey, pConn)` (which returns an array of objects with rendered component values), build an image object when `item[imageField]` exists, and branch: in display mode render a simple read-only card (no input); in editable mode render a card containing a `Radio` or `Checkbox` control; render each resolved field's `value` directly (it is a renderable component node, NOT a plain string); while iterating, when `type === 'radio'` and `radioBtnValue === item[recordKey]`, set `radioItemSelected = true`. After the loop, when `type === 'radio'` and `setIsRadioCardSelected` is provided, call `setIsRadioCardSelected(radioItemSelected)`.
|
|
101
65
|
|
|
102
66
|
## Behavioral Contract
|
|
103
67
|
|
|
104
68
|
### Data source selection
|
|
105
69
|
|
|
106
|
-
|
|
107
|
-
cardDataSource = (readOnly || displayMode === 'DISPLAY_ONLY')
|
|
108
|
-
? readOnlyList || []
|
|
109
|
-
: dataSource?.source
|
|
110
|
-
```
|
|
70
|
+
`cardDataSource` is `readOnlyList` (or `[]` if empty) when `readOnly` or `displayMode === 'DISPLAY_ONLY'`; otherwise it is `dataSource?.source`.
|
|
111
71
|
|
|
112
72
|
### "No Value" guard
|
|
113
73
|
|
|
@@ -115,57 +75,15 @@ If `showNoValue`: render a plain text element showing `'No Value'` and return ea
|
|
|
115
75
|
|
|
116
76
|
### Card click handler
|
|
117
77
|
|
|
118
|
-
Cards should be clickable anywhere (not just on the checkbox/radio):
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
const handleCardClick = (event) => {
|
|
122
|
-
if (disabled || readOnly) return;
|
|
123
|
-
if (event.target.closest('label, input')) return; // native click already handled
|
|
124
|
-
const input = event.currentTarget.querySelector('input[type="radio"], input[type="checkbox"]');
|
|
125
|
-
if (input) input.click();
|
|
126
|
-
};
|
|
127
|
-
```
|
|
78
|
+
Cards should be clickable anywhere (not just on the checkbox/radio): the handler returns early when `disabled` or `readOnly` is set; it also returns early when the click target is inside a `label` or `input` element (the native click is already handled in that case); otherwise it locates the radio or checkbox input within the current card element and programmatically clicks it.
|
|
128
79
|
|
|
129
80
|
### Subsection: Display mode (`displayMode === 'DISPLAY_ONLY'`)
|
|
130
81
|
|
|
131
|
-
Render a **simple read-only card** (no radio/checkbox)
|
|
132
|
-
|
|
133
|
-
- Optional image (`<img>`)
|
|
134
|
-
- Card title: `item[cardLabel]`
|
|
135
|
-
- Additional resolved fields (from `resolveReferenceFields`)
|
|
136
|
-
- `style: { display: 'flex' }`
|
|
137
|
-
|
|
138
|
-
```html
|
|
139
|
-
<Card style="display: flex">
|
|
140
|
-
{image && <img src="..." alt="..." style="width: 100px" />}
|
|
141
|
-
<CardContent>
|
|
142
|
-
<body1>{item[cardLabel]}</body1>
|
|
143
|
-
{fields.map(field => <body2>{field.value}</body2>)}
|
|
144
|
-
</CardContent>
|
|
145
|
-
</Card>
|
|
146
|
-
```
|
|
82
|
+
Render a **simple read-only card** (no radio/checkbox) containing, in a flex-row layout: an optional image, the card title (`item[cardLabel]`), and the additional resolved fields (from `resolveReferenceFields`). Each field's `value` is a rendered component node — render it directly (do NOT stringify it). If `field.name` is present, render it as a label alongside the value.
|
|
147
83
|
|
|
148
84
|
### Subsection: Editable mode (radio or checkbox)
|
|
149
85
|
|
|
150
|
-
Render a **selectable card** with click handler, containing the
|
|
151
|
-
|
|
152
|
-
```html
|
|
153
|
-
<div style="paddingTop: 15px">
|
|
154
|
-
<Card style="cursor: pointer, height: 100%, flexDirection: column"
|
|
155
|
-
onClick={handleCardClick}>
|
|
156
|
-
<CardContent style={imageLayoutStyle}>
|
|
157
|
-
<!-- Image section (40% width for inline positions) -->
|
|
158
|
-
{image && <img full-width, aspect-ratio 16/9, contain>}
|
|
159
|
-
<!-- Content section (60% width for inline positions) -->
|
|
160
|
-
{type === 'radio'
|
|
161
|
-
? <FormControlLabel control={<Radio value={item[recordKey]} checked={radioBtnValue === item[recordKey]} onChange={onChange} ... />} label={item[cardLabel]}>
|
|
162
|
-
: <FormControlLabel control={<Checkbox id={item[recordKey]} checked={readOnlyList.some(d => d[recordKey] === item[recordKey])} onChange={onChange} ... />} label={item[cardLabel]}>
|
|
163
|
-
}
|
|
164
|
-
{fields.map(field => <div style={fieldLayoutStyle}>{field.name && <div>{field.name}</div>}<div>{field.value}</div></div>)}
|
|
165
|
-
</CardContent>
|
|
166
|
-
</Card>
|
|
167
|
-
</div>
|
|
168
|
-
```
|
|
86
|
+
Render a **selectable card** wrapped in a container with top padding, with a pointer cursor, full height, and a column flex direction, and a click handler (`handleCardClick`) on the card itself. Inside, the card content area (styled per the image layout table below) contains: an optional image section (full width, 16:9 aspect ratio, contained) shown for inline positions at roughly 40% width; a content section at roughly 60% width containing either a radio control (`value={item[recordKey]}`, `checked={radioBtnValue === item[recordKey]}`, `onChange`) or a checkbox control (`id={item[recordKey]}`, `checked` computed by checking whether `readOnlyList` contains an entry matching `item[recordKey]`, `onChange`), each labeled with `item[cardLabel]`; and finally the list of additional resolved fields, each rendered with its field name (if present) alongside its value (a rendered component node). Unless the field's `type` is `'TextArea'`, lay out each field entry as a two-column grid (label in one column, rendered component in the other).
|
|
169
87
|
|
|
170
88
|
### Image layout (inline positions)
|
|
171
89
|
|
|
@@ -177,40 +95,15 @@ Render a **selectable card** with click handler, containing the appropriate inpu
|
|
|
177
95
|
|
|
178
96
|
### Image element
|
|
179
97
|
|
|
180
|
-
|
|
181
|
-
img {
|
|
182
|
-
width: 100%;
|
|
183
|
-
background-color: transparent;
|
|
184
|
-
aspect-ratio: 16 / 9;
|
|
185
|
-
max-height: 100%;
|
|
186
|
-
height: 100%;
|
|
187
|
-
object-fit: contain;
|
|
188
|
-
max-width: 100%;
|
|
189
|
-
}
|
|
190
|
-
```
|
|
98
|
+
**Visual-only styling notes:** The image spans the full width of its container with a transparent background, a 16:9 aspect ratio, and is constrained to the container's max height/width while using `object-fit: contain` so it scales without distortion.
|
|
191
99
|
|
|
192
100
|
### Field display layout
|
|
193
101
|
|
|
194
|
-
Each additional field in editable mode
|
|
195
|
-
|
|
196
|
-
```css
|
|
197
|
-
.card-field {
|
|
198
|
-
font-size: 0.875rem;
|
|
199
|
-
display: grid; /* only if type !== 'TextArea' */
|
|
200
|
-
grid-template-columns: 1fr 1fr;
|
|
201
|
-
margin: 5px;
|
|
202
|
-
}
|
|
203
|
-
```
|
|
102
|
+
**Visual-only styling notes:** Each additional field in editable mode uses a small font size and a small margin; unless the field type is `TextArea`, it is laid out as a two-column grid (label in one column, value in the other).
|
|
204
103
|
|
|
205
104
|
### Radio tracking
|
|
206
105
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
if (radioBtnValue === item[recordKey]) radioItemSelected = true
|
|
211
|
-
// After loop:
|
|
212
|
-
setIsRadioCardSelected(radioItemSelected)
|
|
213
|
-
```
|
|
106
|
+
While iterating cards, if `type === 'radio'` and `radioBtnValue === item[recordKey]` for the current item, set `radioItemSelected = true`. After the loop completes, if `setIsRadioCardSelected` is provided, call it with the final `radioItemSelected` value.
|
|
214
107
|
|
|
215
108
|
## Display Mode Rendering
|
|
216
109
|
|
|
@@ -228,59 +121,35 @@ setIsRadioCardSelected(radioItemSelected)
|
|
|
228
121
|
| Card border | Default (design-system card elevation) | Default |
|
|
229
122
|
| Disabled | `cursor: default` | — |
|
|
230
123
|
|
|
231
|
-
**
|
|
232
|
-
|
|
233
|
-
```css
|
|
234
|
-
.selectable-card {
|
|
235
|
-
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
236
|
-
border-radius: 4px;
|
|
237
|
-
padding: 16px;
|
|
238
|
-
cursor: pointer;
|
|
239
|
-
display: flex;
|
|
240
|
-
flex-direction: column;
|
|
241
|
-
height: 100%;
|
|
242
|
-
margin-top: 15px;
|
|
243
|
-
transition: border-color 0.2s;
|
|
244
|
-
}
|
|
245
|
-
.selectable-card:hover {
|
|
246
|
-
border-color: #1976d2;
|
|
247
|
-
}
|
|
248
|
-
.selectable-card.disabled {
|
|
249
|
-
cursor: default;
|
|
250
|
-
opacity: 0.7;
|
|
251
|
-
}
|
|
252
|
-
.selectable-card.readonly {
|
|
253
|
-
cursor: default;
|
|
254
|
-
}
|
|
255
|
-
.selectable-card-label {
|
|
256
|
-
font-size: 1rem;
|
|
257
|
-
font-weight: 400;
|
|
258
|
-
}
|
|
259
|
-
```
|
|
124
|
+
**Visual-only styling notes:** Each card has a thin light border, small border radius, comfortable padding, a pointer cursor, and a column flex layout that fills the height of its grid row, with a small top margin; on hover the border switches to an accent color. Disabled cards use a default cursor and reduced opacity; read-only cards use a default cursor. The card label text uses the standard body font size and regular weight.
|
|
260
125
|
|
|
261
126
|
## Edge Cases & Special Logic
|
|
262
127
|
|
|
263
|
-
- **`resolveReferenceFields(item, hideFieldLabels, recordKey, pConn)`** —
|
|
128
|
+
- **`resolveReferenceFields(item, hideFieldLabels, recordKey, pConn)`** — resolves additional display fields using the PConnect presets pattern. Gets field definitions from `pConnect.getRawMetadata().config.presets[0].children[0].children` (max 5 fields). For each preset, creates a PConnect instance via `PCore.createPConnect({ meta: { ...preset, config: { ...preset.config, displayMode: 'DISPLAY_ONLY', contextName: pConnect.getContextName() } }, useCustomContext: item })`, retrieves its metadata, and passes it to `prepareComponentInCaseSummary` to produce a rendered field component. The returned `value` for each field is a live rendered component (with proper formatting for currency, dates, etc.), NOT a plain string — render it directly in the UI.
|
|
129
|
+
- **`prepareComponentInCaseSummary(pConnectMeta, getPConnect)`** — creates a display-only field component. Resolves the label from config, calls `getPConnect().createComponent({ type, children, config })`, then sets inherited props `displayMode: 'DISPLAY_ONLY'` and `readOnly: true` on the created component. Returns `{ name, value }`.
|
|
130
|
+
- **Do NOT use `Object.keys(item)` to enumerate fields** — this shows raw internal keys, system properties, and unformatted values. Always use the presets-based resolution described above.
|
|
264
131
|
- Checkbox `id={item[recordKey]}` — required for the card click handler to find and click the input by ID.
|
|
265
|
-
- `getPConnect`
|
|
132
|
+
- `getPConnect` input on the checkbox control: passed through to support SDK checkbox augmentation.
|
|
266
133
|
- `imageDescriptionKey = showImageDescription ? imageDescription : undefined` — only show alt text when `showImageDescription` is true.
|
|
134
|
+
- **`imageField`** — this value is the last path segment of the image property reference (e.g., if the Pega property path is `.PhoneImage`, the `imageField` passed to this component is `PhoneImage`). The parent component (RadioButtons or Checkbox) is responsible for extracting this segment before passing it.
|
|
267
135
|
|
|
268
136
|
## Dependencies
|
|
269
137
|
|
|
270
|
-
- `
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
138
|
+
- Two local helper functions: `prepareComponentInCaseSummary` (creates display-only field components from metadata) and `resolveReferenceFields` (resolves preset fields into rendered components via `PCore.createPConnect`).
|
|
139
|
+
- `PCore.createPConnect` — SDK API for creating PConnect instances from field metadata with custom context.
|
|
140
|
+
- The DS's radio and checkbox components.
|
|
141
|
+
- The DS's card/container component.
|
|
142
|
+
- The DS's text/typography component.
|
|
274
143
|
|
|
275
144
|
## Design System Mapping
|
|
276
145
|
|
|
277
146
|
**UI control type:** Selectable card grid (radio or multi-select).
|
|
278
147
|
|
|
279
|
-
|
|
148
|
+
When implementing in a specific design system, map the following:
|
|
280
149
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
150
|
+
- **Card container** → use the DS's card component with a pointer cursor and click handler
|
|
151
|
+
- **Radio/Checkbox** → use the DS's radio or checkbox component inside each card
|
|
152
|
+
- **Card label** → use the DS's text/typography component for the card title
|
|
153
|
+
- **Image layout** → configure flex direction based on `imagePosition` (inline-start, inline-end, or block)
|
|
154
|
+
- **Read-only/display mode** → render simple cards without radio/checkbox inputs, using `readOnlyList` as data source
|
|
155
|
+
- **"No Value" guard** → render plain text when no items are selected in read-only mode
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Clickable hyperlink that navigates to a referenced Pega case or data object using semantic URL resolution.
|
|
4
4
|
|
|
5
|
-
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture,
|
|
5
|
+
> **Prerequisite skill:** [`field-components.md`](../field-components.md) — covers architecture, input contract, display modes, event handling, and registration patterns common to ALL field components.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Component Purpose
|
|
10
10
|
|
|
11
|
-
Renders a clickable link
|
|
11
|
+
Renders a clickable link that navigates to a Pega case or data object. Resolves the correct semantic URL based on whether the reference is a Case or Data type. Handles Ctrl/Meta+click for opening in a new tab. Shows `'--'` when no text is provided.
|
|
12
12
|
|
|
13
13
|
## Pega Metadata
|
|
14
14
|
|
|
15
15
|
- **Pega Name:** `SemanticLink`
|
|
16
16
|
- **Type / Subtype:** `Field` / `Link-SemanticLink`
|
|
17
|
-
- **Registration key:** `SemanticLink` (in
|
|
17
|
+
- **Registration key:** `SemanticLink` (in the project's component map)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Inputs (component-specific)
|
|
20
20
|
|
|
21
21
|
| Prop | Type | Default | Description |
|
|
22
22
|
| ------------------------- | ----------------- | ------- | ---------------------------------------------------------------------------------- |
|
|
@@ -30,69 +30,21 @@ Renders a clickable link (`<a>` or button-style link) that navigates to a Pega c
|
|
|
30
30
|
| `dataRelationshipContext` | `string \| null` | `null` | Context for data relationship resolution |
|
|
31
31
|
| `contextPage` | `any` | — | Context page with `classID` |
|
|
32
32
|
|
|
33
|
-
##
|
|
33
|
+
## Implementation Structure
|
|
34
34
|
|
|
35
35
|
This component computes a URL and renders a clickable link. Most logic is URL resolution — no form state.
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
referenceType: string | null;
|
|
49
|
-
dataRelationshipContext: string | null;
|
|
50
|
-
contextPage: any;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default function SemanticLink(props: SemanticLinkProps) {
|
|
54
|
-
// 1. Destructure (note: onClick is received but NOT used directly)
|
|
55
|
-
const {
|
|
56
|
-
text, resourcePayload = {}, resourceParams = {},
|
|
57
|
-
getPConnect, previewKey, onClick, testId = '',
|
|
58
|
-
referenceType, dataRelationshipContext = null, contextPage,
|
|
59
|
-
...restProps
|
|
60
|
-
} = props;
|
|
61
|
-
|
|
62
|
-
// 2. Constants
|
|
63
|
-
const { ACTION_OPENWORKBYHANDLE, ACTION_SHOWDATA } = PCore.getSemanticUrlUtils().getActions();
|
|
64
|
-
const pConnect = getPConnect();
|
|
65
|
-
const { RESOURCE_TYPES: { DATA }, WORKCLASS, CASE_INFO: { CASE_INFO_CLASSID } } = PCore.getConstants();
|
|
66
|
-
|
|
67
|
-
// 3. URL resolution variables
|
|
68
|
-
let linkURL = '';
|
|
69
|
-
let payload = {};
|
|
70
|
-
let dataViewName;
|
|
71
|
-
let isData = false;
|
|
72
|
-
|
|
73
|
-
// 4. Determine reference type and resolve URL
|
|
74
|
-
// → see Behavioral Contract "URL Resolution"
|
|
75
|
-
|
|
76
|
-
// 5. showDataAction() — calls getPConnect().getActionsApi().showData(...)
|
|
77
|
-
// → see Behavioral Contract
|
|
78
|
-
|
|
79
|
-
// 6. openLinkClick(e) — click handler
|
|
80
|
-
// If !metaKey && !ctrlKey: preventDefault, then showDataAction or openWorkByHandle
|
|
81
|
-
// If metaKey/ctrlKey: let browser open href in new tab
|
|
82
|
-
|
|
83
|
-
// 7. Render link
|
|
84
|
-
return (
|
|
85
|
-
<LinkComponent
|
|
86
|
-
href={linkURL}
|
|
87
|
-
onClick={openLinkClick}
|
|
88
|
-
data-testid={testId}
|
|
89
|
-
{...restProps}
|
|
90
|
-
>
|
|
91
|
-
{text || '--'}
|
|
92
|
-
</LinkComponent>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
```
|
|
37
|
+
**Module Setup:** The component depends on a local utility module (`semanticUtils`) for data reference resolution. Define the input contract as an extension of the project's field input contract, adding `text`, `resourcePayload`, `resourceParams`, `previewKey`, `onClick`, `testId`, `referenceType`, `dataRelationshipContext`, and `contextPage` fields.
|
|
38
|
+
|
|
39
|
+
**Main Component Logic** — steps in order:
|
|
40
|
+
|
|
41
|
+
1. **Receive inputs** (note: `onClick` is received but NOT used directly) — `text`, `resourcePayload` (default `{}`), `resourceParams` (default `{}`), `getPConnect`, `previewKey`, `onClick`, `testId` (default `''`), `referenceType`, `dataRelationshipContext` (default `null`), `contextPage`, and collect remaining inputs into `restInputs`.
|
|
42
|
+
2. **Constants** — `ACTION_OPENWORKBYHANDLE` and `ACTION_SHOWDATA` from `PCore.getSemanticUrlUtils().getActions()`; `pConnect` via `getPConnect()`; `DATA` from `PCore.getConstants().RESOURCE_TYPES`, plus `WORKCLASS` and `CASE_INFO_CLASSID` from the same constants object.
|
|
43
|
+
3. **URL resolution variables** — `linkURL` (default `''`), `payload` (default `{}`), `dataViewName`, and `isData` (default `false`).
|
|
44
|
+
4. **Determine reference type and resolve the URL** — see the Behavioral Contract "URL Resolution" section.
|
|
45
|
+
5. **`showDataAction()`** — calls `getPConnect().getActionsApi().showData(...)`; see the Behavioral Contract section below.
|
|
46
|
+
6. **`openLinkClick(e)`** (click handler) — when neither `metaKey` nor `ctrlKey` is pressed, prevent the default navigation and instead call `showDataAction()` or `openWorkByHandle`; when either modifier key is pressed, let the browser open the `href` in a new tab.
|
|
47
|
+
7. **Render the link** — a link element with `href` set to `linkURL`, the click handler, a test-id attribute, the remaining inputs spread, and content set to `text || '--'`.
|
|
96
48
|
|
|
97
49
|
## Behavioral Contract
|
|
98
50
|
|
|
@@ -105,14 +57,7 @@ export default function SemanticLink(props: SemanticLinkProps) {
|
|
|
105
57
|
- If `contextPage?.classID`: override `resourcePayload.caseClassName = contextPage.classID`
|
|
106
58
|
- If `resourcePayload.caseClassName === WORKCLASS`: override with actual case class from `pConnect.getValue(CASE_INFO_CLASSID)`
|
|
107
59
|
|
|
108
|
-
**Step 2a: Data reference (`referenceType === 'DATA'` or `shouldTreatAsDataReference`):**
|
|
109
|
-
|
|
110
|
-
```
|
|
111
|
-
const dataRefContext = semanticUtils.getDataReferenceInfo(pConnect, dataRelationshipContext, contextPage)
|
|
112
|
-
dataViewName = dataRefContext.dataContext
|
|
113
|
-
payload = dataRefContext.dataContextParameters
|
|
114
|
-
isData = true
|
|
115
|
-
```
|
|
60
|
+
**Step 2a: Data reference (`referenceType === 'DATA'` or `shouldTreatAsDataReference`):** call `semanticUtils.getDataReferenceInfo(pConnect, dataRelationshipContext, contextPage)` to get a `dataRefContext`; set `dataViewName = dataRefContext.dataContext`, `payload = dataRefContext.dataContextParameters`, and `isData = true`.
|
|
116
61
|
|
|
117
62
|
**Step 2b: Resource type DATA (`resourcePayload.resourceType === 'DATA'`):**
|
|
118
63
|
|
|
@@ -128,19 +73,7 @@ isData = true
|
|
|
128
73
|
|
|
129
74
|
### Click Handler (`openLinkClick`)
|
|
130
75
|
|
|
131
|
-
|
|
132
|
-
function openLinkClick(e) {
|
|
133
|
-
if (!e.metaKey && !e.ctrlKey) {
|
|
134
|
-
e.preventDefault()
|
|
135
|
-
if (isData or shouldTreatAsDataReference) {
|
|
136
|
-
showDataAction()
|
|
137
|
-
} else if (previewKey) {
|
|
138
|
-
getPConnect().getActionsApi().openWorkByHandle(previewKey, resourcePayload.caseClassName)
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// If metaKey/ctrlKey: allow default browser behavior (open in new tab)
|
|
142
|
-
}
|
|
143
|
-
```
|
|
76
|
+
When neither `e.metaKey` nor `e.ctrlKey` is set: call `e.preventDefault()`, then either call `showDataAction()` (when this is a data reference or `shouldTreatAsDataReference` is true) or, when `previewKey` is set, call `getPConnect().getActionsApi().openWorkByHandle(previewKey, resourcePayload.caseClassName)`. When `e.metaKey` or `e.ctrlKey` is set, do nothing and allow the browser's default behavior (opening the link in a new tab).
|
|
144
77
|
|
|
145
78
|
### `showDataAction()`
|
|
146
79
|
|
|
@@ -153,7 +86,7 @@ No explicit `displayMode` handling — `SemanticLink` is always rendered as a li
|
|
|
153
86
|
|
|
154
87
|
## Visual Specifications
|
|
155
88
|
|
|
156
|
-
Derived from
|
|
89
|
+
Derived from the reference component's styling:
|
|
157
90
|
|
|
158
91
|
| Property | Value |
|
|
159
92
|
| ----------- | ---------------------------------------- |
|
|
@@ -164,56 +97,37 @@ Derived from `makeStyles` and MUI `Link` props:
|
|
|
164
97
|
| Font weight | 400 |
|
|
165
98
|
| Underline | Default link underline on hover |
|
|
166
99
|
| Cursor | Pointer |
|
|
167
|
-
| Text | `text`
|
|
168
|
-
|
|
169
|
-
**
|
|
170
|
-
|
|
171
|
-
```css
|
|
172
|
-
.semantic-link {
|
|
173
|
-
display: inline-block;
|
|
174
|
-
padding: 8px;
|
|
175
|
-
margin: 8px;
|
|
176
|
-
color: #1976d2;
|
|
177
|
-
text-decoration: none;
|
|
178
|
-
cursor: pointer;
|
|
179
|
-
font-weight: 400;
|
|
180
|
-
background: none;
|
|
181
|
-
border: none;
|
|
182
|
-
font-size: inherit;
|
|
183
|
-
}
|
|
184
|
-
.semantic-link:hover {
|
|
185
|
-
text-decoration: underline;
|
|
186
|
-
}
|
|
187
|
-
```
|
|
100
|
+
| Text | `text` input value, or `'--'` if empty |
|
|
101
|
+
|
|
102
|
+
**Visual-only styling notes:** The link renders as an inline block with 8px padding and margin on all sides, using the theme's primary link color with no default text decoration, a pointer cursor, normal font weight (400), transparent background, and no border, inheriting the surrounding font size; on hover the text becomes underlined.
|
|
188
103
|
|
|
189
104
|
## Edge Cases & Special Logic
|
|
190
105
|
|
|
191
106
|
- **BUG-678282 fix:** When `resourceParams.workID === ''` and `previewKey` is a string, set `resourceParams.objectID = previewKey.split(' ')[1]` to handle cases where workID was not populated.
|
|
192
107
|
- If `previewKey` is set: also set `resourceParams.id = previewKey`.
|
|
193
108
|
- `linkURL` is computed synchronously at render — if an error occurs in data reference resolution, it is silently caught (`try/catch`) and `linkURL` remains `''`.
|
|
194
|
-
- `onClick`
|
|
109
|
+
- `onClick` input from parent is received but NOT used directly — the component has its own `openLinkClick`. Do not call the parent's `onClick` directly.
|
|
195
110
|
- **Ctrl/Meta+click**: `e.metaKey || e.ctrlKey` → don't `preventDefault()`, let the browser open the href in a new tab.
|
|
196
111
|
- `text || '--'` is always rendered — never renders empty.
|
|
197
112
|
|
|
198
113
|
## Dependencies
|
|
199
114
|
|
|
200
|
-
- `semanticUtils.getDataReferenceInfo(pConnect, dataRelationshipContext, contextPage)
|
|
115
|
+
- Local utility: `semanticUtils.getDataReferenceInfo(pConnect, dataRelationshipContext, contextPage)`.
|
|
201
116
|
- `PCore.getSemanticUrlUtils().getResolvedSemanticURL()` — URL resolution.
|
|
202
117
|
- `PCore.getSemanticUrlUtils().getActions()` — `ACTION_OPENWORKBYHANDLE`, `ACTION_SHOWDATA`.
|
|
203
118
|
- `PCore.getDataTypeUtils().getLookUpDataPage()`, `getLookUpDataPageInfo()`, `getDataPageKeys()`.
|
|
204
119
|
- `PCore.getAnnotationUtils().isProperty()`, `getPropertyName()`.
|
|
205
120
|
- `PCore.getConstants()` — `RESOURCE_TYPES.DATA`, `WORKCLASS`, `CASE_INFO.CASE_INFO_CLASSID`.
|
|
206
|
-
- A link/anchor
|
|
121
|
+
- A link/anchor element (native `<a>` with button-like behavior, or the DS's link component).
|
|
207
122
|
|
|
208
123
|
## Design System Mapping
|
|
209
124
|
|
|
210
125
|
**UI control type:** Clickable hyperlink (button or anchor with navigation behavior).
|
|
211
126
|
|
|
212
|
-
|
|
127
|
+
When implementing in a specific design system, map the following:
|
|
213
128
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
| Chakra UI | `<Link as="button">` |
|
|
129
|
+
- **Link element** → use the DS's link or button-link component (renders as an anchor with `href`)
|
|
130
|
+
- **Click handler** → prevent default for normal clicks; allow Ctrl/Meta+click to open in new tab
|
|
131
|
+
- **Empty text** → render `'--'` when `text` is falsy
|
|
132
|
+
- **Padding/margin** → `8px` all sides
|
|
133
|
+
- **Color** → primary link color from the theme
|