@pega/sdk 0.0.5 → 0.0.7
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 +828 -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/mcp/claude-code.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/copilot.mcp.json +8 -0
- package/templates/react-sdk-reference/.ai-common/mcp/cursor.mcp.json +11 -0
- 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
|
@@ -1,87 +1,44 @@
|
|
|
1
1
|
# Skill: Template Components
|
|
2
2
|
|
|
3
|
-
Create or replace template components (layouts and page structures) in the
|
|
3
|
+
Create or replace template components (layouts and page structures) in the project. Template components arrange child components into visual layouts (columns, tabs, forms, pages).
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Architecture Overview
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
src/components/template/<ComponentName>/
|
|
11
|
-
├── <ComponentName>.tsx # Component implementation
|
|
12
|
-
├── index.tsx # Re-export (if present)
|
|
13
|
-
├── <ComponentName>.css # Styles (CSS file, optional)
|
|
14
|
-
├── utils.ts # Template-specific utilities (optional)
|
|
15
|
-
└── config-ext.json # Metadata (optional)
|
|
16
|
-
```
|
|
9
|
+
Each template component lives under the project's template components directory in its own folder, named after the component. The folder typically contains: the component implementation file; an optional re-export module; an optional companion stylesheet; an optional utilities module for template-specific helpers; and an optional metadata file.
|
|
17
10
|
|
|
18
|
-
Some templates have nested sub-templates
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
src/components/template/TwoColumn/
|
|
22
|
-
├── TwoColumn/TwoColumn.tsx
|
|
23
|
-
├── TwoColumnPage/TwoColumnPage.tsx
|
|
24
|
-
└── TwoColumnTab/TwoColumnTab.tsx
|
|
25
|
-
```
|
|
11
|
+
Some templates have nested sub-templates instead of a flat structure. For example, `TwoColumn` organizes its three variants as separate sub-folders, each containing its own implementation file.
|
|
26
12
|
|
|
27
13
|
---
|
|
28
14
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
Template components extend `PConnProps`:
|
|
15
|
+
## Input Contract
|
|
32
16
|
|
|
33
|
-
|
|
34
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
17
|
+
Template components extend the project's **base component interface**, which declares a single required member, `getPConnect` — a function returning the `PConnect` instance for the component.
|
|
35
18
|
|
|
36
|
-
|
|
37
|
-
getPConnect: () => typeof PConnect;
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Templates typically receive children through `getPConnect().getChildren()` rather than React `children` prop, though layout templates (TwoColumn, OneColumn) receive React children directly.
|
|
19
|
+
Templates typically receive children through `getPConnect().getChildren()` rather than via the framework's content projection mechanism, though layout templates (TwoColumn, OneColumn) receive children via content projection directly.
|
|
42
20
|
|
|
43
21
|
---
|
|
44
22
|
|
|
45
23
|
## Implementation Patterns
|
|
46
24
|
|
|
47
|
-
### Layout Template (renders
|
|
25
|
+
### Layout Template (renders children in grid)
|
|
48
26
|
|
|
49
27
|
Used for: TwoColumn, OneColumn, NarrowWide, WideNarrow
|
|
50
28
|
|
|
51
|
-
This pattern is design-system agnostic
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
|
|
65
|
-
const { children, templateCol = '1fr 1fr' } = props;
|
|
66
|
-
const childrenToRender = children as ReactElement[];
|
|
67
|
-
|
|
68
|
-
// templateCol maps directly to CSS grid-template-columns — no conversion needed
|
|
69
|
-
// Use plain CSS grid with width: 100% to guarantee the layout fills its parent
|
|
70
|
-
// On mobile: use a media query or @container query to stack columns
|
|
71
|
-
return (
|
|
72
|
-
<div style={{ display: 'grid', gridTemplateColumns: templateCol, gap: '0.5rem', width: '100%' }}>
|
|
73
|
-
<div style={{ display: 'grid', gap: '1rem', alignContent: 'baseline' }}>
|
|
74
|
-
{childrenToRender[0]}
|
|
75
|
-
</div>
|
|
76
|
-
<div style={{ display: 'grid', gap: '1rem', alignContent: 'baseline' }}>
|
|
77
|
-
{childrenToRender[1]}
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
> ⚠️ **Do NOT use DS-specific grid components** (e.g., Carbon `<Grid>`, Ant Design `<Row>/<Col>`) for layout templates. Many DS grids have built-in `max-width` constraints that prevent the layout from filling its parent container. Use plain CSS grid with `grid-template-columns: templateCol` — this works with every design system and guarantees full-width rendering.
|
|
29
|
+
This pattern is design-system agnostic — the grid/flex section must be replaced with your design system's grid or flex layout primitive; see the "Design System Adaptation" section below.
|
|
30
|
+
|
|
31
|
+
**Module Setup:** Define the input contract as an extension of the project's base component interface, adding an optional `templateCol` string (e.g. `'1fr 1fr'`, `'2fr 1fr'`) representing the CSS grid column template. The component accepts children via the framework's content projection mechanism.
|
|
32
|
+
|
|
33
|
+
**Main Component Logic** — steps in order:
|
|
34
|
+
|
|
35
|
+
1. Receive `children` and `templateCol` (defaulting to `'1fr 1fr'`) from inputs; treat `children` as an array of child elements.
|
|
36
|
+
2. `templateCol` maps directly to CSS `grid-template-columns` — no conversion needed.
|
|
37
|
+
3. Render an outer container with `display: grid`, `gridTemplateColumns: templateCol`, a `gap`, and `width: 100%` so the layout always fills its parent.
|
|
38
|
+
4. Inside, render two inner wrapper elements — one per column — each with `display: grid`, a `gap`, and `alignContent: baseline`; the first wraps `children[0]`, the second wraps `children[1]`.
|
|
39
|
+
5. On mobile, use a media query or container query to stack the columns into a single column.
|
|
40
|
+
|
|
41
|
+
> ⚠️ **Do NOT use DS-specific grid components** for layout templates. Many DS grids have built-in `max-width` constraints that prevent the layout from filling its parent container. Use plain CSS grid with `grid-template-columns: templateCol` — this works with every design system and guarantees full-width rendering.
|
|
85
42
|
|
|
86
43
|
---
|
|
87
44
|
|
|
@@ -89,223 +46,112 @@ export default function TwoColumn(props: PropsWithChildren<TwoColumnProps>) {
|
|
|
89
46
|
|
|
90
47
|
> Form templates and page templates use the PConnect bridge pattern and do **not** use any design system primitives. This section applies only to layout templates: TwoColumn, OneColumn, NarrowWide, WideNarrow, and their sub-variants.
|
|
91
48
|
>
|
|
92
|
-
> **Use plain CSS grid** (`display: grid; grid-template-columns; width: 100%`) for all layout templates. The `templateCol`
|
|
49
|
+
> **Use plain CSS grid** (`display: grid; grid-template-columns; width: 100%`) for all layout templates. The `templateCol` input value (e.g., `'1fr 1fr'`, `'2fr 1fr'`) maps directly to `grid-template-columns`. Do NOT use DS grid components — they may have max-width constraints.
|
|
93
50
|
|
|
94
|
-
**1. Check the component-specific skill file** — `{{SKILL_DIR}}/template-skills/<ComponentName>.md` contains a **Design System Mapping**
|
|
51
|
+
**1. Check the component-specific skill file** — `{{SKILL_DIR}}/template-skills/<ComponentName>.md` contains a **Design System Mapping** section where available. Use it as a starting point.
|
|
95
52
|
|
|
96
|
-
**2. If the chosen design system is not
|
|
53
|
+
**2. If the chosen design system is not covered** — use the **component purpose** description to identify the appropriate DS layout primitive (grid, flex, columns).
|
|
97
54
|
|
|
98
|
-
**3. Discover the API from installed packages** — confirm layout component names and
|
|
55
|
+
**3. Discover the API from installed packages** — before writing the component's markup, confirm the layout component names and inputs by searching the installed design-system package's type declaration files for grid/column/flex primitives, then inspecting the exported input interface.
|
|
99
56
|
|
|
100
|
-
|
|
101
|
-
find node_modules/<ds-package> -name "*.d.ts" | xargs grep -l "Grid\|Columns\|Flex" | head -5
|
|
102
|
-
grep -A 30 "interface.*Props" <path-to-file>
|
|
103
|
-
```
|
|
57
|
+
**4. Column ratio mapping** — the `templateCol` input (e.g., `'2fr 1fr'`) gives you fractional widths. Map to your DS's column system:
|
|
104
58
|
|
|
105
|
-
|
|
59
|
+
| `templateCol` | Fraction | 12-col grid | CSS `grid-template-columns` |
|
|
60
|
+
| ------------- | --------- | ----------- | --------------------------- |
|
|
61
|
+
| `'1fr 1fr'` | 50% / 50% | 6 / 6 | `1fr 1fr` |
|
|
62
|
+
| `'2fr 1fr'` | 67% / 33% | 8 / 4 | `2fr 1fr` |
|
|
63
|
+
| `'1fr 2fr'` | 33% / 67% | 4 / 8 | `1fr 2fr` |
|
|
106
64
|
|
|
107
|
-
|
|
108
|
-
| ------------- | --------- | ---------- | --------------------------- |
|
|
109
|
-
| `'1fr 1fr'` | 50% / 50% | 6 / 6 | `1fr 1fr` |
|
|
110
|
-
| `'2fr 1fr'` | 67% / 33% | 8 / 4 | `2fr 1fr` |
|
|
111
|
-
| `'1fr 2fr'` | 33% / 67% | 4 / 8 | `1fr 2fr` |
|
|
112
|
-
|
|
113
|
-
**5. Responsive behavior** — on mobile, both columns must stack to full width. Use your DS's responsive breakpoint props or a CSS media query.
|
|
65
|
+
**5. Responsive behavior** — on mobile, both columns must stack to full width. Use your DS's responsive breakpoint mechanism or a CSS media query.
|
|
114
66
|
|
|
115
67
|
### Form Template (renders children via PConnect bridge)
|
|
116
68
|
|
|
117
69
|
Used for: DefaultForm, HierarchicalForm
|
|
118
70
|
|
|
119
|
-
> ⚠️ **CRITICAL:** Form templates MUST use the
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
import { createElement } from 'react';
|
|
123
|
-
import { PConnectComponent } from '@pega/sdk-react';
|
|
124
|
-
import connectToState from '../../helpers/state-utils';
|
|
125
|
-
import { getKeyForMappedField, mapStateToProps } from './utils';
|
|
126
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
127
|
-
|
|
128
|
-
interface DefaultFormProps extends PConnProps {
|
|
129
|
-
NumCols: string;
|
|
130
|
-
instructions: string;
|
|
131
|
-
}
|
|
71
|
+
> ⚠️ **CRITICAL:** Form templates MUST use the project's state-connection wrapper pattern. Without it, form fields will not render because they won't be subscribed to the application store for visibility and input updates.
|
|
132
72
|
|
|
133
|
-
|
|
134
|
-
const Child = connectToState(mapStateToProps)((props) => {
|
|
135
|
-
const { key, visibility, ...rest } = props;
|
|
136
|
-
return createElement(PConnectComponent, { ...rest, key, visibility });
|
|
137
|
-
});
|
|
73
|
+
**Module Setup:** The component depends on the framework's element-creation utility, the project's PConnect bridge utility, the project's state-connection wrapper (from the project's state utilities), and `getKeyForMappedField` / `mapStateToInputs` from the companion utilities module. Define the input contract as an extension of the project's base component interface with `NumCols: string` and `instructions: string`.
|
|
138
74
|
|
|
139
|
-
|
|
140
|
-
const { getPConnect, NumCols = '1' } = props;
|
|
75
|
+
Outside the main component logic, define a `Child` wrapper using the project's state-connection wrapper invoked with `mapStateToInputs`. This is MANDATORY — it subscribes each field to the application store. Inside `Child`, receive `key`, `visibility`, and the remaining inputs, then render the project's PConnect bridge utility with those values.
|
|
141
76
|
|
|
142
|
-
|
|
143
|
-
const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
|
|
77
|
+
**Main Component Logic** — steps in order:
|
|
144
78
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
79
|
+
1. Receive `getPConnect` and `NumCols` (defaulting to `'1'`) from inputs.
|
|
80
|
+
2. Unwrap the region children: the first child returned by `getPConnect().getChildren()` is a region, so call `.getPConnect().getChildren()` on it to get the actual field children.
|
|
81
|
+
3. Map each child through the `Child` wrapper defined above — every child MUST be rendered via the `Child` wrapper with `key` set to `getKeyForMappedField(kid)` and all field data spread, never directly through the PConnect bridge utility alone.
|
|
82
|
+
4. Return a container element with a class name derived from `NumCols` (e.g. `form-${NumCols}-col`) containing the mapped children.
|
|
149
83
|
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
> ❌ **INCORRECT pattern** (will cause fields to not render):
|
|
155
|
-
>
|
|
156
|
-
> ```typescript
|
|
157
|
-
> // DO NOT USE — fields won't be subscribed to store
|
|
158
|
-
> arChildren.map((kid, i) => createElement(PConnectComponent, { ...kid, key: i }));
|
|
159
|
-
> ```
|
|
84
|
+
> ❌ **INCORRECT pattern** (will cause fields to not render): mapping children directly through the PConnect bridge utility, bypassing the state-connection wrapper entirely. This causes fields to never subscribe to the application store, so they silently fail to render or update.
|
|
160
85
|
|
|
161
86
|
### Page Template (renders regions from PConnect children)
|
|
162
87
|
|
|
163
88
|
Used for: CaseView, DefaultPage, ObjectPage, AppShell, Confirmation
|
|
164
89
|
|
|
165
|
-
> ⚠️ **CRITICAL:** Page templates are NOT simple wrappers. They contain PCore API calls,
|
|
90
|
+
> ⚠️ **CRITICAL:** Page templates are NOT simple wrappers. They contain PCore API calls, lifecycle effects, state management, and complex input drilling to infrastructure components. NEVER simplify a Page template to a single return statement. Always follow the component-specific skill file's Implementation Structure faithfully.
|
|
166
91
|
>
|
|
167
|
-
> After generating a Page template, compare your output against the skill file
|
|
92
|
+
> After generating a Page template, compare your output against the skill file's Implementation Structure. Every piece of state, every effect, every registry lookup, every PCore API call, helper function, and utility dependency described there MUST appear in your generated output. If your output is significantly shorter than what's described, you have over-simplified.
|
|
168
93
|
>
|
|
169
|
-
> ⚠️ **COMMON ERROR — `tabconfig` must be an array, NOT a
|
|
170
|
-
> The `VerticalTabs` infrastructure component expects `tabconfig` to be `{ name: string; id: number }
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
import { getComponentFromRegistry, PConnectComponent } from '@pega/sdk-react';
|
|
175
|
-
import type { PConnProps } from '@pega/sdk-react';
|
|
176
|
-
|
|
177
|
-
export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
|
|
178
|
-
// 1. Get infrastructure components from registry
|
|
179
|
-
const VerticalTabs = getComponentFromRegistry('VerticalTabs');
|
|
180
|
-
const DeferLoad = getComponentFromRegistry('DeferLoad');
|
|
181
|
-
|
|
182
|
-
// 2. Destructure ALL props from the skill file skeleton
|
|
183
|
-
const { getPConnect, children, header, ... } = props;
|
|
184
|
-
const pConn = getPConnect();
|
|
94
|
+
> ⚠️ **COMMON ERROR — `tabconfig` must be an array, NOT a rendered element:**
|
|
95
|
+
> The `VerticalTabs` infrastructure component expects `tabconfig` to be an array of `{ name: string; id: number }` objects. You MUST use the `extractTabsInfo` SDK utility to build this array. NEVER pass a raw rendered region element to `VerticalTabs` — it causes `TypeError: tabconfig.map is not a function`.
|
|
96
|
+
>
|
|
97
|
+
> ⚠️ **CRITICAL — Do NOT call `child.getPConnect()` on framework-rendered children:**
|
|
98
|
+
> Children passed to page templates via the framework's content projection mechanism are **rendered elements** — they do NOT expose `getPConnect` as a direct method. Calling `child.getPConnect()` on them causes `TypeError: child.getPConnect is not a function`. For named region extraction, use `PCore.getSDKUtils().getSDKCaseUtils().getChildRegionByName(childArr, name)`. For tab info, use `PCore.getSDKUtils().getSDKCaseUtils().extractTabsInfo(tabsRegion)`. For field extraction in CaseSummary, use `PCore.getSDKUtils().getSDKCaseUtils().filterSummaryFields(getPConnect)`. If you need PConnect metadata access by index (e.g., SelfServiceCaseView), use `getPConnect().getChildren()` which returns PConnect child envs that DO have `getPConnect` methods. Render extracted regions directly in the template — do NOT pass them through the PConnect bridge component.
|
|
185
99
|
|
|
186
|
-
|
|
187
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
188
|
-
useEffect(() => { /* event listeners, pub/sub */ }, []);
|
|
100
|
+
**Module Setup:** The component depends on the project's component registry (to resolve infrastructure components like `VerticalTabs` and `DeferLoad`), SDK utilities from `PCore.getSDKUtils()`, local state management, and lifecycle effects. Define the input contract as an extension of the project's base component interface.
|
|
189
101
|
|
|
190
|
-
|
|
191
|
-
function getChildRegionByName(name: string) { ... }
|
|
102
|
+
**Main Component Logic** — general shape for any Page template:
|
|
192
103
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
104
|
+
1. Look up infrastructure components from the project's component registry, e.g. `VerticalTabs` and `DeferLoad`.
|
|
105
|
+
2. Receive ALL inputs described in the component-specific skill file (e.g. `getPConnect`, `children`, `header`, etc.), then call `getPConnect()` once and reuse the result.
|
|
106
|
+
3. Declare ALL state, effects, and handlers described in the skill file — for example local state for active tab tracking, and lifecycle effects for event listeners or pub/sub subscriptions.
|
|
107
|
+
4. Use SDK utilities from `PCore.getSDKUtils().getSDKCaseUtils()` for region extraction (e.g., `getChildRegionByName`, `extractTabsInfo`, `filterSummaryFields`). For positional child access needing metadata, use `getPConnect().getChildren()` (PConnect child envs). **NEVER implement custom region extraction that calls `child.getPConnect()` on framework-rendered children.**
|
|
108
|
+
5. Render the full layout structure described in the skill file. Render extracted regions directly in the template — they are already renderable elements.
|
|
197
109
|
|
|
198
110
|
---
|
|
199
111
|
|
|
200
112
|
## Rendering Children
|
|
201
113
|
|
|
202
|
-
Templates use
|
|
114
|
+
Templates use three patterns to render child components:
|
|
203
115
|
|
|
204
|
-
### 1.
|
|
116
|
+
### 1. Children via content projection (layout templates)
|
|
205
117
|
|
|
206
|
-
|
|
207
|
-
// TwoColumn, OneColumn, etc. receive children as React props
|
|
208
|
-
const { children } = props;
|
|
209
|
-
const childrenToRender = children as ReactElement[];
|
|
210
|
-
```
|
|
118
|
+
TwoColumn, OneColumn, and similar layout templates receive children via the framework's content projection mechanism. Receive `children` from inputs and treat it as an array of child elements before indexing into it.
|
|
211
119
|
|
|
212
120
|
### 2. PConnect children (form/page templates)
|
|
213
121
|
|
|
214
|
-
|
|
215
|
-
import { createElement } from 'react';
|
|
216
|
-
import { PConnectComponent } from '@pega/sdk-react';
|
|
217
|
-
|
|
218
|
-
// Get child PConnect objects
|
|
219
|
-
const children = getPConnect().getChildren();
|
|
220
|
-
|
|
221
|
-
// Render each child through the PConnect bridge
|
|
222
|
-
children.map((child, i) => createElement(PConnectComponent, { ...child, key: `child-${i}` }));
|
|
223
|
-
```
|
|
122
|
+
Get the child PConnect objects via `getPConnect().getChildren()`, then render each one through the project's PConnect bridge utility, passing the child's configuration object and a unique key for each child.
|
|
224
123
|
|
|
225
124
|
### 3. State-connected children (REQUIRED for Form templates)
|
|
226
125
|
|
|
227
126
|
> ⚠️ This is the ONLY correct pattern for Form templates (DefaultForm, HierarchicalForm). Using pattern #2 above for form fields will result in fields not rendering.
|
|
228
127
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
import connectToState from '../../helpers/state-utils';
|
|
233
|
-
import { getKeyForMappedField, mapStateToProps } from './utils';
|
|
234
|
-
|
|
235
|
-
// connectToState HOC subscribes to Redux store for visibility/props
|
|
236
|
-
const Child = connectToState(mapStateToProps)((props) => {
|
|
237
|
-
const { key, visibility, ...rest } = props;
|
|
238
|
-
return createElement(PConnectComponent, { ...rest, key, visibility });
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
// Usage inside component:
|
|
242
|
-
const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
|
|
243
|
-
const dfChildren = arChildren?.map((kid) => (
|
|
244
|
-
<Child key={getKeyForMappedField(kid)} {...kid} />
|
|
245
|
-
));
|
|
246
|
-
```
|
|
128
|
+
The component depends on the project's PConnect bridge utility, the project's state-connection wrapper (from the project's state utilities), and `getKeyForMappedField` / `mapStateToInputs` from the companion utilities module. Define a `Child` wrapper using the state-connection wrapper invoked with `mapStateToInputs` — this subscribes each field to the application store for visibility and dynamic input updates. Inside the wrapped component, receive `key`, `visibility`, and the remaining inputs, then render the PConnect bridge utility with those values.
|
|
129
|
+
|
|
130
|
+
To use it: unwrap the first region's children via `getPConnect().getChildren()[0].getPConnect().getChildren()`, then map each child through the `Child` wrapper with `key` set to `getKeyForMappedField(kid)` and all field data spread.
|
|
247
131
|
|
|
248
132
|
---
|
|
249
133
|
|
|
250
134
|
## Helper Utilities
|
|
251
135
|
|
|
252
|
-
###
|
|
253
|
-
|
|
254
|
-
The PConnect bridge component. Used to render child PConnect objects:
|
|
136
|
+
### PConnect bridge utility
|
|
255
137
|
|
|
256
|
-
|
|
257
|
-
import { createElement } from 'react';
|
|
258
|
-
import { PConnectComponent } from '@pega/sdk-react';
|
|
259
|
-
createElement(PConnectComponent, { ...childPConnectProps, key });
|
|
260
|
-
```
|
|
138
|
+
The project's PConnect bridge component, used to render child PConnect objects. Use the framework's element-creation mechanism to create an instance of the bridge component for each child, passing the child's PConnect configuration and a unique key.
|
|
261
139
|
|
|
262
|
-
###
|
|
140
|
+
### State-connection wrapper
|
|
263
141
|
|
|
264
|
-
|
|
142
|
+
A higher-order utility that connects a component to the application store for visibility and dynamic input updates. Apply it with a state-mapping function to produce a store-connected version of the child component. Located in the project's state utilities module.
|
|
265
143
|
|
|
266
|
-
|
|
267
|
-
import connectToState from '../../helpers/state-utils';
|
|
268
|
-
const ConnectedChild = connectToState(mapStateToProps)(ChildComponent);
|
|
269
|
-
```
|
|
144
|
+
### Instructions helper
|
|
270
145
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
Extracts instruction text for forms:
|
|
274
|
-
|
|
275
|
-
```typescript
|
|
276
|
-
import { getInstructions } from '../../helpers/template-utils';
|
|
277
|
-
const instructions = getInstructions(getPConnect(), props.instructions);
|
|
278
|
-
```
|
|
146
|
+
Extracts instruction text for forms. Located in the project's template utilities module. Call it with `getPConnect()` and the component's `instructions` input to obtain the resolved instruction HTML string.
|
|
279
147
|
|
|
280
148
|
---
|
|
281
149
|
|
|
282
150
|
## Registration
|
|
283
151
|
|
|
284
|
-
Register templates in
|
|
285
|
-
|
|
286
|
-
```typescript
|
|
287
|
-
import MyTemplate from './template/MyTemplate';
|
|
288
|
-
|
|
289
|
-
// In getSampleComponentMap():
|
|
290
|
-
{
|
|
291
|
-
...sdkComponents,
|
|
292
|
-
MyTemplate, // Key must match Pega component name
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
For nested templates (e.g., TwoColumn/TwoColumnPage/TwoColumnTab), register each separately:
|
|
297
|
-
|
|
298
|
-
```typescript
|
|
299
|
-
import TwoColumn from './template/TwoColumn/TwoColumn/TwoColumn';
|
|
300
|
-
import TwoColumnPage from './template/TwoColumn/TwoColumnPage';
|
|
301
|
-
import TwoColumnTab from './template/TwoColumn/TwoColumnTab';
|
|
152
|
+
Register templates in the project's component map by importing the template's default export from its folder under the template components directory and adding it to the object returned by the project's component registration function, using a key that matches the Pega component name.
|
|
302
153
|
|
|
303
|
-
|
|
304
|
-
TwoColumn,
|
|
305
|
-
TwoColumnPage,
|
|
306
|
-
TwoColumnTab,
|
|
307
|
-
}
|
|
308
|
-
```
|
|
154
|
+
For nested templates (e.g., TwoColumn/TwoColumnPage/TwoColumnTab), import each sub-variant from its own nested path and register all variants as separate keys in the component map.
|
|
309
155
|
|
|
310
156
|
---
|
|
311
157
|
|
|
@@ -344,9 +190,9 @@ import TwoColumnTab from './template/TwoColumn/TwoColumnTab';
|
|
|
344
190
|
|
|
345
191
|
## Key Conventions
|
|
346
192
|
|
|
347
|
-
1. **Default export** —
|
|
193
|
+
1. **Default export** — Each component is exported as the module's default export.
|
|
348
194
|
2. **Children from PConnect** — Use `getPConnect().getChildren()` to access child regions.
|
|
349
|
-
3. **
|
|
350
|
-
4. **CSS files** — Template-specific styles go in
|
|
351
|
-
5. **Responsive** — Use
|
|
352
|
-
6. **templateCol** — Layout templates often receive a `templateCol`
|
|
195
|
+
3. **PConnect bridge pattern** — Use the project's PConnect bridge utility to render PConnect children.
|
|
196
|
+
4. **CSS files** — Template-specific styles go in a companion stylesheet alongside the component.
|
|
197
|
+
5. **Responsive** — Use CSS grid with full-width on mobile and computed column widths on desktop breakpoints.
|
|
198
|
+
6. **templateCol** — Layout templates often receive a `templateCol` input (e.g., `"1fr 1fr"`, `"2fr 1fr"`) to control column ratios.
|