@pega/react-sdk-overrides 0.23.25 → 0.23.27
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.css +4 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +33 -16
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +34 -65
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +33 -17
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
// Helper singleton class to assist with loading and accessing
|
|
2
|
-
// the SDK Config JSON
|
|
3
|
-
import {sdkGetAuthHeader} from './authManager';
|
|
4
|
-
import Utils from './utils';
|
|
5
|
-
|
|
6
|
-
// Create a singleton for this class (with async loading of config file) and export it
|
|
7
|
-
// Note: Initialzing SdkConfigAccess to null seems to cause lots of compile issues with references
|
|
8
|
-
// within other components and the value potentially being null (so try to leave it undefined)
|
|
9
|
-
let SdkConfigAccess;
|
|
10
|
-
let SdkConfigAccessCreateInProgress = false;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ConfigAccess {
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
// sdkConfig is the JSON object read from the sdk-config.json file
|
|
17
|
-
this.sdkConfig = {};
|
|
18
|
-
// isConfigLoaded will be updated to true after the async load is complete
|
|
19
|
-
this.isConfigLoaded = false;
|
|
20
|
-
|
|
21
|
-
// The "work" to load the config file is done (asynchronously) via the initialize
|
|
22
|
-
// (Factory function) below)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Asynchronous initialization of the config file contents.
|
|
27
|
-
* @returns Promise of config file fetch
|
|
28
|
-
*/
|
|
29
|
-
async readSdkConfig() {
|
|
30
|
-
if(Utils.isEmptyObject(this.sdkConfig)) {
|
|
31
|
-
return fetch("./sdk-config.json")
|
|
32
|
-
.then ( (response) => {
|
|
33
|
-
if( response.ok ) {
|
|
34
|
-
return response.json();
|
|
35
|
-
} else {
|
|
36
|
-
throw new Error(`Failed with status:${response.status}`);
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
.then ( (data) => {
|
|
40
|
-
this.sdkConfig = data;
|
|
41
|
-
this.fixupConfigSettings();
|
|
42
|
-
return Promise.resolve(this.sdkConfig);
|
|
43
|
-
}).catch(err => {
|
|
44
|
-
console.error("Fetch for sdk-config.js failed.");
|
|
45
|
-
console.error(err);
|
|
46
|
-
return Promise.reject(err);
|
|
47
|
-
});
|
|
48
|
-
} else {
|
|
49
|
-
return Promise.resolve(this.sdkConfig);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Adjust any settings like setting up defaults or making sure URIs have a trailing slash
|
|
54
|
-
fixupConfigSettings() {
|
|
55
|
-
const oServerConfig = this.sdkConfig["serverConfig"];
|
|
56
|
-
// If not present, then use current root path
|
|
57
|
-
oServerConfig.sdkContentServerUrl = oServerConfig.sdkContentServerUrl || window.location.origin;
|
|
58
|
-
// Needs a trailing slash so add one if not there
|
|
59
|
-
if( !oServerConfig.sdkContentServerUrl.endsWith('/') ) {
|
|
60
|
-
oServerConfig.sdkContentServerUrl = `${oServerConfig.sdkContentServerUrl}/`;
|
|
61
|
-
}
|
|
62
|
-
console.log(`Using sdkContentServerUrl: ${this.sdkConfig["serverConfig"].sdkContentServerUrl}`);
|
|
63
|
-
|
|
64
|
-
// Don't want a trailing slash for infinityRestServerUrl
|
|
65
|
-
if( oServerConfig.infinityRestServerUrl.endsWith('/') ) {
|
|
66
|
-
oServerConfig.infinityRestServerUrl = oServerConfig.infinityRestServerUrl.slice(0, -1)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Specify our own internal list of well known portals to exclude (if one not specified)
|
|
70
|
-
if( !oServerConfig.excludePortals ) {
|
|
71
|
-
oServerConfig.excludePortals = ["pxExpress", "Developer", "pxPredictionStudio", "pxAdminStudio", "pyCaseWorker", "pyCaseManager7"];
|
|
72
|
-
console.warn(`No exludePortals entry found within serverConfig section of sdk-config.json. Using the following default list: ["pxExpress", "Developer", "pxPredictionStudio", "pxAdminStudio", "pyCaseWorker", "pyCaseManager7"]`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @returns the sdk-config JSON object
|
|
79
|
-
*/
|
|
80
|
-
getSdkConfig = async () => {
|
|
81
|
-
if(Utils.isEmptyObject(this.sdkConfig)) {
|
|
82
|
-
await getSdkConfig();
|
|
83
|
-
}
|
|
84
|
-
return this.sdkConfig;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @returns the authConfig block in the SDK Config object
|
|
91
|
-
*/
|
|
92
|
-
getSdkConfigAuth = () => {
|
|
93
|
-
if(Utils.isEmptyObject(this.sdkConfig)) {
|
|
94
|
-
const config = this.getSdkConfig();
|
|
95
|
-
}
|
|
96
|
-
return this.sdkConfig["authConfig"];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* @returns the serverConfig bloc from the sdk-config.json file
|
|
102
|
-
*/
|
|
103
|
-
getSdkConfigServer = () => {
|
|
104
|
-
if(Utils.isEmptyObject(this.sdkConfig)) {
|
|
105
|
-
const config = this.getSdkConfig();
|
|
106
|
-
}
|
|
107
|
-
return this.sdkConfig["serverConfig"];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @param {String} key the key to be inserted/updated in serverConfig
|
|
113
|
-
* @param {String} value the value to be assigned to the given key
|
|
114
|
-
*/
|
|
115
|
-
setSdkConfigServer = (key, value) => {
|
|
116
|
-
|
|
117
|
-
this.sdkConfig.serverConfig[key] = value;
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* If this.sdkConfig.serverConfig.appPortal is set, leave it and the specified portal will be used.
|
|
123
|
-
* If not set, set this.sdkConfig.serverConfig.appPortal to default portal of currently logged in user
|
|
124
|
-
*/
|
|
125
|
-
async selectPortal() {
|
|
126
|
-
|
|
127
|
-
if(Utils.isEmptyObject(this.sdkConfig)) {
|
|
128
|
-
await getSdkConfig();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const serverConfig = this.sdkConfig.serverConfig;
|
|
132
|
-
|
|
133
|
-
if ((serverConfig.appPortal !== "") &&
|
|
134
|
-
(serverConfig.appPortal !== undefined) ) {
|
|
135
|
-
// use the specified portal
|
|
136
|
-
console.log(`Using appPortal: ${serverConfig.appPortal}`);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const userAccessGroup = PCore.getEnvironmentInfo().getAccessGroup();
|
|
141
|
-
const dataPageName = "D_OperatorAccessGroups";
|
|
142
|
-
const serverUrl = serverConfig.infinityRestServerUrl;
|
|
143
|
-
const appAlias = serverConfig.appAlias;
|
|
144
|
-
const appAliasPath = appAlias ? `/app/${appAlias}` : '';
|
|
145
|
-
const arExcludedPortals = serverConfig["excludePortals"];
|
|
146
|
-
|
|
147
|
-
// Using v1 API here as v2 data_views is not able to access same data page currently. Should move to avoid having this logic to find
|
|
148
|
-
// a default portal or constellation portal and rather have Constellation JS Engine API just load the default portal
|
|
149
|
-
await fetch ( `${serverUrl}${appAliasPath}/api/v1/data/${dataPageName}`,
|
|
150
|
-
{
|
|
151
|
-
method: 'GET',
|
|
152
|
-
headers: {
|
|
153
|
-
'Content-Type' : 'application/json',
|
|
154
|
-
'Authorization' : sdkGetAuthHeader()
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
.then( response => {
|
|
158
|
-
if( response.ok && response.status === 200) {
|
|
159
|
-
return response.json();
|
|
160
|
-
} else {
|
|
161
|
-
if( response.status === 401 ) {
|
|
162
|
-
// Might be either a real token expiration or revoke, but more likely that the "api" service package is misconfigured
|
|
163
|
-
throw( new Error(`Attempt to access ${dataPageName} failed. The "api" service package is likely not configured to use "OAuth 2.0"`));
|
|
164
|
-
};
|
|
165
|
-
throw( new Error(`HTTP Error: ${response.status}`));
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
.then( async (agData) => {
|
|
169
|
-
|
|
170
|
-
let arAccessGroups = agData.pxResults;
|
|
171
|
-
let selectedPortal = null;
|
|
172
|
-
|
|
173
|
-
for (let ag of arAccessGroups) {
|
|
174
|
-
if (ag.pyAccessGroup === userAccessGroup) {
|
|
175
|
-
// Check if default portal works
|
|
176
|
-
if( !arExcludedPortals.includes(ag.pyPortal) ) {
|
|
177
|
-
selectedPortal = ag.pyPortal;
|
|
178
|
-
} else {
|
|
179
|
-
console.error(`Default portal for current operator (${ag.pyPortal}) is not compatible with SDK.\nConsider using a different operator, adjusting the default portal for this operator, or using "appPortal" setting within sdk-config.json to specify a specific portal to load.`);
|
|
180
|
-
// Find first portal that is not excluded (might work)
|
|
181
|
-
for (let portal of ag.pyUserPortals ) {
|
|
182
|
-
if( !arExcludedPortals.includes(portal.pyPortalLayout) ) {
|
|
183
|
-
selectedPortal = portal.pyPortalLayout;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if( selectedPortal ) {
|
|
192
|
-
// Found operator's current access group. Use its portal
|
|
193
|
-
this.setSdkConfigServer("appPortal", selectedPortal);
|
|
194
|
-
console.log(`Using non-excluded portal: ${serverConfig.appPortal}`);
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
.catch( e => {
|
|
198
|
-
console.error(e.message);
|
|
199
|
-
// check specific error if 401, and wiped out if so stored token is stale. Fetch new tokens.
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Path to the BootstrapCSS
|
|
206
|
-
* @returns the locBootstrapCSS from the serverConfig block of the sdk-config.json file
|
|
207
|
-
*/
|
|
208
|
-
getSdkConfigBootstrapCSS = () => {
|
|
209
|
-
const serverConfig = this.getSdkConfigServer();
|
|
210
|
-
const locBootstrapCSS = serverConfig.locBootstrapCSS;
|
|
211
|
-
if (locBootstrapCSS === undefined) {
|
|
212
|
-
console.error(`locBootstrapCSS: ${locBootstrapCSS}`);
|
|
213
|
-
}
|
|
214
|
-
return locBootstrapCSS;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// Implement Factory function to allow async load
|
|
221
|
-
// See https://stackoverflow.com/questions/49905178/asynchronous-operations-in-constructor/49906064#49906064 for inspiration
|
|
222
|
-
async function createSdkConfigAccess() {
|
|
223
|
-
// Note that our initialize function returns a promise...
|
|
224
|
-
let singleton = new ConfigAccess();
|
|
225
|
-
await singleton.readSdkConfig();
|
|
226
|
-
return singleton;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// Initialize exported SdkConfigAccess structure
|
|
230
|
-
async function getSdkConfig() {
|
|
231
|
-
return new Promise( (resolve) => {
|
|
232
|
-
let idNextCheck = null;
|
|
233
|
-
if( !SdkConfigAccess && !SdkConfigAccessCreateInProgress ) {
|
|
234
|
-
SdkConfigAccessCreateInProgress = true;
|
|
235
|
-
createSdkConfigAccess().then( theConfigAccess => {
|
|
236
|
-
// Key initialization of SdkConfigAccess
|
|
237
|
-
SdkConfigAccess = theConfigAccess;
|
|
238
|
-
SdkConfigAccessCreateInProgress = false;
|
|
239
|
-
// console.log(`SdkConfigAccess: ${JSON.stringify(SdkConfigAccess)}`);
|
|
240
|
-
// Create and dispatch the SdkConfigAccessReady event
|
|
241
|
-
const event = new CustomEvent("SdkConfigAccessReady", { });
|
|
242
|
-
document.dispatchEvent(event);
|
|
243
|
-
return resolve( SdkConfigAccess.sdkConfig );
|
|
244
|
-
});
|
|
245
|
-
} else {
|
|
246
|
-
const fnCheckForConfig = () => {
|
|
247
|
-
if( SdkConfigAccess ) {
|
|
248
|
-
if( idNextCheck ) {
|
|
249
|
-
clearInterval(idNextCheck);
|
|
250
|
-
}
|
|
251
|
-
return resolve( SdkConfigAccess.sdkConfig );
|
|
252
|
-
}
|
|
253
|
-
idNextCheck = setInterval(fnCheckForConfig, 500);
|
|
254
|
-
};
|
|
255
|
-
if( SdkConfigAccess ) {
|
|
256
|
-
return resolve( SdkConfigAccess.sdkConfig );
|
|
257
|
-
} else {
|
|
258
|
-
idNextCheck = setInterval(fnCheckForConfig, 500);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if( true ) {
|
|
265
|
-
let ignore = getSdkConfig();
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export {SdkConfigAccess, getSdkConfig};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function Boolean(value, { allowEmpty = true, tick = "", cross = "" } = {}) {
|
|
2
|
-
if (
|
|
3
|
-
(!allowEmpty && !value) ||
|
|
4
|
-
value === false ||
|
|
5
|
-
value?.toString()?.toLowerCase() === "false" ||
|
|
6
|
-
value === 0 ||
|
|
7
|
-
value === "0"
|
|
8
|
-
) {
|
|
9
|
-
return cross || "";
|
|
10
|
-
}
|
|
11
|
-
if (
|
|
12
|
-
value === true ||
|
|
13
|
-
value?.toString()?.toLowerCase() === "true" ||
|
|
14
|
-
value === 1 ||
|
|
15
|
-
value === "1"
|
|
16
|
-
) {
|
|
17
|
-
return tick || "";
|
|
18
|
-
}
|
|
19
|
-
if (
|
|
20
|
-
allowEmpty &&
|
|
21
|
-
(value === "null" ||
|
|
22
|
-
value === "" ||
|
|
23
|
-
value === null ||
|
|
24
|
-
typeof value === "undefined")
|
|
25
|
-
) {
|
|
26
|
-
return "- -";
|
|
27
|
-
}
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
TrueFalse: (value, options) =>
|
|
33
|
-
Boolean(value, {
|
|
34
|
-
...options,
|
|
35
|
-
tick: "True",
|
|
36
|
-
cross: "False"
|
|
37
|
-
})
|
|
38
|
-
};
|