@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
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Snackbar } from 'react-native-paper';
|
|
4
|
+
import AssignmentCard from '../AssignmentCard';
|
|
5
|
+
import MultiStep from '../MultiStep';
|
|
6
|
+
import { PConnProps } from '../../../types/PConnProps';
|
|
7
|
+
|
|
8
|
+
interface AssignmentProps extends PConnProps {
|
|
9
|
+
// If any, enter additional props that only exist on this component
|
|
10
|
+
itemKey: string;
|
|
11
|
+
isInModal?: boolean;
|
|
12
|
+
banners?: any[];
|
|
13
|
+
actionButtons?: any[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
|
|
17
|
+
const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
|
|
18
|
+
const thePConn = getPConnect();
|
|
19
|
+
|
|
20
|
+
const [bHasNavigation, setHasNavigation] = useState(false);
|
|
21
|
+
const [actionButtons, setActionButtons] = useState([]);
|
|
22
|
+
const [bIsVertical, setIsVertical] = useState(false);
|
|
23
|
+
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<any[]>([]);
|
|
24
|
+
const [arNavigationSteps, setArNavigationSteps] = useState<any[]>([]);
|
|
25
|
+
|
|
26
|
+
const actionsAPI = thePConn.getActionsApi();
|
|
27
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
28
|
+
const localeCategory = 'Assignment';
|
|
29
|
+
const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect()
|
|
30
|
+
.getCaseInfo()
|
|
31
|
+
.getName()}`.toUpperCase();
|
|
32
|
+
|
|
33
|
+
// store off bound functions to above pointers
|
|
34
|
+
const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
|
|
35
|
+
const navigateToStep = actionsAPI.navigateToStep.bind(actionsAPI);
|
|
36
|
+
const cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI);
|
|
37
|
+
const saveAssignment = actionsAPI.saveAssignment?.bind(actionsAPI);
|
|
38
|
+
const cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
|
|
39
|
+
const approveCase = actionsAPI.approveCase?.bind(actionsAPI);
|
|
40
|
+
const rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
|
|
41
|
+
// const showPage = actionsAPI.showPage.bind(actionsAPI);
|
|
42
|
+
|
|
43
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
44
|
+
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
45
|
+
|
|
46
|
+
function findCurrentIndicies(arStepperSteps: any[], arIndicies: number[], depth: number): number[] {
|
|
47
|
+
let count = 0;
|
|
48
|
+
arStepperSteps.forEach((step) => {
|
|
49
|
+
if (step.visited_status === 'current') {
|
|
50
|
+
arIndicies[depth] = count;
|
|
51
|
+
|
|
52
|
+
// add in
|
|
53
|
+
step.step_status = '';
|
|
54
|
+
} else if (step.visited_status === 'success') {
|
|
55
|
+
count += 1;
|
|
56
|
+
step.step_status = 'completed';
|
|
57
|
+
} else {
|
|
58
|
+
count += 1;
|
|
59
|
+
step.step_status = '';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (step.steps) {
|
|
63
|
+
arIndicies = findCurrentIndicies(step.steps, arIndicies, depth + 1);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return arIndicies;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getStepsInfo(steps: any, formedSteps: any = []) {
|
|
71
|
+
steps.forEach((step) => {
|
|
72
|
+
if (step.name) {
|
|
73
|
+
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
|
|
74
|
+
}
|
|
75
|
+
if (step.steps) {
|
|
76
|
+
formedSteps = getStepsInfo(step.steps, formedSteps);
|
|
77
|
+
} else {
|
|
78
|
+
formedSteps.push(step);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return formedSteps;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (children) {
|
|
86
|
+
const firstChild = Array.isArray(children) ? children[0] : children;
|
|
87
|
+
const oWorkItem = firstChild.props.getPConnect();
|
|
88
|
+
const oWorkData = oWorkItem.getDataObject();
|
|
89
|
+
const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
|
|
90
|
+
|
|
91
|
+
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
|
|
92
|
+
const oCaseInfo = oData?.caseInfo;
|
|
93
|
+
|
|
94
|
+
if (oCaseInfo && oCaseInfo.actionButtons) {
|
|
95
|
+
setActionButtons(oCaseInfo.actionButtons);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (oCaseInfo?.navigation /* was oCaseInfo.navigation != null */) {
|
|
99
|
+
setHasNavigation(true);
|
|
100
|
+
|
|
101
|
+
if (
|
|
102
|
+
(oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') ||
|
|
103
|
+
oCaseInfo?.navigation?.steps?.length === 1
|
|
104
|
+
) {
|
|
105
|
+
setHasNavigation(false);
|
|
106
|
+
} else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') {
|
|
107
|
+
setIsVertical(true);
|
|
108
|
+
} else {
|
|
109
|
+
setIsVertical(false);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (oCaseInfo?.navigation?.steps) {
|
|
113
|
+
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
|
|
114
|
+
const formedSteps = getStepsInfo(steps);
|
|
115
|
+
setArNavigationSteps(formedSteps);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, [children]);
|
|
123
|
+
|
|
124
|
+
function showToast(message: string) {
|
|
125
|
+
const theMessage = `Assignment: ${message}`;
|
|
126
|
+
|
|
127
|
+
console.error(theMessage);
|
|
128
|
+
setSnackbarMessage(message);
|
|
129
|
+
setShowSnackbar(true);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function handleSnackbarClose() {
|
|
133
|
+
setShowSnackbar(false);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function onSaveActionSuccess(data) {
|
|
137
|
+
actionsAPI.cancelAssignment(itemKey, false).then(() => {
|
|
138
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function buttonPress(sAction: string, sButtonType: string) {
|
|
143
|
+
if (sButtonType === 'secondary') {
|
|
144
|
+
switch (sAction) {
|
|
145
|
+
case 'navigateToStep': {
|
|
146
|
+
const navigatePromise = navigateToStep('previous', itemKey);
|
|
147
|
+
|
|
148
|
+
navigatePromise
|
|
149
|
+
.then(() => {})
|
|
150
|
+
.catch(() => {
|
|
151
|
+
showToast(`${localizedVal('Navigation failed!', localeCategory)}`);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
case 'saveAssignment': {
|
|
158
|
+
const caseID = thePConn.getCaseInfo().getKey();
|
|
159
|
+
const assignmentID = thePConn.getCaseInfo().getAssignmentID();
|
|
160
|
+
const savePromise = saveAssignment(itemKey);
|
|
161
|
+
|
|
162
|
+
savePromise
|
|
163
|
+
.then(() => {
|
|
164
|
+
// @ts-ignore - Property 'c11nEnv' is private and only accessible within class 'CaseInfo'.
|
|
165
|
+
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
166
|
+
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
167
|
+
})
|
|
168
|
+
.catch(() => {
|
|
169
|
+
showToast(`${localizedVal('Save failed', localeCategory)}`);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
case 'cancelAssignment': {
|
|
176
|
+
// check if create stage (modal)
|
|
177
|
+
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
178
|
+
const { publish } = PCore.getPubSubUtils();
|
|
179
|
+
// @ts-ignore - Property 'isAssignmentInCreateStage' is private and only accessible within class 'CaseInfo'
|
|
180
|
+
const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
|
|
181
|
+
const isLocalAction =
|
|
182
|
+
// @ts-ignore - Property 'isLocalAction' is private and only accessible within class 'CaseInfo'.
|
|
183
|
+
thePConn.getCaseInfo().isLocalAction() ||
|
|
184
|
+
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
|
|
185
|
+
getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION));
|
|
186
|
+
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
187
|
+
const cancelPromise = cancelCreateStageAssignment(itemKey);
|
|
188
|
+
|
|
189
|
+
cancelPromise
|
|
190
|
+
.then((data) => {
|
|
191
|
+
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
192
|
+
})
|
|
193
|
+
.catch(() => {
|
|
194
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
const cancelPromise = cancelAssignment(itemKey, false);
|
|
198
|
+
|
|
199
|
+
cancelPromise
|
|
200
|
+
.then((data) => {
|
|
201
|
+
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
202
|
+
})
|
|
203
|
+
.catch(() => {
|
|
204
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
case 'rejectCase': {
|
|
211
|
+
const rejectPromise = rejectCase(itemKey);
|
|
212
|
+
|
|
213
|
+
rejectPromise
|
|
214
|
+
.then(() => {})
|
|
215
|
+
.catch(() => {
|
|
216
|
+
showToast(`${localizedVal('Rejection failed!', localeCategory)}`);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
default:
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
} else if (sButtonType === 'primary') {
|
|
226
|
+
switch (sAction) {
|
|
227
|
+
case 'finishAssignment': {
|
|
228
|
+
const finishPromise = finishAssignment(itemKey);
|
|
229
|
+
|
|
230
|
+
finishPromise
|
|
231
|
+
.then(() => {})
|
|
232
|
+
.catch(() => {
|
|
233
|
+
showToast(`${localizedVal('Submit failed!', localeCategory)}`);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
case 'approveCase': {
|
|
240
|
+
const approvePromise = approveCase(itemKey);
|
|
241
|
+
|
|
242
|
+
approvePromise
|
|
243
|
+
.then(() => {})
|
|
244
|
+
.catch(() => {
|
|
245
|
+
showToast(`${localizedVal('Approve failed!', localeCategory)}`);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
default:
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function getRefreshProps(refreshConditions) {
|
|
258
|
+
// refreshConditions cuurently supports only "Changes" event
|
|
259
|
+
if (!refreshConditions) {
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
return (
|
|
263
|
+
refreshConditions
|
|
264
|
+
.filter((item) => item.event && item.event === 'Changes')
|
|
265
|
+
.map((item) => [item.field, item.field?.substring(1)]) || []
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// expected format of refreshConditions : [{field: ".Name", event: "Changes"}]
|
|
270
|
+
// @ts-ignore - Property 'getActionRefreshConditions' is private and only accessible within class 'CaseInfo'
|
|
271
|
+
const refreshConditions = thePConn.getCaseInfo()?.getActionRefreshConditions();
|
|
272
|
+
const context = thePConn.getContextName();
|
|
273
|
+
const pageReference = thePConn.getPageReference();
|
|
274
|
+
|
|
275
|
+
// refresh api de-registration
|
|
276
|
+
PCore.getRefreshManager().deRegisterForRefresh(context);
|
|
277
|
+
|
|
278
|
+
// refresh api registration
|
|
279
|
+
const refreshProps = getRefreshProps(refreshConditions);
|
|
280
|
+
const caseKey = thePConn.getCaseInfo().getKey();
|
|
281
|
+
const refreshOptions = {
|
|
282
|
+
autoDetectRefresh: true,
|
|
283
|
+
preserveClientChanges: false,
|
|
284
|
+
};
|
|
285
|
+
if (refreshProps.length > 0) {
|
|
286
|
+
refreshProps.forEach((prop) => {
|
|
287
|
+
PCore.getRefreshManager().registerForRefresh(
|
|
288
|
+
'PROP_CHANGE',
|
|
289
|
+
thePConn.getActionsApi().refreshCaseView.bind(thePConn.getActionsApi(), caseKey, '', pageReference, {
|
|
290
|
+
...refreshOptions,
|
|
291
|
+
refreshFor: prop[0],
|
|
292
|
+
}),
|
|
293
|
+
`${pageReference}.${prop[1]}`,
|
|
294
|
+
`${context}/${pageReference}`,
|
|
295
|
+
context,
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<View>
|
|
302
|
+
{banners}
|
|
303
|
+
{bHasNavigation ? (
|
|
304
|
+
<>
|
|
305
|
+
<MultiStep
|
|
306
|
+
getPConnect={getPConnect}
|
|
307
|
+
itemKey={itemKey}
|
|
308
|
+
actionButtons={actionButtons}
|
|
309
|
+
onButtonPress={buttonPress}
|
|
310
|
+
bIsVertical={bIsVertical}
|
|
311
|
+
arCurrentStepIndicies={arCurrentStepIndicies}
|
|
312
|
+
arNavigationSteps={arNavigationSteps}
|
|
313
|
+
>
|
|
314
|
+
{children}
|
|
315
|
+
</MultiStep>
|
|
316
|
+
<Snackbar
|
|
317
|
+
visible={showSnackbar}
|
|
318
|
+
duration={3000}
|
|
319
|
+
onDismiss={handleSnackbarClose}
|
|
320
|
+
action={{
|
|
321
|
+
label: 'Close',
|
|
322
|
+
onPress: handleSnackbarClose,
|
|
323
|
+
}}
|
|
324
|
+
>
|
|
325
|
+
{snackbarMessage}
|
|
326
|
+
</Snackbar>
|
|
327
|
+
</>
|
|
328
|
+
) : (
|
|
329
|
+
<>
|
|
330
|
+
<AssignmentCard getPConnect={getPConnect} actionButtons={actionButtons} onButtonPress={buttonPress}>
|
|
331
|
+
{children}
|
|
332
|
+
</AssignmentCard>
|
|
333
|
+
<Snackbar
|
|
334
|
+
visible={showSnackbar}
|
|
335
|
+
duration={3000}
|
|
336
|
+
onDismiss={handleSnackbarClose}
|
|
337
|
+
action={{
|
|
338
|
+
label: 'Close',
|
|
339
|
+
onPress: handleSnackbarClose,
|
|
340
|
+
}}
|
|
341
|
+
>
|
|
342
|
+
{snackbarMessage}
|
|
343
|
+
</Snackbar>
|
|
344
|
+
</>
|
|
345
|
+
)}
|
|
346
|
+
</View>
|
|
347
|
+
);
|
|
348
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Assignment';
|
package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
4
|
+
|
|
5
|
+
import { PConnProps } from '../../../types/PConnProps';
|
|
6
|
+
import ActionButtons from '../ActionButtons';
|
|
7
|
+
|
|
8
|
+
interface AssignmentCardProps extends PConnProps {
|
|
9
|
+
// If any, enter additional props that only exist on this component
|
|
10
|
+
actionButtons: any;
|
|
11
|
+
onButtonPress: any;
|
|
12
|
+
showSteps?: boolean;
|
|
13
|
+
steps?: any[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function AssignmentCard(props: PropsWithChildren<AssignmentCardProps>) {
|
|
17
|
+
const { children, actionButtons, onButtonPress } = props;
|
|
18
|
+
|
|
19
|
+
const [arMainButtons, setArMainButtons] = useState([]);
|
|
20
|
+
const [arSecondaryButtons, setArSecondaryButtons] = useState([]);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (actionButtons) {
|
|
24
|
+
setArMainButtons(actionButtons.main);
|
|
25
|
+
setArSecondaryButtons(actionButtons.secondary);
|
|
26
|
+
}
|
|
27
|
+
}, [actionButtons]);
|
|
28
|
+
|
|
29
|
+
function buttonPress(sAction, sType) {
|
|
30
|
+
onButtonPress(sAction, sType);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View
|
|
35
|
+
style={{
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
justifyContent: 'space-between',
|
|
39
|
+
height: '100%',
|
|
40
|
+
paddingHorizontal: 16,
|
|
41
|
+
paddingTop: 10,
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<KeyboardAwareScrollView showsVerticalScrollIndicator={false} style={{ flex: 1, height: '100%', paddingTop: 10 }}>
|
|
45
|
+
{children}
|
|
46
|
+
</KeyboardAwareScrollView>
|
|
47
|
+
{arMainButtons && arSecondaryButtons && (
|
|
48
|
+
<ActionButtons
|
|
49
|
+
arMainButtons={arMainButtons}
|
|
50
|
+
arSecondaryButtons={arSecondaryButtons}
|
|
51
|
+
onButtonPress={buttonPress}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
</View>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AssignmentCard';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import Assignment from '../../Assignment';
|
|
4
|
+
import { withSimpleViewContainerRenderer } from '../../Containers/SimpleView';
|
|
5
|
+
import { addContainerItem } from '../../Containers/ViewContainer/helper';
|
|
6
|
+
import { isContainerInitialized } from '../../Containers/helper';
|
|
7
|
+
import { hasContainerItems } from './helpers';
|
|
8
|
+
|
|
9
|
+
const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';
|
|
10
|
+
|
|
11
|
+
function FlowContainer(props: any) {
|
|
12
|
+
const { subscribe } = PCore.getPubSubUtils();
|
|
13
|
+
const [hasError, setHasError] = useState(false);
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
getPConnect: getPConnectOfFlowContainer,
|
|
17
|
+
rootViewElement,
|
|
18
|
+
getPConnectOfActiveContainerItem,
|
|
19
|
+
activeContainerItemID: itemKey,
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
const pConnectOfFlowContainer = getPConnectOfFlowContainer();
|
|
23
|
+
const isInitialized = isContainerInitialized(pConnectOfFlowContainer);
|
|
24
|
+
const hasItems = isInitialized && hasContainerItems(pConnectOfFlowContainer);
|
|
25
|
+
const getPConnect = getPConnectOfActiveContainerItem || getPConnectOfFlowContainer;
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
// @ts-ignore - Property 'getMetadata' is private and only accessible within class 'C11nEnv'
|
|
29
|
+
if (isInitialized && pConnectOfFlowContainer.getMetadata().children && !hasItems) {
|
|
30
|
+
// ensuring not to add container items, if container already has items
|
|
31
|
+
// because during multi doc mode, we will have container items already in store
|
|
32
|
+
addContainerItem(pConnectOfFlowContainer);
|
|
33
|
+
}
|
|
34
|
+
}, [isInitialized, hasItems]);
|
|
35
|
+
|
|
36
|
+
subscribe(
|
|
37
|
+
ERROR_WHILE_RENDERING,
|
|
38
|
+
() => {
|
|
39
|
+
setHasError(true);
|
|
40
|
+
},
|
|
41
|
+
`${ERROR_WHILE_RENDERING}-fc-${getPConnect().getContextName()}`,
|
|
42
|
+
false,
|
|
43
|
+
getPConnect().getContextName(),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const assignmentForm = useMemo(() => {
|
|
47
|
+
return (
|
|
48
|
+
<Assignment getPConnect={getPConnect} itemKey={itemKey}>
|
|
49
|
+
{rootViewElement}
|
|
50
|
+
</Assignment>
|
|
51
|
+
);
|
|
52
|
+
}, [getPConnect, props, hasError]);
|
|
53
|
+
|
|
54
|
+
return <View>{assignmentForm}</View>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default withSimpleViewContainerRenderer(FlowContainer);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Moved PCore.getConstants() into each function in which it's used until we can
|
|
2
|
+
// make sure that this code isn't run until PCore is defined (after onPCoreReady)
|
|
3
|
+
// const { CASE_INFO } = PCore.getConstants();
|
|
4
|
+
|
|
5
|
+
export const addContainerItem = (pConnect) => {
|
|
6
|
+
const containerManager = pConnect.getContainerManager();
|
|
7
|
+
const contextName = pConnect.getContextName(); // here we will get parent context name, as flow container is child of view container
|
|
8
|
+
const caseViewMode = pConnect.getValue('context_data.caseViewMode');
|
|
9
|
+
|
|
10
|
+
let key;
|
|
11
|
+
let flowName;
|
|
12
|
+
|
|
13
|
+
if (caseViewMode !== 'review') {
|
|
14
|
+
const target = contextName.substring(0, contextName.lastIndexOf('_'));
|
|
15
|
+
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(target);
|
|
16
|
+
const containerItemData = PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
|
|
17
|
+
|
|
18
|
+
if (containerItemData) {
|
|
19
|
+
({ key, flowName } = containerItemData);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
containerManager.addContainerItem({
|
|
24
|
+
semanticURL: '',
|
|
25
|
+
key,
|
|
26
|
+
flowName,
|
|
27
|
+
caseViewMode: 'perform',
|
|
28
|
+
resourceType: 'ASSIGNMENT',
|
|
29
|
+
data: pConnect.getDataObject(contextName),
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const hasContainerItems = (pConnect) => {
|
|
34
|
+
const contextName = pConnect.getContextName();
|
|
35
|
+
const containerName = pConnect.getContainerName();
|
|
36
|
+
return PCore.getContainerUtils().hasContainerItems(`${contextName}/${containerName}`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getActiveCaseActionName = (pConnect) => {
|
|
40
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
41
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
42
|
+
const activeActionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
|
|
43
|
+
const activeAction = caseActions.find((action) => action.ID === activeActionID);
|
|
44
|
+
return activeAction?.name || '';
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const getFirstCaseActionName = (pConnect) => {
|
|
48
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
49
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
50
|
+
return caseActions[0]?.name || '';
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const hasNotificationMessages = (pConnect) => {
|
|
54
|
+
return !!pConnect.getValue('caseMessages');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const isCaseWideLocalAction = (pConnect) => {
|
|
58
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
59
|
+
const actionID = pConnect.getValue(CASE_INFO.ACTIVE_ACTION_ID);
|
|
60
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
61
|
+
if (caseActions && actionID) {
|
|
62
|
+
const activeAction = caseActions.find((caseAction) => caseAction.ID === actionID);
|
|
63
|
+
return activeAction?.type === 'Case';
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const getChildCaseAssignments = (pConnect) => {
|
|
69
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
70
|
+
const childCases = pConnect.getValue(CASE_INFO.CHILD_ASSIGNMENTS);
|
|
71
|
+
let allAssignments = [];
|
|
72
|
+
if (childCases && childCases.length > 0) {
|
|
73
|
+
childCases.forEach(({ assignments, Name }) => {
|
|
74
|
+
if (assignments) {
|
|
75
|
+
const childCaseAssignments = assignments.map((assignment) => ({
|
|
76
|
+
...assignment,
|
|
77
|
+
caseName: Name,
|
|
78
|
+
}));
|
|
79
|
+
allAssignments = allAssignments.concat(childCaseAssignments);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return allAssignments;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const hasAssignments = (pConnect) => {
|
|
87
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
88
|
+
const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS);
|
|
89
|
+
const childCasesAssignments = getChildCaseAssignments(pConnect);
|
|
90
|
+
|
|
91
|
+
if (assignments || childCasesAssignments || isCaseWideLocalAction(pConnect)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const showBanner = (getPConnect) => {
|
|
98
|
+
const pConnect = getPConnect();
|
|
99
|
+
return hasNotificationMessages(pConnect) || !hasAssignments(pConnect);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const showTodo = (pConnect) => {
|
|
103
|
+
const caseViewMode = pConnect.getValue('context_data.caseViewMode');
|
|
104
|
+
return caseViewMode !== 'perform';
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const isRenderWithToDoWrapper = (getPConnect, options) => {
|
|
108
|
+
const pConnect = getPConnect();
|
|
109
|
+
const { showWithToDo } = options;
|
|
110
|
+
return showWithToDo && (!isCaseWideLocalAction(pConnect) || showTodo(pConnect));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const getToDoAssignments = (pConnect) => {
|
|
114
|
+
const { CASE_INFO } = PCore.getConstants();
|
|
115
|
+
const caseActions = pConnect.getValue(CASE_INFO.CASE_INFO_ACTIONS);
|
|
116
|
+
const assignmentLabel = pConnect.getValue(CASE_INFO.ASSIGNMENT_LABEL);
|
|
117
|
+
const assignments = pConnect.getValue(CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS) || [];
|
|
118
|
+
const childCasesAssignments = getChildCaseAssignments(pConnect) || [];
|
|
119
|
+
let childCasesAssignmentsCopy = JSON.parse(JSON.stringify(childCasesAssignments));
|
|
120
|
+
|
|
121
|
+
childCasesAssignmentsCopy = childCasesAssignmentsCopy.map((assignment) => {
|
|
122
|
+
assignment.isChild = true;
|
|
123
|
+
return assignment;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const todoAssignments = [...assignments, ...childCasesAssignmentsCopy];
|
|
127
|
+
let todoAssignmentsCopy = JSON.parse(JSON.stringify(todoAssignments));
|
|
128
|
+
|
|
129
|
+
if (caseActions && !showTodo(pConnect)) {
|
|
130
|
+
todoAssignmentsCopy = todoAssignmentsCopy.map((assignment) => {
|
|
131
|
+
assignment.name = getActiveCaseActionName(pConnect) || assignmentLabel;
|
|
132
|
+
return assignment;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return todoAssignmentsCopy;
|
|
137
|
+
};
|
package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FlowContainer';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createElement, useEffect, useState } from 'react';
|
|
2
|
+
import { Text, View } from 'react-native';
|
|
3
|
+
import { PConnectComponent } from '@pega/sdk-react';
|
|
4
|
+
|
|
5
|
+
const getNoPortalContent = (pConn: any) => {
|
|
6
|
+
const configProps = pConn.getConfigProps();
|
|
7
|
+
const options = { context: 'app', target: pConn.getTarget() };
|
|
8
|
+
|
|
9
|
+
const viewContainerConfig = {
|
|
10
|
+
meta: {
|
|
11
|
+
type: 'ViewContainer',
|
|
12
|
+
config: configProps,
|
|
13
|
+
},
|
|
14
|
+
options,
|
|
15
|
+
};
|
|
16
|
+
const theViewContainer: any = PCore.createPConnect(viewContainerConfig);
|
|
17
|
+
|
|
18
|
+
return createElement(PConnectComponent, theViewContainer);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default function RootContainer(props: any) {
|
|
22
|
+
const [componentName, setComponentName] = useState('');
|
|
23
|
+
|
|
24
|
+
const { getPConnect, renderingMode, routingInfo } = props;
|
|
25
|
+
|
|
26
|
+
const pConn = getPConnect();
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const { containers } = PCore.getStore().getState();
|
|
30
|
+
const items = Object.keys(containers).filter((item) => item.includes('root'));
|
|
31
|
+
(PCore.getContainerUtils().getContainerAPI() as any).addContainerItems(items);
|
|
32
|
+
}, [routingInfo]);
|
|
33
|
+
|
|
34
|
+
if (renderingMode === 'noPortal') {
|
|
35
|
+
const theChildren = pConn.getChildren() as any[];
|
|
36
|
+
if (theChildren && theChildren.length === 1) {
|
|
37
|
+
const localPConn = theChildren[0].getPConnect();
|
|
38
|
+
const localCompName = localPConn.getComponentName();
|
|
39
|
+
if (componentName !== localCompName) {
|
|
40
|
+
setComponentName(localCompName);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return <View>{getNoPortalContent(pConn)}</View>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View>
|
|
49
|
+
<Text>Root Container</Text>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RootContainer';
|