@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.
- package/lib/bridge/Context/StoreContext.d.ts +3 -2
- package/lib/bridge/Context/StoreContext.d.ts.map +1 -1
- package/lib/bridge/Context/StoreContext.js +2 -3
- package/lib/bridge/Context/StoreContext.js.map +1 -1
- package/lib/bridge/helpers/sdk_component_map.d.ts +1 -0
- package/lib/bridge/helpers/sdk_component_map.d.ts.map +1 -1
- package/lib/bridge/helpers/sdk_component_map.js +22 -0
- package/lib/bridge/helpers/sdk_component_map.js.map +1 -1
- package/lib/bridge/react_pconnect.d.ts.map +1 -1
- package/lib/bridge/react_pconnect.js +2 -14
- package/lib/bridge/react_pconnect.js.map +1 -1
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts +10 -0
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.d.ts.map +1 -0
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +19 -0
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js.map +1 -0
- package/lib/components/designSystemExtension/AlertBanner/index.d.ts +2 -0
- package/lib/components/designSystemExtension/AlertBanner/index.d.ts.map +1 -0
- package/lib/components/designSystemExtension/AlertBanner/index.js +2 -0
- package/lib/components/designSystemExtension/AlertBanner/index.js.map +1 -0
- package/lib/components/designSystemExtension/Banner/Banner.d.ts +15 -1
- package/lib/components/designSystemExtension/Banner/Banner.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts +6 -9
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +3 -7
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts +4 -10
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +1 -8
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts +6 -2
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +3 -3
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts +7 -2
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +4 -4
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts +7 -2
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +3 -3
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.d.ts +17 -7
- package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.js +13 -16
- package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.d.ts +5 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.js +3 -6
- package/lib/components/designSystemExtension/Pulse/Pulse.js.map +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts +19 -0
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +1 -0
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +77 -0
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +1 -0
- package/lib/components/designSystemExtension/RichTextEditor/index.d.ts +2 -0
- package/lib/components/designSystemExtension/RichTextEditor/index.d.ts.map +1 -0
- package/lib/components/designSystemExtension/RichTextEditor/index.js +2 -0
- package/lib/components/designSystemExtension/RichTextEditor/index.js.map +1 -0
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts +6 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.d.ts.map +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +2 -2
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.d.ts +15 -1
- package/lib/components/field/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.js +17 -15
- package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.d.ts +7 -2
- package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.js +12 -10
- package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts +19 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +12 -10
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts +6 -1
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +11 -11
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts.map +1 -1
- package/lib/components/field/Currency/currency-utils.js +1 -1
- package/lib/components/field/Currency/currency-utils.js.map +1 -1
- package/lib/components/field/Date/Date.d.ts +5 -1
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +19 -11
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts +5 -1
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +15 -9
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts +8 -1
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +43 -9
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts +10 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +26 -9
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Email/Email.d.ts +5 -1
- package/lib/components/field/Email/Email.d.ts.map +1 -1
- package/lib/components/field/Email/Email.js +7 -5
- package/lib/components/field/Email/Email.js.map +1 -1
- package/lib/components/field/Integer/Integer.d.ts +5 -1
- package/lib/components/field/Integer/Integer.d.ts.map +1 -1
- package/lib/components/field/Integer/Integer.js +6 -4
- package/lib/components/field/Integer/Integer.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts +5 -1
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +6 -4
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/Phone/Phone.d.ts +5 -1
- package/lib/components/field/Phone/Phone.d.ts.map +1 -1
- package/lib/components/field/Phone/Phone.js +10 -7
- package/lib/components/field/Phone/Phone.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts +7 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +24 -11
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/RichText/RichText.d.ts +7 -0
- package/lib/components/field/RichText/RichText.d.ts.map +1 -0
- package/lib/components/field/RichText/RichText.js +51 -0
- package/lib/components/field/RichText/RichText.js.map +1 -0
- package/lib/components/field/RichText/index.d.ts +2 -0
- package/lib/components/field/RichText/index.d.ts.map +1 -0
- package/lib/components/field/RichText/index.js +2 -0
- package/lib/components/field/RichText/index.js.map +1 -0
- package/lib/components/field/ScalarList/ScalarList.d.ts +13 -0
- package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -0
- package/lib/components/field/ScalarList/ScalarList.js +34 -0
- package/lib/components/field/ScalarList/ScalarList.js.map +1 -0
- package/lib/components/field/ScalarList/index.d.ts +2 -0
- package/lib/components/field/ScalarList/index.d.ts.map +1 -0
- package/lib/components/field/ScalarList/index.js +2 -0
- package/lib/components/field/ScalarList/index.js.map +1 -0
- package/lib/components/field/SemanticLink/SemanticLink.d.ts +5 -9
- package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +10 -14
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/SemanticLink/utils.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/utils.js.map +1 -1
- package/lib/components/field/TextArea/TextArea.d.ts +6 -1
- package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/field/TextArea/TextArea.js +5 -3
- package/lib/components/field/TextArea/TextArea.js.map +1 -1
- package/lib/components/field/TextContent/TextContent.d.ts +7 -1
- package/lib/components/field/TextContent/TextContent.d.ts.map +1 -1
- package/lib/components/field/TextContent/TextContent.js.map +1 -1
- package/lib/components/field/TextInput/TextInput.d.ts +6 -1
- package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
- package/lib/components/field/TextInput/TextInput.js +24 -5
- package/lib/components/field/TextInput/TextInput.js.map +1 -1
- package/lib/components/field/Time/Time.d.ts +5 -1
- package/lib/components/field/Time/Time.d.ts.map +1 -1
- package/lib/components/field/Time/Time.js +14 -8
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/URL/URL.d.ts +5 -1
- package/lib/components/field/URL/URL.d.ts.map +1 -1
- package/lib/components/field/URL/URL.js +11 -5
- package/lib/components/field/URL/URL.js.map +1 -1
- package/lib/components/field/UserReference/UserReference.d.ts +19 -40
- package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
- package/lib/components/field/UserReference/UserReference.js +16 -45
- package/lib/components/field/UserReference/UserReference.js.map +1 -1
- package/lib/components/helpers/attachmentHelpers.d.ts +6 -6
- package/lib/components/helpers/attachmentHelpers.d.ts.map +1 -1
- package/lib/components/helpers/attachmentHelpers.js +2 -2
- package/lib/components/helpers/attachmentHelpers.js.map +1 -1
- package/lib/components/helpers/auth.d.ts +8 -6
- package/lib/components/helpers/auth.d.ts.map +1 -1
- package/lib/components/helpers/auth.js +642 -327
- package/lib/components/helpers/auth.js.map +1 -1
- package/lib/components/helpers/authManager.d.ts +20 -17
- package/lib/components/helpers/authManager.d.ts.map +1 -1
- package/lib/components/helpers/authManager.js +713 -438
- package/lib/components/helpers/authManager.js.map +1 -1
- package/lib/components/helpers/case-utils.d.ts +20 -0
- package/lib/components/helpers/case-utils.d.ts.map +1 -0
- package/lib/components/helpers/case-utils.js +82 -0
- package/lib/components/helpers/case-utils.js.map +1 -0
- package/lib/components/helpers/common-utils.d.ts +2 -0
- package/lib/components/helpers/common-utils.d.ts.map +1 -0
- package/lib/components/helpers/common-utils.js +5 -0
- package/lib/components/helpers/common-utils.js.map +1 -0
- package/lib/components/helpers/config_access.d.ts.map +1 -1
- package/lib/components/helpers/config_access.js +28 -98
- package/lib/components/helpers/config_access.js.map +1 -1
- package/lib/components/helpers/data_page.d.ts.map +1 -1
- package/lib/components/helpers/data_page.js.map +1 -1
- package/lib/components/helpers/date-format-utils.d.ts +1 -6
- package/lib/components/helpers/date-format-utils.d.ts.map +1 -1
- package/lib/components/helpers/date-format-utils.js +23 -14
- package/lib/components/helpers/date-format-utils.js.map +1 -1
- package/lib/components/helpers/event-utils.d.ts +1 -1
- package/lib/components/helpers/event-utils.d.ts.map +1 -1
- package/lib/components/helpers/event-utils.js.map +1 -1
- package/lib/components/helpers/field-group-utils.d.ts +15 -2
- package/lib/components/helpers/field-group-utils.d.ts.map +1 -1
- package/lib/components/helpers/field-group-utils.js +3 -3
- package/lib/components/helpers/field-group-utils.js.map +1 -1
- package/lib/components/helpers/formatters/Boolean.d.ts +3 -3
- package/lib/components/helpers/formatters/Boolean.d.ts.map +1 -1
- package/lib/components/helpers/formatters/Boolean.js.map +1 -1
- package/lib/components/helpers/formatters/Currency.d.ts +6 -6
- package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
- package/lib/components/helpers/formatters/Currency.js +6 -5
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.d.ts +881 -1399
- package/lib/components/helpers/formatters/CurrencyMap.d.ts.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.js.map +1 -1
- package/lib/components/helpers/formatters/Date.d.ts +4 -4
- package/lib/components/helpers/formatters/Date.d.ts.map +1 -1
- package/lib/components/helpers/formatters/Date.js +1 -1
- package/lib/components/helpers/formatters/Date.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts +2 -2
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js +4 -5
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts +11 -11
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/reactContextHelpers.d.ts +3 -2
- package/lib/components/helpers/reactContextHelpers.d.ts.map +1 -1
- package/lib/components/helpers/reactContextHelpers.js.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts +5 -3
- package/lib/components/helpers/simpleTableHelpers.d.ts.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.js +10 -5
- package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
- package/lib/components/helpers/state-utils.d.ts +4 -0
- package/lib/components/helpers/state-utils.d.ts.map +1 -0
- package/lib/components/helpers/state-utils.js +36 -0
- package/lib/components/helpers/state-utils.js.map +1 -0
- package/lib/components/helpers/template-utils.d.ts +7 -3
- package/lib/components/helpers/template-utils.d.ts.map +1 -1
- package/lib/components/helpers/template-utils.js.map +1 -1
- package/lib/components/helpers/utils.d.ts +1 -1
- package/lib/components/helpers/utils.d.ts.map +1 -1
- package/lib/components/helpers/utils.js +9 -3
- package/lib/components/helpers/utils.js.map +1 -1
- package/lib/components/helpers/versionHelpers.d.ts.map +1 -1
- package/lib/components/helpers/versionHelpers.js.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.d.ts +6 -13
- package/lib/components/infra/ActionButtons/ActionButtons.d.ts.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.js +5 -15
- package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
- package/lib/components/infra/Assignment/Assignment.d.ts +9 -14
- package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +32 -33
- package/lib/components/infra/Assignment/Assignment.js.map +1 -1
- package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts +8 -14
- package/lib/components/infra/AssignmentCard/AssignmentCard.d.ts.map +1 -1
- package/lib/components/infra/AssignmentCard/AssignmentCard.js +3 -16
- package/lib/components/infra/AssignmentCard/AssignmentCard.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts +1 -21
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +53 -52
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.d.ts +12 -12
- package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.js +17 -16
- package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts +8 -17
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +22 -24
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts +9 -22
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +7 -22
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts +9 -19
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.js +2 -16
- package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts +1 -14
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.js +13 -15
- package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts +5 -12
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +9 -16
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.d.ts +11 -17
- package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.js +6 -20
- package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts +8 -16
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +9 -20
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/Reference/Reference.d.ts +8 -17
- package/lib/components/infra/Reference/Reference.d.ts.map +1 -1
- package/lib/components/infra/Reference/Reference.js +1 -15
- package/lib/components/infra/Reference/Reference.js.map +1 -1
- package/lib/components/infra/Region/Region.d.ts +4 -7
- package/lib/components/infra/Region/Region.d.ts.map +1 -1
- package/lib/components/infra/Region/Region.js +0 -4
- package/lib/components/infra/Region/Region.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts +1 -21
- package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +16 -36
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/infra/Stages/Stages.d.ts +5 -8
- package/lib/components/infra/Stages/Stages.d.ts.map +1 -1
- package/lib/components/infra/Stages/Stages.js +3 -7
- package/lib/components/infra/Stages/Stages.js.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.d.ts.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js.map +1 -1
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts +4 -10
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.d.ts.map +1 -1
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js +4 -9
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js.map +1 -1
- package/lib/components/infra/View/View.d.ts +13 -16
- package/lib/components/infra/View/View.d.ts.map +1 -1
- package/lib/components/infra/View/View.js +8 -54
- package/lib/components/infra/View/View.js.map +1 -1
- package/lib/components/template/AppShell/AppShell.d.ts +20 -15
- package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +17 -29
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/BannerPage/BannerPage.d.ts +11 -23
- package/lib/components/template/BannerPage/BannerPage.d.ts.map +1 -1
- package/lib/components/template/BannerPage/BannerPage.js +4 -22
- package/lib/components/template/BannerPage/BannerPage.js.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.d.ts +5 -7
- package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js +6 -6
- package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts +10 -22
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +41 -45
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts +8 -13
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.d.ts.map +1 -1
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +9 -16
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.d.ts +10 -16
- package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.js +12 -23
- package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/template/DataReference/DataReference.d.ts +1 -31
- package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
- package/lib/components/template/DataReference/DataReference.js +41 -48
- package/lib/components/template/DataReference/DataReference.js.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.d.ts +1 -11
- package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.js +18 -15
- package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
- package/lib/components/template/DefaultForm/utils/index.d.ts +3 -0
- package/lib/components/template/DefaultForm/utils/index.d.ts.map +1 -0
- package/lib/components/template/DefaultForm/utils/index.js +27 -0
- package/lib/components/template/DefaultForm/utils/index.js.map +1 -0
- package/lib/components/template/Details/Details/Details.d.ts +1 -16
- package/lib/components/template/Details/Details/Details.d.ts.map +1 -1
- package/lib/components/template/Details/Details/Details.js +10 -15
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts +7 -15
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js +1 -13
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts +1 -16
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +14 -16
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts +1 -16
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +14 -16
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts +12 -19
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +7 -21
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.d.ts +7 -7
- package/lib/components/template/InlineDashboard/InlineDashboard.d.ts.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.js +0 -5
- package/lib/components/template/InlineDashboard/InlineDashboard.js.map +1 -1
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts +8 -15
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.d.ts.map +1 -1
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js +5 -14
- package/lib/components/template/InlineDashboardPage/InlineDashboardPage.js.map +1 -1
- package/lib/components/template/ListPage/ListPage.d.ts +5 -13
- package/lib/components/template/ListPage/ListPage.d.ts.map +1 -1
- package/lib/components/template/ListPage/ListPage.js +6 -10
- package/lib/components/template/ListPage/ListPage.js.map +1 -1
- package/lib/components/template/ListView/DefaultViewMeta.d.ts +1 -90
- package/lib/components/template/ListView/DefaultViewMeta.d.ts.map +1 -1
- package/lib/components/template/ListView/DefaultViewMeta.js.map +1 -1
- package/lib/components/template/ListView/ListView.d.ts +1 -9
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +96 -100
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/hooks.d.ts.map +1 -1
- package/lib/components/template/ListView/hooks.js +0 -1
- package/lib/components/template/ListView/hooks.js.map +1 -1
- package/lib/components/template/ListView/utils.d.ts +72 -16
- package/lib/components/template/ListView/utils.d.ts.map +1 -1
- package/lib/components/template/ListView/utils.js +143 -3
- package/lib/components/template/ListView/utils.js.map +1 -1
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts +9 -13
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.d.ts.map +1 -1
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js +2 -13
- package/lib/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts +10 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts +1 -16
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +14 -16
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts +5 -1
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts +7 -14
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js +4 -13
- package/lib/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts +4 -7
- package/lib/components/template/OneColumn/OneColumn/OneColumn.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js +0 -5
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts +4 -8
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js +3 -6
- package/lib/components/template/OneColumn/OneColumnPage/OneColumnPage.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts +4 -7
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.d.ts.map +1 -1
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js +0 -5
- package/lib/components/template/OneColumn/OneColumnTab/OneColumnTab.js.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts +1 -15
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js +17 -13
- package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +57 -5
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +18 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +5 -5
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts +1 -29
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +22 -28
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts +14 -26
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts.map +1 -1
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js +5 -26
- package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js.map +1 -1
- package/lib/components/template/SubTabs/SubTabs.d.ts +4 -10
- package/lib/components/template/SubTabs/SubTabs.d.ts.map +1 -1
- package/lib/components/template/SubTabs/SubTabs.js +1 -8
- package/lib/components/template/SubTabs/SubTabs.js.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.d.ts.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts +5 -11
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +1 -12
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts +4 -8
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js +3 -6
- package/lib/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts +5 -11
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +1 -9
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts +10 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts +1 -16
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +31 -23
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts +5 -1
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts +7 -14
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js +4 -14
- package/lib/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.js.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.d.ts +17 -1
- package/lib/components/template/WssNavBar/WssNavBar.d.ts.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.js +2 -2
- package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts +8 -17
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.d.ts.map +1 -1
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js +4 -19
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +15 -3
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +44 -32
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.d.ts +4 -7
- package/lib/components/widget/CaseHistory/CaseHistory.d.ts.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.js +4 -8
- package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts +8 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts +5 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +33 -23
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
- package/lib/components/widget/Followers/Followers.d.ts +4 -5
- package/lib/components/widget/Followers/Followers.d.ts.map +1 -1
- package/lib/components/widget/Followers/Followers.js +3 -10
- package/lib/components/widget/Followers/Followers.js.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js +12 -4
- package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.d.ts +7 -1
- package/lib/components/widget/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js +2 -2
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/widget/SummaryList/SummaryList.d.ts +7 -1
- package/lib/components/widget/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/widget/SummaryList/SummaryList.js +5 -2
- package/lib/components/widget/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/widget/ToDo/ToDo.d.ts +13 -27
- package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
- package/lib/components/widget/ToDo/ToDo.js +35 -67
- package/lib/components/widget/ToDo/ToDo.js.map +1 -1
- package/lib/components_map.d.ts +3 -3
- package/lib/components_map.d.ts.map +1 -1
- package/lib/components_map.js +819 -818
- package/lib/components_map.js.map +1 -1
- package/lib/doc/KeyReleaseUpdates.md +65 -9
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +4 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useAfterInitialEffect.d.ts +9 -0
- package/lib/hooks/useAfterInitialEffect.d.ts.map +1 -0
- package/lib/hooks/useAfterInitialEffect.js +16 -0
- package/lib/hooks/useAfterInitialEffect.js.map +1 -0
- package/lib/hooks/useConsolidatedRef.d.ts +9 -0
- package/lib/hooks/useConsolidatedRef.d.ts.map +1 -0
- package/lib/hooks/useConsolidatedRef.js +30 -0
- package/lib/hooks/useConsolidatedRef.js.map +1 -0
- package/lib/hooks/useUID.d.ts +8 -0
- package/lib/hooks/useUID.d.ts.map +1 -0
- package/lib/hooks/useUID.js +14 -0
- package/lib/hooks/useUID.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/sdk-pega-component-map.d.ts +15 -1
- package/lib/sdk-pega-component-map.js +15 -1
- package/lib/sdk-pega-component-map.js.map +1 -1
- package/lib/types/PConnProps.d.ts +42 -0
- 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
|
|
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
|
-
|
|
14
|
+
// Current properties within dynState structure:
|
|
15
|
+
// codeVerifier, state, sessionIndex, sessionIndexAttempts, acRedirectUri
|
|
16
|
+
constructor(ssKeyConfig, ssKeyDynState) {
|
|
9
17
|
_PegaAuth_instances.add(this);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
46
|
+
else {
|
|
47
|
+
throw new Error('invalid config settings');
|
|
48
|
+
}
|
|
31
49
|
}
|
|
32
50
|
async login() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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.
|
|
231
|
-
const { clientId, clientSecret,
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
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(
|
|
91
|
+
formData.append('client_id', clientId);
|
|
238
92
|
if (clientSecret) {
|
|
239
|
-
formData.append(
|
|
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
|
-
|
|
131
|
+
agent: __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getAgent).call(this),
|
|
132
|
+
method: 'POST',
|
|
247
133
|
headers: new Headers({
|
|
248
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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.
|
|
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
|
|
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(
|
|
186
|
+
formData.append('client_id', clientId);
|
|
281
187
|
if (clientSecret) {
|
|
282
|
-
formData.append(
|
|
188
|
+
formData.append('client_secret', clientSecret);
|
|
283
189
|
}
|
|
284
|
-
formData.append(
|
|
285
|
-
formData.append(
|
|
190
|
+
formData.append('grant_type', 'refresh_token');
|
|
191
|
+
formData.append('refresh_token', refresh_token);
|
|
286
192
|
return fetch(tokenUri, {
|
|
287
|
-
|
|
193
|
+
agent: __classPrivateFieldGet(this, _PegaAuth_instances, "m", _PegaAuth_getAgent).call(this),
|
|
194
|
+
method: 'POST',
|
|
288
195
|
headers: new Headers({
|
|
289
|
-
|
|
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() +
|
|
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.
|
|
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 (
|
|
314
|
-
// Must have a config structure
|
|
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
|
|
318
|
-
|
|
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
|
|
321
|
-
hdrs.authorization = `Basic ${
|
|
232
|
+
const basicCreds = btoa(`${clientId}:${clientSecret}`);
|
|
233
|
+
hdrs.authorization = `Basic ${basicCreds}`;
|
|
322
234
|
}
|
|
323
|
-
const aTknProps = [
|
|
235
|
+
const aTknProps = ['access_token'];
|
|
324
236
|
if (refresh_token) {
|
|
325
|
-
aTknProps.push(
|
|
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(
|
|
242
|
+
formData.append('client_id', clientId);
|
|
331
243
|
}
|
|
332
|
-
formData.append(
|
|
333
|
-
formData.append(
|
|
244
|
+
formData.append('token', prop === 'access_token' ? access_token : refresh_token);
|
|
245
|
+
formData.append('token_type_hint', prop);
|
|
334
246
|
fetch(revokeUri, {
|
|
335
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
|
|
364
|
-
|
|
365
|
-
|
|
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
|
-
|
|
373
|
-
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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.
|
|
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
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
-
|
|
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
|
|
718
|
+
return btoa(new Uint8Array(buff).reduce((s, b) => s + String.fromCharCode(b), ''));
|
|
425
719
|
}, _PegaAuth_base64UrlSafeEncode = function _PegaAuth_base64UrlSafeEncode(buf) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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
|
-
})
|
|
733
|
+
})
|
|
734
|
+
.catch((error) => {
|
|
432
735
|
// eslint-disable-next-line no-console
|
|
433
|
-
console.
|
|
434
|
-
})
|
|
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
|