@pega/react-sdk-components 0.23.26 → 8.8.20

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 (553) hide show
  1. package/lib/bridge/Context/StoreContext.d.ts +3 -2
  2. package/lib/bridge/Context/StoreContext.d.ts.map +1 -1
  3. package/lib/bridge/Context/StoreContext.js +2 -3
  4. package/lib/bridge/Context/StoreContext.js.map +1 -1
  5. package/lib/bridge/helpers/sdk_component_map.d.ts +1 -0
  6. package/lib/bridge/helpers/sdk_component_map.d.ts.map +1 -1
  7. package/lib/bridge/helpers/sdk_component_map.js +22 -0
  8. package/lib/bridge/helpers/sdk_component_map.js.map +1 -1
  9. package/lib/bridge/react_pconnect.d.ts.map +1 -1
  10. package/lib/bridge/react_pconnect.js +2 -14
  11. package/lib/bridge/react_pconnect.js.map +1 -1
  12. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts +10 -0
  13. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts.map +1 -0
  14. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +19 -0
  15. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js.map +1 -0
  16. package/lib/components/designSystemExtension/AlertBanner/index.d.ts +2 -0
  17. package/lib/components/designSystemExtension/AlertBanner/index.d.ts.map +1 -0
  18. package/lib/components/designSystemExtension/AlertBanner/index.js +2 -0
  19. package/lib/components/designSystemExtension/AlertBanner/index.js.map +1 -0
  20. package/lib/components/designSystemExtension/Banner/Banner.d.ts +15 -1
  21. package/lib/components/designSystemExtension/Banner/Banner.d.ts.map +1 -1
  22. package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
  23. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts +6 -9
  24. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
  25. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +3 -7
  26. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
  27. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts +4 -10
  28. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts.map +1 -1
  29. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +1 -8
  30. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
  31. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts +6 -2
  32. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
  33. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +3 -3
  34. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
  35. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts +7 -2
  36. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts.map +1 -1
  37. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +4 -4
  38. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
  39. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts +7 -2
  40. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
  41. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +3 -3
  42. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
  43. package/lib/components/designSystemExtension/Operator/Operator.d.ts +17 -7
  44. package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
  45. package/lib/components/designSystemExtension/Operator/Operator.js +13 -16
  46. package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
  47. package/lib/components/designSystemExtension/Pulse/Pulse.d.ts +5 -1
  48. package/lib/components/designSystemExtension/Pulse/Pulse.d.ts.map +1 -1
  49. package/lib/components/designSystemExtension/Pulse/Pulse.js +3 -6
  50. package/lib/components/designSystemExtension/Pulse/Pulse.js.map +1 -1
  51. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts +19 -0
  52. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +1 -0
  53. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +77 -0
  54. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +1 -0
  55. package/lib/components/designSystemExtension/RichTextEditor/index.d.ts +2 -0
  56. package/lib/components/designSystemExtension/RichTextEditor/index.d.ts.map +1 -0
  57. package/lib/components/designSystemExtension/RichTextEditor/index.js +2 -0
  58. package/lib/components/designSystemExtension/RichTextEditor/index.js.map +1 -0
  59. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts +6 -1
  60. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts.map +1 -1
  61. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +2 -2
  62. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
  63. package/lib/components/field/AutoComplete/AutoComplete.d.ts +15 -1
  64. package/lib/components/field/AutoComplete/AutoComplete.d.ts.map +1 -1
  65. package/lib/components/field/AutoComplete/AutoComplete.js +17 -15
  66. package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
  67. package/lib/components/field/CancelAlert/CancelAlert.d.ts +7 -2
  68. package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
  69. package/lib/components/field/CancelAlert/CancelAlert.js +12 -10
  70. package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
  71. package/lib/components/field/Checkbox/Checkbox.d.ts +19 -1
  72. package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
  73. package/lib/components/field/Checkbox/Checkbox.js +12 -10
  74. package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
  75. package/lib/components/field/Currency/Currency.d.ts +6 -1
  76. package/lib/components/field/Currency/Currency.d.ts.map +1 -1
  77. package/lib/components/field/Currency/Currency.js +11 -11
  78. package/lib/components/field/Currency/Currency.js.map +1 -1
  79. package/lib/components/field/Currency/currency-utils.d.ts +1 -1
  80. package/lib/components/field/Currency/currency-utils.d.ts.map +1 -1
  81. package/lib/components/field/Currency/currency-utils.js +1 -1
  82. package/lib/components/field/Currency/currency-utils.js.map +1 -1
  83. package/lib/components/field/Date/Date.d.ts +5 -1
  84. package/lib/components/field/Date/Date.d.ts.map +1 -1
  85. package/lib/components/field/Date/Date.js +19 -11
  86. package/lib/components/field/Date/Date.js.map +1 -1
  87. package/lib/components/field/DateTime/DateTime.d.ts +5 -1
  88. package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
  89. package/lib/components/field/DateTime/DateTime.js +15 -9
  90. package/lib/components/field/DateTime/DateTime.js.map +1 -1
  91. package/lib/components/field/Decimal/Decimal.d.ts +8 -1
  92. package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
  93. package/lib/components/field/Decimal/Decimal.js +43 -9
  94. package/lib/components/field/Decimal/Decimal.js.map +1 -1
  95. package/lib/components/field/Dropdown/Dropdown.d.ts +10 -1
  96. package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
  97. package/lib/components/field/Dropdown/Dropdown.js +26 -9
  98. package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
  99. package/lib/components/field/Email/Email.d.ts +5 -1
  100. package/lib/components/field/Email/Email.d.ts.map +1 -1
  101. package/lib/components/field/Email/Email.js +7 -5
  102. package/lib/components/field/Email/Email.js.map +1 -1
  103. package/lib/components/field/Integer/Integer.d.ts +5 -1
  104. package/lib/components/field/Integer/Integer.d.ts.map +1 -1
  105. package/lib/components/field/Integer/Integer.js +6 -4
  106. package/lib/components/field/Integer/Integer.js.map +1 -1
  107. package/lib/components/field/Percentage/Percentage.d.ts +5 -1
  108. package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
  109. package/lib/components/field/Percentage/Percentage.js +6 -4
  110. package/lib/components/field/Percentage/Percentage.js.map +1 -1
  111. package/lib/components/field/Phone/Phone.d.ts +5 -1
  112. package/lib/components/field/Phone/Phone.d.ts.map +1 -1
  113. package/lib/components/field/Phone/Phone.js +10 -7
  114. package/lib/components/field/Phone/Phone.js.map +1 -1
  115. package/lib/components/field/RadioButtons/RadioButtons.d.ts +7 -1
  116. package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
  117. package/lib/components/field/RadioButtons/RadioButtons.js +24 -11
  118. package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
  119. package/lib/components/field/RichText/RichText.d.ts +7 -0
  120. package/lib/components/field/RichText/RichText.d.ts.map +1 -0
  121. package/lib/components/field/RichText/RichText.js +51 -0
  122. package/lib/components/field/RichText/RichText.js.map +1 -0
  123. package/lib/components/field/RichText/index.d.ts +2 -0
  124. package/lib/components/field/RichText/index.d.ts.map +1 -0
  125. package/lib/components/field/RichText/index.js +2 -0
  126. package/lib/components/field/RichText/index.js.map +1 -0
  127. package/lib/components/field/ScalarList/ScalarList.d.ts +13 -0
  128. package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -0
  129. package/lib/components/field/ScalarList/ScalarList.js +34 -0
  130. package/lib/components/field/ScalarList/ScalarList.js.map +1 -0
  131. package/lib/components/field/ScalarList/index.d.ts +2 -0
  132. package/lib/components/field/ScalarList/index.d.ts.map +1 -0
  133. package/lib/components/field/ScalarList/index.js +2 -0
  134. package/lib/components/field/ScalarList/index.js.map +1 -0
  135. package/lib/components/field/SemanticLink/SemanticLink.d.ts +5 -9
  136. package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
  137. package/lib/components/field/SemanticLink/SemanticLink.js +10 -14
  138. package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
  139. package/lib/components/field/SemanticLink/utils.d.ts.map +1 -1
  140. package/lib/components/field/SemanticLink/utils.js.map +1 -1
  141. package/lib/components/field/TextArea/TextArea.d.ts +6 -1
  142. package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
  143. package/lib/components/field/TextArea/TextArea.js +5 -3
  144. package/lib/components/field/TextArea/TextArea.js.map +1 -1
  145. package/lib/components/field/TextContent/TextContent.d.ts +7 -1
  146. package/lib/components/field/TextContent/TextContent.d.ts.map +1 -1
  147. package/lib/components/field/TextContent/TextContent.js.map +1 -1
  148. package/lib/components/field/TextInput/TextInput.d.ts +6 -1
  149. package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
  150. package/lib/components/field/TextInput/TextInput.js +24 -5
  151. package/lib/components/field/TextInput/TextInput.js.map +1 -1
  152. package/lib/components/field/Time/Time.d.ts +5 -1
  153. package/lib/components/field/Time/Time.d.ts.map +1 -1
  154. package/lib/components/field/Time/Time.js +14 -8
  155. package/lib/components/field/Time/Time.js.map +1 -1
  156. package/lib/components/field/URL/URL.d.ts +5 -1
  157. package/lib/components/field/URL/URL.d.ts.map +1 -1
  158. package/lib/components/field/URL/URL.js +11 -5
  159. package/lib/components/field/URL/URL.js.map +1 -1
  160. package/lib/components/field/UserReference/UserReference.d.ts +19 -40
  161. package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
  162. package/lib/components/field/UserReference/UserReference.js +16 -45
  163. package/lib/components/field/UserReference/UserReference.js.map +1 -1
  164. package/lib/components/helpers/attachmentHelpers.d.ts +6 -6
  165. package/lib/components/helpers/attachmentHelpers.d.ts.map +1 -1
  166. package/lib/components/helpers/attachmentHelpers.js +2 -2
  167. package/lib/components/helpers/attachmentHelpers.js.map +1 -1
  168. package/lib/components/helpers/auth.d.ts +8 -6
  169. package/lib/components/helpers/auth.d.ts.map +1 -1
  170. package/lib/components/helpers/auth.js +642 -327
  171. package/lib/components/helpers/auth.js.map +1 -1
  172. package/lib/components/helpers/authManager.d.ts +20 -17
  173. package/lib/components/helpers/authManager.d.ts.map +1 -1
  174. package/lib/components/helpers/authManager.js +713 -438
  175. package/lib/components/helpers/authManager.js.map +1 -1
  176. package/lib/components/helpers/case-utils.d.ts +20 -0
  177. package/lib/components/helpers/case-utils.d.ts.map +1 -0
  178. package/lib/components/helpers/case-utils.js +82 -0
  179. package/lib/components/helpers/case-utils.js.map +1 -0
  180. package/lib/components/helpers/common-utils.d.ts +2 -0
  181. package/lib/components/helpers/common-utils.d.ts.map +1 -0
  182. package/lib/components/helpers/common-utils.js +5 -0
  183. package/lib/components/helpers/common-utils.js.map +1 -0
  184. package/lib/components/helpers/config_access.d.ts.map +1 -1
  185. package/lib/components/helpers/config_access.js +28 -98
  186. package/lib/components/helpers/config_access.js.map +1 -1
  187. package/lib/components/helpers/data_page.d.ts.map +1 -1
  188. package/lib/components/helpers/data_page.js.map +1 -1
  189. package/lib/components/helpers/date-format-utils.d.ts +1 -6
  190. package/lib/components/helpers/date-format-utils.d.ts.map +1 -1
  191. package/lib/components/helpers/date-format-utils.js +23 -14
  192. package/lib/components/helpers/date-format-utils.js.map +1 -1
  193. package/lib/components/helpers/event-utils.d.ts +1 -1
  194. package/lib/components/helpers/event-utils.d.ts.map +1 -1
  195. package/lib/components/helpers/event-utils.js.map +1 -1
  196. package/lib/components/helpers/field-group-utils.d.ts +15 -2
  197. package/lib/components/helpers/field-group-utils.d.ts.map +1 -1
  198. package/lib/components/helpers/field-group-utils.js +3 -3
  199. package/lib/components/helpers/field-group-utils.js.map +1 -1
  200. package/lib/components/helpers/formatters/Boolean.d.ts +3 -3
  201. package/lib/components/helpers/formatters/Boolean.d.ts.map +1 -1
  202. package/lib/components/helpers/formatters/Boolean.js.map +1 -1
  203. package/lib/components/helpers/formatters/Currency.d.ts +6 -6
  204. package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
  205. package/lib/components/helpers/formatters/Currency.js +6 -5
  206. package/lib/components/helpers/formatters/Currency.js.map +1 -1
  207. package/lib/components/helpers/formatters/CurrencyMap.d.ts +881 -1399
  208. package/lib/components/helpers/formatters/CurrencyMap.d.ts.map +1 -1
  209. package/lib/components/helpers/formatters/CurrencyMap.js.map +1 -1
  210. package/lib/components/helpers/formatters/Date.d.ts +4 -4
  211. package/lib/components/helpers/formatters/Date.d.ts.map +1 -1
  212. package/lib/components/helpers/formatters/Date.js +1 -1
  213. package/lib/components/helpers/formatters/Date.js.map +1 -1
  214. package/lib/components/helpers/formatters/common.d.ts +2 -2
  215. package/lib/components/helpers/formatters/common.d.ts.map +1 -1
  216. package/lib/components/helpers/formatters/common.js +4 -5
  217. package/lib/components/helpers/formatters/common.js.map +1 -1
  218. package/lib/components/helpers/formatters/index.d.ts +11 -11
  219. package/lib/components/helpers/formatters/index.d.ts.map +1 -1
  220. package/lib/components/helpers/formatters/index.js.map +1 -1
  221. package/lib/components/helpers/reactContextHelpers.d.ts +3 -2
  222. package/lib/components/helpers/reactContextHelpers.d.ts.map +1 -1
  223. package/lib/components/helpers/reactContextHelpers.js.map +1 -1
  224. package/lib/components/helpers/simpleTableHelpers.d.ts +5 -3
  225. package/lib/components/helpers/simpleTableHelpers.d.ts.map +1 -1
  226. package/lib/components/helpers/simpleTableHelpers.js +10 -5
  227. package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
  228. package/lib/components/helpers/state-utils.d.ts +4 -0
  229. package/lib/components/helpers/state-utils.d.ts.map +1 -0
  230. package/lib/components/helpers/state-utils.js +36 -0
  231. package/lib/components/helpers/state-utils.js.map +1 -0
  232. package/lib/components/helpers/template-utils.d.ts +7 -3
  233. package/lib/components/helpers/template-utils.d.ts.map +1 -1
  234. package/lib/components/helpers/template-utils.js.map +1 -1
  235. package/lib/components/helpers/utils.d.ts +1 -1
  236. package/lib/components/helpers/utils.d.ts.map +1 -1
  237. package/lib/components/helpers/utils.js +9 -3
  238. package/lib/components/helpers/utils.js.map +1 -1
  239. package/lib/components/helpers/versionHelpers.d.ts.map +1 -1
  240. package/lib/components/helpers/versionHelpers.js.map +1 -1
  241. package/lib/components/infra/ActionButtons/ActionButtons.d.ts +6 -13
  242. package/lib/components/infra/ActionButtons/ActionButtons.d.ts.map +1 -1
  243. package/lib/components/infra/ActionButtons/ActionButtons.js +5 -15
  244. package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
  245. package/lib/components/infra/Assignment/Assignment.d.ts +9 -14
  246. package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
  247. package/lib/components/infra/Assignment/Assignment.js +32 -33
  248. package/lib/components/infra/Assignment/Assignment.js.map +1 -1
  249. package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts +8 -14
  250. package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts.map +1 -1
  251. package/lib/components/infra/AssignmentCard/AssignmentCard.js +3 -16
  252. package/lib/components/infra/AssignmentCard/AssignmentCard.js.map +1 -1
  253. package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts +1 -21
  254. package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
  255. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +53 -52
  256. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
  257. package/lib/components/infra/Containers/FlowContainer/helpers.d.ts +12 -12
  258. package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
  259. package/lib/components/infra/Containers/FlowContainer/helpers.js +17 -16
  260. package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
  261. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts +8 -17
  262. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
  263. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +22 -24
  264. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
  265. package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts +9 -22
  266. package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts.map +1 -1
  267. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +7 -22
  268. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
  269. package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts +9 -19
  270. package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
  271. package/lib/components/infra/DashboardFilter/DashboardFilter.js +2 -16
  272. package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
  273. package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
  274. package/lib/components/infra/DashboardFilter/filterUtils.js +1 -1
  275. package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
  276. package/lib/components/infra/DeferLoad/DeferLoad.d.ts +1 -14
  277. package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
  278. package/lib/components/infra/DeferLoad/DeferLoad.js +13 -15
  279. package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
  280. package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts +5 -12
  281. package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
  282. package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +9 -16
  283. package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
  284. package/lib/components/infra/MultiStep/MultiStep.d.ts +11 -17
  285. package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
  286. package/lib/components/infra/MultiStep/MultiStep.js +6 -20
  287. package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
  288. package/lib/components/infra/NavBar/NavBar.d.ts +8 -16
  289. package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
  290. package/lib/components/infra/NavBar/NavBar.js +9 -20
  291. package/lib/components/infra/NavBar/NavBar.js.map +1 -1
  292. package/lib/components/infra/Reference/Reference.d.ts +8 -17
  293. package/lib/components/infra/Reference/Reference.d.ts.map +1 -1
  294. package/lib/components/infra/Reference/Reference.js +1 -15
  295. package/lib/components/infra/Reference/Reference.js.map +1 -1
  296. package/lib/components/infra/Region/Region.d.ts +4 -7
  297. package/lib/components/infra/Region/Region.d.ts.map +1 -1
  298. package/lib/components/infra/Region/Region.js +0 -4
  299. package/lib/components/infra/Region/Region.js.map +1 -1
  300. package/lib/components/infra/RootContainer/RootContainer.d.ts +1 -21
  301. package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
  302. package/lib/components/infra/RootContainer/RootContainer.js +16 -36
  303. package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
  304. package/lib/components/infra/Stages/Stages.d.ts +5 -8
  305. package/lib/components/infra/Stages/Stages.d.ts.map +1 -1
  306. package/lib/components/infra/Stages/Stages.js +3 -7
  307. package/lib/components/infra/Stages/Stages.js.map +1 -1
  308. package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.d.ts.map +1 -1
  309. package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js.map +1 -1
  310. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts +4 -10
  311. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts.map +1 -1
  312. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js +4 -9
  313. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js.map +1 -1
  314. package/lib/components/infra/View/View.d.ts +13 -16
  315. package/lib/components/infra/View/View.d.ts.map +1 -1
  316. package/lib/components/infra/View/View.js +8 -54
  317. package/lib/components/infra/View/View.js.map +1 -1
  318. package/lib/components/template/AppShell/AppShell.d.ts +20 -15
  319. package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
  320. package/lib/components/template/AppShell/AppShell.js +17 -29
  321. package/lib/components/template/AppShell/AppShell.js.map +1 -1
  322. package/lib/components/template/BannerPage/BannerPage.d.ts +11 -23
  323. package/lib/components/template/BannerPage/BannerPage.d.ts.map +1 -1
  324. package/lib/components/template/BannerPage/BannerPage.js +4 -22
  325. package/lib/components/template/BannerPage/BannerPage.js.map +1 -1
  326. package/lib/components/template/CaseSummary/CaseSummary.d.ts +5 -7
  327. package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
  328. package/lib/components/template/CaseSummary/CaseSummary.js +6 -6
  329. package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
  330. package/lib/components/template/CaseView/CaseView.d.ts +10 -22
  331. package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
  332. package/lib/components/template/CaseView/CaseView.js +41 -45
  333. package/lib/components/template/CaseView/CaseView.js.map +1 -1
  334. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts +8 -13
  335. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts.map +1 -1
  336. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +9 -16
  337. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
  338. package/lib/components/template/Confirmation/Confirmation.d.ts +10 -16
  339. package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
  340. package/lib/components/template/Confirmation/Confirmation.js +12 -23
  341. package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
  342. package/lib/components/template/DataReference/DataReference.d.ts +1 -31
  343. package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
  344. package/lib/components/template/DataReference/DataReference.js +41 -48
  345. package/lib/components/template/DataReference/DataReference.js.map +1 -1
  346. package/lib/components/template/DefaultForm/DefaultForm.d.ts +1 -11
  347. package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
  348. package/lib/components/template/DefaultForm/DefaultForm.js +18 -15
  349. package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
  350. package/lib/components/template/DefaultForm/utils/index.d.ts +3 -0
  351. package/lib/components/template/DefaultForm/utils/index.d.ts.map +1 -0
  352. package/lib/components/template/DefaultForm/utils/index.js +27 -0
  353. package/lib/components/template/DefaultForm/utils/index.js.map +1 -0
  354. package/lib/components/template/Details/Details/Details.d.ts +1 -16
  355. package/lib/components/template/Details/Details/Details.d.ts.map +1 -1
  356. package/lib/components/template/Details/Details/Details.js +10 -15
  357. package/lib/components/template/Details/Details/Details.js.map +1 -1
  358. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts +7 -15
  359. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts.map +1 -1
  360. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js +1 -13
  361. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js.map +1 -1
  362. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts +1 -16
  363. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts.map +1 -1
  364. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +14 -16
  365. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
  366. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts +1 -16
  367. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts.map +1 -1
  368. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +14 -16
  369. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
  370. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts +12 -19
  371. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
  372. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +7 -21
  373. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
  374. package/lib/components/template/InlineDashboard/InlineDashboard.d.ts +7 -7
  375. package/lib/components/template/InlineDashboard/InlineDashboard.d.ts.map +1 -1
  376. package/lib/components/template/InlineDashboard/InlineDashboard.js +0 -5
  377. package/lib/components/template/InlineDashboard/InlineDashboard.js.map +1 -1
  378. package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts +8 -15
  379. package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts.map +1 -1
  380. package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js +5 -14
  381. package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js.map +1 -1
  382. package/lib/components/template/ListPage/ListPage.d.ts +5 -13
  383. package/lib/components/template/ListPage/ListPage.d.ts.map +1 -1
  384. package/lib/components/template/ListPage/ListPage.js +6 -10
  385. package/lib/components/template/ListPage/ListPage.js.map +1 -1
  386. package/lib/components/template/ListView/DefaultViewMeta.d.ts +1 -90
  387. package/lib/components/template/ListView/DefaultViewMeta.d.ts.map +1 -1
  388. package/lib/components/template/ListView/DefaultViewMeta.js.map +1 -1
  389. package/lib/components/template/ListView/ListView.d.ts +1 -9
  390. package/lib/components/template/ListView/ListView.d.ts.map +1 -1
  391. package/lib/components/template/ListView/ListView.js +96 -100
  392. package/lib/components/template/ListView/ListView.js.map +1 -1
  393. package/lib/components/template/ListView/hooks.d.ts.map +1 -1
  394. package/lib/components/template/ListView/hooks.js +0 -1
  395. package/lib/components/template/ListView/hooks.js.map +1 -1
  396. package/lib/components/template/ListView/utils.d.ts +72 -16
  397. package/lib/components/template/ListView/utils.d.ts.map +1 -1
  398. package/lib/components/template/ListView/utils.js +143 -3
  399. package/lib/components/template/ListView/utils.js.map +1 -1
  400. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts +9 -13
  401. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts.map +1 -1
  402. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js +2 -13
  403. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js.map +1 -1
  404. package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts +10 -1
  405. package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts.map +1 -1
  406. package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.js.map +1 -1
  407. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts +1 -16
  408. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts.map +1 -1
  409. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +14 -16
  410. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
  411. package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts +5 -1
  412. package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts.map +1 -1
  413. package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.js.map +1 -1
  414. package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts +7 -14
  415. package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts.map +1 -1
  416. package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js +4 -13
  417. package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js.map +1 -1
  418. package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts +4 -7
  419. package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts.map +1 -1
  420. package/lib/components/template/OneColumn/OneColumn/OneColumn.js +0 -5
  421. package/lib/components/template/OneColumn/OneColumn/OneColumn.js.map +1 -1
  422. package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts +4 -8
  423. package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts.map +1 -1
  424. package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js +3 -6
  425. package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js.map +1 -1
  426. package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts +4 -7
  427. package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts.map +1 -1
  428. package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js +0 -5
  429. package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js.map +1 -1
  430. package/lib/components/template/PromotedFilters/PromotedFilters.d.ts +1 -15
  431. package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
  432. package/lib/components/template/PromotedFilters/PromotedFilters.js +17 -13
  433. package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
  434. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
  435. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +57 -5
  436. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
  437. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +18 -1
  438. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
  439. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +5 -5
  440. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
  441. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts +1 -29
  442. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
  443. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +22 -28
  444. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
  445. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts +14 -26
  446. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts.map +1 -1
  447. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js +5 -26
  448. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js.map +1 -1
  449. package/lib/components/template/SubTabs/SubTabs.d.ts +4 -10
  450. package/lib/components/template/SubTabs/SubTabs.d.ts.map +1 -1
  451. package/lib/components/template/SubTabs/SubTabs.js +1 -8
  452. package/lib/components/template/SubTabs/SubTabs.js.map +1 -1
  453. package/lib/components/template/SubTabs/tabUtils.d.ts.map +1 -1
  454. package/lib/components/template/SubTabs/tabUtils.js.map +1 -1
  455. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts +5 -11
  456. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts.map +1 -1
  457. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +1 -12
  458. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
  459. package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts +4 -8
  460. package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts.map +1 -1
  461. package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js +3 -6
  462. package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js.map +1 -1
  463. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts +5 -11
  464. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts.map +1 -1
  465. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +1 -9
  466. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
  467. package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts +10 -1
  468. package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts.map +1 -1
  469. package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js +1 -1
  470. package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js.map +1 -1
  471. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts +1 -16
  472. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts.map +1 -1
  473. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +31 -23
  474. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
  475. package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts +5 -1
  476. package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts.map +1 -1
  477. package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.js.map +1 -1
  478. package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts +7 -14
  479. package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts.map +1 -1
  480. package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js +4 -14
  481. package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js.map +1 -1
  482. package/lib/components/template/WssNavBar/WssNavBar.d.ts +17 -1
  483. package/lib/components/template/WssNavBar/WssNavBar.d.ts.map +1 -1
  484. package/lib/components/template/WssNavBar/WssNavBar.js +2 -2
  485. package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
  486. package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts +8 -17
  487. package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
  488. package/lib/components/widget/AppAnnouncement/AppAnnouncement.js +4 -19
  489. package/lib/components/widget/AppAnnouncement/AppAnnouncement.js.map +1 -1
  490. package/lib/components/widget/Attachment/Attachment.css +15 -3
  491. package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
  492. package/lib/components/widget/Attachment/Attachment.js +44 -32
  493. package/lib/components/widget/Attachment/Attachment.js.map +1 -1
  494. package/lib/components/widget/CaseHistory/CaseHistory.d.ts +4 -7
  495. package/lib/components/widget/CaseHistory/CaseHistory.d.ts.map +1 -1
  496. package/lib/components/widget/CaseHistory/CaseHistory.js +4 -8
  497. package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
  498. package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts +8 -1
  499. package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts.map +1 -1
  500. package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js.map +1 -1
  501. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts +5 -1
  502. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
  503. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +33 -23
  504. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
  505. package/lib/components/widget/Followers/Followers.d.ts +4 -5
  506. package/lib/components/widget/Followers/Followers.d.ts.map +1 -1
  507. package/lib/components/widget/Followers/Followers.js +3 -10
  508. package/lib/components/widget/Followers/Followers.js.map +1 -1
  509. package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
  510. package/lib/components/widget/QuickCreate/QuickCreate.js +12 -4
  511. package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
  512. package/lib/components/widget/SummaryItem/SummaryItem.d.ts +7 -1
  513. package/lib/components/widget/SummaryItem/SummaryItem.d.ts.map +1 -1
  514. package/lib/components/widget/SummaryItem/SummaryItem.js +2 -2
  515. package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
  516. package/lib/components/widget/SummaryList/SummaryList.d.ts +7 -1
  517. package/lib/components/widget/SummaryList/SummaryList.d.ts.map +1 -1
  518. package/lib/components/widget/SummaryList/SummaryList.js +5 -2
  519. package/lib/components/widget/SummaryList/SummaryList.js.map +1 -1
  520. package/lib/components/widget/ToDo/ToDo.d.ts +13 -27
  521. package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
  522. package/lib/components/widget/ToDo/ToDo.js +35 -67
  523. package/lib/components/widget/ToDo/ToDo.js.map +1 -1
  524. package/lib/components_map.d.ts +3 -3
  525. package/lib/components_map.d.ts.map +1 -1
  526. package/lib/components_map.js +819 -818
  527. package/lib/components_map.js.map +1 -1
  528. package/lib/doc/KeyReleaseUpdates.md +65 -9
  529. package/lib/hooks/index.d.ts +4 -0
  530. package/lib/hooks/index.d.ts.map +1 -0
  531. package/lib/hooks/index.js +4 -0
  532. package/lib/hooks/index.js.map +1 -0
  533. package/lib/hooks/useAfterInitialEffect.d.ts +9 -0
  534. package/lib/hooks/useAfterInitialEffect.d.ts.map +1 -0
  535. package/lib/hooks/useAfterInitialEffect.js +16 -0
  536. package/lib/hooks/useAfterInitialEffect.js.map +1 -0
  537. package/lib/hooks/useConsolidatedRef.d.ts +9 -0
  538. package/lib/hooks/useConsolidatedRef.d.ts.map +1 -0
  539. package/lib/hooks/useConsolidatedRef.js +30 -0
  540. package/lib/hooks/useConsolidatedRef.js.map +1 -0
  541. package/lib/hooks/useUID.d.ts +8 -0
  542. package/lib/hooks/useUID.d.ts.map +1 -0
  543. package/lib/hooks/useUID.js +14 -0
  544. package/lib/hooks/useUID.js.map +1 -0
  545. package/lib/index.d.ts +1 -0
  546. package/lib/index.d.ts.map +1 -1
  547. package/lib/index.js +2 -1
  548. package/lib/index.js.map +1 -1
  549. package/lib/sdk-pega-component-map.d.ts +15 -1
  550. package/lib/sdk-pega-component-map.js +15 -1
  551. package/lib/sdk-pega-component-map.js.map +1 -1
  552. package/lib/types/PConnProps.d.ts +42 -0
  553. package/package.json +1 -1
@@ -3,217 +3,64 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _PegaAuth_instances, _PegaAuth_updateConfig, _PegaAuth_buildAuthorizeUrl, _PegaAuth_sha256Hash, _PegaAuth_encode64, _PegaAuth_base64UrlSafeEncode, _PegaAuth_getCodeChallenge;
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _PegaAuth_instances, _PegaAuth_config, _PegaAuth_dynState, _PegaAuth_reloadSS, _PegaAuth_reloadConfig, _PegaAuth_updateConfig, _PegaAuth_importSingleLib, _PegaAuth_importNodeLibs, _PegaAuth_buildAuthorizeUrl, _PegaAuth_authCodeStart, _PegaAuth_updateSessionIndex, _PegaAuth_sha256Hash, _PegaAuth_encode64, _PegaAuth_base64UrlSafeEncode, _PegaAuth_getRandomString, _PegaAuth_getCodeChallenge, _PegaAuth_getAgent;
7
13
  class PegaAuth {
8
- constructor(ssKeyConfig) {
14
+ // Current properties within dynState structure:
15
+ // codeVerifier, state, sessionIndex, sessionIndexAttempts, acRedirectUri
16
+ constructor(ssKeyConfig, ssKeyDynState) {
9
17
  _PegaAuth_instances.add(this);
10
- this.ssKeyConfig = ssKeyConfig;
11
- this.bEncodeSI = false;
12
- this.reloadConfig();
13
- }
14
- reloadConfig() {
15
- const peConfig = window.sessionStorage.getItem(this.ssKeyConfig);
16
- let obj = {};
17
- if (peConfig) {
18
- try {
19
- obj = JSON.parse(peConfig);
20
- }
21
- catch (e) {
22
- try {
23
- obj = JSON.parse(window.atob(peConfig));
24
- }
25
- catch (e2) {
26
- obj = {};
27
- }
18
+ // The properties within config structure are expected to be more static config values that are then
19
+ // used to properly make various OAuth endpoint calls.
20
+ _PegaAuth_config.set(this, null);
21
+ // Any dynamic state is stored separately in its own structure. If a sessionStorage key is passed in
22
+ // without a Dynamic State key.
23
+ _PegaAuth_dynState.set(this, {});
24
+ if (typeof ssKeyConfig === 'string') {
25
+ this.ssKeyConfig = ssKeyConfig;
26
+ this.ssKeyDynState = ssKeyDynState || `${ssKeyConfig}_DS`;
27
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadConfig).call(this);
28
+ }
29
+ else {
30
+ // object with config structure is passed in
31
+ __classPrivateFieldSet(this, _PegaAuth_config, ssKeyConfig, "f");
32
+ __classPrivateFieldSet(this, _PegaAuth_dynState, ssKeyDynState, "f");
33
+ }
34
+ this.urlencoded = 'application/x-www-form-urlencoded';
35
+ this.isNode = typeof window === 'undefined';
36
+ // For isNode path the below attributes are initialized on first method invocation
37
+ if (!this.isNode) {
38
+ this.crypto = window.crypto;
39
+ this.subtle = window.crypto.subtle;
40
+ }
41
+ if (Object.keys(__classPrivateFieldGet(this, _PegaAuth_config, "f")).length > 0) {
42
+ if (!__classPrivateFieldGet(this, _PegaAuth_config, "f").serverType) {
43
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").serverType = 'infinity';
28
44
  }
29
45
  }
30
- this.config = peConfig ? obj : null;
46
+ else {
47
+ throw new Error('invalid config settings');
48
+ }
31
49
  }
32
50
  async login() {
33
- const fnGetRedirectUriOrigin = () => {
34
- const redirectUri = this.config.redirectUri;
35
- const nRootOffset = redirectUri.indexOf("//");
36
- const nFirstPathOffset = nRootOffset !== -1 ? redirectUri.indexOf("/", nRootOffset + 2) : -1;
37
- return nFirstPathOffset !== -1 ? redirectUri.substring(0, nFirstPathOffset) : redirectUri;
38
- };
39
- const redirectOrigin = fnGetRedirectUriOrigin();
40
- // eslint-disable-next-line no-restricted-globals
41
- const state = window.btoa(location.origin);
42
- return new Promise((resolve, reject) => {
43
- __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
44
- let myWindow = null; // popup or iframe
45
- let elIframe = null;
46
- let elCloseBtn = null;
47
- const iframeTimeout = this.config.silentTimeout !== undefined ? this.config.silentTimeout : 5000;
48
- let bWinIframe = iframeTimeout > 0 && ((!!this.config.userIdentifier && !!this.config.password) || this.config.iframeLoginUI || this.config.authService !== "pega");
49
- let tmrAuthComplete = null;
50
- let checkWindowClosed = null;
51
- const myWinOnLoad = () => {
52
- try {
53
- if (bWinIframe) {
54
- elIframe.contentWindow.postMessage({ type: "PegaAuth" }, redirectOrigin);
55
- // eslint-disable-next-line no-console
56
- console.log("authjs(login): loaded a page in iFrame");
57
- }
58
- else {
59
- myWindow.postMessage({ type: "PegaAuth" }, redirectOrigin);
60
- }
61
- }
62
- catch (e) {
63
- // eslint-disable-next-line no-console
64
- console.log("authjs(login): Exception trying to postMessage on load");
65
- }
66
- };
67
- const fnOpenPopup = () => {
68
- myWindow = window.open(url, '_blank', 'width=700,height=500,left=200,top=100');
69
- if (!myWindow) {
70
- // Blocked by popup-blocker
71
- // eslint-disable-next-line prefer-promise-reject-errors
72
- return reject("blocked");
73
- }
74
- checkWindowClosed = setInterval(() => {
75
- if (myWindow.closed) {
76
- clearInterval(checkWindowClosed);
77
- // eslint-disable-next-line prefer-promise-reject-errors
78
- reject("closed");
79
- }
80
- }, 500);
81
- try {
82
- myWindow.addEventListener("load", myWinOnLoad, true);
83
- }
84
- catch (e) {
85
- // eslint-disable-next-line no-console
86
- console.log("authjs(login): Exception trying to add onload handler to opened window;");
87
- }
88
- };
89
- const fnCloseIframe = () => {
90
- elIframe.parentNode.removeChild(elIframe);
91
- elCloseBtn.parentNode.removeChild(elCloseBtn);
92
- // eslint-disable-next-line no-multi-assign
93
- elIframe = elCloseBtn = null;
94
- bWinIframe = false;
95
- };
96
- const fnCloseAndReject = () => {
97
- fnCloseIframe();
98
- // eslint-disable-next-line prefer-promise-reject-errors
99
- reject("closed");
100
- };
101
- // If there is a userIdentifier and password specified or an external SSO auth service,
102
- // we can try to use this silently in an iFrame first
103
- if (bWinIframe) {
104
- const nFrameZLevel = 99999;
105
- elIframe = document.createElement('iframe');
106
- // eslint-disable-next-line prefer-template
107
- elIframe.id = 'pe' + this.config.clientId;
108
- const loginBoxWidth = 500;
109
- const loginBoxHeight = 700;
110
- const oStyle = elIframe.style;
111
- oStyle.position = 'absolute';
112
- oStyle.display = 'none';
113
- oStyle.zIndex = nFrameZLevel;
114
- oStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2)}px`;
115
- oStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2)}px`;
116
- oStyle.width = '500px';
117
- oStyle.height = '700px';
118
- // Add Iframe to top of document DOM to have it load
119
- document.body.insertBefore(elIframe, document.body.firstChild);
120
- // Add Iframe to DOM to have it load
121
- document.getElementsByTagName('body')[0].appendChild(elIframe);
122
- elIframe.addEventListener("load", myWinOnLoad, true);
123
- // Disallow iframe content attempts to navigate main window
124
- elIframe.setAttribute("sandbox", "allow-scripts allow-forms allow-same-origin");
125
- elIframe.setAttribute('src', url);
126
- const svgCloseBtn = `<?xml version="1.0" encoding="UTF-8"?>
127
- <svg width="34px" height="34px" viewBox="0 0 34 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
128
- <title>Dismiss - Black</title>
129
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
130
- <g transform="translate(1.000000, 1.000000)">
131
- <circle fill="#252C32" cx="16" cy="16" r="16"></circle>
132
- <g transform="translate(9.109375, 9.214844)" fill="#FFFFFF" fill-rule="nonzero">
133
- <path d="M12.7265625,0 L0,12.6210938 L1.0546875,13.5703125 L13.78125,1.0546875 L12.7265625,0 Z M13.7460938,12.5507812 L1.01953125,0 L0,1.01953125 L12.7617188,13.6054688 L13.7460938,12.5507812 Z"></path>
134
- </g>
135
- </g>
136
- </g>
137
- </svg>`;
138
- const bCloseWithinFrame = false;
139
- elCloseBtn = document.createElement('img');
140
- elCloseBtn.onclick = fnCloseAndReject;
141
- // eslint-disable-next-line prefer-template
142
- elCloseBtn.src = 'data:image/svg+xml;base64,' + window.btoa(svgCloseBtn);
143
- const oBtnStyle = elCloseBtn.style;
144
- oBtnStyle.cursor = 'pointer';
145
- // If svg doesn't set width and height might want to set oBtStyle width and height to something like '2em'
146
- oBtnStyle.position = 'absolute';
147
- oBtnStyle.display = 'none';
148
- oBtnStyle.zIndex = nFrameZLevel + 1;
149
- const nTopOffset = bCloseWithinFrame ? 5 : -10;
150
- const nRightOffset = bCloseWithinFrame ? -34 : -20;
151
- oBtnStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2) + nTopOffset}px`;
152
- oBtnStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2) + loginBoxWidth + nRightOffset}px`;
153
- document.body.insertBefore(elCloseBtn, document.body.firstChild);
154
- // If the password was wrong, then the login screen will be in the iframe
155
- // ..and with Pega without realization of US-372314 it may replace the top (main portal) window
156
- // For now set a timer and if the timer expires, remove the iFrame and use same url within
157
- // visible window
158
- tmrAuthComplete = setTimeout(() => {
159
- clearTimeout(tmrAuthComplete);
160
- // remove password from config
161
- if (this.config.password) {
162
- delete this.config.password;
163
- __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
164
- }
165
- if (this.config.iframeLoginUI) {
166
- elIframe.style.display = "block";
167
- elCloseBtn.style.display = "block";
168
- }
169
- else {
170
- fnCloseIframe();
171
- fnOpenPopup();
172
- }
173
- }, iframeTimeout);
174
- }
175
- else {
176
- fnOpenPopup();
177
- }
178
- let authMessageReceiver = null;
179
- /* Retrieve token(s) and close login window */
180
- const fnGetTokenAndFinish = (code) => {
181
- window.removeEventListener("message", authMessageReceiver, false);
182
- this.getToken(code).then(token => {
183
- if (bWinIframe) {
184
- clearTimeout(tmrAuthComplete);
185
- fnCloseIframe();
186
- }
187
- else {
188
- clearInterval(checkWindowClosed);
189
- myWindow.close();
190
- }
191
- resolve(token);
192
- })
193
- .catch(e => {
194
- reject(e);
195
- });
196
- };
197
- /* Handler to receive the auth code */
198
- authMessageReceiver = (event) => {
199
- // Check origin to make sure it is the redirect origin
200
- if (event.origin !== redirectOrigin)
201
- return;
202
- if (!event.data || !event.data.type || event.data.type !== "PegaAuth")
203
- return;
204
- // eslint-disable-next-line no-console
205
- console.log("authjs(login): postMessage received with code");
206
- const code = event.data.code.toString();
207
- fnGetTokenAndFinish(code);
208
- };
209
- window.addEventListener("message", authMessageReceiver, false);
210
- window.authCodeCallback = (code) => {
211
- // eslint-disable-next-line no-console
212
- console.log("authjs(login): authCodeCallback used with code");
213
- fnGetTokenAndFinish(code);
214
- };
215
- });
216
- });
51
+ if (this.isNode && !this.crypto) {
52
+ // Deferring dynamic loading of node libraries til this first method to avoid doing this in constructor
53
+ await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importNodeLibs).call(this);
54
+ }
55
+ const { grantType, noPKCE } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
56
+ if (grantType && grantType !== 'authCode') {
57
+ return this.getToken();
58
+ }
59
+ // Make sure browser in a secure context, else PKCE will fail
60
+ if (!this.isNode && !noPKCE && !window.isSecureContext) {
61
+ throw new Error(`Authorization code grant flow failed due to insecure browser context at ${window.location.origin}. Use localhost or https.`);
62
+ }
63
+ return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_authCodeStart).call(this);
217
64
  }
218
65
  // Login redirect
219
66
  loginRedirect() {
@@ -224,71 +71,131 @@ class PegaAuth {
224
71
  location.href = url;
225
72
  });
226
73
  }
74
+ // check state
75
+ checkStateMatch(state) {
76
+ return state === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
77
+ }
227
78
  // For PKCE token endpoint includes code_verifier
228
79
  getToken(authCode) {
229
80
  // Reload config to pick up the previously stored codeVerifier
230
- this.reloadConfig();
231
- const { clientId, clientSecret, redirectUri, tokenUri, codeVerifier } = this.config;
232
- // eslint-disable-next-line no-restricted-globals
233
- const queryString = location.search;
234
- const urlParams = new URLSearchParams(queryString);
235
- const code = authCode || urlParams.get("code");
81
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadConfig).call(this);
82
+ const { serverType, isolationId, clientId, clientSecret, tokenUri, grantType, customTokenParams, userIdentifier, password, noPKCE } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
83
+ const { sessionIndex, acRedirectUri, codeVerifier } = __classPrivateFieldGet(this, _PegaAuth_dynState, "f");
84
+ const bAuthCode = !grantType || grantType === 'authCode';
85
+ if (bAuthCode && !authCode && !this.isNode) {
86
+ const queryString = window.location.search;
87
+ const urlParams = new URLSearchParams(queryString);
88
+ authCode = urlParams.get('code');
89
+ }
236
90
  const formData = new URLSearchParams();
237
- formData.append("client_id", clientId);
91
+ formData.append('client_id', clientId);
238
92
  if (clientSecret) {
239
- formData.append("client_secret", clientSecret);
93
+ formData.append('client_secret', clientSecret);
94
+ }
95
+ /* eslint-disable camelcase */
96
+ const fullGTName = {
97
+ authCode: 'authorization_code',
98
+ clientCreds: 'client_credentials',
99
+ customBearer: 'custom-bearer',
100
+ passwordCreds: 'password'
101
+ }[grantType];
102
+ const grant_type = fullGTName || grantType || 'authorization_code';
103
+ formData.append('grant_type', grant_type);
104
+ if (serverType === 'launchpad' && grantType !== 'authCode') {
105
+ formData.append('isolation_ids', isolationId);
106
+ }
107
+ if (bAuthCode) {
108
+ formData.append('code', authCode);
109
+ formData.append('redirect_uri', acRedirectUri);
110
+ if (!noPKCE) {
111
+ formData.append('code_verifier', codeVerifier);
112
+ }
113
+ }
114
+ else if (sessionIndex) {
115
+ formData.append('session_index', sessionIndex);
116
+ }
117
+ /* eslint-enable camelcase */
118
+ if (grantType === 'customBearer' && customTokenParams) {
119
+ Object.keys(customTokenParams).forEach((param) => {
120
+ formData.append(param, customTokenParams[param]);
121
+ });
122
+ }
123
+ if (grantType !== 'authCode') {
124
+ formData.append('enable_psyncId', 'true');
125
+ }
126
+ if (grantType === 'passwordCreds') {
127
+ formData.append('username', userIdentifier);
128
+ formData.append('password', atob(password));
240
129
  }
241
- formData.append("grant_type", "authorization_code");
242
- formData.append("code", code);
243
- formData.append("redirect_uri", redirectUri);
244
- formData.append("code_verifier", codeVerifier);
245
130
  return fetch(tokenUri, {
246
- method: "POST",
131
+ agent: __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getAgent).call(this),
132
+ method: 'POST',
247
133
  headers: new Headers({
248
- "content-type": "application/x-www-form-urlencoded",
134
+ 'content-type': this.urlencoded
249
135
  }),
250
- body: formData.toString(),
136
+ body: formData.toString()
251
137
  })
252
138
  .then((response) => response.json())
253
- .then(token => {
254
- // .expires_in contains the # of seconds before access token expires
255
- // add property to keep track of current time when the token expires
256
- token.eA = Date.now() + (token.expires_in * 1000);
257
- if (this.config.codeVerifier) {
258
- delete this.config.codeVerifier;
259
- }
260
- // If there is a session_index then move this to the peConfig structure (as used on authorize)
261
- if (token.session_index) {
262
- this.config.sessionIndex = token.session_index;
139
+ .then((token) => {
140
+ if (token.errors || token.error) {
141
+ // eslint-disable-next-line no-console
142
+ console.error(`Token endpoint error: ${JSON.stringify(token.errors || token.error)}`);
263
143
  }
264
- // If we got a token and have a session index, then reset the sessionIndexAttempts
265
- if (this.config.sessionIndex) {
266
- this.config.sessionIndexAttempts = 0;
144
+ else {
145
+ // .expires_in contains the # of seconds before access token expires
146
+ // add property to keep track of current time when the token expires
147
+ token.eA = Date.now() + token.expires_in * 1000;
148
+ // Clear authCode related config state: state, codeVerifier, acRedirectUri
149
+ if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").state) {
150
+ delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
151
+ }
152
+ if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier) {
153
+ delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier;
154
+ }
155
+ if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri) {
156
+ delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri;
157
+ }
158
+ // If there is a session_index then move this to the peConfig structure (as used on authorize)
159
+ if (token.session_index) {
160
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex = token.session_index;
161
+ }
162
+ // If we got a token and have a session index, then reset the sessionIndexAttempts
163
+ if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex) {
164
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts = 0;
165
+ }
166
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
267
167
  }
268
- __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
269
168
  return token;
270
169
  })
271
- .catch(e => {
170
+ .catch((e) => {
272
171
  // eslint-disable-next-line no-console
273
- console.log(e);
172
+ console.error(`Token endpoint error: ${e}`);
274
173
  });
275
174
  }
276
175
  /* eslint-disable camelcase */
277
176
  async refreshToken(refresh_token) {
278
- const { clientId, clientSecret, tokenUri } = this.config;
177
+ const { clientId, clientSecret, tokenUri } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
178
+ if (this.isNode && !this.crypto) {
179
+ // Deferring dynamic loading of node libraries til this first method to avoid doing this in constructor
180
+ await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importNodeLibs).call(this);
181
+ }
182
+ if (!refresh_token) {
183
+ return null;
184
+ }
279
185
  const formData = new URLSearchParams();
280
- formData.append("client_id", clientId);
186
+ formData.append('client_id', clientId);
281
187
  if (clientSecret) {
282
- formData.append("client_secret", clientSecret);
188
+ formData.append('client_secret', clientSecret);
283
189
  }
284
- formData.append("grant_type", "refresh_token");
285
- formData.append("refresh_token", refresh_token);
190
+ formData.append('grant_type', 'refresh_token');
191
+ formData.append('refresh_token', refresh_token);
286
192
  return fetch(tokenUri, {
287
- method: "POST",
193
+ agent: __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getAgent).call(this),
194
+ method: 'POST',
288
195
  headers: new Headers({
289
- "content-type": "application/x-www-form-urlencoded",
196
+ 'content-type': this.urlencoded
290
197
  }),
291
- body: formData.toString(),
198
+ body: formData.toString()
292
199
  })
293
200
  .then((response) => {
294
201
  if (!response.ok && response.status === 401) {
@@ -296,142 +203,550 @@ class PegaAuth {
296
203
  }
297
204
  return response.json();
298
205
  })
299
- .then(token => {
206
+ .then((token) => {
300
207
  if (token) {
301
208
  // .expires_in contains the # of seconds before access token expires
302
209
  // add property to keep track of current time when the token expires
303
- token.eA = Date.now() + (token.expires_in * 1000);
210
+ token.eA = Date.now() + token.expires_in * 1000;
304
211
  }
305
212
  return token;
306
213
  })
307
- .catch(e => {
214
+ .catch((e) => {
308
215
  // eslint-disable-next-line no-console
309
- console.log(e);
216
+ console.warn(`Refresh token failed: ${e}`);
217
+ return null;
310
218
  });
311
219
  }
312
220
  async revokeTokens(access_token, refresh_token = null) {
313
- if (!this.config || !this.config.revokeUri) {
314
- // Must have a config structure and revokeUri to proceed
221
+ if (Object.keys(__classPrivateFieldGet(this, _PegaAuth_config, "f")).length === 0) {
222
+ // Must have a config structure to proceed
315
223
  return;
316
224
  }
317
- const { clientId, clientSecret, revokeUri } = this.config;
318
- const hdrs = { "content-type": "application/x-www-form-urlencoded" };
225
+ const { clientId, clientSecret, revokeUri } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
226
+ if (this.isNode && !this.crypto) {
227
+ // Deferring dynamic loading of node libraries til this first method to avoid doing this in constructor
228
+ await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importNodeLibs).call(this);
229
+ }
230
+ const hdrs = { 'content-type': this.urlencoded };
319
231
  if (clientSecret) {
320
- const creds = `${clientId}:${clientSecret}`;
321
- hdrs.authorization = `Basic ${window.btoa(creds)}`;
232
+ const basicCreds = btoa(`${clientId}:${clientSecret}`);
233
+ hdrs.authorization = `Basic ${basicCreds}`;
322
234
  }
323
- const aTknProps = ["access_token"];
235
+ const aTknProps = ['access_token'];
324
236
  if (refresh_token) {
325
- aTknProps.push("refresh_token");
237
+ aTknProps.push('refresh_token');
326
238
  }
327
239
  aTknProps.forEach((prop) => {
328
240
  const formData = new URLSearchParams();
329
241
  if (!clientSecret) {
330
- formData.append("client_id", clientId);
242
+ formData.append('client_id', clientId);
331
243
  }
332
- formData.append("token", prop === "access_token" ? access_token : refresh_token);
333
- formData.append("token_type_hint", prop);
244
+ formData.append('token', prop === 'access_token' ? access_token : refresh_token);
245
+ formData.append('token_type_hint', prop);
334
246
  fetch(revokeUri, {
335
- method: "POST",
247
+ agent: __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getAgent).call(this),
248
+ method: 'POST',
336
249
  headers: new Headers(hdrs),
337
- body: formData.toString(),
250
+ body: formData.toString()
338
251
  })
339
252
  .then((response) => {
340
253
  if (!response.ok) {
341
254
  // eslint-disable-next-line no-console
342
- console.log(`Error revoking ${prop}:${response.status}`);
255
+ console.error(`Error revoking ${prop}:${response.status}`);
343
256
  }
344
257
  })
345
- .catch(e => {
258
+ .catch((e) => {
346
259
  // eslint-disable-next-line no-console
347
- console.log(e);
260
+ console.error(`Error revoking ${prop}; ${e}`);
348
261
  });
349
262
  });
263
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed = false;
350
264
  // Also clobber any sessionIndex
351
- if (this.config.sessionIndex) {
352
- delete this.config.sessionIndex;
353
- __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
354
- }
265
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateSessionIndex).call(this, null);
355
266
  }
356
- // For userinfo endpoint to return meaningful data, endpoint must include appAlias (if specified) and authorize must
357
- // specify profile and optionally email scope to get such info returned
358
- async getUserinfo(access_token) {
359
- if (!this.config || !this.config.userinfoUri) {
360
- // Must have a config structure and userInfo to proceed
361
- return {};
267
+ }
268
+ _PegaAuth_config = new WeakMap(), _PegaAuth_dynState = new WeakMap(), _PegaAuth_instances = new WeakSet(), _PegaAuth_reloadSS = function _PegaAuth_reloadSS(ssKey) {
269
+ const sItem = window.sessionStorage.getItem(ssKey);
270
+ let obj = {};
271
+ if (sItem) {
272
+ try {
273
+ obj = JSON.parse(sItem);
362
274
  }
363
- const hdrs = { 'authorization': `bearer ${access_token}`, 'content-type': 'application/json;charset=UTF-8' };
364
- return fetch(this.config.userinfoUri, {
365
- method: "GET",
366
- headers: new Headers(hdrs)
367
- })
368
- .then(response => {
369
- if (response.ok) {
370
- return response.json();
275
+ catch (e) {
276
+ try {
277
+ obj = JSON.parse(atob(sItem));
371
278
  }
372
- else {
373
- // eslint-disable-next-line no-console
374
- console.log(`Error invoking userinfo: ${response.status}`);
279
+ catch (err) {
280
+ obj = {};
375
281
  }
376
- })
377
- .then(data => {
378
- return data;
379
- })
380
- .catch(e => {
381
- // eslint-disable-next-line no-console
382
- console.log(e);
383
- });
282
+ }
384
283
  }
385
- }
386
- _PegaAuth_instances = new WeakSet(), _PegaAuth_updateConfig = function _PegaAuth_updateConfig() {
387
- const sSI = JSON.stringify(this.config);
388
- window.sessionStorage.setItem(this.ssKeyConfig, this.bEncodeSI ? window.btoa(sSI) : sSI);
284
+ if (ssKey === this.ssKeyConfig) {
285
+ __classPrivateFieldSet(this, _PegaAuth_config, sItem ? obj : {}, "f");
286
+ }
287
+ else {
288
+ __classPrivateFieldSet(this, _PegaAuth_dynState, sItem ? obj : {}, "f");
289
+ }
290
+ }, _PegaAuth_reloadConfig = function _PegaAuth_reloadConfig() {
291
+ if (this.ssKeyConfig) {
292
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadSS).call(this, this.ssKeyConfig);
293
+ }
294
+ if (this.ssKeyDynState) {
295
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_reloadSS).call(this, this.ssKeyDynState);
296
+ }
297
+ }, _PegaAuth_updateConfig = function _PegaAuth_updateConfig() {
298
+ // transform must occur unless it is explicitly disabled
299
+ const transform = __classPrivateFieldGet(this, _PegaAuth_config, "f").transform !== false;
300
+ // May not need to write out Config info all the time, but there is a scenario where a
301
+ // non obfuscated value is passed in and then it needs to be obfuscated
302
+ if (this.ssKeyConfig) {
303
+ const sConfig = JSON.stringify(__classPrivateFieldGet(this, _PegaAuth_config, "f"));
304
+ window.sessionStorage.setItem(this.ssKeyConfig, transform ? btoa(sConfig) : sConfig);
305
+ }
306
+ if (this.ssKeyDynState) {
307
+ const sDynState = JSON.stringify(__classPrivateFieldGet(this, _PegaAuth_dynState, "f"));
308
+ window.sessionStorage.setItem(this.ssKeyDynState, transform ? btoa(sDynState) : sDynState);
309
+ }
310
+ if (__classPrivateFieldGet(this, _PegaAuth_config, "f").fnDynStateChangedCB) {
311
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").fnDynStateChangedCB();
312
+ }
313
+ }, _PegaAuth_importSingleLib = async function _PegaAuth_importSingleLib(libName, libProp, bLoadAlways = false) {
314
+ // eslint-disable-next-line no-undef
315
+ if (!bLoadAlways && typeof (this.isNode ? global : window)[libProp] !== 'undefined') {
316
+ // eslint-disable-next-line no-undef
317
+ this[libProp] = (this.isNode ? global : window)[libProp];
318
+ return this[libProp];
319
+ }
320
+ // Needed to explicitly make import argument a string by using template literals to fix a compile
321
+ // error: Critical dependency: the request of a dependency is an expression
322
+ return import(`${libName}`)
323
+ .then((mod) => {
324
+ this[libProp] = mod.default;
325
+ })
326
+ .catch((e) => {
327
+ // eslint-disable-next-line no-console
328
+ console.error(`Library ${libName} failed to load. ${e}`);
329
+ throw e;
330
+ });
331
+ }, _PegaAuth_importNodeLibs = async function _PegaAuth_importNodeLibs() {
332
+ // Also current assumption is using Node 18 or better
333
+ // With 18.3 there is now a native fetch (but may want to force use of node-fetch)
334
+ const useNodeFetch = !!__classPrivateFieldGet(this, _PegaAuth_config, "f").useNodeFetch;
335
+ return Promise.all([
336
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node-fetch', 'fetch', useNodeFetch),
337
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'open', 'open'),
338
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:crypto', 'crypto', true),
339
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:https', 'https'),
340
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:http', 'http'),
341
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_importSingleLib).call(this, 'node:fs', 'fs')
342
+ ]).then(() => {
343
+ this.subtle = this.crypto?.subtle || this.crypto.webcrypto.subtle;
344
+ if ((typeof fetch === 'undefined' || useNodeFetch) && this.fetch) {
345
+ /* eslint-disable-next-line no-global-assign */
346
+ fetch = this.fetch;
347
+ }
348
+ });
389
349
  }, _PegaAuth_buildAuthorizeUrl =
390
350
  // For PKCE the authorize includes a code_challenge & code_challenge_method as well
391
351
  async function _PegaAuth_buildAuthorizeUrl(state) {
392
- const { clientId, redirectUri, authorizeUri, authService, sessionIndex, appAlias, useLocking, userIdentifier, password } = this.config;
393
- // Generate random string of 64 chars for verifier. RFC 7636 says from 43-128 chars
394
- let buf = new Uint8Array(64);
395
- window.crypto.getRandomValues(buf);
396
- this.config.codeVerifier = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
352
+ const { serverType, clientId, redirectUri, authorizeUri, authService, appAlias, userIdentifier, password, noPKCE, isolationId } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
353
+ const { sessionIndex, } = __classPrivateFieldGet(this, _PegaAuth_dynState, "f");
354
+ const bInfinity = serverType === 'infinity';
355
+ if (!noPKCE) {
356
+ // Generate random string of 64 chars for verifier. RFC 7636 says from 43-128 chars
357
+ const buf = new Uint8Array(64);
358
+ this.crypto.getRandomValues(buf);
359
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
360
+ }
397
361
  // If sessionIndex exists then increment attempts count (we will stop sending session_index after two failures)
362
+ // With Infinity '24 we can now properly detect a invalid_session_index error, but can't for earlier versions
398
363
  if (sessionIndex) {
399
- this.config.sessionIndexAttempts += 1;
364
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts += 1;
400
365
  }
366
+ // We use state to verify that the received code is for the right authorize transaction
367
+ // eslint-disable-next-line no-unneeded-ternary
368
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state = `${state ? state : ''}.${__classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getRandomString).call(this, 32)}`;
369
+ // The same redirectUri needs to be provided to token endpoint, so save this away incase redirectUri is
370
+ // adjusted for next authorize
371
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").acRedirectUri = redirectUri;
401
372
  // Persist codeVerifier in session storage so it survives the redirects that are to follow
402
373
  __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
403
- if (!state) {
404
- // Calc random state variable
405
- buf = new Uint8Array(32);
406
- window.crypto.getRandomValues(buf);
407
- state = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
408
- }
409
374
  // Trim alias to include just the real alias piece
410
- const addtlScope = appAlias ? `+app.alias.${appAlias.replace(/^app\//, '')}` : "";
375
+ const addtlScope = appAlias ? `+app.alias.${appAlias.replace(/^app\//, '')}` : '';
376
+ const scope = bInfinity ? `openid${addtlScope}` : 'user_info';
411
377
  // Add explicit creds if specified to try to avoid login popup
412
- const moreAuthArgs = (authService ? `&authentication_service=${encodeURIComponent(authService)}` : "") +
413
- (sessionIndex && this.config.sessionIndexAttempts < 3 ? `&session_index=${sessionIndex}` : "") +
414
- (useLocking ? `&enable_psyncId=true` : '') +
415
- (userIdentifier ? `&UserIdentifier=${encodeURIComponent(userIdentifier)}` : '') +
416
- (userIdentifier && password ? `&Password=${encodeURIComponent(window.atob(password))}` : '');
417
- return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getCodeChallenge).call(this, this.config.codeVerifier).then(cc => {
418
- // Now includes new enable_psyncId=true and session_index params
419
- return `${authorizeUri}?client_id=${clientId}&response_type=code&redirect_uri=${redirectUri}&scope=openid+email+profile${addtlScope}&state=${state}&code_challenge=${cc}&code_challenge_method=S256${moreAuthArgs}`;
378
+ const authServiceArg = authService ? `&authentication_service=${encodeURIComponent(authService)}` : '';
379
+ const sessionIndexArg = sessionIndex && __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts < 3 ? `&session_index=${sessionIndex}` : '';
380
+ const userIdentifierArg = userIdentifier ? `&UserIdentifier=${encodeURIComponent(userIdentifier)}` : '';
381
+ const passwordArg = password && userIdentifier ? `&Password=${encodeURIComponent(atob(password))}` : '';
382
+ const moreAuthArgs = bInfinity
383
+ ? `&enable_psyncId=true${authServiceArg}${sessionIndexArg}${userIdentifierArg}${passwordArg}`
384
+ : `&isolationID=${isolationId}`;
385
+ let pkceArgs = '';
386
+ if (!noPKCE) {
387
+ const cc = await __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getCodeChallenge).call(this, __classPrivateFieldGet(this, _PegaAuth_dynState, "f").codeVerifier);
388
+ pkceArgs = `&code_challenge=${cc}&code_challenge_method=S256`;
389
+ }
390
+ return `${authorizeUri}?client_id=${clientId}&response_type=code&redirect_uri=${redirectUri}&scope=${scope}&state=${__classPrivateFieldGet(this, _PegaAuth_dynState, "f").state}${pkceArgs}${moreAuthArgs}`;
391
+ }, _PegaAuth_authCodeStart =
392
+ // authCode login issues the authorize endpoint transaction and deals with redirects
393
+ async function _PegaAuth_authCodeStart() {
394
+ const fnGetRedirectUriOrigin = () => {
395
+ const redirectUri = __classPrivateFieldGet(this, _PegaAuth_config, "f").redirectUri;
396
+ const nRootOffset = redirectUri.indexOf('//');
397
+ const nFirstPathOffset = nRootOffset !== -1 ? redirectUri.indexOf('/', nRootOffset + 2) : -1;
398
+ return nFirstPathOffset !== -1 ? redirectUri.substring(0, nFirstPathOffset) : redirectUri;
399
+ };
400
+ const redirectOrigin = fnGetRedirectUriOrigin();
401
+ const state = this.isNode ? '' : btoa(window.location.origin);
402
+ return new Promise((resolve, reject) => {
403
+ let theUrl = null; // holds the crafted authorize url
404
+ let myWindow = null; // popup or iframe
405
+ let elIframe = null;
406
+ let elCloseBtn = null;
407
+ const iframeTimeout = __classPrivateFieldGet(this, _PegaAuth_config, "f").silentTimeout !== undefined ? __classPrivateFieldGet(this, _PegaAuth_config, "f").silentTimeout : 5000;
408
+ let bWinIframe = true;
409
+ let tmrAuthComplete = null;
410
+ let checkWindowClosed = null;
411
+ let bDisablePromptNone = false;
412
+ const myWinOnLoad = () => {
413
+ try {
414
+ if (bWinIframe) {
415
+ elIframe.contentWindow.postMessage({ type: 'PegaAuth' }, redirectOrigin);
416
+ }
417
+ else {
418
+ myWindow.postMessage({ type: 'PegaAuth' }, redirectOrigin);
419
+ }
420
+ }
421
+ catch (e) {
422
+ // Exception trying to postMessage on load (perhaps should console.warn)
423
+ }
424
+ };
425
+ const fnSetSilentAuthFailed = (bSet) => {
426
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed = bSet;
427
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
428
+ };
429
+ /* eslint-disable prefer-promise-reject-errors */
430
+ const fnOpenPopup = () => {
431
+ if (__classPrivateFieldGet(this, _PegaAuth_config, "f").noPopups) {
432
+ return reject('no-popups');
433
+ }
434
+ // Since displaying a visible window, clear the silent auth failed flag
435
+ fnSetSilentAuthFailed(false);
436
+ myWindow = (this.isNode ? this.open : window.open)(theUrl, '_blank', 'width=700,height=500,left=200,top=100');
437
+ if (!myWindow) {
438
+ // Blocked by popup-blocker
439
+ return reject('blocked');
440
+ }
441
+ checkWindowClosed = setInterval(() => {
442
+ if (myWindow.closed) {
443
+ clearInterval(checkWindowClosed);
444
+ reject('closed');
445
+ }
446
+ }, 500);
447
+ if (!this.isNode) {
448
+ try {
449
+ myWindow.addEventListener('load', myWinOnLoad, true);
450
+ }
451
+ catch (e) {
452
+ // Exception trying to add onload handler to opened window
453
+ // eslint-disable-next-line no-console
454
+ console.error(`Error adding event listener on popup window: ${e}`);
455
+ }
456
+ }
457
+ };
458
+ /* eslint-enable prefer-promise-reject-errors */
459
+ const fnCloseIframe = () => {
460
+ elIframe.parentNode.removeChild(elIframe);
461
+ elCloseBtn.parentNode.removeChild(elCloseBtn);
462
+ elIframe = null;
463
+ elCloseBtn = null;
464
+ bWinIframe = false;
465
+ };
466
+ const fnCloseAndReject = () => {
467
+ fnCloseIframe();
468
+ /* eslint-disable-next-line prefer-promise-reject-errors */
469
+ reject('closed');
470
+ };
471
+ const fnAuthMessageReceiver = (event) => {
472
+ // Check origin to make sure it is the redirect origin
473
+ if (event.origin !== redirectOrigin)
474
+ return;
475
+ if (!event.data || !event.data.type || event.data.type !== 'PegaAuth')
476
+ return;
477
+ const aArgs = ['code', 'state', 'error', 'errorDesc'];
478
+ const aValues = [];
479
+ for (let i = 0; i < aArgs.length; i += 1) {
480
+ const arg = aArgs[i];
481
+ aValues[arg] = event.data[arg] ? event.data[arg].toString() : null;
482
+ }
483
+ if (aValues.error || (aValues.code && aValues.state === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
484
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
485
+ fnGetTokenAndFinish(aValues.code, aValues.error, aValues.errorDesc);
486
+ }
487
+ };
488
+ const fnEnableMessageReceiver = (bEnable) => {
489
+ if (bEnable) {
490
+ window.addEventListener('message', fnAuthMessageReceiver, false);
491
+ window.authCodeCallback = (code, state1, error, errorDesc) => {
492
+ if (error || (code && state1 === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
493
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
494
+ fnGetTokenAndFinish(code, error, errorDesc);
495
+ }
496
+ };
497
+ }
498
+ else {
499
+ window.removeEventListener('message', fnAuthMessageReceiver, false);
500
+ delete window.authCodeCallback;
501
+ }
502
+ };
503
+ const doAuthorize = () => {
504
+ // If there is a userIdentifier and password specified or an external SSO auth service,
505
+ // we can try to use this silently in an iFrame first
506
+ bWinIframe =
507
+ !this.isNode &&
508
+ !__classPrivateFieldGet(this, _PegaAuth_config, "f").silentAuthFailed &&
509
+ iframeTimeout > 0 &&
510
+ ((!!__classPrivateFieldGet(this, _PegaAuth_config, "f").userIdentifier && !!__classPrivateFieldGet(this, _PegaAuth_config, "f").password) ||
511
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").iframeLoginUI ||
512
+ __classPrivateFieldGet(this, _PegaAuth_config, "f").authService !== 'pega');
513
+ // Enable message receiver
514
+ if (!this.isNode) {
515
+ fnEnableMessageReceiver(true);
516
+ }
517
+ if (bWinIframe) {
518
+ const nFrameZLevel = 99999;
519
+ elIframe = document.createElement('iframe');
520
+ elIframe.id = `pe${__classPrivateFieldGet(this, _PegaAuth_config, "f").clientId}`;
521
+ const loginBoxWidth = 500;
522
+ const loginBoxHeight = 700;
523
+ const oStyle = elIframe.style;
524
+ oStyle.position = 'absolute';
525
+ oStyle.display = 'none';
526
+ oStyle.zIndex = nFrameZLevel;
527
+ oStyle.top = `${Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2)}px`;
528
+ oStyle.left = `${Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2)}px`;
529
+ oStyle.width = '500px';
530
+ oStyle.height = '700px';
531
+ // Add Iframe to top of document DOM to have it load
532
+ document.body.insertBefore(elIframe, document.body.firstChild);
533
+ // document.getElementsByTagName('body')[0].appendChild(elIframe);
534
+ elIframe.addEventListener('load', myWinOnLoad, true);
535
+ // Disallow iframe content attempts to navigate main window
536
+ elIframe.setAttribute('sandbox', 'allow-scripts allow-forms allow-same-origin');
537
+ // Adding prompt=none as this is standard OIDC way to communicate no UI is expected (expecting Pega security to support this one day)
538
+ elIframe.setAttribute('src', bDisablePromptNone ? theUrl : `${theUrl}&prompt=none`);
539
+ const svgCloseBtn = `<?xml version="1.0" encoding="UTF-8"?>
540
+ <svg width="34px" height="34px" viewBox="0 0 34 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
541
+ <title>Dismiss - Black</title>
542
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
543
+ <g transform="translate(1.000000, 1.000000)">
544
+ <circle fill="#252C32" cx="16" cy="16" r="16"></circle>
545
+ <g transform="translate(9.109375, 9.214844)" fill="#FFFFFF" fill-rule="nonzero">
546
+ <path d="M12.7265625,0 L0,12.6210938 L1.0546875,13.5703125 L13.78125,1.0546875 L12.7265625,0 Z M13.7460938,12.5507812 L1.01953125,0 L0,1.01953125 L12.7617188,13.6054688 L13.7460938,12.5507812 Z"></path>
547
+ </g>
548
+ </g>
549
+ </g>
550
+ </svg>`;
551
+ const bCloseWithinFrame = false;
552
+ elCloseBtn = document.createElement('img');
553
+ elCloseBtn.onclick = fnCloseAndReject;
554
+ elCloseBtn.src = `data:image/svg+xml;base64,${btoa(svgCloseBtn)}`;
555
+ const oBtnStyle = elCloseBtn.style;
556
+ oBtnStyle.cursor = 'pointer';
557
+ // If svg doesn't set width and height might want to set oBtStyle width and height to something like '2em'
558
+ oBtnStyle.position = 'absolute';
559
+ oBtnStyle.display = 'none';
560
+ oBtnStyle.zIndex = nFrameZLevel + 1;
561
+ const nTopOffset = bCloseWithinFrame ? 5 : -10;
562
+ const nRightOffset = bCloseWithinFrame ? -34 : -20;
563
+ const nTop = Math.round(Math.max(window.innerHeight - loginBoxHeight, 0) / 2) + nTopOffset;
564
+ oBtnStyle.top = `${nTop}px`;
565
+ const nLeft = Math.round(Math.max(window.innerWidth - loginBoxWidth, 0) / 2) + loginBoxWidth + nRightOffset;
566
+ oBtnStyle.left = `${nLeft}px`;
567
+ document.body.insertBefore(elCloseBtn, document.body.firstChild);
568
+ // If the password was wrong, then the login screen will be in the iframe
569
+ // ..and with Pega without realization of US-372314 it may replace the top (main portal) window
570
+ // For now set a timer and if the timer expires, remove the iFrame and use same url within
571
+ // visible window
572
+ tmrAuthComplete = setTimeout(() => {
573
+ clearTimeout(tmrAuthComplete);
574
+ /*
575
+ // remove password from config
576
+ if (this.#config.password) {
577
+ delete this.#config.password;
578
+ this.#updateConfig();
579
+ }
580
+ */
581
+ // Display the iframe where the redirects did not succeed (or invoke a popup window)
582
+ if (__classPrivateFieldGet(this, _PegaAuth_config, "f").iframeLoginUI) {
583
+ elIframe.style.display = 'block';
584
+ elCloseBtn.style.display = 'block';
585
+ }
586
+ else {
587
+ fnCloseIframe();
588
+ fnOpenPopup();
589
+ }
590
+ }, iframeTimeout);
591
+ }
592
+ else {
593
+ if (this.isNode) {
594
+ // Determine port to listen to by extracting it from redirect uri
595
+ const { redirectUri, cert, key } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
596
+ const isHttp = redirectUri.startsWith('http:');
597
+ const nLocalhost = redirectUri.indexOf('localhost:');
598
+ const nSlash = redirectUri.indexOf('/', nLocalhost + 10);
599
+ const nPort = parseInt(redirectUri.substring(nLocalhost + 10, nSlash), 10);
600
+ if (nLocalhost !== -1) {
601
+ const options = key && cert && !isHttp
602
+ ? {
603
+ key: this.fs.readFileSync(key),
604
+ cert: this.fs.readFileSync(cert)
605
+ }
606
+ : {};
607
+ const server = (isHttp ? this.http : this.https).createServer(options, (req, res) => {
608
+ const { winTitle, winBodyHtml } = __classPrivateFieldGet(this, _PegaAuth_config, "f");
609
+ res.writeHead(200, { 'Content-Type': 'text/html' });
610
+ // Auto closing window for now. Can always leave it up and allow authConfig props to set title and bodyHtml
611
+ res.end(`<html><head><title>${winTitle}</title><script>window.close();</script></head><body>${winBodyHtml}</body></html>`);
612
+ const queryString = req.url.split('?')[1];
613
+ const urlParams = new URLSearchParams(queryString);
614
+ const code = urlParams.get('code');
615
+ const state1 = urlParams.get('state');
616
+ const error = urlParams.get('error');
617
+ const errorDesc = urlParams.get('error_description');
618
+ if (error || (code && state1 === __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state)) {
619
+ // Stop receiving connections and close when all are handled.
620
+ server.close();
621
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
622
+ fnGetTokenAndFinish(code, error, errorDesc);
623
+ }
624
+ });
625
+ /* eslint-enable no-undef */
626
+ server.listen(nPort);
627
+ }
628
+ }
629
+ fnOpenPopup();
630
+ }
631
+ };
632
+ /* Retrieve token(s) and close login window */
633
+ const fnGetTokenAndFinish = (code, error, errorDesc) => {
634
+ // Can clear state in session info at this point
635
+ delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").state;
636
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
637
+ if (!this.isNode) {
638
+ fnEnableMessageReceiver(false);
639
+ if (bWinIframe) {
640
+ clearTimeout(tmrAuthComplete);
641
+ fnCloseIframe();
642
+ }
643
+ else {
644
+ clearInterval(checkWindowClosed);
645
+ myWindow.close();
646
+ }
647
+ }
648
+ if (code) {
649
+ this.getToken(code)
650
+ .then((token) => {
651
+ resolve(token);
652
+ })
653
+ .catch((e) => {
654
+ reject(e);
655
+ });
656
+ }
657
+ else if (error) {
658
+ // Handle some errors in a special manner and pass others back to client
659
+ if (error === 'login_required') {
660
+ // eslint-disable-next-line no-console
661
+ console.warn('silent authentication failed...starting full authentication');
662
+ const bSpecialDebugPath = false;
663
+ if (bSpecialDebugPath) {
664
+ fnSetSilentAuthFailed(false);
665
+ bDisablePromptNone = true;
666
+ }
667
+ else {
668
+ fnSetSilentAuthFailed(true);
669
+ bDisablePromptNone = false;
670
+ }
671
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
672
+ theUrl = url;
673
+ doAuthorize();
674
+ });
675
+ }
676
+ else if (error === 'invalid_session_index') {
677
+ // eslint-disable-next-line no-console
678
+ console.warn('auth session no longer valid...starting new session');
679
+ // In these scenarios, not much user can do without just starting a new session, so do that
680
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateSessionIndex).call(this, null);
681
+ fnSetSilentAuthFailed(false);
682
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
683
+ theUrl = url;
684
+ doAuthorize();
685
+ });
686
+ }
687
+ else {
688
+ // eslint-disable-next-line no-console
689
+ console.warn(`Authorize failed: ${error}. ${errorDesc}\nFailing authorize url: ${theUrl}`);
690
+ throw new Error(error, { cause: errorDesc });
691
+ }
692
+ }
693
+ };
694
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_buildAuthorizeUrl).call(this, state).then((url) => {
695
+ theUrl = url;
696
+ doAuthorize();
697
+ });
420
698
  });
699
+ }, _PegaAuth_updateSessionIndex = function _PegaAuth_updateSessionIndex(sessionIndex) {
700
+ if (sessionIndex) {
701
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex = sessionIndex;
702
+ __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndexAttempts = 0;
703
+ }
704
+ else if (__classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex) {
705
+ delete __classPrivateFieldGet(this, _PegaAuth_dynState, "f").sessionIndex;
706
+ }
707
+ __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_updateConfig).call(this);
421
708
  }, _PegaAuth_sha256Hash = function _PegaAuth_sha256Hash(str) {
422
- return window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(str));
709
+ // Found that the Node implementation of subtle.digest is yielding incorrect results
710
+ // so using a different set of apis to get expected results.
711
+ if (this.isNode) {
712
+ return new Promise((resolve) => {
713
+ resolve(this.crypto.createHash('sha256').update(str).digest());
714
+ });
715
+ }
716
+ return this.subtle.digest('SHA-256', new TextEncoder().encode(str));
423
717
  }, _PegaAuth_encode64 = function _PegaAuth_encode64(buff) {
424
- return window.btoa(new Uint8Array(buff).reduce((s, b) => s + String.fromCharCode(b), ''));
718
+ return btoa(new Uint8Array(buff).reduce((s, b) => s + String.fromCharCode(b), ''));
425
719
  }, _PegaAuth_base64UrlSafeEncode = function _PegaAuth_base64UrlSafeEncode(buf) {
426
- const s = __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_encode64).call(this, buf).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
427
- return s;
428
- }, _PegaAuth_getCodeChallenge = function _PegaAuth_getCodeChallenge(code_verifier) {
429
- return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_sha256Hash).call(this, code_verifier).then((hashed) => {
720
+ return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_encode64).call(this, buf).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
721
+ }, _PegaAuth_getRandomString = function _PegaAuth_getRandomString(nSize) {
722
+ const buf = new Uint8Array(nSize);
723
+ this.crypto.getRandomValues(buf);
724
+ return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, buf);
725
+ }, _PegaAuth_getCodeChallenge =
726
+ /* Calc code verifier if necessary
727
+ */
728
+ /* eslint-disable camelcase */
729
+ async function _PegaAuth_getCodeChallenge(code_verifier) {
730
+ return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_sha256Hash).call(this, code_verifier)
731
+ .then((hashed) => {
430
732
  return __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_base64UrlSafeEncode).call(this, hashed);
431
- }).catch((error) => {
733
+ })
734
+ .catch((error) => {
432
735
  // eslint-disable-next-line no-console
433
- console.log(error);
434
- }).finally(() => { return null; });
736
+ console.error(`Error calculation code challenge for PKCE: ${error}`);
737
+ })
738
+ .finally(() => {
739
+ return null;
740
+ });
741
+ }, _PegaAuth_getAgent = function _PegaAuth_getAgent() {
742
+ if (this.isNode && __classPrivateFieldGet(this, _PegaAuth_config, "f").ignoreInvalidCerts) {
743
+ const options = { rejectUnauthorized: false };
744
+ if (__classPrivateFieldGet(this, _PegaAuth_config, "f").legacyTLS) {
745
+ options.secureOptions = this.crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT;
746
+ }
747
+ return new this.https.Agent(options);
748
+ }
749
+ return undefined;
435
750
  };
436
751
  export default PegaAuth;
437
752
  //# sourceMappingURL=auth.js.map