@pega/react-sdk-components 0.23.26 → 8.23.11

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 (259) 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 +13 -0
  13. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts.map +1 -0
  14. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +26 -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/FieldGroupList/FieldGroupList.d.ts.map +1 -1
  21. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +1 -1
  22. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
  23. package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
  24. package/lib/components/designSystemExtension/Operator/Operator.js +12 -10
  25. package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
  26. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +2 -2
  27. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
  28. package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
  29. package/lib/components/field/CancelAlert/CancelAlert.js +9 -7
  30. package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
  31. package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
  32. package/lib/components/field/Checkbox/Checkbox.js +3 -3
  33. package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
  34. package/lib/components/field/Currency/currency-utils.d.ts +1 -1
  35. package/lib/components/field/Currency/currency-utils.d.ts.map +1 -1
  36. package/lib/components/field/Currency/currency-utils.js.map +1 -1
  37. package/lib/components/field/Date/Date.d.ts.map +1 -1
  38. package/lib/components/field/Date/Date.js +11 -5
  39. package/lib/components/field/Date/Date.js.map +1 -1
  40. package/lib/components/field/DateTime/DateTime.js +1 -1
  41. package/lib/components/field/DateTime/DateTime.js.map +1 -1
  42. package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
  43. package/lib/components/field/Decimal/Decimal.js +41 -8
  44. package/lib/components/field/Decimal/Decimal.js.map +1 -1
  45. package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
  46. package/lib/components/field/Dropdown/Dropdown.js +21 -7
  47. package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
  48. package/lib/components/field/Phone/Phone.d.ts.map +1 -1
  49. package/lib/components/field/Phone/Phone.js +2 -1
  50. package/lib/components/field/Phone/Phone.js.map +1 -1
  51. package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
  52. package/lib/components/field/RadioButtons/RadioButtons.js +17 -4
  53. package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
  54. package/lib/components/field/SemanticLink/utils.d.ts.map +1 -1
  55. package/lib/components/field/SemanticLink/utils.js.map +1 -1
  56. package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
  57. package/lib/components/field/TextInput/TextInput.js +20 -3
  58. package/lib/components/field/TextInput/TextInput.js.map +1 -1
  59. package/lib/components/field/Time/Time.d.ts.map +1 -1
  60. package/lib/components/field/Time/Time.js +6 -2
  61. package/lib/components/field/Time/Time.js.map +1 -1
  62. package/lib/components/field/URL/URL.d.ts.map +1 -1
  63. package/lib/components/field/URL/URL.js +6 -2
  64. package/lib/components/field/URL/URL.js.map +1 -1
  65. package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
  66. package/lib/components/field/UserReference/UserReference.js.map +1 -1
  67. package/lib/components/helpers/attachmentHelpers.d.ts +5 -5
  68. package/lib/components/helpers/attachmentHelpers.d.ts.map +1 -1
  69. package/lib/components/helpers/attachmentHelpers.js +2 -2
  70. package/lib/components/helpers/attachmentHelpers.js.map +1 -1
  71. package/lib/components/helpers/authManager.d.ts.map +1 -1
  72. package/lib/components/helpers/authManager.js +15 -12
  73. package/lib/components/helpers/authManager.js.map +1 -1
  74. package/lib/components/helpers/case-utils.d.ts +20 -0
  75. package/lib/components/helpers/case-utils.d.ts.map +1 -0
  76. package/lib/components/helpers/case-utils.js +81 -0
  77. package/lib/components/helpers/case-utils.js.map +1 -0
  78. package/lib/components/helpers/common-utils.d.ts +2 -0
  79. package/lib/components/helpers/common-utils.d.ts.map +1 -0
  80. package/lib/components/helpers/common-utils.js +5 -0
  81. package/lib/components/helpers/common-utils.js.map +1 -0
  82. package/lib/components/helpers/config_access.d.ts.map +1 -1
  83. package/lib/components/helpers/config_access.js +75 -82
  84. package/lib/components/helpers/config_access.js.map +1 -1
  85. package/lib/components/helpers/data_page.d.ts.map +1 -1
  86. package/lib/components/helpers/data_page.js.map +1 -1
  87. package/lib/components/helpers/date-format-utils.d.ts.map +1 -1
  88. package/lib/components/helpers/date-format-utils.js +23 -14
  89. package/lib/components/helpers/date-format-utils.js.map +1 -1
  90. package/lib/components/helpers/event-utils.d.ts +1 -1
  91. package/lib/components/helpers/event-utils.d.ts.map +1 -1
  92. package/lib/components/helpers/event-utils.js.map +1 -1
  93. package/lib/components/helpers/field-group-utils.d.ts +15 -2
  94. package/lib/components/helpers/field-group-utils.d.ts.map +1 -1
  95. package/lib/components/helpers/field-group-utils.js +3 -3
  96. package/lib/components/helpers/field-group-utils.js.map +1 -1
  97. package/lib/components/helpers/formatters/Boolean.d.ts +3 -3
  98. package/lib/components/helpers/formatters/Boolean.d.ts.map +1 -1
  99. package/lib/components/helpers/formatters/Boolean.js.map +1 -1
  100. package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
  101. package/lib/components/helpers/formatters/Currency.js +4 -3
  102. package/lib/components/helpers/formatters/Currency.js.map +1 -1
  103. package/lib/components/helpers/formatters/CurrencyMap.d.ts +1132 -1399
  104. package/lib/components/helpers/formatters/CurrencyMap.d.ts.map +1 -1
  105. package/lib/components/helpers/formatters/CurrencyMap.js.map +1 -1
  106. package/lib/components/helpers/formatters/Date.d.ts.map +1 -1
  107. package/lib/components/helpers/formatters/Date.js +1 -1
  108. package/lib/components/helpers/formatters/Date.js.map +1 -1
  109. package/lib/components/helpers/formatters/common.d.ts +2 -2
  110. package/lib/components/helpers/formatters/common.d.ts.map +1 -1
  111. package/lib/components/helpers/formatters/common.js +4 -5
  112. package/lib/components/helpers/formatters/common.js.map +1 -1
  113. package/lib/components/helpers/formatters/index.d.ts +1 -1
  114. package/lib/components/helpers/formatters/index.d.ts.map +1 -1
  115. package/lib/components/helpers/formatters/index.js.map +1 -1
  116. package/lib/components/helpers/reactContextHelpers.d.ts +3 -2
  117. package/lib/components/helpers/reactContextHelpers.d.ts.map +1 -1
  118. package/lib/components/helpers/reactContextHelpers.js.map +1 -1
  119. package/lib/components/helpers/simpleTableHelpers.d.ts +2 -2
  120. package/lib/components/helpers/simpleTableHelpers.d.ts.map +1 -1
  121. package/lib/components/helpers/simpleTableHelpers.js +5 -2
  122. package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
  123. package/lib/components/helpers/state-utils.d.ts +4 -0
  124. package/lib/components/helpers/state-utils.d.ts.map +1 -0
  125. package/lib/components/helpers/state-utils.js +36 -0
  126. package/lib/components/helpers/state-utils.js.map +1 -0
  127. package/lib/components/helpers/template-utils.d.ts.map +1 -1
  128. package/lib/components/helpers/template-utils.js +0 -1
  129. package/lib/components/helpers/template-utils.js.map +1 -1
  130. package/lib/components/helpers/utils.d.ts +1 -1
  131. package/lib/components/helpers/utils.d.ts.map +1 -1
  132. package/lib/components/helpers/utils.js +9 -3
  133. package/lib/components/helpers/utils.js.map +1 -1
  134. package/lib/components/helpers/versionHelpers.d.ts +0 -6
  135. package/lib/components/helpers/versionHelpers.d.ts.map +1 -1
  136. package/lib/components/helpers/versionHelpers.js +0 -6
  137. package/lib/components/helpers/versionHelpers.js.map +1 -1
  138. package/lib/components/infra/ActionButtons/ActionButtons.d.ts.map +1 -1
  139. package/lib/components/infra/ActionButtons/ActionButtons.js +4 -2
  140. package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
  141. package/lib/components/infra/Assignment/Assignment.d.ts +1 -0
  142. package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
  143. package/lib/components/infra/Assignment/Assignment.js +27 -15
  144. package/lib/components/infra/Assignment/Assignment.js.map +1 -1
  145. package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
  146. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +17 -9
  147. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
  148. package/lib/components/infra/Containers/FlowContainer/helpers.d.ts +12 -12
  149. package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
  150. package/lib/components/infra/Containers/FlowContainer/helpers.js +17 -16
  151. package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
  152. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
  153. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +17 -8
  154. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
  155. package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts.map +1 -1
  156. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +4 -2
  157. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
  158. package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
  159. package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
  160. package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
  161. package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
  162. package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
  163. package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
  164. package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
  165. package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +7 -4
  166. package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
  167. package/lib/components/infra/MultiStep/MultiStep.js +2 -2
  168. package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
  169. package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
  170. package/lib/components/infra/NavBar/NavBar.js +6 -4
  171. package/lib/components/infra/NavBar/NavBar.js.map +1 -1
  172. package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
  173. package/lib/components/infra/RootContainer/RootContainer.js +12 -15
  174. package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
  175. package/lib/components/infra/Stages/Stages.d.ts.map +1 -1
  176. package/lib/components/infra/Stages/Stages.js +2 -1
  177. package/lib/components/infra/Stages/Stages.js.map +1 -1
  178. package/lib/components/infra/View/View.d.ts +1 -1
  179. package/lib/components/infra/View/View.d.ts.map +1 -1
  180. package/lib/components/infra/View/View.js +6 -34
  181. package/lib/components/infra/View/View.js.map +1 -1
  182. package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
  183. package/lib/components/template/AppShell/AppShell.js +8 -8
  184. package/lib/components/template/AppShell/AppShell.js.map +1 -1
  185. package/lib/components/template/CaseView/CaseView.d.ts +1 -1
  186. package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
  187. package/lib/components/template/CaseView/CaseView.js +37 -28
  188. package/lib/components/template/CaseView/CaseView.js.map +1 -1
  189. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts +3 -1
  190. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts.map +1 -1
  191. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +13 -8
  192. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
  193. package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
  194. package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
  195. package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
  196. package/lib/components/template/DataReference/DataReference.js.map +1 -1
  197. package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
  198. package/lib/components/template/DefaultForm/DefaultForm.js +9 -5
  199. package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
  200. package/lib/components/template/DefaultForm/utils/index.d.ts +3 -0
  201. package/lib/components/template/DefaultForm/utils/index.d.ts.map +1 -0
  202. package/lib/components/template/DefaultForm/utils/index.js +27 -0
  203. package/lib/components/template/DefaultForm/utils/index.js.map +1 -0
  204. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
  205. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +1 -1
  206. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
  207. package/lib/components/template/ListView/DefaultViewMeta.d.ts +1 -90
  208. package/lib/components/template/ListView/DefaultViewMeta.d.ts.map +1 -1
  209. package/lib/components/template/ListView/DefaultViewMeta.js.map +1 -1
  210. package/lib/components/template/ListView/ListView.d.ts.map +1 -1
  211. package/lib/components/template/ListView/ListView.js +1 -1
  212. package/lib/components/template/ListView/ListView.js.map +1 -1
  213. package/lib/components/template/ListView/hooks.d.ts.map +1 -1
  214. package/lib/components/template/ListView/hooks.js +0 -1
  215. package/lib/components/template/ListView/hooks.js.map +1 -1
  216. package/lib/components/template/ListView/utils.d.ts +28 -16
  217. package/lib/components/template/ListView/utils.d.ts.map +1 -1
  218. package/lib/components/template/ListView/utils.js +1 -2
  219. package/lib/components/template/ListView/utils.js.map +1 -1
  220. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts.map +1 -1
  221. package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js.map +1 -1
  222. package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
  223. package/lib/components/template/PromotedFilters/PromotedFilters.js +2 -2
  224. package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
  225. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
  226. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
  227. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
  228. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +3 -3
  229. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
  230. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
  231. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
  232. package/lib/components/template/SubTabs/tabUtils.d.ts.map +1 -1
  233. package/lib/components/template/SubTabs/tabUtils.js.map +1 -1
  234. package/lib/components/template/WssNavBar/WssNavBar.js +2 -2
  235. package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
  236. package/lib/components/widget/Attachment/Attachment.css +15 -3
  237. package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
  238. package/lib/components/widget/Attachment/Attachment.js +29 -25
  239. package/lib/components/widget/Attachment/Attachment.js.map +1 -1
  240. package/lib/components/widget/CaseHistory/CaseHistory.js +3 -3
  241. package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
  242. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
  243. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +17 -17
  244. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
  245. package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
  246. package/lib/components/widget/QuickCreate/QuickCreate.js +2 -2
  247. package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
  248. package/lib/components/widget/SummaryItem/SummaryItem.d.ts.map +1 -1
  249. package/lib/components/widget/SummaryItem/SummaryItem.js +2 -2
  250. package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
  251. package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
  252. package/lib/components/widget/ToDo/ToDo.js +10 -6
  253. package/lib/components/widget/ToDo/ToDo.js.map +1 -1
  254. package/lib/components_map.d.ts +3 -3
  255. package/lib/components_map.d.ts.map +1 -1
  256. package/lib/components_map.js +819 -818
  257. package/lib/components_map.js.map +1 -1
  258. package/lib/doc/KeyReleaseUpdates.md +44 -9
  259. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"authManager.js","sourceRoot":"","sources":["../../../src/components/helpers/authManager.js"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAE9B,qDAAqD;AACrD,MAAM,CAAC,IAAI,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AACnE,qDAAqD;AACrD,MAAM,CAAC,IAAI,iBAAiB,GAAG,cAAc,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;AACjF,2CAA2C;AAE3C,mCAAmC;AACnC,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB,uHAAuH;AACvH,IAAI,wBAAwB,GAAG,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GAAG,CAAC,UAAU,EAAE,EAAE;IAC7C,kEAAkE;IAClE,IAAI,UAAU,EAAG;QACf,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC9C,yEAAyE;QACzE,IAAI,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,sBAAsB,EAAG;YACxD,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;SAChE;KACF;SAAM;QACL,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;KACtC;IACD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,uHAAuH;IACvH,qEAAqE;IACrE,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC/E,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// This file wraps various calls related to logging in, logging out, etc.\n// that use the auth.html/auth.js to do the work of logging in via OAuth 2.0.\n\nimport { getSdkConfig, SdkConfigAccess } from './config_access';\nimport PegaAuth from './auth';\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let gbLoggedIn = sessionStorage.getItem('rsdk_AH') !== null;\n// eslint-disable-next-line import/no-mutable-exports\nexport let gbLoginInProgress = sessionStorage.getItem(\"rsdk_loggingIn\") !== null;\n// other sessionStorage items: rsdk_appName\n\n// will store the PegaAuth instance\nlet authMgr = null;\n// Since this variable is loaded in a separate instance in the popup scenario, use storage to coordinate across the two\nlet usePopupForRestOfSession = sessionStorage.getItem(\"rsdk_popup\") === \"1\";\nlet gbC11NBootstrapInProgress = false;\n// Some non Pega OAuth 2.0 Authentication in use (Basic or Custom for service package)\nlet gbCustomAuth = false;\n\n/*\n * Set to use popup experience for rest of session\n */\nconst forcePopupForReauths = ( bForce ) => {\n if( bForce ) {\n sessionStorage.setItem(\"rsdk_popup\", \"1\");\n usePopupForRestOfSession = true;\n } else {\n sessionStorage.removeItem(\"rsdk_popup\");\n usePopupForRestOfSession = false;\n }\n};\n\nconst setNoInitialRedirect = (bNoInitialRedirect ) => {\n if( bNoInitialRedirect ) {\n forcePopupForReauths(true);\n sessionStorage.setItem(\"rsdk_noRedirect\", \"1\");\n } else {\n sessionStorage.removeItem(\"rsdk_noRedirect\");\n }\n};\n\nconst isLoginExpired = () => {\n let bExpired = true;\n const sLoginStart = sessionStorage.getItem(\"rsdk_loggingIn\");\n if( sLoginStart !== null ) {\n const currTime = Date.now();\n bExpired = currTime - parseInt(sLoginStart, 10) > 60000;\n }\n return bExpired;\n};\n\n/**\n * Clean up any web storage allocated for the user session.\n */\nconst clearAuthMgr = (bFullReauth=false) => {\n // Remove any local storage for the user\n if( !gbCustomAuth ) {\n sessionStorage.removeItem('rsdk_AH');\n }\n if( !bFullReauth ) {\n sessionStorage.removeItem(\"rsdk_CI\");\n }\n sessionStorage.removeItem(\"rsdk_TI\");\n sessionStorage.removeItem(\"rsdk_UI\");\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n gbLoggedIn = false;\n gbLoginInProgress = false;\n forcePopupForReauths(bFullReauth);\n // Not removing the authMgr structure itself...as it can be leveraged on next login\n};\n\nexport const authNoRedirect = () => {\n return sessionStorage.getItem(\"rsdk_noRedirect\") === \"1\";\n};\n\n/**\n * Initialize OAuth config structure members and create authMgr instance\n * bInit - governs whether to create new sessionStorage or load existing one\n */\nconst initOAuth = (bInit) => {\n return getSdkConfig().then( sdkConfig => {\n const sdkConfigAuth = sdkConfig.authConfig;\n const sdkConfigServer = sdkConfig.serverConfig;\n let pegaUrl = sdkConfigServer.infinityRestServerUrl;\n const bNoInitialRedirect = authNoRedirect();\n\n // Construct default OAuth endpoints (if not explicitly specified)\n if (pegaUrl) {\n // Cope with trailing slash being present\n if (!pegaUrl.endsWith('/')) {\n pegaUrl += '/';\n }\n if (!sdkConfigAuth.authorize) {\n sdkConfigAuth.authorize = `${pegaUrl}PRRestService/oauth2/v1/authorize`;\n }\n if (!sdkConfigAuth.token) {\n sdkConfigAuth.token = `${pegaUrl}PRRestService/oauth2/v1/token`;\n }\n if (!sdkConfigAuth.revoke) {\n sdkConfigAuth.revoke = `${pegaUrl}PRRestService/oauth2/v1/revoke`;\n }\n if( !sdkConfigAuth.redirectUri ) {\n sdkConfigAuth.redirectUri = `${window.location.origin}${window.location.pathname}`;\n }\n if (!sdkConfigAuth.userinfo) {\n const appAliasSeg = sdkConfigServer.appAlias ? `app/${sdkConfigServer.appAlias}/` : '';\n sdkConfigAuth.userinfo = `${pegaUrl}${appAliasSeg}api/oauthclients/v1/userinfo/JSON`;\n }\n }\n // Auth service alias\n if( !sdkConfigAuth.authService) {\n sdkConfigAuth.authService = \"pega\";\n }\n\n // Construct path to auth.html (used for case when not doing a main window redirect)\n let sNoMainRedirectUri=sdkConfigAuth.redirectUri;\n const nLastPathSep = sNoMainRedirectUri.lastIndexOf(\"/\");\n sNoMainRedirectUri = nLastPathSep !== -1 ? `${sNoMainRedirectUri.substring(0,nLastPathSep+1)}auth.html` : `${sNoMainRedirectUri}/auth.html`;\n\n const authConfig = {\n clientId: bNoInitialRedirect ? sdkConfigAuth.mashupClientId : sdkConfigAuth.portalClientId,\n authorizeUri: sdkConfigAuth.authorize,\n tokenUri: sdkConfigAuth.token,\n revokeUri: sdkConfigAuth.revoke,\n userinfoUri: sdkConfigAuth.userinfo,\n redirectUri: bNoInitialRedirect || usePopupForRestOfSession\n ? sNoMainRedirectUri\n : sdkConfigAuth.redirectUri,\n authService: sdkConfigAuth.authService,\n appAlias: sdkConfigServer.appAlias || '',\n useLocking: true\n };\n // If no clientId is specified assume not OAuth but custom auth\n if( !authConfig.clientId ) {\n gbCustomAuth = true;\n return;\n }\n if( 'silentTimeout' in sdkConfigAuth ) {\n authConfig.silentTimeout = sdkConfigAuth.silentTimeout;\n }\n if( bNoInitialRedirect ) {\n authConfig.userIdentifier = sdkConfigAuth.mashupUserIdentifier;\n authConfig.password = sdkConfigAuth.mashupPassword;\n }\n if( 'iframeLoginUI' in sdkConfigAuth ){\n authConfig.iframeLoginUI = sdkConfigAuth.iframeLoginUI.toString().toLowerCase() === 'true';\n }\n\n // Check if sessionStorage exists (and if so if for same authorize endpoint). Otherwise, assume\n // sessionStorage is out of date (user just edited endpoints). Else, logout required to clear\n // sessionStorage and get other endpoints updates.\n // Doing this as sessionIndex might have been added to this storage structure\n let sSI = sessionStorage.getItem(\"rsdk_CI\");\n if( sSI ) {\n try {\n const oSI = JSON.parse(sSI);\n if( oSI.authorizeUri !== authConfig.authorizeUri ||\n oSI.appAlias !== authConfig.appAlias ||\n oSI.clientId !== authConfig.clientId ||\n oSI.userIdentifier !== authConfig.userIdentifier ||\n oSI.password !== authConfig.password) {\n clearAuthMgr();\n sSI = null;\n }\n } catch(e) {\n // do nothing\n }\n }\n\n if( !sSI || bInit ) {\n sessionStorage.setItem('rsdk_CI', JSON.stringify(authConfig));\n }\n authMgr = new PegaAuth('rsdk_CI');\n });\n};\n\nconst getAuthMgr = ( bInit ) => {\n return new Promise( (resolve) => {\n let idNextCheck = null;\n const fnCheckForAuthMgr = () => {\n if( PegaAuth && !authMgr ) {\n initOAuth( bInit );\n }\n if(authMgr) {\n if( idNextCheck ) {\n clearInterval(idNextCheck);\n }\n return resolve(authMgr);\n }\n }\n fnCheckForAuthMgr();\n idNextCheck = setInterval(fnCheckForAuthMgr, 10);\n });\n};\n\nexport const sdkGetAuthHeader = () => {\n return sessionStorage.getItem(\"rsdk_AH\");\n};\n\n/**\n * Initiate the process to get the Constellation bootstrap shell loaded and initialized\n * @param {Object} authConfig\n * @param {Object} tokenInfo\n * @param {Function} authTokenUpdated - callback invoked when Constellation JS Engine silently updates\n * an expired access_token\n * @param {Function} fnReauth - callback invoked when a full or custom reauth is needed\n */\nconst constellationInit = (authConfig, tokenInfo, authTokenUpdated, fnReauth) => {\n const constellationBootConfig = {};\n const sdkConfigServer = SdkConfigAccess.getSdkConfigServer();\n\n // Set up constellationConfig with data that bootstrapWithAuthHeader expects\n constellationBootConfig.customRendering = true;\n constellationBootConfig.restServerUrl = sdkConfigServer.infinityRestServerUrl;\n // NOTE: Needs a trailing slash! So add one if not provided\n if( !sdkConfigServer.sdkContentServerUrl.endsWith('/') ) {\n sdkConfigServer.sdkContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}/`;\n }\n constellationBootConfig.staticContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}constellation/`;\n if( !constellationBootConfig.staticContentServerUrl.endsWith('/') ) {\n constellationBootConfig.staticContentServerUrl = `${constellationBootConfig.staticContentServerUrl}/`;\n }\n // If appAlias specified, use it\n if( sdkConfigServer.appAlias ) {\n constellationBootConfig.appAlias = sdkConfigServer.appAlias;\n }\n\n if( tokenInfo ) {\n // Pass in auth info to Constellation\n constellationBootConfig.authInfo = {\n authType: \"OAuth2.0\",\n tokenInfo,\n // Set whether we want constellation to try to do a full re-Auth or not ()\n // true doesn't seem to be working in SDK scenario so always passing false for now\n popupReauth: false /* !authNoRedirect() */,\n client_id: authConfig.clientId,\n authentication_service: authConfig.authService,\n redirect_uri: authConfig.redirectUri,\n endPoints: {\n authorize: authConfig.authorizeUri,\n token: authConfig.tokenUri,\n revoke: authConfig.revokeUri\n },\n // TODO: setup callback so we can update own storage\n onTokenRetrieval: authTokenUpdated\n }\n } else {\n constellationBootConfig.authorizationHeader = sdkGetAuthHeader();\n }\n\n\n // Turn off dynamic load components (should be able to do it here instead of after load?)\n constellationBootConfig.dynamicLoadComponents = false;\n\n if( gbC11NBootstrapInProgress ) {\n return;\n } else {\n gbC11NBootstrapInProgress = true;\n }\n\n // Note that staticContentServerUrl already ends with a slash (see above), so no slash added.\n // In order to have this import succeed and to have it done with the webpackIgnore magic comment tag.\n // See: https://webpack.js.org/api/module-methods/\n import(/* webpackIgnore: true */ `${constellationBootConfig.staticContentServerUrl}bootstrap-shell.js`).then((bootstrapShell) => {\n // NOTE: once this callback is done, we lose the ability to access loadMashup.\n // So, create a reference to it\n window.myLoadMashup = bootstrapShell.loadMashup;\n window.myLoadPortal = bootstrapShell.loadPortal;\n window.myLoadDefaultPortal = bootstrapShell.loadDefaultPortal;\n\n bootstrapShell.bootstrapWithAuthHeader(constellationBootConfig, 'shell').then(() => {\n // eslint-disable-next-line no-console\n console.log('Bootstrap successful!');\n gbC11NBootstrapInProgress = false;\n\n // Setup listener for the reauth event\n if( tokenInfo ) {\n // eslint-disable-next-line no-undef\n PCore.getPubSubUtils().subscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_FULL_REAUTH, fnReauth, \"authFullReauth\");\n } else {\n // customReauth event introduced with 8.8\n // eslint-disable-next-line no-undef\n const sEvent = PCore.getConstants().PUB_SUB_EVENTS.EVENT_CUSTOM_REAUTH;\n if( sEvent ) {\n // eslint-disable-next-line no-undef\n PCore.getPubSubUtils().subscribe(sEvent, fnReauth, \"doReauth\");\n }\n }\n\n // Fire SdkConstellationReady event so bridge and app route can do expected post PCore initializations\n const event = new CustomEvent('SdkConstellationReady', {});\n document.dispatchEvent(event);\n })\n .catch( e => {\n // Assume error caught is because token is not valid and attempt a full reauth\n // eslint-disable-next-line no-console\n console.error(`Constellation JS Engine bootstrap failed. ${e}`);\n gbC11NBootstrapInProgress = false;\n fnReauth();\n })\n });\n /* Ends here */\n};\n\nexport const updateLoginStatus = () => {\n const sAuthHdr = sdkGetAuthHeader();\n gbLoggedIn = sAuthHdr && sAuthHdr.length > 0;\n};\n\nconst getCurrentTokens = () => {\n let tokens = null;\n const sTI = sessionStorage.getItem('rsdk_TI');\n if(sTI) {\n try {\n tokens = JSON.parse(sTI);\n } catch(e) {\n tokens = null;\n }\n }\n return tokens;\n};\n\nconst fireTokenAvailable = (token, bLoadC11N=true) => {\n if( !token ) {\n // This is used on page reload to load the token from sessionStorage and carry on\n token = getCurrentTokens();\n if( !token ) {\n return;\n }\n }\n\n sessionStorage.setItem('rsdk_AH', `${token.token_type} ${token.access_token}`);\n updateLoginStatus();\n\n // gbLoggedIn is getting updated in updateLoginStatus\n gbLoggedIn = true;\n gbLoginInProgress = false;\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n forcePopupForReauths(true);\n\n const sSI = sessionStorage.getItem(\"rsdk_CI\");\n let authConfig = null;\n if( sSI ) {\n try {\n authConfig = JSON.parse(sSI);\n } catch(e) {\n // do nothing\n }\n }\n\n if( !window.PCore && bLoadC11N ) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n constellationInit( authConfig, token, authTokenUpdated, authFullReauth );\n }\n\n/*\n // Create and dispatch the SdkLoggedIn event to trigger constellationInit\n const event = new CustomEvent('SdkLoggedIn', { detail: { authConfig, tokenInfo: token } });\n document.dispatchEvent(event);\n */\n};\n\nconst processTokenOnLogin = ( token, bLoadC11N=true ) => {\n sessionStorage.setItem(\"rsdk_TI\", JSON.stringify(token));\n if( window.PCore ) {\n window.PCore.getAuthUtils().setTokens(token);\n } else {\n fireTokenAvailable(token, bLoadC11N);\n }\n};\n\nconst updateRedirectUri = (aMgr, sRedirectUri) => {\n const sSI = sessionStorage.getItem(\"rsdk_CI\");\n let authConfig = null;\n if( sSI ) {\n try {\n authConfig = JSON.parse(sSI);\n } catch(e) {\n // do nothing\n }\n }\n authConfig.redirectUri = sRedirectUri;\n sessionStorage.setItem(\"rsdk_CI\", JSON.stringify(authConfig));\n aMgr.reloadConfig();\n};\n\n\n// TODO: Cope with 401 and refresh token if possible (or just hope that it succeeds during login)\n/**\n * Retrieve UserInfo for current authentication service\n */\n export const getUserInfo = (bUseSS=true) => {\n const ssUserInfo = sessionStorage.getItem(\"rsdk_UI\");\n let userInfo = null;\n if( bUseSS && ssUserInfo ) {\n try {\n userInfo = JSON.parse(ssUserInfo);\n return Promise.resolve(userInfo);\n } catch(e) {\n // do nothing\n }\n }\n getAuthMgr(false).then( (aMgr) => {\n const tokenInfo = getCurrentTokens();\n return aMgr.getUserinfo(tokenInfo.access_token).then( data => {\n userInfo = data;\n if( userInfo ) {\n sessionStorage.setItem(\"rsdk_UI\", JSON.stringify(userInfo));\n } else {\n sessionStorage.removeItem(\"rsdk_UI\");\n }\n return Promise.resolve(userInfo);\n });\n });\n\n};\n\nexport const login = (bFullReauth=false) => {\n\n if( gbCustomAuth ) return;\n\n gbLoginInProgress = true;\n // Needed so a redirect to login screen and back will know we are still in process of logging in\n sessionStorage.setItem(\"rsdk_loggingIn\", `${Date.now()}`);\n\n getAuthMgr(!bFullReauth).then( (aMgr) => {\n const bMainRedirect = !authNoRedirect();\n const sdkConfigAuth = SdkConfigAccess.getSdkConfigAuth();\n let sRedirectUri=sdkConfigAuth.redirectUri;\n\n // If initial main redirect is OK, redirect to main page, otherwise will authorize in a popup window\n if (bMainRedirect && !bFullReauth) {\n // update redirect uri to be the root\n updateRedirectUri(aMgr, sRedirectUri);\n aMgr.loginRedirect();\n // Don't have token til after the redirect\n return Promise.resolve(undefined);\n } else {\n // Construct path to redirect uri\n const nLastPathSep = sRedirectUri.lastIndexOf(\"/\");\n sRedirectUri = nLastPathSep !== -1 ? `${sRedirectUri.substring(0,nLastPathSep+1)}auth.html` : `${sRedirectUri}/auth.html`;\n // Set redirectUri to static auth.html\n updateRedirectUri(aMgr, sRedirectUri);\n return new Promise( (resolve, reject) => {\n aMgr.login().then(token => {\n processTokenOnLogin(token);\n // getUserInfo();\n resolve(token.access_token);\n }).catch( (e) => {\n gbLoginInProgress = false;\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n // eslint-disable-next-line no-console\n console.log(e);\n reject(e);\n });\n });\n }\n });\n\n};\n\nexport const authRedirectCallback = ( href, fnLoggedInCB=null ) => {\n // Get code from href and swap for token\n const aHrefParts = href.split('?');\n const urlParams = new URLSearchParams(aHrefParts.length>1 ? `?${aHrefParts[1]}` : '');\n const code = urlParams.get(\"code\");\n\n getAuthMgr(false).then( (aMgr) => {\n aMgr.getToken(code).then(token => {\n if( token && token.access_token ) {\n processTokenOnLogin(token, false);\n // getUserInfo();\n if( fnLoggedInCB ) {\n fnLoggedInCB( token.access_token );\n }\n }\n });\n });\n};\n\n/**\n * Silent or visible login based on login status\n * @param {string} appName - unique name for application route (will be used to clear an session storage for another route)\n * @param {boolean} noMainRedirect - avoid the initial main window redirect that happens in scenarios where it is OK to transition\n * away from the main page\n * @param {boolean} deferLogin - defer logging in (if not already authenticated)\n */\nexport const loginIfNecessary = (appName, noMainRedirect=false, deferLogin=false) => {\n // If no initial redirect status of page changed...clearAuthMgr\n const currNoMainRedirect = authNoRedirect();\n const currAppName = sessionStorage.getItem(\"rsdk_appName\");\n if( appName !== currAppName || noMainRedirect !== currNoMainRedirect) {\n clearAuthMgr();\n sessionStorage.setItem(\"rsdk_appName\", appName);\n }\n setNoInitialRedirect(noMainRedirect);\n // If custom auth no need to do any OAuth logic\n if( gbCustomAuth ) {\n if( !window.PCore ) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n constellationInit( null, null, null, authCustomReauth );\n }\n return;\n }\n\n if( window.location.href.indexOf(\"?code\") !== -1 ) {\n // initialize authMgr\n initOAuth(false);\n return getAuthMgr(false).then(() => {\n authRedirectCallback(window.location.href, ()=> {\n window.location.href = window.location.pathname;\n });\n });\n }\n if( !deferLogin && (!gbLoginInProgress || isLoginExpired()) ) {\n initOAuth(false);\n return getAuthMgr(false).then(() => {\n updateLoginStatus();\n if( gbLoggedIn ) {\n fireTokenAvailable(getCurrentTokens());\n // getUserInfo();\n } else {\n return login();\n }\n });\n }\n};\n\nexport const getHomeUrl = () => {\n return `${window.location.origin}/`;\n};\n\n\nexport const authIsMainRedirect = () => {\n // Even with main redirect, we want to use it only for the first login (so it doesn't wipe out any state or the reload)\n return !authNoRedirect() && !usePopupForRestOfSession;\n};\n\n// Passive update where just session storage is updated so can be used on a window refresh\nexport const authTokenUpdated = (tokenInfo ) => {\n sessionStorage.setItem(\"rsdk_TI\", JSON.stringify(tokenInfo));\n};\n\nexport const logout = () => {\n sessionStorage.removeItem('rsdk_portalName');\n return new Promise((resolve) => {\n const fnClearAndResolve = () => {\n clearAuthMgr();\n\n const event = new Event('SdkLoggedOut');\n document.dispatchEvent(event);\n\n resolve();\n };\n if( gbCustomAuth ) {\n sessionStorage.removeItem(\"rsdk_AH\");\n fnClearAndResolve();\n return;\n }\n const tokenInfo = getCurrentTokens();\n if( tokenInfo && tokenInfo.access_token ) {\n if( window.PCore ) {\n window.PCore.getAuthUtils().revokeTokens().then(() => {\n fnClearAndResolve();\n }).catch(err => {\n // eslint-disable-next-line no-console\n console.log(\"Error:\",err?.message);\n });\n } else {\n getAuthMgr(false).then( (aMgr) => {\n aMgr.revokeTokens(tokenInfo.access_token, tokenInfo.refresh_token)\n .then(() => {\n // Go to finally\n })\n .finally(() => {\n fnClearAndResolve();\n });\n });\n }\n } else {\n fnClearAndResolve();\n }\n });\n};\n\n// Callback routine for custom event to ask for updated tokens\nexport const authUpdateTokens = (token) => {\n processTokenOnLogin( token );\n};\n\n\n// Initiate a full OAuth re-authorization (any refresh token has also expired).\nexport const authFullReauth = () => {\n const bHandleHere = true; // Other alternative is to raise an event and have someone else handle it\n\n if( bHandleHere ) {\n // Don't want to do a full clear of authMgr as will loose sessionIndex. Rather just clear the tokens\n clearAuthMgr(true);\n login(true);\n } else {\n // Fire the SdkFullReauth event to indicate a new token is needed (PCore.getAuthUtils.setTokens method\n // should be used to communicate the new token to Constellation JS Engine.\n const event = new CustomEvent('SdkFullReauth', { detail: authUpdateTokens });\n document.dispatchEvent(event);\n }\n};\n\n// Set the custom authorization header for the SDK (and Constellation JS Engine) to\n// utilize for every DX API request\nexport const sdkSetAuthHeader = (authHeader) => {\n // set this within session storage so it survives a browser reload\n if( authHeader ) {\n sessionStorage.setItem(\"rsdk_AH\", authHeader);\n // setAuthorizationHeader method not available til 8.8 so do safety check\n if( window.PCore?.getAuthUtils().setAuthorizationHeader ) {\n window.PCore.getAuthUtils().setAuthorizationHeader(authHeader);\n }\n } else {\n sessionStorage.removeItem(\"rsdk_AH\");\n }\n gbCustomAuth = true;\n};\n\n// Initiate a custom re-authorization.\nexport const authCustomReauth = () => {\n // Fire the SdkCustomReauth event to indicate a new authHeader is needed. Event listener should invoke sdkSetAuthHeader\n // to communicate the new token to sdk (and Constellation JS Engine)\n const event = new CustomEvent('SdkCustomReauth', { detail: sdkSetAuthHeader });\n document.dispatchEvent(event);\n};\n"]}
1
+ {"version":3,"file":"authManager.js","sourceRoot":"","sources":["../../../src/components/helpers/authManager.js"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,QAAQ,MAAM,QAAQ,CAAC;AAE9B,qDAAqD;AACrD,MAAM,CAAC,IAAI,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AACnE,qDAAqD;AACrD,MAAM,CAAC,IAAI,iBAAiB,GAAG,cAAc,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;AACjF,2CAA2C;AAE3C,mCAAmC;AACnC,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB,uHAAuH;AACvH,IAAI,wBAAwB,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC;AAC5E,IAAI,yBAAyB,GAAG,KAAK,CAAC;AACtC,sFAAsF;AACtF,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;GAEG;AACH,MAAM,oBAAoB,GAAG,CAAE,MAAM,EAAG,EAAE;IACxC,IAAI,MAAM,EAAG;QACT,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAC1C,wBAAwB,GAAG,IAAI,CAAC;KACnC;SAAM;QACH,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACxC,wBAAwB,GAAG,KAAK,CAAC;KACpC;AACH,CAAC,CAAC;AAEF,MAAM,oBAAoB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AAK,EAAE,YAAY,EAAE,CAAC,sBAAsB,EAAG;YACxD,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;SAChE;KACF;SAAM;QACL,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;KACtC;IACD,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,uHAAuH;IACvH,qEAAqE;IACrE,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAC/E,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// This file wraps various calls related to logging in, logging out, etc.\n// that use the auth.html/auth.js to do the work of logging in via OAuth 2.0.\n\nimport { getSdkConfig, SdkConfigAccess } from './config_access';\nimport PegaAuth from './auth';\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let gbLoggedIn = sessionStorage.getItem('rsdk_AH') !== null;\n// eslint-disable-next-line import/no-mutable-exports\nexport let gbLoginInProgress = sessionStorage.getItem(\"rsdk_loggingIn\") !== null;\n// other sessionStorage items: rsdk_appName\n\n// will store the PegaAuth instance\nlet authMgr = null;\n// Since this variable is loaded in a separate instance in the popup scenario, use storage to coordinate across the two\nlet usePopupForRestOfSession = sessionStorage.getItem(\"rsdk_popup\") === \"1\";\nlet gbC11NBootstrapInProgress = false;\n// Some non Pega OAuth 2.0 Authentication in use (Basic or Custom for service package)\nlet gbCustomAuth = false;\n\n/*\n * Set to use popup experience for rest of session\n */\nconst forcePopupForReauths = ( bForce ) => {\n if( bForce ) {\n sessionStorage.setItem(\"rsdk_popup\", \"1\");\n usePopupForRestOfSession = true;\n } else {\n sessionStorage.removeItem(\"rsdk_popup\");\n usePopupForRestOfSession = false;\n }\n};\n\nconst setNoInitialRedirect = (bNoInitialRedirect ) => {\n if( bNoInitialRedirect ) {\n forcePopupForReauths(true);\n sessionStorage.setItem(\"rsdk_noRedirect\", \"1\");\n } else {\n sessionStorage.removeItem(\"rsdk_noRedirect\");\n }\n};\n\nconst isLoginExpired = () => {\n let bExpired = true;\n const sLoginStart = sessionStorage.getItem(\"rsdk_loggingIn\");\n if( sLoginStart !== null ) {\n const currTime = Date.now();\n bExpired = currTime - parseInt(sLoginStart, 10) > 60000;\n }\n return bExpired;\n};\n\n/**\n * Clean up any web storage allocated for the user session.\n */\nconst clearAuthMgr = (bFullReauth=false) => {\n // Remove any local storage for the user\n if( !gbCustomAuth ) {\n sessionStorage.removeItem('rsdk_AH');\n }\n if( !bFullReauth ) {\n sessionStorage.removeItem(\"rsdk_CI\");\n }\n sessionStorage.removeItem(\"rsdk_TI\");\n sessionStorage.removeItem(\"rsdk_UI\");\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n gbLoggedIn = false;\n gbLoginInProgress = false;\n forcePopupForReauths(bFullReauth);\n // Not removing the authMgr structure itself...as it can be leveraged on next login\n};\n\nexport const authNoRedirect = () => {\n return sessionStorage.getItem(\"rsdk_noRedirect\") === \"1\";\n};\n\n/**\n * Initialize OAuth config structure members and create authMgr instance\n * bInit - governs whether to create new sessionStorage or load existing one\n */\nconst initOAuth = (bInit) => {\n return getSdkConfig().then( sdkConfig => {\n const sdkConfigAuth = sdkConfig.authConfig;\n const sdkConfigServer = sdkConfig.serverConfig;\n let pegaUrl = sdkConfigServer.infinityRestServerUrl;\n const bNoInitialRedirect = authNoRedirect();\n\n // Construct default OAuth endpoints (if not explicitly specified)\n if (pegaUrl) {\n // Cope with trailing slash being present\n if (!pegaUrl.endsWith('/')) {\n pegaUrl += '/';\n }\n if (!sdkConfigAuth.authorize) {\n sdkConfigAuth.authorize = `${pegaUrl}PRRestService/oauth2/v1/authorize`;\n }\n if (!sdkConfigAuth.token) {\n sdkConfigAuth.token = `${pegaUrl}PRRestService/oauth2/v1/token`;\n }\n if (!sdkConfigAuth.revoke) {\n sdkConfigAuth.revoke = `${pegaUrl}PRRestService/oauth2/v1/revoke`;\n }\n if( !sdkConfigAuth.redirectUri ) {\n sdkConfigAuth.redirectUri = `${window.location.origin}${window.location.pathname}`;\n }\n if (!sdkConfigAuth.userinfo) {\n const appAliasSeg = sdkConfigServer.appAlias ? `app/${sdkConfigServer.appAlias}/` : '';\n sdkConfigAuth.userinfo = `${pegaUrl}${appAliasSeg}api/oauthclients/v1/userinfo/JSON`;\n }\n }\n // Auth service alias\n if( !sdkConfigAuth.authService) {\n sdkConfigAuth.authService = \"pega\";\n }\n\n // Construct path to auth.html (used for case when not doing a main window redirect)\n let sNoMainRedirectUri=sdkConfigAuth.redirectUri;\n const nLastPathSep = sNoMainRedirectUri.lastIndexOf(\"/\");\n sNoMainRedirectUri = nLastPathSep !== -1 ? `${sNoMainRedirectUri.substring(0,nLastPathSep+1)}auth.html` : `${sNoMainRedirectUri}/auth.html`;\n\n const authConfig = {\n clientId: bNoInitialRedirect ? sdkConfigAuth.mashupClientId : sdkConfigAuth.portalClientId,\n authorizeUri: sdkConfigAuth.authorize,\n tokenUri: sdkConfigAuth.token,\n revokeUri: sdkConfigAuth.revoke,\n userinfoUri: sdkConfigAuth.userinfo,\n redirectUri: bNoInitialRedirect || usePopupForRestOfSession\n ? sNoMainRedirectUri\n : sdkConfigAuth.redirectUri,\n authService: sdkConfigAuth.authService,\n appAlias: sdkConfigServer.appAlias || '',\n useLocking: true\n };\n // If no clientId is specified assume not OAuth but custom auth\n if( !authConfig.clientId ) {\n gbCustomAuth = true;\n return;\n }\n if( 'silentTimeout' in sdkConfigAuth ) {\n authConfig.silentTimeout = sdkConfigAuth.silentTimeout;\n }\n if( bNoInitialRedirect && sdkConfigAuth.mashupUserIdentifier && sdkConfigAuth.mashupPassword ) {\n authConfig.userIdentifier = sdkConfigAuth.mashupUserIdentifier;\n authConfig.password = sdkConfigAuth.mashupPassword;\n }\n if( 'iframeLoginUI' in sdkConfigAuth ){\n authConfig.iframeLoginUI = sdkConfigAuth.iframeLoginUI.toString().toLowerCase() === 'true';\n }\n\n // Check if sessionStorage exists (and if so if for same authorize endpoint). Otherwise, assume\n // sessionStorage is out of date (user just edited endpoints). Else, logout required to clear\n // sessionStorage and get other endpoints updates.\n // Doing this as sessionIndex might have been added to this storage structure\n let sSI = sessionStorage.getItem(\"rsdk_CI\");\n if( sSI ) {\n try {\n const oSI = JSON.parse(sSI);\n const aProps = ['authorizeUri', 'appAlias', 'clientId', 'authService', 'userIdentifier'];\n for( let i = 0; i < aProps.length; i += 1 ) {\n const prop = aProps[i];\n const currValue = oSI[prop];\n const newValue = authConfig[prop];\n if( currValue !== newValue ) {\n // eslint-disable-next-line no-console\n console.warn(`Clearing credentials due to mismatch for property: ${prop};` +\n `currValue (${currValue}) does not match new desired value (${newValue})`);\n clearAuthMgr();\n sSI = null;\n break;\n }\n }\n } catch(e) {\n // do nothing\n }\n }\n\n if( !sSI || bInit ) {\n sessionStorage.setItem('rsdk_CI', JSON.stringify(authConfig));\n }\n authMgr = new PegaAuth('rsdk_CI');\n });\n};\n\nconst getAuthMgr = ( bInit ) => {\n return new Promise( (resolve) => {\n let idNextCheck = null;\n const fnCheckForAuthMgr = () => {\n if( PegaAuth && !authMgr ) {\n initOAuth( bInit );\n }\n if(authMgr) {\n if( idNextCheck ) {\n clearInterval(idNextCheck);\n }\n return resolve(authMgr);\n }\n }\n fnCheckForAuthMgr();\n idNextCheck = setInterval(fnCheckForAuthMgr, 10);\n });\n};\n\nexport const sdkGetAuthHeader = () => {\n return sessionStorage.getItem(\"rsdk_AH\");\n};\n\n/**\n * Initiate the process to get the Constellation bootstrap shell loaded and initialized\n * @param {Object} authConfig\n * @param {Object} tokenInfo\n * @param {Function} authTokenUpdated - callback invoked when Constellation JS Engine silently updates\n * an expired access_token\n * @param {Function} fnReauth - callback invoked when a full or custom reauth is needed\n */\nconst constellationInit = (authConfig, tokenInfo, authTokenUpdated, fnReauth) => {\n const constellationBootConfig = {};\n const sdkConfigServer = SdkConfigAccess.getSdkConfigServer();\n\n // Set up constellationConfig with data that bootstrapWithAuthHeader expects\n constellationBootConfig.customRendering = true;\n constellationBootConfig.restServerUrl = sdkConfigServer.infinityRestServerUrl;\n // NOTE: Needs a trailing slash! So add one if not provided\n if( !sdkConfigServer.sdkContentServerUrl.endsWith('/') ) {\n sdkConfigServer.sdkContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}/`;\n }\n constellationBootConfig.staticContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}constellation/`;\n if( !constellationBootConfig.staticContentServerUrl.endsWith('/') ) {\n constellationBootConfig.staticContentServerUrl = `${constellationBootConfig.staticContentServerUrl}/`;\n }\n // If appAlias specified, use it\n if( sdkConfigServer.appAlias ) {\n constellationBootConfig.appAlias = sdkConfigServer.appAlias;\n }\n\n if( tokenInfo ) {\n // Pass in auth info to Constellation\n constellationBootConfig.authInfo = {\n authType: \"OAuth2.0\",\n tokenInfo,\n // Set whether we want constellation to try to do a full re-Auth or not ()\n // true doesn't seem to be working in SDK scenario so always passing false for now\n popupReauth: false /* !authNoRedirect() */,\n client_id: authConfig.clientId,\n authentication_service: authConfig.authService,\n redirect_uri: authConfig.redirectUri,\n endPoints: {\n authorize: authConfig.authorizeUri,\n token: authConfig.tokenUri,\n revoke: authConfig.revokeUri\n },\n // TODO: setup callback so we can update own storage\n onTokenRetrieval: authTokenUpdated\n }\n } else {\n constellationBootConfig.authorizationHeader = sdkGetAuthHeader();\n }\n\n\n // Turn off dynamic load components (should be able to do it here instead of after load?)\n constellationBootConfig.dynamicLoadComponents = false;\n\n if( gbC11NBootstrapInProgress ) {\n return;\n } else {\n gbC11NBootstrapInProgress = true;\n }\n\n // Note that staticContentServerUrl already ends with a slash (see above), so no slash added.\n // In order to have this import succeed and to have it done with the webpackIgnore magic comment tag.\n // See: https://webpack.js.org/api/module-methods/\n import(/* webpackIgnore: true */ `${constellationBootConfig.staticContentServerUrl}bootstrap-shell.js`).then((bootstrapShell) => {\n // NOTE: once this callback is done, we lose the ability to access loadMashup.\n // So, create a reference to it\n window.myLoadMashup = bootstrapShell.loadMashup;\n window.myLoadPortal = bootstrapShell.loadPortal;\n window.myLoadDefaultPortal = bootstrapShell.loadDefaultPortal;\n\n bootstrapShell.bootstrapWithAuthHeader(constellationBootConfig, 'pega-root').then(() => {\n // eslint-disable-next-line no-console\n console.log('Bootstrap successful!');\n gbC11NBootstrapInProgress = false;\n\n // Setup listener for the reauth event\n if( tokenInfo ) {\n PCore.getPubSubUtils().subscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_FULL_REAUTH, fnReauth, \"authFullReauth\");\n } else {\n // customReauth event introduced with 8.8\n const sEvent = PCore.getConstants().PUB_SUB_EVENTS.EVENT_CUSTOM_REAUTH;\n if( sEvent ) {\n PCore.getPubSubUtils().subscribe(sEvent, fnReauth, \"doReauth\");\n }\n }\n\n // Fire SdkConstellationReady event so bridge and app route can do expected post PCore initializations\n const event = new CustomEvent('SdkConstellationReady', {});\n document.dispatchEvent(event);\n })\n .catch( e => {\n // Assume error caught is because token is not valid and attempt a full reauth\n // eslint-disable-next-line no-console\n console.error(`Constellation JS Engine bootstrap failed. ${e}`);\n gbC11NBootstrapInProgress = false;\n fnReauth();\n })\n });\n /* Ends here */\n};\n\nexport const updateLoginStatus = () => {\n const sAuthHdr = sdkGetAuthHeader();\n gbLoggedIn = sAuthHdr && sAuthHdr.length > 0;\n};\n\nconst getCurrentTokens = () => {\n let tokens = null;\n const sTI = sessionStorage.getItem('rsdk_TI');\n if(sTI) {\n try {\n tokens = JSON.parse(sTI);\n } catch(e) {\n tokens = null;\n }\n }\n return tokens;\n};\n\nconst fireTokenAvailable = (token, bLoadC11N=true) => {\n if( !token ) {\n // This is used on page reload to load the token from sessionStorage and carry on\n token = getCurrentTokens();\n if( !token ) {\n return;\n }\n }\n\n sessionStorage.setItem('rsdk_AH', `${token.token_type} ${token.access_token}`);\n updateLoginStatus();\n\n // gbLoggedIn is getting updated in updateLoginStatus\n gbLoggedIn = true;\n gbLoginInProgress = false;\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n forcePopupForReauths(true);\n\n const sSI = sessionStorage.getItem(\"rsdk_CI\");\n let authConfig = null;\n if( sSI ) {\n try {\n authConfig = JSON.parse(sSI);\n } catch(e) {\n // do nothing\n }\n }\n\n if( !window.PCore && bLoadC11N ) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n constellationInit( authConfig, token, authTokenUpdated, authFullReauth );\n }\n\n/*\n // Create and dispatch the SdkLoggedIn event to trigger constellationInit\n const event = new CustomEvent('SdkLoggedIn', { detail: { authConfig, tokenInfo: token } });\n document.dispatchEvent(event);\n */\n};\n\nconst processTokenOnLogin = ( token, bLoadC11N=true ) => {\n sessionStorage.setItem(\"rsdk_TI\", JSON.stringify(token));\n if( window.PCore ) {\n window.PCore.getAuthUtils().setTokens(token);\n } else {\n fireTokenAvailable(token, bLoadC11N);\n }\n};\n\nconst updateRedirectUri = (aMgr, sRedirectUri) => {\n const sSI = sessionStorage.getItem(\"rsdk_CI\");\n let authConfig = null;\n if( sSI ) {\n try {\n authConfig = JSON.parse(sSI);\n } catch(e) {\n // do nothing\n }\n }\n authConfig.redirectUri = sRedirectUri;\n sessionStorage.setItem(\"rsdk_CI\", JSON.stringify(authConfig));\n aMgr.reloadConfig();\n};\n\n\n// TODO: Cope with 401 and refresh token if possible (or just hope that it succeeds during login)\n/**\n * Retrieve UserInfo for current authentication service\n */\n export const getUserInfo = (bUseSS=true) => {\n const ssUserInfo = sessionStorage.getItem(\"rsdk_UI\");\n let userInfo = null;\n if( bUseSS && ssUserInfo ) {\n try {\n userInfo = JSON.parse(ssUserInfo);\n return Promise.resolve(userInfo);\n } catch(e) {\n // do nothing\n }\n }\n getAuthMgr(false).then( (aMgr) => {\n const tokenInfo = getCurrentTokens();\n return aMgr.getUserinfo(tokenInfo.access_token).then( data => {\n userInfo = data;\n if( userInfo ) {\n sessionStorage.setItem(\"rsdk_UI\", JSON.stringify(userInfo));\n } else {\n sessionStorage.removeItem(\"rsdk_UI\");\n }\n return Promise.resolve(userInfo);\n });\n });\n\n};\n\nexport const login = (bFullReauth=false) => {\n\n if( gbCustomAuth ) return;\n\n gbLoginInProgress = true;\n // Needed so a redirect to login screen and back will know we are still in process of logging in\n sessionStorage.setItem(\"rsdk_loggingIn\", `${Date.now()}`);\n\n getAuthMgr(!bFullReauth).then( (aMgr) => {\n const bMainRedirect = !authNoRedirect();\n const sdkConfigAuth = SdkConfigAccess.getSdkConfigAuth();\n let sRedirectUri=sdkConfigAuth.redirectUri;\n\n // If initial main redirect is OK, redirect to main page, otherwise will authorize in a popup window\n if (bMainRedirect && !bFullReauth) {\n // update redirect uri to be the root\n updateRedirectUri(aMgr, sRedirectUri);\n aMgr.loginRedirect();\n // Don't have token til after the redirect\n return Promise.resolve(undefined);\n } else {\n // Construct path to redirect uri\n const nLastPathSep = sRedirectUri.lastIndexOf(\"/\");\n sRedirectUri = nLastPathSep !== -1 ? `${sRedirectUri.substring(0,nLastPathSep+1)}auth.html` : `${sRedirectUri}/auth.html`;\n // Set redirectUri to static auth.html\n updateRedirectUri(aMgr, sRedirectUri);\n return new Promise( (resolve, reject) => {\n aMgr.login().then(token => {\n processTokenOnLogin(token);\n // getUserInfo();\n resolve(token.access_token);\n }).catch( (e) => {\n gbLoginInProgress = false;\n sessionStorage.removeItem(\"rsdk_loggingIn\");\n // eslint-disable-next-line no-console\n console.log(e);\n reject(e);\n });\n });\n }\n });\n\n};\n\nexport const authRedirectCallback = ( href, fnLoggedInCB=null ) => {\n // Get code from href and swap for token\n const aHrefParts = href.split('?');\n const urlParams = new URLSearchParams(aHrefParts.length>1 ? `?${aHrefParts[1]}` : '');\n const code = urlParams.get(\"code\");\n\n getAuthMgr(false).then( (aMgr) => {\n aMgr.getToken(code).then(token => {\n if( token && token.access_token ) {\n processTokenOnLogin(token, false);\n // getUserInfo();\n if( fnLoggedInCB ) {\n fnLoggedInCB( token.access_token );\n }\n }\n });\n });\n};\n\n/**\n * Silent or visible login based on login status\n * @param {string} appName - unique name for application route (will be used to clear an session storage for another route)\n * @param {boolean} noMainRedirect - avoid the initial main window redirect that happens in scenarios where it is OK to transition\n * away from the main page\n * @param {boolean} deferLogin - defer logging in (if not already authenticated)\n */\nexport const loginIfNecessary = (appName, noMainRedirect=false, deferLogin=false) => {\n // If no initial redirect status of page changed...clearAuthMgr\n const currNoMainRedirect = authNoRedirect();\n const currAppName = sessionStorage.getItem(\"rsdk_appName\");\n if( appName !== currAppName || noMainRedirect !== currNoMainRedirect) {\n clearAuthMgr();\n sessionStorage.setItem(\"rsdk_appName\", appName);\n }\n setNoInitialRedirect(noMainRedirect);\n // If custom auth no need to do any OAuth logic\n if( gbCustomAuth ) {\n if( !window.PCore ) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n constellationInit( null, null, null, authCustomReauth );\n }\n return;\n }\n\n if( window.location.href.indexOf(\"?code\") !== -1 ) {\n // initialize authMgr\n initOAuth(false);\n return getAuthMgr(false).then(() => {\n authRedirectCallback(window.location.href, ()=> {\n window.location.href = window.location.pathname;\n });\n });\n }\n if( !deferLogin && (!gbLoginInProgress || isLoginExpired()) ) {\n initOAuth(false);\n return getAuthMgr(false).then(() => {\n updateLoginStatus();\n if( gbLoggedIn ) {\n fireTokenAvailable(getCurrentTokens());\n // getUserInfo();\n } else {\n return login();\n }\n });\n }\n};\n\nexport const getHomeUrl = () => {\n return `${window.location.origin}/`;\n};\n\n\nexport const authIsMainRedirect = () => {\n // Even with main redirect, we want to use it only for the first login (so it doesn't wipe out any state or the reload)\n return !authNoRedirect() && !usePopupForRestOfSession;\n};\n\n// Passive update where just session storage is updated so can be used on a window refresh\nexport const authTokenUpdated = (tokenInfo ) => {\n sessionStorage.setItem(\"rsdk_TI\", JSON.stringify(tokenInfo));\n};\n\nexport const logout = () => {\n sessionStorage.removeItem('rsdk_portalName');\n return new Promise((resolve) => {\n const fnClearAndResolve = () => {\n clearAuthMgr();\n\n const event = new Event('SdkLoggedOut');\n document.dispatchEvent(event);\n\n resolve();\n };\n if( gbCustomAuth ) {\n sessionStorage.removeItem(\"rsdk_AH\");\n fnClearAndResolve();\n return;\n }\n const tokenInfo = getCurrentTokens();\n if( tokenInfo && tokenInfo.access_token ) {\n if( window.PCore ) {\n window.PCore.getAuthUtils().revokeTokens().then(() => {\n fnClearAndResolve();\n }).catch(err => {\n // eslint-disable-next-line no-console\n console.log(\"Error:\",err?.message);\n });\n } else {\n getAuthMgr(false).then( (aMgr) => {\n aMgr.revokeTokens(tokenInfo.access_token, tokenInfo.refresh_token)\n .then(() => {\n // Go to finally\n })\n .finally(() => {\n fnClearAndResolve();\n });\n });\n }\n } else {\n fnClearAndResolve();\n }\n });\n};\n\n// Callback routine for custom event to ask for updated tokens\nexport const authUpdateTokens = (token) => {\n processTokenOnLogin( token );\n};\n\n\n// Initiate a full OAuth re-authorization (any refresh token has also expired).\nexport const authFullReauth = () => {\n const bHandleHere = true; // Other alternative is to raise an event and have someone else handle it\n\n if( bHandleHere ) {\n // Don't want to do a full clear of authMgr as will loose sessionIndex. Rather just clear the tokens\n clearAuthMgr(true);\n login(true);\n } else {\n // Fire the SdkFullReauth event to indicate a new token is needed (PCore.getAuthUtils.setTokens method\n // should be used to communicate the new token to Constellation JS Engine.\n const event = new CustomEvent('SdkFullReauth', { detail: authUpdateTokens });\n document.dispatchEvent(event);\n }\n};\n\n// Set the custom authorization header for the SDK (and Constellation JS Engine) to\n// utilize for every DX API request\nexport const sdkSetAuthHeader = (authHeader) => {\n // set this within session storage so it survives a browser reload\n if( authHeader ) {\n sessionStorage.setItem(\"rsdk_AH\", authHeader);\n // setAuthorizationHeader method not available til 8.8 so do safety check\n if( window.PCore?.getAuthUtils().setAuthorizationHeader ) {\n window.PCore.getAuthUtils().setAuthorizationHeader(authHeader);\n }\n } else {\n sessionStorage.removeItem(\"rsdk_AH\");\n }\n gbCustomAuth = true;\n};\n\n// Initiate a custom re-authorization.\nexport const authCustomReauth = () => {\n // Fire the SdkCustomReauth event to indicate a new authHeader is needed. Event listener should invoke sdkSetAuthHeader\n // to communicate the new token to sdk (and Constellation JS Engine)\n const event = new CustomEvent('SdkCustomReauth', { detail: sdkSetAuthHeader });\n document.dispatchEvent(event);\n};\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Function that accepts array of messages as input and group them by their type and returns the resulting object
3
+ * @param {Array} inputMessages
4
+ * Eg: [
5
+ * {message: 'First Name is required', type: 'error'},
6
+ * {message: 'Last Name is required', type: 'error'},
7
+ * {message: 'Address field should be clear and precise', type: 'info'}
8
+ * ]
9
+ *
10
+ * @returns {object}
11
+ *
12
+ * Eg: {
13
+ * error: ['First Name is required', 'Last Name is required'],
14
+ * info: ['Address field should be clear and precise']
15
+ * }
16
+ */
17
+ declare function getMessagesGrouped(inputMessages: any): {};
18
+ declare function getBanners(config: any): any;
19
+ export { getMessagesGrouped, getBanners };
20
+ //# sourceMappingURL=case-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"case-utils.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/case-utils.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AAEH,iBAAS,kBAAkB,CAAC,aAAa,KAAA,MAUxC;AA+BD,iBAAS,UAAU,CAAC,MAAM,KAAA,OAsCzB;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import AlertBanner from '../designSystemExtension/AlertBanner';
3
+ /**
4
+ * Function that accepts array of messages as input and group them by their type and returns the resulting object
5
+ * @param {Array} inputMessages
6
+ * Eg: [
7
+ * {message: 'First Name is required', type: 'error'},
8
+ * {message: 'Last Name is required', type: 'error'},
9
+ * {message: 'Address field should be clear and precise', type: 'info'}
10
+ * ]
11
+ *
12
+ * @returns {object}
13
+ *
14
+ * Eg: {
15
+ * error: ['First Name is required', 'Last Name is required'],
16
+ * info: ['Address field should be clear and precise']
17
+ * }
18
+ */
19
+ function getMessagesGrouped(inputMessages) {
20
+ const messages = {};
21
+ if (inputMessages && inputMessages instanceof Array && inputMessages.length > 0) {
22
+ inputMessages.forEach(item => {
23
+ const { message, type } = item;
24
+ messages[type] = [...(messages[type] || []), message];
25
+ });
26
+ }
27
+ return messages;
28
+ }
29
+ /**
30
+ * Function accepts a error type and variant of the banner
31
+ * @param {string} type
32
+ * Eg: 'error'
33
+ * @returns {string}
34
+ * Eg: 'urgent'
35
+ */
36
+ function getVariant(type) {
37
+ const { BANNER_VARIANT_SUCCESS, BANNER_VARIANT_INFO, BANNER_VARIANT_URGENT, MESSAGES } = PCore.getConstants();
38
+ const { MESSAGES_TYPE_ERROR, MESSAGES_TYPE_INFO, MESSAGES_TYPE_SUCCESS } = MESSAGES;
39
+ let variant;
40
+ switch (type) {
41
+ case MESSAGES_TYPE_ERROR:
42
+ variant = BANNER_VARIANT_URGENT;
43
+ break;
44
+ case MESSAGES_TYPE_INFO:
45
+ variant = BANNER_VARIANT_INFO;
46
+ break;
47
+ case MESSAGES_TYPE_SUCCESS:
48
+ variant = BANNER_VARIANT_SUCCESS;
49
+ break;
50
+ default:
51
+ variant = '';
52
+ }
53
+ return variant;
54
+ }
55
+ function getBanners(config) {
56
+ const { target, pageMessages, httpMessages } = config;
57
+ const { PAGE } = PCore.getConstants();
58
+ const { clearMessages } = PCore.getMessageManager();
59
+ const banners = [];
60
+ const groupedPageMessages = getMessagesGrouped(pageMessages);
61
+ Object.keys(groupedPageMessages).forEach(type => {
62
+ const messagesByType = groupedPageMessages[type];
63
+ const variant = getVariant(type);
64
+ const pageMessagesBannerID = `${target}_${PAGE}_${type}`.toLowerCase().replace('/', '_');
65
+ banners.push(React.createElement(AlertBanner, { id: pageMessagesBannerID, variant: variant, messages: messagesByType, onDismiss: variant === 'urgent'
66
+ ? ''
67
+ : () => {
68
+ clearMessages({
69
+ category: PAGE,
70
+ type,
71
+ context: target
72
+ });
73
+ } }));
74
+ });
75
+ if (httpMessages && httpMessages.length > 0) {
76
+ banners.push(React.createElement(AlertBanner, { id: 'modalViewContainerBanner', variant: 'urgent', messages: httpMessages }));
77
+ }
78
+ return banners;
79
+ }
80
+ export { getMessagesGrouped, getBanners };
81
+ //# sourceMappingURL=case-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"case-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/case-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAI/D;;;;;;;;;;;;;;;GAeG;AAEH,SAAS,kBAAkB,CAAC,aAAa;IACvC,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,IAAI,aAAa,IAAI,aAAa,YAAY,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/E,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC3B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YAC/B,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,IAAI;IACtB,MAAM,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,GACpF,KAAK,CAAC,YAAY,EAAE,CAAC;IACvB,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,GAAG,QAAQ,CAAC;IAEpF,IAAI,OAAO,CAAC;IACZ,QAAQ,IAAI,EAAE;QACZ,KAAK,mBAAmB;YACtB,OAAO,GAAG,qBAAqB,CAAC;YAChC,MAAM;QACR,KAAK,kBAAkB;YACrB,OAAO,GAAG,mBAAmB,CAAC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AAE;QAC3C,OAAO,CAAC,IAAI,CACV,oBAAC,WAAW,IAAC,EAAE,EAAC,0BAA0B,EAAC,OAAO,EAAC,QAAQ,EAAC,QAAQ,EAAE,YAAY,GAAI,CACvF,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import React from 'react';\nimport AlertBanner from '../designSystemExtension/AlertBanner';\n\ndeclare let PCore: any;\n\n/**\n * Function that accepts array of messages as input and group them by their type and returns the resulting object\n * @param {Array} inputMessages\n * Eg: [\n * {message: 'First Name is required', type: 'error'},\n * {message: 'Last Name is required', type: 'error'},\n * {message: 'Address field should be clear and precise', type: 'info'}\n * ]\n *\n * @returns {object}\n *\n * Eg: {\n * error: ['First Name is required', 'Last Name is required'],\n * info: ['Address field should be clear and precise']\n * }\n */\n\nfunction getMessagesGrouped(inputMessages) {\n const messages = {};\n\n if (inputMessages && inputMessages instanceof Array && inputMessages.length > 0) {\n inputMessages.forEach(item => {\n const { message, type } = item;\n messages[type] = [...(messages[type] || []), message];\n });\n }\n return messages;\n}\n\n/**\n * Function accepts a error type and variant of the banner\n * @param {string} type\n * Eg: 'error'\n * @returns {string}\n * Eg: 'urgent'\n */\nfunction getVariant(type) {\n const { BANNER_VARIANT_SUCCESS, BANNER_VARIANT_INFO, BANNER_VARIANT_URGENT, MESSAGES } =\n PCore.getConstants();\n const { MESSAGES_TYPE_ERROR, MESSAGES_TYPE_INFO, MESSAGES_TYPE_SUCCESS } = MESSAGES;\n\n let variant;\n switch (type) {\n case MESSAGES_TYPE_ERROR:\n variant = BANNER_VARIANT_URGENT;\n break;\n case MESSAGES_TYPE_INFO:\n variant = BANNER_VARIANT_INFO;\n break;\n case MESSAGES_TYPE_SUCCESS:\n variant = BANNER_VARIANT_SUCCESS;\n break;\n default:\n variant = '';\n }\n return variant;\n}\n\nfunction getBanners(config) {\n const { target, pageMessages, httpMessages } = config;\n const { PAGE } = PCore.getConstants();\n const { clearMessages } = PCore.getMessageManager();\n const banners: any = [];\n const groupedPageMessages = getMessagesGrouped(pageMessages);\n\n Object.keys(groupedPageMessages).forEach(type => {\n const messagesByType = groupedPageMessages[type];\n const variant = getVariant(type);\n const pageMessagesBannerID = `${target}_${PAGE}_${type}`.toLowerCase().replace('/', '_');\n banners.push(\n <AlertBanner\n id={pageMessagesBannerID}\n variant={variant}\n messages={messagesByType}\n onDismiss={\n variant === 'urgent'\n ? ''\n : () => {\n clearMessages({\n category: PAGE,\n type,\n context: target\n });\n }\n }\n />\n );\n });\n\n if (httpMessages && httpMessages.length > 0) {\n banners.push(\n <AlertBanner id='modalViewContainerBanner' variant='urgent' messages={httpMessages} />\n );\n }\n\n return banners;\n}\n\nexport { getMessagesGrouped, getBanners };\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isEmptyObject(obj: Object): Boolean;
2
+ //# sourceMappingURL=common-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-utils.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD"}
@@ -0,0 +1,5 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export function isEmptyObject(obj) {
3
+ return Object.keys(obj).length === 0;
4
+ }
5
+ //# sourceMappingURL=common-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC","sourcesContent":["// eslint-disable-next-line import/prefer-default-export\nexport function isEmptyObject(obj: Object): Boolean {\n return Object.keys(obj).length === 0;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"config_access.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/config_access.js"],"names":[],"mappings":"AAQA,gCAAoB;AA6NpB,6CAgCC"}
1
+ {"version":3,"file":"config_access.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/config_access.js"],"names":[],"mappings":"AAQA,gCAAoB;AAoNpB,6CAgCC"}
@@ -1,7 +1,7 @@
1
1
  // Helper singleton class to assist with loading and accessing
2
2
  // the SDK Config JSON
3
3
  import { sdkGetAuthHeader } from './authManager';
4
- import Utils from './utils';
4
+ import { isEmptyObject } from './common-utils';
5
5
  // Create a singleton for this class (with async loading of config file) and export it
6
6
  // Note: Initialzing SdkConfigAccess to null seems to cause lots of compile issues with references
7
7
  // within other components and the value potentially being null (so try to leave it undefined)
@@ -18,7 +18,7 @@ class ConfigAccess {
18
18
  configurable: true,
19
19
  writable: true,
20
20
  value: async () => {
21
- if (Utils.isEmptyObject(this.sdkConfig)) {
21
+ if (isEmptyObject(this.sdkConfig)) {
22
22
  await getSdkConfig();
23
23
  }
24
24
  return this.sdkConfig;
@@ -33,10 +33,10 @@ class ConfigAccess {
33
33
  configurable: true,
34
34
  writable: true,
35
35
  value: () => {
36
- if (Utils.isEmptyObject(this.sdkConfig)) {
36
+ if (isEmptyObject(this.sdkConfig)) {
37
37
  const config = this.getSdkConfig();
38
38
  }
39
- return this.sdkConfig["authConfig"];
39
+ return this.sdkConfig['authConfig'];
40
40
  }
41
41
  });
42
42
  /**
@@ -48,16 +48,16 @@ class ConfigAccess {
48
48
  configurable: true,
49
49
  writable: true,
50
50
  value: () => {
51
- if (Utils.isEmptyObject(this.sdkConfig)) {
51
+ if (isEmptyObject(this.sdkConfig)) {
52
52
  const config = this.getSdkConfig();
53
53
  }
54
- return this.sdkConfig["serverConfig"];
54
+ return this.sdkConfig['serverConfig'];
55
55
  }
56
56
  });
57
57
  /**
58
- * @param {String} key the key to be inserted/updated in serverConfig
59
- * @param {String} value the value to be assigned to the given key
60
- */
58
+ * @param {String} key the key to be inserted/updated in serverConfig
59
+ * @param {String} value the value to be assigned to the given key
60
+ */
61
61
  Object.defineProperty(this, "setSdkConfigServer", {
62
62
  enumerable: true,
63
63
  configurable: true,
@@ -95,9 +95,9 @@ class ConfigAccess {
95
95
  * @returns Promise of config file fetch
96
96
  */
97
97
  async readSdkConfig() {
98
- if (Utils.isEmptyObject(this.sdkConfig)) {
99
- return fetch("./sdk-config.json")
100
- .then((response) => {
98
+ if (isEmptyObject(this.sdkConfig)) {
99
+ return fetch('./sdk-config.json')
100
+ .then(response => {
101
101
  if (response.ok) {
102
102
  return response.json();
103
103
  }
@@ -105,12 +105,13 @@ class ConfigAccess {
105
105
  throw new Error(`Failed with status:${response.status}`);
106
106
  }
107
107
  })
108
- .then((data) => {
108
+ .then(data => {
109
109
  this.sdkConfig = data;
110
110
  this.fixupConfigSettings();
111
111
  return Promise.resolve(this.sdkConfig);
112
- }).catch(err => {
113
- console.error("Fetch for sdk-config.js failed.");
112
+ })
113
+ .catch(err => {
114
+ console.error('Fetch for sdk-config.js failed.');
114
115
  console.error(err);
115
116
  return Promise.reject(err);
116
117
  });
@@ -121,98 +122,91 @@ class ConfigAccess {
121
122
  }
122
123
  // Adjust any settings like setting up defaults or making sure URIs have a trailing slash
123
124
  fixupConfigSettings() {
124
- const oServerConfig = this.sdkConfig["serverConfig"];
125
+ const oServerConfig = this.sdkConfig['serverConfig'];
125
126
  // If not present, then use current root path
126
127
  oServerConfig.sdkContentServerUrl = oServerConfig.sdkContentServerUrl || window.location.origin;
127
128
  // Needs a trailing slash so add one if not there
128
129
  if (!oServerConfig.sdkContentServerUrl.endsWith('/')) {
129
130
  oServerConfig.sdkContentServerUrl = `${oServerConfig.sdkContentServerUrl}/`;
130
131
  }
131
- console.log(`Using sdkContentServerUrl: ${this.sdkConfig["serverConfig"].sdkContentServerUrl}`);
132
+ console.log(`Using sdkContentServerUrl: ${this.sdkConfig['serverConfig'].sdkContentServerUrl}`);
132
133
  // Don't want a trailing slash for infinityRestServerUrl
133
134
  if (oServerConfig.infinityRestServerUrl.endsWith('/')) {
134
135
  oServerConfig.infinityRestServerUrl = oServerConfig.infinityRestServerUrl.slice(0, -1);
135
136
  }
136
137
  // Specify our own internal list of well known portals to exclude (if one not specified)
137
138
  if (!oServerConfig.excludePortals) {
138
- oServerConfig.excludePortals = ["pxExpress", "Developer", "pxPredictionStudio", "pxAdminStudio", "pyCaseWorker", "pyCaseManager7"];
139
+ oServerConfig.excludePortals = [
140
+ 'pxExpress',
141
+ 'Developer',
142
+ 'pxPredictionStudio',
143
+ 'pxAdminStudio',
144
+ 'pyCaseWorker',
145
+ 'pyCaseManager7'
146
+ ];
139
147
  console.warn(`No exludePortals entry found within serverConfig section of sdk-config.json. Using the following default list: ["pxExpress", "Developer", "pxPredictionStudio", "pxAdminStudio", "pyCaseWorker", "pyCaseManager7"]`);
140
148
  }
141
149
  }
142
150
  /**
143
- * If this.sdkConfig.serverConfig.appPortal is set, leave it and the specified portal will be used.
144
- * If not set, set this.sdkConfig.serverConfig.appPortal to default portal of currently logged in user
151
+ * Get available portals which supports SDK
152
+ * @returns list of available portals (portals other than excludingPortals list)
145
153
  */
146
- async selectPortal() {
147
- if (Utils.isEmptyObject(this.sdkConfig)) {
148
- await getSdkConfig();
149
- }
150
- const serverConfig = this.sdkConfig.serverConfig;
151
- if ((serverConfig.appPortal !== "") &&
152
- (serverConfig.appPortal !== undefined)) {
153
- // use the specified portal
154
- console.log(`Using appPortal: ${serverConfig.appPortal}`);
155
- return;
156
- }
157
- const userAccessGroup = PCore.getEnvironmentInfo().getAccessGroup();
158
- const dataPageName = "D_OperatorAccessGroups";
159
- const serverUrl = serverConfig.infinityRestServerUrl;
160
- const appAlias = serverConfig.appAlias;
161
- const appAliasPath = appAlias ? `/app/${appAlias}` : '';
162
- const arExcludedPortals = serverConfig["excludePortals"];
163
- // Using v1 API here as v2 data_views is not able to access same data page currently. Should move to avoid having this logic to find
164
- // a default portal or constellation portal and rather have Constellation JS Engine API just load the default portal
165
- await fetch(`${serverUrl}${appAliasPath}/api/v1/data/${dataPageName}`, {
166
- method: 'GET',
167
- headers: {
168
- 'Content-Type': 'application/json',
169
- 'Authorization': sdkGetAuthHeader()
170
- }
171
- })
172
- .then(response => {
173
- if (response.ok && response.status === 200) {
174
- return response.json();
154
+ async getAvailablePortals() {
155
+ return new Promise(async (resolve, reject) => {
156
+ if (isEmptyObject(this.sdkConfig)) {
157
+ await getSdkConfig();
175
158
  }
176
- else {
177
- if (response.status === 401) {
178
- // Might be either a real token expiration or revoke, but more likely that the "api" service package is misconfigured
179
- throw (new Error(`Attempt to access ${dataPageName} failed. The "api" service package is likely not configured to use "OAuth 2.0"`));
159
+ const serverConfig = this.sdkConfig.serverConfig;
160
+ const userAccessGroup = PCore.getEnvironmentInfo().getAccessGroup();
161
+ const dataPageName = 'D_OperatorAccessGroups';
162
+ const serverUrl = serverConfig.infinityRestServerUrl;
163
+ const appAlias = serverConfig.appAlias;
164
+ const appAliasPath = appAlias ? `/app/${appAlias}` : '';
165
+ const arExcludedPortals = serverConfig['excludePortals'];
166
+ let headers = {
167
+ Authorization: sdkGetAuthHeader(),
168
+ 'Content-Type': 'application/json'
169
+ };
170
+ // Using v1 API here as v2 data_views is not able to access same data page currently. Should move to avoid having this logic to find
171
+ // a default portal or constellation portal and rather have Constellation JS Engine API just load the default portal
172
+ fetch(`${serverUrl}${appAliasPath}/api/v1/data/${dataPageName}`, {
173
+ method: 'GET',
174
+ headers
175
+ })
176
+ .then(response => {
177
+ if (response.ok && response.status === 200) {
178
+ return response.json();
180
179
  }
181
- ;
182
- throw (new Error(`HTTP Error: ${response.status}`));
183
- }
184
- })
185
- .then(async (agData) => {
186
- let arAccessGroups = agData.pxResults;
187
- let selectedPortal = null;
188
- for (let ag of arAccessGroups) {
189
- if (ag.pyAccessGroup === userAccessGroup) {
190
- // Check if default portal works
191
- if (!arExcludedPortals.includes(ag.pyPortal)) {
192
- selectedPortal = ag.pyPortal;
180
+ else {
181
+ if (response.status === 401) {
182
+ // Might be either a real token expiration or revoke, but more likely that the "api" service package is misconfigured
183
+ throw new Error(`Attempt to access ${dataPageName} failed. The "api" service package is likely not configured to use "OAuth 2.0"`);
193
184
  }
194
- else {
185
+ throw new Error(`HTTP Error: ${response.status}`);
186
+ }
187
+ })
188
+ .then(async (agData) => {
189
+ const arAccessGroups = agData.pxResults;
190
+ const availablePortals = [];
191
+ for (let ag of arAccessGroups) {
192
+ if (ag.pyAccessGroup === userAccessGroup) {
195
193
  console.error(`Default portal for current operator (${ag.pyPortal}) is not compatible with SDK.\nConsider using a different operator, adjusting the default portal for this operator, or using "appPortal" setting within sdk-config.json to specify a specific portal to load.`);
196
- // Find first portal that is not excluded (might work)
197
194
  for (let portal of ag.pyUserPortals) {
198
195
  if (!arExcludedPortals.includes(portal.pyPortalLayout)) {
199
- selectedPortal = portal.pyPortalLayout;
200
- break;
196
+ availablePortals.push(portal.pyPortalLayout);
201
197
  }
202
198
  }
199
+ break;
203
200
  }
204
- break;
205
201
  }
206
- }
207
- if (selectedPortal) {
208
202
  // Found operator's current access group. Use its portal
209
- this.setSdkConfigServer("appPortal", selectedPortal);
210
- console.log(`Using non-excluded portal: ${serverConfig.appPortal}`);
211
- }
212
- })
213
- .catch(e => {
214
- console.error(e.message);
215
- // check specific error if 401, and wiped out if so stored token is stale. Fetch new tokens.
203
+ console.log(`Available portals: ${availablePortals}`);
204
+ resolve(availablePortals);
205
+ })
206
+ .catch(e => {
207
+ console.error(e.message);
208
+ // check specific error if 401, and wiped out if so stored token is stale. Fetch new tokens.
209
+ });
216
210
  });
217
211
  }
218
212
  }
@@ -224,10 +218,9 @@ async function createSdkConfigAccess() {
224
218
  await singleton.readSdkConfig();
225
219
  return singleton;
226
220
  }
227
- ;
228
221
  // Initialize exported SdkConfigAccess structure
229
222
  async function getSdkConfig() {
230
- return new Promise((resolve) => {
223
+ return new Promise(resolve => {
231
224
  let idNextCheck = null;
232
225
  if (!SdkConfigAccess && !SdkConfigAccessCreateInProgress) {
233
226
  SdkConfigAccessCreateInProgress = true;
@@ -237,7 +230,7 @@ async function getSdkConfig() {
237
230
  SdkConfigAccessCreateInProgress = false;
238
231
  // console.log(`SdkConfigAccess: ${JSON.stringify(SdkConfigAccess)}`);
239
232
  // Create and dispatch the SdkConfigAccessReady event
240
- const event = new CustomEvent("SdkConfigAccessReady", {});
233
+ const event = new CustomEvent('SdkConfigAccessReady', {});
241
234
  document.dispatchEvent(event);
242
235
  return resolve(SdkConfigAccess.sdkConfig);
243
236
  });