@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
package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import LabelText from '../../common/LabelText';
|
|
4
|
+
import DisplayField from '../../common/DisplayField';
|
|
5
|
+
import FormFieldWrapper from '../../common/FormFieldWrapper';
|
|
6
|
+
import HelperText from '../../common/HelperText';
|
|
7
|
+
import Radio from '../../design-system/Radio';
|
|
8
|
+
import handleEvent from '../../helpers/event-utils';
|
|
9
|
+
import Utils from '../../helpers/utils';
|
|
10
|
+
import { PConnFieldProps } from '../../../types/PConnProps';
|
|
11
|
+
|
|
12
|
+
// Can't use RadioButtonProps until getLocaleRuleNameFromKeys is NOT private
|
|
13
|
+
interface RadioButtonsProps extends PConnFieldProps {
|
|
14
|
+
// If any, enter additional props that only exist on RadioButtons here
|
|
15
|
+
inline: boolean;
|
|
16
|
+
fieldMetadata?: any;
|
|
17
|
+
variant?: string;
|
|
18
|
+
datasource?: any;
|
|
19
|
+
|
|
20
|
+
imagePosition?: string;
|
|
21
|
+
imageSize?: string;
|
|
22
|
+
showImageDescription?: string;
|
|
23
|
+
hideFieldLabels?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function RadioButtons(props: RadioButtonsProps) {
|
|
27
|
+
const {
|
|
28
|
+
getPConnect,
|
|
29
|
+
label,
|
|
30
|
+
value = '',
|
|
31
|
+
readOnly,
|
|
32
|
+
disabled,
|
|
33
|
+
validatemessage,
|
|
34
|
+
helperText,
|
|
35
|
+
status,
|
|
36
|
+
required,
|
|
37
|
+
inline,
|
|
38
|
+
displayMode,
|
|
39
|
+
hideLabel,
|
|
40
|
+
fieldMetadata,
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const thePConn = getPConnect();
|
|
44
|
+
const actions = thePConn.getActionsApi();
|
|
45
|
+
const propName = (thePConn.getStateProps() as any).value;
|
|
46
|
+
const configProps = thePConn.getConfigProps();
|
|
47
|
+
const className = thePConn.getCaseInfo().getClassName();
|
|
48
|
+
|
|
49
|
+
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
50
|
+
|
|
51
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
52
|
+
|
|
53
|
+
let configProperty = (thePConn.getRawMetadata() as any)?.config?.value || '';
|
|
54
|
+
configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
|
|
55
|
+
configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
|
|
56
|
+
|
|
57
|
+
const metaData = Array.isArray(fieldMetadata)
|
|
58
|
+
? fieldMetadata.filter((field) => field?.classID === className)[0]
|
|
59
|
+
: fieldMetadata;
|
|
60
|
+
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
61
|
+
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
62
|
+
|
|
63
|
+
const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
|
|
64
|
+
const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
|
|
65
|
+
const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : configProperty;
|
|
66
|
+
const localePath = localeContext === 'datapage' ? displayName : localeName;
|
|
67
|
+
|
|
68
|
+
// theOptions will be an array of JSON objects that are literally key/value pairs.
|
|
69
|
+
// Ex: [ {key: "Basic", value: "Basic"} ]
|
|
70
|
+
const theOptions = Utils.getOptionList(configProps, thePConn.getDataObject(''));
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
// This update theSelectedButton which will update the UI to show the selected button correctly
|
|
74
|
+
setSelectedButton(value);
|
|
75
|
+
}, [value]);
|
|
76
|
+
|
|
77
|
+
if (['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode || '')) {
|
|
78
|
+
return (
|
|
79
|
+
<DisplayField
|
|
80
|
+
type="radio"
|
|
81
|
+
label={label}
|
|
82
|
+
value={thePConn.getLocalizedValue(
|
|
83
|
+
value,
|
|
84
|
+
localePath,
|
|
85
|
+
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName),
|
|
86
|
+
)}
|
|
87
|
+
hideLabel={hideLabel}
|
|
88
|
+
variant={displayMode === 'STACKED_LARGE_VAL' ? 'stacked' : 'inline'}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const handleChange = (val) => {
|
|
94
|
+
if (readOnly) return;
|
|
95
|
+
|
|
96
|
+
const selectedValue = theOptions.find((option) => option.key === val);
|
|
97
|
+
handleEvent(actions, 'changeNblur', propName, selectedValue.key);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<FormFieldWrapper style={{ width: '100%' }}>
|
|
102
|
+
{label && <LabelText label={label} required={required} style={{ color: '#fff', paddingBottom: 10 }} />}
|
|
103
|
+
<Radio
|
|
104
|
+
options={theOptions.map((theOption) => ({
|
|
105
|
+
label: theOption.value,
|
|
106
|
+
value: theOption.key,
|
|
107
|
+
}))}
|
|
108
|
+
readOnly={readOnly}
|
|
109
|
+
selectedValue={theSelectedButton}
|
|
110
|
+
onChange={handleChange}
|
|
111
|
+
inline={inline}
|
|
112
|
+
disabled={disabled}
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<HelperText type={status === 'error' ? 'error' : 'info'} value={helperTextToDisplay} />
|
|
116
|
+
</FormFieldWrapper>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RadioButtons';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TextInput as RNTextInput } from 'react-native-paper';
|
|
3
|
+
|
|
4
|
+
import FormFieldWrapper from '../../common/FormFieldWrapper';
|
|
5
|
+
import LabelText from '../../common/LabelText';
|
|
6
|
+
import HelperText from '../../common/HelperText';
|
|
7
|
+
import DisplayField from '../../common/DisplayField';
|
|
8
|
+
import { FORM_INPUT_PROPS } from '../../common/inputTheme';
|
|
9
|
+
import handleEvent from '../../helpers/event-utils';
|
|
10
|
+
import { PConnFieldProps } from '../../../types/PConnProps';
|
|
11
|
+
|
|
12
|
+
interface TextAreaProps extends PConnFieldProps {
|
|
13
|
+
// If any, enter additional props that only exist on TextArea here
|
|
14
|
+
fieldMetadata?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function TextArea(props: TextAreaProps) {
|
|
18
|
+
const {
|
|
19
|
+
getPConnect,
|
|
20
|
+
label,
|
|
21
|
+
required,
|
|
22
|
+
disabled,
|
|
23
|
+
value = '',
|
|
24
|
+
validatemessage,
|
|
25
|
+
status,
|
|
26
|
+
readOnly,
|
|
27
|
+
testId,
|
|
28
|
+
helperText,
|
|
29
|
+
placeholder,
|
|
30
|
+
displayMode,
|
|
31
|
+
hideLabel,
|
|
32
|
+
} = props;
|
|
33
|
+
const pConn = getPConnect();
|
|
34
|
+
const actions = pConn.getActionsApi();
|
|
35
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
36
|
+
|
|
37
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
38
|
+
|
|
39
|
+
const [inputValue, setInputValue] = useState('');
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setInputValue(value);
|
|
43
|
+
}, [value]);
|
|
44
|
+
|
|
45
|
+
if (['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode || '')) {
|
|
46
|
+
return (
|
|
47
|
+
<DisplayField
|
|
48
|
+
type="text"
|
|
49
|
+
label={label}
|
|
50
|
+
value={value}
|
|
51
|
+
hideLabel={hideLabel}
|
|
52
|
+
variant={displayMode === 'STACKED_LARGE_VAL' ? 'stacked' : 'inline'}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function handleChange(value: string) {
|
|
58
|
+
// update internal value
|
|
59
|
+
setInputValue(value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function handleBlur() {
|
|
63
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<FormFieldWrapper>
|
|
68
|
+
<RNTextInput
|
|
69
|
+
multiline
|
|
70
|
+
numberOfLines={5}
|
|
71
|
+
{...FORM_INPUT_PROPS}
|
|
72
|
+
label={<LabelText label={label} required={required} />}
|
|
73
|
+
value={inputValue}
|
|
74
|
+
onChangeText={handleChange}
|
|
75
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
76
|
+
error={status === 'error'}
|
|
77
|
+
testID={testId}
|
|
78
|
+
placeholder={placeholder}
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
readOnly={readOnly}
|
|
81
|
+
style={{ minHeight: 100, maxHeight: 200 }}
|
|
82
|
+
/>
|
|
83
|
+
<HelperText type={status === 'error' ? 'error' : 'info'} value={helperTextToDisplay} />
|
|
84
|
+
</FormFieldWrapper>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextArea';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TextInput as RNTextInput } from 'react-native-paper';
|
|
3
|
+
|
|
4
|
+
import FormFieldWrapper from '../../common/FormFieldWrapper';
|
|
5
|
+
import LabelText from '../../common/LabelText';
|
|
6
|
+
import HelperText from '../../common/HelperText';
|
|
7
|
+
import DisplayField from '../../common/DisplayField';
|
|
8
|
+
import { FORM_INPUT_PROPS } from '../../common/inputTheme';
|
|
9
|
+
import handleEvent from '../../helpers/event-utils';
|
|
10
|
+
import { PConnFieldProps } from '../../../types/PConnProps';
|
|
11
|
+
|
|
12
|
+
interface TextInputProps extends PConnFieldProps {
|
|
13
|
+
// If any, enter additional props that only exist on TextInput here
|
|
14
|
+
fieldMetadata?: any;
|
|
15
|
+
additionalProps?: object;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function TextInput(props: TextInputProps) {
|
|
19
|
+
const {
|
|
20
|
+
getPConnect,
|
|
21
|
+
placeholder,
|
|
22
|
+
validatemessage,
|
|
23
|
+
label,
|
|
24
|
+
hideLabel,
|
|
25
|
+
helperText,
|
|
26
|
+
required,
|
|
27
|
+
disabled,
|
|
28
|
+
value = '',
|
|
29
|
+
status,
|
|
30
|
+
readOnly,
|
|
31
|
+
displayMode,
|
|
32
|
+
testId,
|
|
33
|
+
} = props;
|
|
34
|
+
|
|
35
|
+
const pConn = getPConnect();
|
|
36
|
+
const actions = pConn.getActionsApi();
|
|
37
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
38
|
+
|
|
39
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
40
|
+
|
|
41
|
+
const [inputValue, setInputValue] = useState('');
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setInputValue(value);
|
|
45
|
+
}, [value]);
|
|
46
|
+
|
|
47
|
+
if (['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode || '')) {
|
|
48
|
+
return (
|
|
49
|
+
<DisplayField
|
|
50
|
+
type="text"
|
|
51
|
+
label={label}
|
|
52
|
+
value={value}
|
|
53
|
+
hideLabel={hideLabel}
|
|
54
|
+
variant={displayMode === 'STACKED_LARGE_VAL' ? 'stacked' : 'inline'}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleChange(value) {
|
|
60
|
+
setInputValue(value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function handleBlur() {
|
|
64
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<FormFieldWrapper>
|
|
69
|
+
<RNTextInput
|
|
70
|
+
{...FORM_INPUT_PROPS}
|
|
71
|
+
label={<LabelText label={label} required={required} />}
|
|
72
|
+
value={inputValue}
|
|
73
|
+
onChangeText={handleChange}
|
|
74
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
75
|
+
error={status === 'error'}
|
|
76
|
+
testID={testId}
|
|
77
|
+
placeholder={placeholder}
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
readOnly={readOnly}
|
|
80
|
+
/>
|
|
81
|
+
<HelperText type={status === 'error' ? 'error' : 'info'} value={helperTextToDisplay} />
|
|
82
|
+
</FormFieldWrapper>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextInput';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { TextInput as RNTextInput } from 'react-native-paper';
|
|
3
|
+
|
|
4
|
+
import { PConnFieldProps } from '../../../types/PConnProps';
|
|
5
|
+
import FormFieldWrapper from '../../common/FormFieldWrapper';
|
|
6
|
+
import HelperText from '../../common/HelperText';
|
|
7
|
+
import handleEvent from '../../helpers/event-utils';
|
|
8
|
+
import LabelText from '../../common/LabelText';
|
|
9
|
+
import DisplayField from '../../common/DisplayField';
|
|
10
|
+
import { FORM_INPUT_PROPS } from '../../common/inputTheme';
|
|
11
|
+
|
|
12
|
+
interface TextInputProps extends PConnFieldProps {
|
|
13
|
+
// If any, enter additional props that only exist on URL here
|
|
14
|
+
fieldMetadata?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function URL(props: TextInputProps) {
|
|
18
|
+
const {
|
|
19
|
+
getPConnect,
|
|
20
|
+
label,
|
|
21
|
+
required,
|
|
22
|
+
disabled,
|
|
23
|
+
value = '',
|
|
24
|
+
validatemessage,
|
|
25
|
+
status,
|
|
26
|
+
readOnly,
|
|
27
|
+
testId,
|
|
28
|
+
helperText,
|
|
29
|
+
placeholder,
|
|
30
|
+
displayMode,
|
|
31
|
+
hideLabel,
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
const pConn = getPConnect();
|
|
35
|
+
const actions = pConn.getActionsApi();
|
|
36
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
37
|
+
|
|
38
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
39
|
+
|
|
40
|
+
const [inputValue, setInputValue] = useState('');
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setInputValue(value);
|
|
44
|
+
}, [value]);
|
|
45
|
+
|
|
46
|
+
if (['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode || '')) {
|
|
47
|
+
return (
|
|
48
|
+
<DisplayField
|
|
49
|
+
type="text"
|
|
50
|
+
label={label}
|
|
51
|
+
value={value}
|
|
52
|
+
hideLabel={hideLabel}
|
|
53
|
+
variant={displayMode === 'STACKED_LARGE_VAL' ? 'stacked' : 'inline'}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handleChange(value) {
|
|
59
|
+
setInputValue(value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function handleBlur() {
|
|
63
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<FormFieldWrapper>
|
|
68
|
+
<RNTextInput
|
|
69
|
+
{...FORM_INPUT_PROPS}
|
|
70
|
+
label={<LabelText label={label} required={required} />}
|
|
71
|
+
value={inputValue}
|
|
72
|
+
onChangeText={handleChange}
|
|
73
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
74
|
+
error={status === 'error'}
|
|
75
|
+
testID={testId}
|
|
76
|
+
placeholder={placeholder}
|
|
77
|
+
disabled={disabled}
|
|
78
|
+
readOnly={readOnly}
|
|
79
|
+
keyboardType="url" // This optimizes the keyboard for URL entry
|
|
80
|
+
autoCapitalize="none" // URLs are typically lowercase
|
|
81
|
+
autoCorrect={false} // Prevents unwanted autocorrection
|
|
82
|
+
/>
|
|
83
|
+
<HelperText type={status === 'error' ? 'error' : 'info'} value={helperTextToDisplay} />
|
|
84
|
+
</FormFieldWrapper>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './URL';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const getDataPage = (dataPageName, parameters, context) => {
|
|
2
|
+
let dataViewParams;
|
|
3
|
+
if (parameters) {
|
|
4
|
+
dataViewParams = {
|
|
5
|
+
dataViewParameters: parameters,
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
(PCore.getDataApiUtils().getData(dataPageName, dataViewParams, context) as any)
|
|
10
|
+
.then((response) => {
|
|
11
|
+
resolve(response.data.data);
|
|
12
|
+
})
|
|
13
|
+
.catch((e) => {
|
|
14
|
+
if (e) {
|
|
15
|
+
// check specific error if 401, and wiped out if so stored token is stale. Fetcch new tokens.
|
|
16
|
+
reject(e);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// From DX Components src/utils/event-utils.js
|
|
2
|
+
|
|
3
|
+
const handleEvent = (actions: any, eventType: string, propName: string, value: string) => {
|
|
4
|
+
switch (eventType) {
|
|
5
|
+
case 'change':
|
|
6
|
+
actions.updateFieldValue(propName, value);
|
|
7
|
+
break;
|
|
8
|
+
case 'blur':
|
|
9
|
+
actions.triggerFieldChange(propName, value);
|
|
10
|
+
break;
|
|
11
|
+
case 'changeNblur':
|
|
12
|
+
actions.updateFieldValue(propName, value);
|
|
13
|
+
actions.triggerFieldChange(propName, value);
|
|
14
|
+
break;
|
|
15
|
+
default:
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default handleEvent;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const setVisibilityForList = (c11nEnv, visibility) => {
|
|
2
|
+
const { selectionMode, selectionList, renderMode, referenceList } = c11nEnv.getComponentConfig();
|
|
3
|
+
// usecase:multiselect, fieldgroup, editable table
|
|
4
|
+
if (
|
|
5
|
+
(selectionMode === PCore.getConstants().LIST_SELECTION_MODE.MULTI && selectionList) ||
|
|
6
|
+
(renderMode === 'Editable' && referenceList)
|
|
7
|
+
) {
|
|
8
|
+
c11nEnv.getListActions().setVisibility(visibility);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const isSelfReferencedProperty = (param, referenceProp) => {
|
|
13
|
+
const [, parentPropName] = param.split('.');
|
|
14
|
+
const referencePropParent = referenceProp?.split('.').pop();
|
|
15
|
+
return parentPropName === referencePropParent;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const updateNewInstructions = (c11nEnv, selectionList) => {
|
|
19
|
+
const { datasource: { parameters = {} } = {} } = c11nEnv.getFieldMetadata(selectionList) || {};
|
|
20
|
+
const compositeKeys: any = [];
|
|
21
|
+
Object.values(parameters).forEach((param: any) => {
|
|
22
|
+
if (isSelfReferencedProperty(param, selectionList)) compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
|
|
23
|
+
});
|
|
24
|
+
c11nEnv.getListActions().initDefaultPageInstructions(selectionList, compositeKeys);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const insertInstruction = (c11nEnv, selectionList, selectionKey, primaryField, item, additionalFields) => {
|
|
28
|
+
const { id, primary } = item;
|
|
29
|
+
const actualProperty = selectionKey.startsWith('.') ? selectionKey.substring(1) : selectionKey;
|
|
30
|
+
const displayProperty = primaryField.startsWith('.') ? primaryField.substring(1) : primaryField;
|
|
31
|
+
const rows = c11nEnv.getValue(`${c11nEnv.getPageReference()}${selectionList}`) || [];
|
|
32
|
+
const startIndex = rows.length;
|
|
33
|
+
const content = {
|
|
34
|
+
[actualProperty]: id,
|
|
35
|
+
[displayProperty]: primary,
|
|
36
|
+
nonFormProperties: actualProperty !== displayProperty ? [displayProperty] : [],
|
|
37
|
+
};
|
|
38
|
+
// additional fields(ex:composite keys) to be submitted
|
|
39
|
+
additionalFields
|
|
40
|
+
?.map((key) => {
|
|
41
|
+
return key.startsWith('.') ? key.substring(1) : key;
|
|
42
|
+
})
|
|
43
|
+
.forEach((col, index) => {
|
|
44
|
+
content[col] = item.secondaryFieldValues[index];
|
|
45
|
+
});
|
|
46
|
+
c11nEnv.getListActions().insert(content, startIndex);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const deleteInstruction = (c11nEnv, selectionList, selectionKey, item) => {
|
|
50
|
+
const { id } = item;
|
|
51
|
+
const actualProperty = selectionKey.startsWith('.') ? selectionKey.substring(1) : selectionKey;
|
|
52
|
+
const rows = c11nEnv.getValue(`${c11nEnv.getPageReference()}${selectionList}`) || [];
|
|
53
|
+
const index = rows.findIndex((row) => row[actualProperty] === id);
|
|
54
|
+
c11nEnv.getListActions().deleteEntry(index);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { updateNewInstructions, insertInstruction, deleteInstruction };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { connect, Provider, shallowEqual } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
import ReactReduxContext from '../../bridge/Context/StoreContext';
|
|
5
|
+
|
|
6
|
+
const connectToState = (mapStateToProps = () => {}) => {
|
|
7
|
+
return (Component: any) => {
|
|
8
|
+
const ConnectedComponent = connect(mapStateToProps, null, null, {
|
|
9
|
+
areStatePropsEqual: (next, prev: any) => {
|
|
10
|
+
// Compare visibility
|
|
11
|
+
const prevWasVisible = prev.visibility !== false;
|
|
12
|
+
if (next.visibility !== undefined && next.visibility !== prevWasVisible) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
// Compare start props
|
|
16
|
+
const c11nEnv = next.getPConnect();
|
|
17
|
+
const allStateProps = c11nEnv.getStateProps();
|
|
18
|
+
for (const key of Object.keys(allStateProps)) {
|
|
19
|
+
if (
|
|
20
|
+
!shallowEqual(next[key], prev[key]) ||
|
|
21
|
+
(next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
|
|
22
|
+
) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/* TODO For some rawConfig we are not getting routingInfo under allStateProps */
|
|
27
|
+
return !(
|
|
28
|
+
'routingInfo' in next &&
|
|
29
|
+
(!shallowEqual(next.routingInfo, prev.routingInfo) || !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
})(Component);
|
|
33
|
+
|
|
34
|
+
return (ownProps = {}) => {
|
|
35
|
+
const { store } = useContext<any>(ReactReduxContext);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Provider store={store}>
|
|
39
|
+
<ConnectedComponent {...ownProps} />
|
|
40
|
+
</Provider>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default connectToState;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export function getAllFields(pConnect: any) {
|
|
2
|
+
const metadata = pConnect.getRawMetadata();
|
|
3
|
+
let allFields: any[] = [];
|
|
4
|
+
if (metadata.children && metadata.children.map) {
|
|
5
|
+
allFields = metadata.children.map((fields) => {
|
|
6
|
+
const children = fields.children instanceof Array ? fields.children : [];
|
|
7
|
+
return children.map((field) => field.config);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return allFields;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function filterForFieldValueList(fields: any[]) {
|
|
14
|
+
return fields
|
|
15
|
+
.filter(({ visibility }) => visibility !== false)
|
|
16
|
+
.map(({ value, label }) => ({
|
|
17
|
+
id: label.toLowerCase(),
|
|
18
|
+
name: label,
|
|
19
|
+
value,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Determine if the current view is the view of the case step/assignment.
|
|
25
|
+
* @param {Function} pConnect PConnect object for the component
|
|
26
|
+
*/
|
|
27
|
+
export function getIsAssignmentView(pConnect) {
|
|
28
|
+
// Get caseInfo content from the store which contains the view info about the current assignment/step
|
|
29
|
+
// TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available
|
|
30
|
+
const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID);
|
|
31
|
+
const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID);
|
|
32
|
+
|
|
33
|
+
const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`;
|
|
34
|
+
|
|
35
|
+
// Get the info about the current view from pConnect
|
|
36
|
+
const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`;
|
|
37
|
+
|
|
38
|
+
return assignmentViewId === currentViewId;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A hook that gets the instructions content for a view.
|
|
43
|
+
* @param {Function} pConnect PConnect object for the component
|
|
44
|
+
* @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
|
|
45
|
+
*/
|
|
46
|
+
export function getInstructions(pConnect, instructions: string = 'casestep'): string | undefined {
|
|
47
|
+
const caseStepInstructions =
|
|
48
|
+
PCore.getConstants().CASE_INFO.INSTRUCTIONS && pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
|
|
49
|
+
|
|
50
|
+
// Determine if this view is the current assignment/step view
|
|
51
|
+
const isCurrentAssignmentView = getIsAssignmentView(pConnect);
|
|
52
|
+
|
|
53
|
+
// Case step instructions
|
|
54
|
+
if (instructions === 'casestep' && isCurrentAssignmentView && caseStepInstructions?.length) {
|
|
55
|
+
return caseStepInstructions;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// No instructions
|
|
59
|
+
if (instructions === 'none') {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// If the annotation wasn't processed correctly, don't return any instruction text
|
|
64
|
+
if (instructions?.startsWith('@PARAGRAPH')) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Custom instructions from the view
|
|
69
|
+
// The raw metadata for `instructions` will be something like '@PARAGRAPH .SomeParagraphRule' but
|
|
70
|
+
// it is evaluated by core logic to the content
|
|
71
|
+
if (instructions !== 'casestep' && instructions !== 'none') {
|
|
72
|
+
return instructions;
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|