@pega/sdk 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +10 -3
  2. package/dist/index.js +828 -165
  3. package/package.json +1 -1
  4. package/templates/react-native-sdk-reference/.claude/settings.json +5 -0
  5. package/templates/react-native-sdk-reference/.prettierignore +17 -0
  6. package/templates/react-native-sdk-reference/.vscode/extensions.json +1 -0
  7. package/templates/react-native-sdk-reference/.vscode/settings.json +7 -0
  8. package/templates/react-native-sdk-reference/AGENTS.md +3 -0
  9. package/templates/react-native-sdk-reference/CLAUDE.md +1 -0
  10. package/templates/react-native-sdk-reference/README.md +56 -0
  11. package/templates/react-native-sdk-reference/app.json +40 -5
  12. package/templates/react-native-sdk-reference/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
  13. package/templates/react-native-sdk-reference/assets/expo.icon/Assets/grid.png +0 -0
  14. package/templates/react-native-sdk-reference/assets/expo.icon/icon.json +35 -0
  15. package/templates/react-native-sdk-reference/assets/icons/bell.png +0 -0
  16. package/templates/react-native-sdk-reference/assets/icons/clock.png +0 -0
  17. package/templates/react-native-sdk-reference/assets/icons/cross.png +0 -0
  18. package/templates/react-native-sdk-reference/assets/icons/donut.png +0 -0
  19. package/templates/react-native-sdk-reference/assets/icons/gear.png +0 -0
  20. package/templates/react-native-sdk-reference/assets/icons/globe.png +0 -0
  21. package/templates/react-native-sdk-reference/assets/icons/internet.png +0 -0
  22. package/templates/react-native-sdk-reference/assets/icons/music.png +0 -0
  23. package/templates/react-native-sdk-reference/assets/icons/right-arrow.png +0 -0
  24. package/templates/react-native-sdk-reference/assets/icons/speed.png +0 -0
  25. package/templates/react-native-sdk-reference/assets/images/MediaCo.png +0 -0
  26. package/templates/react-native-sdk-reference/assets/images/adaptive-icon.png +0 -0
  27. package/templates/react-native-sdk-reference/assets/images/android-icon-background.png +0 -0
  28. package/templates/react-native-sdk-reference/assets/images/android-icon-foreground.png +0 -0
  29. package/templates/react-native-sdk-reference/assets/images/android-icon-monochrome.png +0 -0
  30. package/templates/react-native-sdk-reference/assets/images/expo-badge-white.png +0 -0
  31. package/templates/react-native-sdk-reference/assets/images/expo-badge.png +0 -0
  32. package/templates/react-native-sdk-reference/assets/images/expo-logo.png +0 -0
  33. package/templates/react-native-sdk-reference/assets/images/favicon.png +0 -0
  34. package/templates/react-native-sdk-reference/assets/images/icon.png +0 -0
  35. package/templates/react-native-sdk-reference/assets/images/logo-glow.png +0 -0
  36. package/templates/react-native-sdk-reference/assets/images/partial-react-logo.png +0 -0
  37. package/templates/react-native-sdk-reference/assets/images/react-logo.png +0 -0
  38. package/templates/react-native-sdk-reference/assets/images/react-logo@2x.png +0 -0
  39. package/templates/react-native-sdk-reference/assets/images/react-logo@3x.png +0 -0
  40. package/templates/react-native-sdk-reference/assets/images/splash-icon.png +0 -0
  41. package/templates/react-native-sdk-reference/assets/images/tutorial-web.png +0 -0
  42. package/templates/react-native-sdk-reference/eslint.config.mjs +68 -0
  43. package/templates/react-native-sdk-reference/package.json +59 -14
  44. package/templates/react-native-sdk-reference/pega-constellationjs-0.26.3.tgz +0 -0
  45. package/templates/react-native-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
  46. package/templates/react-native-sdk-reference/pega-sdk-types-0.1.0.tgz +0 -0
  47. package/templates/react-native-sdk-reference/sdk-config.json +31 -9
  48. package/templates/react-native-sdk-reference/src/app/_layout.tsx +38 -0
  49. package/templates/react-native-sdk-reference/src/app/home/_layout.tsx +39 -0
  50. package/templates/react-native-sdk-reference/src/app/home/contact.tsx +11 -0
  51. package/templates/react-native-sdk-reference/src/app/home/index.tsx +36 -0
  52. package/templates/react-native-sdk-reference/src/app/home/shop.tsx +11 -0
  53. package/templates/react-native-sdk-reference/src/app/home/your-services.tsx +11 -0
  54. package/templates/react-native-sdk-reference/src/app/index.tsx +72 -0
  55. package/templates/react-native-sdk-reference/src/app/workarea.tsx +135 -0
  56. package/templates/react-native-sdk-reference/src/bridge/Context/StoreContext.ts +4 -0
  57. package/templates/react-native-sdk-reference/src/bridge/RootComponent.tsx +12 -0
  58. package/templates/react-native-sdk-reference/src/bridge/react_pconnect.jsx +334 -0
  59. package/templates/react-native-sdk-reference/src/components/common/DisplayField.tsx +29 -0
  60. package/templates/react-native-sdk-reference/src/components/common/FormFieldWrapper.tsx +5 -0
  61. package/templates/react-native-sdk-reference/src/components/common/HelperText.tsx +11 -0
  62. package/templates/react-native-sdk-reference/src/components/common/LabelText.tsx +22 -0
  63. package/templates/react-native-sdk-reference/src/components/common/inputTheme.ts +17 -0
  64. package/templates/react-native-sdk-reference/src/components/design-system/AutoComplete.tsx +126 -0
  65. package/templates/react-native-sdk-reference/src/components/design-system/FieldGroup.tsx +72 -0
  66. package/templates/react-native-sdk-reference/src/components/design-system/Radio.tsx +61 -0
  67. package/templates/react-native-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +196 -0
  68. package/templates/react-native-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
  69. package/templates/react-native-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +89 -0
  70. package/templates/react-native-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
  71. package/templates/react-native-sdk-reference/src/components/field/Currency/Currency.tsx +84 -0
  72. package/templates/react-native-sdk-reference/src/components/field/Currency/index.tsx +1 -0
  73. package/templates/react-native-sdk-reference/src/components/field/Date/Date.tsx +94 -0
  74. package/templates/react-native-sdk-reference/src/components/field/Date/index.tsx +1 -0
  75. package/templates/react-native-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +211 -0
  76. package/templates/react-native-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
  77. package/templates/react-native-sdk-reference/src/components/field/Email/Email.tsx +81 -0
  78. package/templates/react-native-sdk-reference/src/components/field/Email/index.tsx +1 -0
  79. package/templates/react-native-sdk-reference/src/components/field/Group/Group.tsx +47 -0
  80. package/templates/react-native-sdk-reference/src/components/field/Group/index.tsx +1 -0
  81. package/templates/react-native-sdk-reference/src/components/field/Integer/Integer.tsx +84 -0
  82. package/templates/react-native-sdk-reference/src/components/field/Integer/index.tsx +1 -0
  83. package/templates/react-native-sdk-reference/src/components/field/Phone/Phone.tsx +85 -0
  84. package/templates/react-native-sdk-reference/src/components/field/Phone/index.ts +1 -0
  85. package/templates/react-native-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +118 -0
  86. package/templates/react-native-sdk-reference/src/components/field/RadioButtons/index.ts +1 -0
  87. package/templates/react-native-sdk-reference/src/components/field/TextArea/TextArea.tsx +86 -0
  88. package/templates/react-native-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
  89. package/templates/react-native-sdk-reference/src/components/field/TextInput/TextInput.tsx +84 -0
  90. package/templates/react-native-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
  91. package/templates/react-native-sdk-reference/src/components/field/URL/URL.tsx +86 -0
  92. package/templates/react-native-sdk-reference/src/components/field/URL/index.tsx +1 -0
  93. package/templates/react-native-sdk-reference/src/components/helpers/data_page.ts +20 -0
  94. package/templates/react-native-sdk-reference/src/components/helpers/event-utils.ts +20 -0
  95. package/templates/react-native-sdk-reference/src/components/helpers/instructions-utils.ts +57 -0
  96. package/templates/react-native-sdk-reference/src/components/helpers/state-utils.tsx +46 -0
  97. package/templates/react-native-sdk-reference/src/components/helpers/template-utils.ts +75 -0
  98. package/templates/react-native-sdk-reference/src/components/helpers/utils.ts +339 -0
  99. package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/ActionButtons.tsx +63 -0
  100. package/templates/react-native-sdk-reference/src/components/infra/ActionButtons/index.tsx +1 -0
  101. package/templates/react-native-sdk-reference/src/components/infra/Assignment/Assignment.tsx +348 -0
  102. package/templates/react-native-sdk-reference/src/components/infra/Assignment/index.tsx +1 -0
  103. package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/AssignmentCard.tsx +56 -0
  104. package/templates/react-native-sdk-reference/src/components/infra/AssignmentCard/index.tsx +1 -0
  105. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/FlowContainer.tsx +57 -0
  106. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/helpers.ts +137 -0
  107. package/templates/react-native-sdk-reference/src/components/infra/Containers/FlowContainer/index.tsx +1 -0
  108. package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/RootContainer.tsx +52 -0
  109. package/templates/react-native-sdk-reference/src/components/infra/Containers/RootContainer/index.tsx +1 -0
  110. package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/helper.ts +128 -0
  111. package/templates/react-native-sdk-reference/src/components/infra/Containers/SimpleView/index.tsx +59 -0
  112. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/ViewContainer.tsx +31 -0
  113. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/helper.ts +39 -0
  114. package/templates/react-native-sdk-reference/src/components/infra/Containers/ViewContainer/index.ts +1 -0
  115. package/templates/react-native-sdk-reference/src/components/infra/Containers/helper.ts +9 -0
  116. package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/ErrorBoundary.tsx +53 -0
  117. package/templates/react-native-sdk-reference/src/components/infra/ErrorBoundary/index.tsx +1 -0
  118. package/templates/react-native-sdk-reference/src/components/infra/MultiStep/MultiStep.tsx +24 -0
  119. package/templates/react-native-sdk-reference/src/components/infra/MultiStep/index.ts +1 -0
  120. package/templates/react-native-sdk-reference/src/components/infra/Reference/Reference.tsx +68 -0
  121. package/templates/react-native-sdk-reference/src/components/infra/Reference/index.tsx +1 -0
  122. package/templates/react-native-sdk-reference/src/components/infra/Reference/utils.ts +16 -0
  123. package/templates/react-native-sdk-reference/src/components/infra/Region/Region.tsx +10 -0
  124. package/templates/react-native-sdk-reference/src/components/infra/Region/index.tsx +1 -0
  125. package/templates/react-native-sdk-reference/src/components/infra/View/View.tsx +49 -0
  126. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +38 -0
  127. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
  128. package/templates/react-native-sdk-reference/src/components/template/DefaultForm/utils/index.ts +28 -0
  129. package/templates/react-native-sdk-reference/src/components/template/Details/Details.tsx +82 -0
  130. package/templates/react-native-sdk-reference/src/components/template/Details/index.tsx +1 -0
  131. package/templates/react-native-sdk-reference/src/components/template/OneColumn/OneColumn.tsx +29 -0
  132. package/templates/react-native-sdk-reference/src/components/template/OneColumn/index.tsx +1 -0
  133. package/templates/react-native-sdk-reference/src/context/LoaderContext.tsx +42 -0
  134. package/templates/react-native-sdk-reference/src/mediaco/AdvBanner.tsx +62 -0
  135. package/templates/react-native-sdk-reference/src/mediaco/Header.tsx +60 -0
  136. package/templates/react-native-sdk-reference/src/mediaco/HomeScreen.tsx +78 -0
  137. package/templates/react-native-sdk-reference/src/mediaco/QuickActions.tsx +68 -0
  138. package/templates/react-native-sdk-reference/src/mediaco/ResolutionScreen.tsx +48 -0
  139. package/templates/react-native-sdk-reference/src/mediaco/SafeArea.tsx +11 -0
  140. package/templates/react-native-sdk-reference/src/mediaco/TabBar.tsx +102 -0
  141. package/templates/react-native-sdk-reference/src/mediaco/YourServices.tsx +90 -0
  142. package/templates/react-native-sdk-reference/src/sdk-pega-component-map.ts +64 -0
  143. package/templates/react-native-sdk-reference/src/types/PConnProps.d.ts +41 -0
  144. package/templates/react-native-sdk-reference/src/utils/auth.ts +62 -0
  145. package/templates/react-native-sdk-reference/src/utils/init-pcore.ts +37 -0
  146. package/templates/react-native-sdk-reference/src/utils/pcore-polyfills.ts +66 -0
  147. package/templates/react-native-sdk-reference/tsconfig.json +9 -8
  148. package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +171 -0
  149. package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +25 -26
  150. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +119 -0
  151. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +70 -121
  152. package/templates/react-sdk-reference/.ai-common/instructions/component-map.md +7 -19
  153. package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +10 -40
  154. package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +134 -0
  155. package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +15 -43
  156. package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +11 -63
  157. package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +12 -57
  158. package/templates/react-sdk-reference/.ai-common/mcp/claude-code.mcp.json +8 -0
  159. package/templates/react-sdk-reference/.ai-common/mcp/copilot.mcp.json +8 -0
  160. package/templates/react-sdk-reference/.ai-common/mcp/cursor.mcp.json +11 -0
  161. package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +45 -71
  162. package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +98 -0
  163. package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +155 -0
  164. package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +67 -237
  165. package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +26 -77
  166. package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +315 -0
  167. package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +31 -80
  168. package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +43 -99
  169. package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +33 -83
  170. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AlertBanner.md +60 -74
  171. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Banner.md +64 -84
  172. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/CaseSummaryFields.md +76 -109
  173. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/DetailsFields.md +84 -101
  174. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroup.md +62 -87
  175. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldGroupList.md +56 -76
  176. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/FieldValueList.md +61 -85
  177. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Operator.md +84 -107
  178. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Pulse.md +36 -44
  179. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/RichTextEditor.md +125 -189
  180. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/WssQuickCreate.md +34 -50
  181. package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +57 -179
  182. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +130 -0
  183. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +311 -0
  184. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +156 -0
  185. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +476 -0
  186. package/templates/react-sdk-reference/.ai-common/skills/field-components.md +120 -242
  187. package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +71 -212
  188. package/templates/react-sdk-reference/.ai-common/skills/field-skills/CancelAlert.md +47 -209
  189. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Checkbox.md +90 -259
  190. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Currency.md +75 -169
  191. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Date.md +65 -160
  192. package/templates/react-sdk-reference/.ai-common/skills/field-skills/DateTime.md +59 -157
  193. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Decimal.md +55 -134
  194. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Dropdown.md +61 -185
  195. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Email.md +60 -138
  196. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Group.md +40 -99
  197. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Integer.md +44 -111
  198. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Location.md +57 -165
  199. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Multiselect.md +41 -122
  200. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +32 -130
  201. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Percentage.md +48 -112
  202. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Phone.md +43 -153
  203. package/templates/react-sdk-reference/.ai-common/skills/field-skills/RadioButtons.md +76 -183
  204. package/templates/react-sdk-reference/.ai-common/skills/field-skills/RichText.md +59 -176
  205. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ScalarList.md +30 -123
  206. package/templates/react-sdk-reference/.ai-common/skills/field-skills/SelectableCard.md +47 -178
  207. package/templates/react-sdk-reference/.ai-common/skills/field-skills/SemanticLink.md +31 -117
  208. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextArea.md +51 -106
  209. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextContent.md +22 -75
  210. package/templates/react-sdk-reference/.ai-common/skills/field-skills/TextInput.md +54 -116
  211. package/templates/react-sdk-reference/.ai-common/skills/field-skills/Time.md +46 -100
  212. package/templates/react-sdk-reference/.ai-common/skills/field-skills/URL.md +44 -93
  213. package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +40 -167
  214. package/templates/react-sdk-reference/.ai-common/skills/infra-components.md +165 -0
  215. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/ActionButtons.md +122 -0
  216. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/MultiStep.md +178 -0
  217. package/templates/react-sdk-reference/.ai-common/skills/infra-skills/Stages.md +140 -0
  218. package/templates/react-sdk-reference/.ai-common/skills/template-components.md +74 -228
  219. package/templates/react-sdk-reference/.ai-common/skills/template-skills/AdvancedSearch.md +66 -167
  220. package/templates/react-sdk-reference/.ai-common/skills/template-skills/AppShell.md +57 -170
  221. package/templates/react-sdk-reference/.ai-common/skills/template-skills/BannerPage.md +41 -76
  222. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseSummary.md +53 -109
  223. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseView.md +86 -289
  224. package/templates/react-sdk-reference/.ai-common/skills/template-skills/CaseViewActionsMenu.md +60 -185
  225. package/templates/react-sdk-reference/.ai-common/skills/template-skills/Confirmation.md +66 -115
  226. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DataReference.md +33 -68
  227. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultForm.md +53 -133
  228. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DefaultPage.md +39 -82
  229. package/templates/react-sdk-reference/.ai-common/skills/template-skills/Details.md +38 -91
  230. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsSubTabs.md +47 -101
  231. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsThreeColumn.md +27 -34
  232. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DetailsTwoColumn.md +25 -40
  233. package/templates/react-sdk-reference/.ai-common/skills/template-skills/DynamicTabs.md +34 -104
  234. package/templates/react-sdk-reference/.ai-common/skills/template-skills/FieldGroupTemplate.md +46 -147
  235. package/templates/react-sdk-reference/.ai-common/skills/template-skills/HierarchicalForm.md +139 -100
  236. package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboard.md +43 -82
  237. package/templates/react-sdk-reference/.ai-common/skills/template-skills/InlineDashboardPage.md +47 -80
  238. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListPage.md +16 -29
  239. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +43 -228
  240. package/templates/react-sdk-reference/.ai-common/skills/template-skills/MultiReferenceReadOnly.md +20 -65
  241. package/templates/react-sdk-reference/.ai-common/skills/template-skills/NarrowWide.md +49 -97
  242. package/templates/react-sdk-reference/.ai-common/skills/template-skills/OneColumn.md +37 -71
  243. package/templates/react-sdk-reference/.ai-common/skills/template-skills/PromotedFilters.md +58 -148
  244. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SelfServiceCaseView.md +82 -107
  245. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +21 -60
  246. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SingleReferenceReadOnly.md +43 -100
  247. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SubTabs.md +36 -76
  248. package/templates/react-sdk-reference/.ai-common/skills/template-skills/TwoColumn.md +41 -90
  249. package/templates/react-sdk-reference/.ai-common/skills/template-skills/WideNarrow.md +36 -43
  250. package/templates/react-sdk-reference/.ai-common/skills/template-skills/WssNavBar.md +25 -115
  251. package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +38 -174
  252. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/AppAnnouncement.md +30 -57
  253. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Attachment.md +55 -101
  254. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/CaseHistory.md +38 -121
  255. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/FileUtility.md +37 -98
  256. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/Followers.md +18 -33
  257. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/QuickCreate.md +26 -91
  258. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/SummaryItem.md +28 -120
  259. package/templates/react-sdk-reference/.ai-common/skills/widget-skills/ToDo.md +41 -272
  260. package/templates/react-sdk-reference/package.json +1 -1
  261. package/templates/react-sdk-reference/pega-auth-0.2.44.tgz +0 -0
  262. package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
  263. package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +13 -3
  264. package/templates/react-native-sdk-reference/.github/AGENTS.md +0 -23
  265. package/templates/react-native-sdk-reference/.github/copilot-instructions.md +0 -40
  266. package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +0 -48
  267. package/templates/react-native-sdk-reference/App.tsx +0 -49
  268. package/templates/react-native-sdk-reference/expo-env.d.ts +0 -3
  269. package/templates/react-sdk-reference/pega-auth-0.2.42.tgz +0 -0
@@ -0,0 +1,128 @@
1
+ import { createElement, useEffect } from 'react';
2
+
3
+ import { PConnectComponent } from '@pega/sdk-react';
4
+ import { isContainerInitialized } from '../helper';
5
+
6
+ const processRootViewDetails = (rootView: any, containerItem: any, options: any) => {
7
+ const { config: { context: viewContext, name: viewName } = {} } = rootView;
8
+ const { context: containerContext } = containerItem;
9
+ const { parentGetPConnect } = options;
10
+ let resolvedViewName = viewName;
11
+ let resolvedViewContext = viewContext;
12
+
13
+ const isAnnotedViewName = PCore.getAnnotationUtils().isProperty(viewName);
14
+ const isAnnotedViewContext = PCore.getAnnotationUtils().isProperty(viewContext);
15
+
16
+ // resolving annoted view context
17
+ if (isAnnotedViewContext) {
18
+ const viewContextProperty = PCore.getAnnotationUtils().getPropertyName(viewContext);
19
+ resolvedViewContext = PCore.getStoreValue(
20
+ `.${viewContextProperty}`,
21
+ viewContextProperty.startsWith('.') ? parentGetPConnect().getPageReference() : '',
22
+ containerContext,
23
+ );
24
+ }
25
+
26
+ if (!resolvedViewContext) {
27
+ resolvedViewContext = parentGetPConnect().getPageReference();
28
+ }
29
+
30
+ // resolving annoted view name
31
+ if (isAnnotedViewName) {
32
+ const viewNameProperty = PCore.getAnnotationUtils().getPropertyName(viewName);
33
+ resolvedViewName = PCore.getStoreValue(`.${viewNameProperty}`, resolvedViewContext, containerContext);
34
+ }
35
+
36
+ /* Special case where context and viewname are dynamic values
37
+ Use case - split for each shape
38
+
39
+ Ex - (caseInfo.content.SCRequestWorkQueues[1]):context --> .pyViewName:viewName
40
+ */
41
+ if (isAnnotedViewName && isAnnotedViewContext && resolvedViewName !== '') {
42
+ /* Allow context processor to resolve view and context when both are dynamic */
43
+ resolvedViewName = viewName;
44
+ resolvedViewContext = viewContext;
45
+ }
46
+
47
+ return {
48
+ viewName: resolvedViewName,
49
+ viewContext: resolvedViewContext,
50
+ };
51
+ };
52
+
53
+ export const getPConnectOfActiveContainerItem = (containerInfo: any, options: any) => {
54
+ const { accessedOrder, items } = containerInfo;
55
+ const { isAssignmentView = false, parentGetPConnect } = options;
56
+ const containerName = parentGetPConnect().getContainerName();
57
+ const { CONTAINER_NAMES } = PCore.getContainerUtils();
58
+ const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants();
59
+
60
+ if (accessedOrder && items) {
61
+ const activeContainerItemKey = accessedOrder[accessedOrder.length - 1];
62
+
63
+ if (
64
+ items[activeContainerItemKey] &&
65
+ items[activeContainerItemKey].view &&
66
+ Object.keys(items[activeContainerItemKey].view).length > 0
67
+ ) {
68
+ const activeContainerItem = items[activeContainerItemKey];
69
+ const target = activeContainerItemKey.substring(0, activeContainerItemKey.lastIndexOf('_'));
70
+
71
+ const { view: rootView, context } = activeContainerItem;
72
+ const { viewName, viewContext } = processRootViewDetails(rootView, activeContainerItem, { parentGetPConnect });
73
+
74
+ if (!viewName) return null;
75
+
76
+ const config = {
77
+ meta: rootView,
78
+ options: {
79
+ context,
80
+ pageReference: viewContext || parentGetPConnect().getPageReference(),
81
+ containerName,
82
+ containerItemID: activeContainerItemKey,
83
+ parentPageReference: parentGetPConnect().getPageReference(),
84
+ hasForm:
85
+ isAssignmentView ||
86
+ containerName === CONTAINER_NAMES.WORKAREA ||
87
+ containerName === CONTAINER_NAMES.MODAL ||
88
+ viewName === CREATE_DETAILS_VIEW_NAME,
89
+ target,
90
+ },
91
+ };
92
+
93
+ return PCore.createPConnect(config).getPConnect;
94
+ }
95
+ }
96
+ return null;
97
+ };
98
+
99
+ export const getActiveContainerRootViewElement = (containerInfo: any, options: any) => {
100
+ const getPConnect = getPConnectOfActiveContainerItem(containerInfo, options);
101
+ if (getPConnect) {
102
+ return createElement(PConnectComponent, { getPConnect });
103
+ }
104
+ return null;
105
+ };
106
+
107
+ export const getActiveContainerItemID = (containerInfo: any) => {
108
+ const { accessedOrder } = containerInfo;
109
+ if (accessedOrder && accessedOrder.length > 0) {
110
+ return accessedOrder[accessedOrder.length - 1];
111
+ }
112
+ return '';
113
+ };
114
+
115
+ export const useContainerInitializer = (getPConnect: any, mode: any) => {
116
+ const pConnect = getPConnect();
117
+ const containerName = pConnect.getContainerName();
118
+ const containerManager = pConnect.getContainerManager();
119
+
120
+ useEffect(() => {
121
+ if (!isContainerInitialized(pConnect)) {
122
+ containerManager.initializeContainers({
123
+ type: mode,
124
+ name: containerName,
125
+ });
126
+ }
127
+ });
128
+ };
@@ -0,0 +1,59 @@
1
+ import { useMemo } from 'react';
2
+
3
+ import {
4
+ getActiveContainerItemID,
5
+ getActiveContainerRootViewElement,
6
+ getPConnectOfActiveContainerItem,
7
+ useContainerInitializer,
8
+ } from './helper';
9
+
10
+ const SimpleViewContainer = (props: any) => {
11
+ const { CONTAINER_TYPE } = PCore.getConstants();
12
+
13
+ const {
14
+ getPConnect,
15
+ mode = CONTAINER_TYPE.SINGLE,
16
+ routingInfo: containerInfo,
17
+ isAssignmentView,
18
+ options = {},
19
+ } = props;
20
+
21
+ const rootViewElement = useMemo(() => {
22
+ return getActiveContainerRootViewElement(containerInfo, {
23
+ isAssignmentView,
24
+ parentGetPConnect: getPConnect,
25
+ });
26
+ }, [containerInfo, isAssignmentView, getPConnect]);
27
+
28
+ useContainerInitializer(getPConnect, options.mode || mode);
29
+
30
+ return rootViewElement;
31
+ };
32
+
33
+ export const withSimpleViewContainerRenderer =
34
+ (Component: any, options: any = {}) =>
35
+ (props: any) => {
36
+ const { CONTAINER_TYPE } = PCore.getConstants();
37
+
38
+ const { getPConnect, mode = CONTAINER_TYPE.SINGLE, routingInfo: containerInfo, isAssignmentView } = props;
39
+
40
+ const rootViewElement = <SimpleViewContainer {...props} options={options} />;
41
+ const activeContainerItemID = getActiveContainerItemID(containerInfo);
42
+ const getPConnectOfActiveItem = getPConnectOfActiveContainerItem(containerInfo, {
43
+ isAssignmentView,
44
+ parentGetPConnect: getPConnect,
45
+ });
46
+
47
+ useContainerInitializer(getPConnect, options.mode || mode);
48
+
49
+ return (
50
+ <Component
51
+ {...props}
52
+ rootViewElement={rootViewElement}
53
+ activeContainerItemID={activeContainerItemID}
54
+ getPConnectOfActiveContainerItem={getPConnectOfActiveItem}
55
+ />
56
+ );
57
+ };
58
+
59
+ export default SimpleViewContainer;
@@ -0,0 +1,31 @@
1
+ import { View } from 'react-native';
2
+
3
+ import { useEffect } from 'react';
4
+ import { withSimpleViewContainerRenderer } from '../SimpleView';
5
+ import { isContainerInitialized } from '../helper';
6
+ import { addContainerItem, setContainerLimit } from './helper';
7
+
8
+ function ViewContainer(props: any) {
9
+ const { rootViewElement, getPConnect, name, mode, limit } = props;
10
+
11
+ const pConnect = getPConnect();
12
+ const isInitialized = isContainerInitialized(pConnect);
13
+
14
+ useEffect(() => {
15
+ if (isInitialized) {
16
+ setContainerLimit({
17
+ pConnect,
18
+ name,
19
+ mode,
20
+ limit,
21
+ });
22
+ // if (!PCore.checkIfSemanticURL())
23
+ addContainerItem(pConnect);
24
+ // if (!skipSemanticUrl) configureBrowserBookmark(pConnect);
25
+ }
26
+ }, [isInitialized]);
27
+
28
+ return <View>{rootViewElement}</View>;
29
+ }
30
+
31
+ export default withSimpleViewContainerRenderer(ViewContainer);
@@ -0,0 +1,39 @@
1
+ export const setContainerLimit = (data: any) => {
2
+ const { name, mode, limit, pConnect } = data;
3
+ const { CONTAINER_TYPE } = PCore.getConstants();
4
+ if (mode === CONTAINER_TYPE.MULTIPLE && limit) {
5
+ /* NOTE: setContainerLimit use is temporary. It is a non-public, unsupported API. */
6
+ PCore.getContainerUtils().setContainerLimit(`${pConnect.getContextName()}/${name}`, limit);
7
+ }
8
+ };
9
+
10
+ export const addContainerItem = (pConnect: any) => {
11
+ const containerManager = pConnect.getContainerManager();
12
+ const context = pConnect.getContextName();
13
+ containerManager.addContainerItem({
14
+ context,
15
+ semanticURL: '',
16
+ });
17
+ };
18
+
19
+ export const configureBrowserBookmark = (pConnect: any) => {
20
+ const context = pConnect.getContextName();
21
+ const containerName = pConnect.getContainerName();
22
+ const navPages = pConnect.getValue('pyPortal.pyPrimaryNavPages');
23
+ let defaultViewLabel = '';
24
+ if (Array.isArray(navPages) && navPages.length > 0) {
25
+ if (navPages[0].NavigationPages?.[0]?.pyLabel) {
26
+ // Handle first item as group
27
+ defaultViewLabel = navPages[0].NavigationPages[0].pyLabel;
28
+ } else if (navPages[0].pyLabel) {
29
+ defaultViewLabel = navPages[0].pyLabel;
30
+ }
31
+ }
32
+ PCore.configureForBrowserBookmark({
33
+ context,
34
+ containerName,
35
+ acName: containerName,
36
+ semanticURL: '',
37
+ defaultViewLabel,
38
+ });
39
+ };
@@ -0,0 +1 @@
1
+ export { default } from './ViewContainer';
@@ -0,0 +1,9 @@
1
+ export const isContainerInitialized = (pConnect: any) => {
2
+ const context = pConnect.getContextName();
3
+ const containerName = pConnect.getContainerName();
4
+ return PCore.getContainerUtils().isContainerInitialized(context, containerName);
5
+ };
6
+
7
+ export default {
8
+ isContainerInitialized,
9
+ };
@@ -0,0 +1,53 @@
1
+ import { Text, View } from 'react-native';
2
+ import { PConnProps } from '../../../types/PConnProps';
3
+
4
+ interface ErrorBoundaryProps extends PConnProps {
5
+ // If any, enter additional props that only exist on this component
6
+ isInternalError?: boolean;
7
+ }
8
+
9
+ export default function ErrorBoundary(props: ErrorBoundaryProps) {
10
+ const errorMsg = PCore.getErrorHandler().getGenericFailedMessage();
11
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
12
+ const localeCategory = 'Messages';
13
+ const ERROR_TEXT = localizedVal(errorMsg, localeCategory);
14
+ const WORK_AREA = 'workarea';
15
+ const ERROR_WHILE_RENDERING = 'ERROR_WHILE_RENDERING';
16
+ const { getPConnect, isInternalError = false } = props;
17
+
18
+ const theErrorDiv = (
19
+ <View>
20
+ <Text>{ERROR_TEXT}</Text>
21
+ </View>
22
+ );
23
+
24
+ if (!getPConnect) {
25
+ return theErrorDiv;
26
+ }
27
+
28
+ const pConn = getPConnect();
29
+
30
+ if (!isInternalError) {
31
+ console.error(`
32
+ ${localizedVal('Unable to load the component', localeCategory)} ${pConn.getComponentName()}
33
+ ${localizedVal(
34
+ 'This might be due to the view metadata getting corrupted or the component file missing.',
35
+ localeCategory,
36
+ )}
37
+ Raw metadata for the component: ${JSON.stringify(pConn.getRawMetadata())}
38
+ `);
39
+ }
40
+
41
+ if ((pConn.getConfigProps() as any).type === 'page') {
42
+ return theErrorDiv;
43
+ }
44
+
45
+ if (pConn.getContainerName() === WORK_AREA || pConn.isInsideList() === true || pConn.getContainerName() === 'modal') {
46
+ const { publish } = PCore.getPubSubUtils();
47
+ // @ts-ignore - second parameter “payload” for publish method should be optional
48
+ publish(ERROR_WHILE_RENDERING);
49
+ return null;
50
+ }
51
+
52
+ return theErrorDiv;
53
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ErrorBoundary';
@@ -0,0 +1,24 @@
1
+ import { View } from 'react-native';
2
+ import AssignmentCard from '../AssignmentCard';
3
+
4
+ export default function MultiStep(props: any) {
5
+ const { getPConnect, children, actionButtons, onButtonPress, arNavigationSteps } = props;
6
+
7
+ function buttonPress(sAction: string, sButtonType: string) {
8
+ onButtonPress(sAction, sButtonType);
9
+ }
10
+
11
+ return (
12
+ <View>
13
+ <AssignmentCard
14
+ getPConnect={getPConnect}
15
+ actionButtons={actionButtons}
16
+ onButtonPress={buttonPress}
17
+ showSteps={true}
18
+ steps={arNavigationSteps}
19
+ >
20
+ {children}
21
+ </AssignmentCard>
22
+ </View>
23
+ );
24
+ }
@@ -0,0 +1 @@
1
+ export { default } from './MultiStep';
@@ -0,0 +1,68 @@
1
+ import { useEffect } from 'react';
2
+
3
+ import resolveContext from './utils';
4
+
5
+ export default function Reference(props: any) {
6
+ const { visibility, context, getPConnect, readOnly, displayMode } = props;
7
+
8
+ const pConnect = getPConnect();
9
+ const referenceConfig = { ...pConnect.getComponentConfig() };
10
+
11
+ useEffect(() => {
12
+ pConnect.registerAdditionalProps({
13
+ classID: `@P ${context}.classID`,
14
+ });
15
+ }, []);
16
+
17
+ delete referenceConfig?.name;
18
+ delete referenceConfig?.type;
19
+ delete referenceConfig?.visibility;
20
+
21
+ const viewMetadata = pConnect.getReferencedView();
22
+ if (!viewMetadata) {
23
+ return null;
24
+ }
25
+
26
+ if (viewMetadata.config.template === 'CaseView') {
27
+ const utilitiesIndex = viewMetadata.children?.findIndex((child: any) => child.name === 'Utilities');
28
+ if (utilitiesIndex !== -1) {
29
+ // Utilities found in metadata
30
+ const mappedID = PCore.getEnvironmentInfo().getKeyMapping('pyID') ?? 'pyID';
31
+ const caseID = pConnect.getValue(`.${mappedID}`);
32
+ const unSupportedWidgets = ['FileUtility', 'Followers', 'RelatedCases', 'Stakeholders', 'Tags'];
33
+ if (!caseID) {
34
+ viewMetadata.children[utilitiesIndex].children = viewMetadata.children[utilitiesIndex].children.filter(
35
+ (widget: any) => !unSupportedWidgets.includes(widget.type),
36
+ );
37
+ }
38
+ }
39
+ }
40
+
41
+ const viewObject = {
42
+ ...viewMetadata,
43
+ config: {
44
+ ...viewMetadata.config,
45
+ ...referenceConfig,
46
+ },
47
+ };
48
+
49
+ const viewComponent = pConnect.createComponent(viewObject, null, null, {
50
+ pageReference: context && context.startsWith('@CLASS') ? '' : resolveContext(context),
51
+ });
52
+
53
+ if (referenceConfig.inheritedProps && referenceConfig.inheritedProps.length > 0) {
54
+ const inheritedProps = pConnect.getInheritedProps();
55
+ referenceConfig.inheritedProps = Object.keys(inheritedProps).map((prop) => ({ prop, value: inheritedProps[prop] }));
56
+ }
57
+
58
+ viewComponent.props.getPConnect().setInheritedConfig({
59
+ ...referenceConfig,
60
+ readOnly,
61
+ displayMode,
62
+ });
63
+
64
+ if (visibility !== false) {
65
+ return <>{viewComponent}</>;
66
+ }
67
+ return null;
68
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Reference';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Resolve the context when using pagelist OR pagegroup that may contain brackets
3
+ * @param context string contains full path of view context
4
+ * @returns resloved context
5
+ */
6
+ export default function resolveContext(context: string | null | undefined): string | null {
7
+ if (!context) {
8
+ return null;
9
+ }
10
+ const regex = /\((\d+)\)/g;
11
+ context = context.replace(regex, (_match, number) => {
12
+ const index = parseInt(number, 10) - 1;
13
+ return `[${index}]`;
14
+ });
15
+ return context;
16
+ }
@@ -0,0 +1,10 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ // Region does NOT have getPConnect. So, no need to extend from PConnProps
4
+ type RegionProps = Record<string, never>;
5
+
6
+ export default function Region(props: PropsWithChildren<RegionProps>) {
7
+ const { children } = props;
8
+
9
+ return <>{children}</>;
10
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Region';
@@ -0,0 +1,49 @@
1
+ import pegaSdkComponentMap from '../../../sdk-pega-component-map';
2
+
3
+ export default function View(props: any) {
4
+ const { children, template, getPConnect, visibility, name: pageName } = props;
5
+ // const { PAGE_TYPES: { PAGE, LANDINGPAGE, LISTPAGE } = {}, MODAL } =
6
+ // PCore.getConstants();
7
+
8
+ const key = `${getPConnect().getContextName()}_${getPConnect().getPageReference()}_${pageName}`;
9
+ // As long as the template is defined in the dependencies of the view
10
+ // it will be loaded, otherwise fall back to single column
11
+ if (visibility === false) {
12
+ return '';
13
+ }
14
+
15
+ if (template) {
16
+ const ViewTemplate: any = pegaSdkComponentMap[template];
17
+ if (template === 'ListView') {
18
+ // special case for ListView - add in a prop
19
+ const bInForm = true;
20
+ props = { ...props, bInForm };
21
+ }
22
+
23
+ // spreading because all props should go to the template
24
+ const RenderedTemplate = (
25
+ <ViewTemplate key={key} {...props}>
26
+ {children}
27
+ </ViewTemplate>
28
+ );
29
+
30
+ return RenderedTemplate;
31
+ }
32
+
33
+ if (children) {
34
+ return <>{children}</>;
35
+ }
36
+
37
+ return null;
38
+ }
39
+
40
+ View.additionalProps = (state: any, getPconnect: any) => {
41
+ const { template } = getPconnect().getConfigProps();
42
+
43
+ if (template) {
44
+ const ViewTemplate: any = PCore.getComponentsRegistry().getLazyComponent(template);
45
+ return ViewTemplate?.additionalProps?.(state, getPconnect);
46
+ }
47
+
48
+ return {};
49
+ };
@@ -0,0 +1,38 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import { Text } from 'react-native-paper';
4
+ import { View } from 'react-native';
5
+
6
+ import { PConnectComponent } from '@pega/sdk-react';
7
+ import { getInstructions } from '../../helpers/template-utils';
8
+
9
+ import { getKeyForMappedField } from './utils';
10
+ import { PConnProps } from '@/types/PConnProps';
11
+
12
+ interface DefaultFormProps extends PConnProps {
13
+ // If any, enter additional props that only exist on this component
14
+ NumCols: string;
15
+ instructions: string;
16
+ }
17
+
18
+ export default function DefaultForm(props: PropsWithChildren<DefaultFormProps>) {
19
+ const { getPConnect } = props;
20
+ const instructions = getInstructions(getPConnect(), props.instructions);
21
+
22
+ // repoint the children because they are in a region and we need to not render the region
23
+ // to take the children and create components for them, put in an array and pass as the
24
+ // defaultForm kids
25
+ const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
26
+ const dfChildren = arChildren?.map((kid) => <PConnectComponent key={getKeyForMappedField(kid)} {...kid} />);
27
+
28
+ return (
29
+ <>
30
+ {instructions && (
31
+ <View style={{ paddingTop: 15, paddingBottom: 15 }}>
32
+ <Text>{instructions}</Text>
33
+ </View>
34
+ )}
35
+ <View>{dfChildren}</View>
36
+ </>
37
+ );
38
+ }
@@ -0,0 +1 @@
1
+ export { default } from './DefaultForm';
@@ -0,0 +1,28 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+
3
+ export const mapStateToProps: any = (_, ownProps) => {
4
+ const { getPConnect } = ownProps;
5
+
6
+ return {
7
+ visibility: getPConnect().getComputedVisibility(),
8
+ getPConnect,
9
+ };
10
+ };
11
+
12
+ export const getKeyForMappedField = (field) => {
13
+ if (Array.isArray(field)) {
14
+ return field
15
+ .map((item) => {
16
+ return getKeyForMappedField(item);
17
+ })
18
+ .join('__');
19
+ }
20
+
21
+ const pConnect = field?.getPConnect?.();
22
+
23
+ if (pConnect?.meta) {
24
+ return JSON.stringify(pConnect.meta);
25
+ }
26
+
27
+ return uuidv4();
28
+ };
@@ -0,0 +1,82 @@
1
+ import React, { createElement } from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+
4
+ import FieldGroup from '../../design-system/FieldGroup';
5
+ import { PConnectComponent } from '@pega/sdk-react';
6
+ import { PConnProps } from '@/types/PConnProps';
7
+
8
+ interface DetailsProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ label: string;
11
+ showLabel: boolean;
12
+ showHighlightedData: boolean;
13
+ }
14
+
15
+ export default function Details(props: DetailsProps) {
16
+ const { label, showLabel, getPConnect, showHighlightedData } = props;
17
+
18
+ // Get the inherited props from the parent to determine label settings
19
+ const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
20
+
21
+ // Set display mode prop and re-create the children so this part of the dom tree renders
22
+ // in a readonly (display) mode instead of a editable
23
+ getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
24
+ getPConnect().setInheritedProp('readOnly', true);
25
+ const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
26
+ createElement(PConnectComponent, {
27
+ ...configObject,
28
+ key: index.toString(),
29
+ }),
30
+ );
31
+
32
+ // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
33
+ let highlightedDataArr = [];
34
+ if (showHighlightedData) {
35
+ const { highlightedData = [] } = (getPConnect().getRawMetadata() as any).config;
36
+ highlightedDataArr = highlightedData.map((field) => {
37
+ field.config.displayMode = 'STACKED_LARGE_VAL';
38
+
39
+ // Mark as status display when using pyStatusWork
40
+ if (field.config.value === '@P .pyStatusWork') {
41
+ field.type = 'TextInput';
42
+ field.config.displayAsStatus = true;
43
+ }
44
+
45
+ return getPConnect().createComponent(field, '', 0, {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
46
+ });
47
+ }
48
+
49
+ return (
50
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
51
+ {showHighlightedData && highlightedDataArr.length > 0 && (
52
+ <View style={styles.highlightedContainer}>
53
+ {highlightedDataArr.map((child, i) => (
54
+ <View style={styles.fullWidthItem} key={`hf-${i + 1}`}>
55
+ {child}
56
+ </View>
57
+ ))}
58
+ </View>
59
+ )}
60
+ <View style={styles.childrenContainer}>
61
+ {children.map((child, i) => (
62
+ <View style={styles.fullWidthItem} key={`r-${i + 1}`}>
63
+ {child}
64
+ </View>
65
+ ))}
66
+ </View>
67
+ </FieldGroup>
68
+ );
69
+ }
70
+
71
+ const styles = StyleSheet.create({
72
+ highlightedContainer: {
73
+ paddingBottom: 16,
74
+ },
75
+ childrenContainer: {
76
+ // Add spacing between children if needed
77
+ },
78
+ fullWidthItem: {
79
+ width: '100%',
80
+ marginBottom: 8,
81
+ },
82
+ });
@@ -0,0 +1 @@
1
+ export { default } from './Details';