@pega/react-sdk-overrides 0.23.26 → 0.23.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
  5. package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
  6. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  8. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  9. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  10. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  11. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  12. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
  13. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  14. package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
  15. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  16. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  17. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  18. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  19. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  20. package/lib/field/AutoComplete/config-ext.json +2 -3
  21. package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
  22. package/lib/field/CancelAlert/index.tsx +1 -1
  23. package/lib/field/Checkbox/Checkbox.tsx +29 -19
  24. package/lib/field/Checkbox/config-ext.json +2 -3
  25. package/lib/field/Currency/Currency.tsx +27 -38
  26. package/lib/field/Currency/config-ext.json +2 -3
  27. package/lib/field/Currency/currency-utils.ts +10 -18
  28. package/lib/field/Date/Date.tsx +33 -15
  29. package/lib/field/Date/config-ext.json +2 -3
  30. package/lib/field/DateTime/DateTime.tsx +22 -11
  31. package/lib/field/DateTime/config-ext.json +1 -2
  32. package/lib/field/Decimal/Decimal.tsx +64 -17
  33. package/lib/field/Decimal/config-ext.json +1 -2
  34. package/lib/field/Decimal/index.tsx +1 -1
  35. package/lib/field/Dropdown/Dropdown.tsx +154 -18
  36. package/lib/field/Dropdown/config-ext.json +1 -2
  37. package/lib/field/Email/Email.tsx +16 -7
  38. package/lib/field/Email/config-ext.json +1 -2
  39. package/lib/field/Email/index.tsx +1 -1
  40. package/lib/field/Group/Group.tsx +37 -0
  41. package/lib/field/Group/config-ext.json +7 -0
  42. package/lib/field/Group/index.tsx +1 -0
  43. package/lib/field/Integer/Integer.tsx +15 -6
  44. package/lib/field/Integer/config-ext.json +1 -2
  45. package/lib/field/Percentage/Percentage.tsx +14 -6
  46. package/lib/field/Percentage/config-ext.json +1 -2
  47. package/lib/field/Phone/Phone.tsx +17 -7
  48. package/lib/field/Phone/index.tsx +1 -1
  49. package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
  50. package/lib/field/RadioButtons/config-ext.json +1 -2
  51. package/lib/field/RichText/RichText.tsx +96 -0
  52. package/lib/field/RichText/index.tsx +1 -0
  53. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  54. package/lib/field/ScalarList/config-ext.json +7 -0
  55. package/lib/field/ScalarList/index.tsx +1 -0
  56. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  57. package/lib/field/SemanticLink/config-ext.json +1 -2
  58. package/lib/field/SemanticLink/utils.ts +8 -10
  59. package/lib/field/TextArea/TextArea.tsx +15 -5
  60. package/lib/field/TextArea/config-ext.json +1 -2
  61. package/lib/field/TextContent/TextContent.tsx +9 -2
  62. package/lib/field/TextContent/config-ext.json +1 -2
  63. package/lib/field/TextInput/TextInput.tsx +41 -10
  64. package/lib/field/TextInput/config-ext.json +1 -2
  65. package/lib/field/TextInput/index.tsx +1 -1
  66. package/lib/field/Time/Time.tsx +21 -18
  67. package/lib/field/Time/config-ext.json +1 -2
  68. package/lib/field/URL/URL.tsx +23 -6
  69. package/lib/field/URL/config-ext.json +1 -2
  70. package/lib/field/URL/index.tsx +1 -1
  71. package/lib/field/UserReference/UserReference.tsx +52 -58
  72. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  73. package/lib/field/UserReference/config-ext.json +1 -2
  74. package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
  75. package/lib/helpers/case-utils.tsx +99 -0
  76. package/lib/helpers/common-utils.ts +8 -0
  77. package/lib/helpers/data_page.ts +3 -6
  78. package/lib/helpers/date-format-utils.ts +29 -19
  79. package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
  80. package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
  81. package/lib/helpers/formatters/Boolean.ts +21 -0
  82. package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
  83. package/lib/helpers/formatters/CurrencyMap.ts +915 -0
  84. package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
  85. package/lib/helpers/formatters/{common.js → common.ts} +3 -4
  86. package/lib/helpers/formatters/{index.js → index.ts} +22 -22
  87. package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +65 -85
  89. package/lib/helpers/state-utils.tsx +43 -0
  90. package/lib/helpers/template-utils.ts +4 -8
  91. package/lib/helpers/utils.ts +16 -8
  92. package/lib/helpers/versionHelpers.ts +1 -5
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -84
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +28 -43
  121. package/lib/infra/Reference/Reference.tsx +16 -22
  122. package/lib/infra/Region/Region.tsx +9 -9
  123. package/lib/infra/RootContainer/RootContainer.tsx +82 -125
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +38 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  128. package/lib/infra/View/View.tsx +32 -63
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +51 -69
  131. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  132. package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +122 -114
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
  137. package/lib/template/Confirmation/Confirmation.tsx +25 -53
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +112 -140
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/DefaultForm/utils/index.ts +33 -0
  145. package/lib/template/Details/Details/Details.tsx +24 -28
  146. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  147. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  151. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  152. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  153. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  154. package/lib/template/Details/DynamicTabs/config.json +36 -0
  155. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  156. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
  157. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  158. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  159. package/lib/template/ListPage/ListPage.tsx +12 -16
  160. package/lib/template/ListPage/config-ext.json +1 -2
  161. package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
  162. package/lib/template/ListView/ListView.tsx +245 -306
  163. package/lib/template/ListView/config-ext.json +1 -2
  164. package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
  165. package/lib/template/ListView/{utils.js → utils.ts} +202 -91
  166. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
  167. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  168. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  169. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  170. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  172. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  173. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  174. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  175. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  177. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  179. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  180. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  181. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  182. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  183. package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
  184. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
  185. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  186. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
  187. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
  188. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  189. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  190. package/lib/template/SubTabs/config-ext.json +1 -2
  191. package/lib/template/SubTabs/tabUtils.ts +2 -7
  192. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  193. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  194. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  196. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  197. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  198. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  199. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  200. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  201. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  202. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  204. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  205. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  207. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  208. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  209. package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
  210. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  211. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  212. package/lib/widget/Attachment/Attachment.css +75 -4
  213. package/lib/widget/Attachment/Attachment.tsx +370 -388
  214. package/lib/widget/Attachment/index.tsx +1 -1
  215. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  216. package/lib/widget/CaseHistory/config-ext.json +1 -2
  217. package/lib/widget/CaseHistory/index.tsx +1 -1
  218. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  219. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  220. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
  221. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  222. package/lib/widget/Followers/Followers.tsx +27 -25
  223. package/lib/widget/Followers/config-ext.json +1 -2
  224. package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
  225. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  226. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
  227. package/lib/widget/SummaryItem/index.tsx +1 -1
  228. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  229. package/lib/widget/ToDo/ToDo.css +4 -4
  230. package/lib/widget/ToDo/ToDo.tsx +80 -116
  231. package/lib/widget/ToDo/config-ext.json +1 -2
  232. package/package.json +5 -2
  233. package/lib/helpers/auth.js +0 -483
  234. package/lib/helpers/authManager.js +0 -631
  235. package/lib/helpers/config_access.js +0 -268
  236. package/lib/helpers/formatters/Boolean.js +0 -38
  237. package/lib/helpers/formatters/CurrencyMap.js +0 -908
  238. package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
@@ -1,19 +1,28 @@
1
- import React, { useEffect, useState } from "react";
1
+ import { useEffect, useState } from 'react';
2
2
  import TextField from '@material-ui/core/TextField';
3
+
3
4
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
- import download from "downloadjs";
5
- import SummaryList from '@pega/react-sdk-components/lib/components/widget/SummaryList';
6
- import ActionButtonsForFileUtil from '@pega/react-sdk-components/lib/components/widget/FileUtility/ActionButtonsForFileUtil';
5
+
6
+ import download from 'downloadjs';
7
+ // import SummaryList from '../../SummaryList';
8
+ // import ActionButtonsForFileUtil from '../ActionButtonsForFileUtil';
7
9
  import './FileUtility.css';
8
- import { IconButton, Menu, MenuItem } from '@material-ui/core';
10
+ import { IconButton, Menu, MenuItem, Button, CircularProgress } from '@material-ui/core';
9
11
  import MoreVertIcon from '@material-ui/icons/MoreVert';
10
- import { Button } from '@material-ui/core';
12
+
11
13
  import { validateMaxSize } from '@pega/react-sdk-components/lib/components/helpers/attachmentHelpers';
12
- import { CircularProgress } from "@material-ui/core";
14
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
15
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
13
16
 
14
- declare const PCore;
17
+ interface FileUtilityProps extends PConnProps {
18
+ // If any, enter additional props that only exist on this component
19
+ }
20
+
21
+ export default function FileUtility(props: FileUtilityProps) {
22
+ // Get emitted components from map (so we can get any override that may exist)
23
+ const SummaryList = getComponentFromMap('SummaryList');
24
+ const ActionButtonsForFileUtil = getComponentFromMap('ActionButtonsForFileUtil');
15
25
 
16
- export default function FileUtility(props) {
17
26
  const { getPConnect } = props;
18
27
  const thePConn = getPConnect();
19
28
  const required = true;
@@ -22,8 +31,8 @@ export default function FileUtility(props) {
22
31
  count: 0
23
32
  };
24
33
  const [list, setList] = useState(listTemp);
25
- const headerSvgIcon$ = Utils.getImageSrc('paper-clip', PCore.getAssetLoader().getStaticServerUrl());
26
- const closeSvgIcon = Utils.getImageSrc("times", PCore.getAssetLoader().getStaticServerUrl());
34
+ const headerSvgIcon$ = Utils.getImageSrc('paper-clip', Utils.getSDKStaticConentUrl());
35
+ const closeSvgIcon = Utils.getImageSrc('times', Utils.getSDKStaticConentUrl());
27
36
  const configProps: any = thePConn.resolveConfigProps(thePConn.getConfigProps());
28
37
 
29
38
  const header = configProps.label;
@@ -31,79 +40,94 @@ export default function FileUtility(props) {
31
40
  showfileModal: false,
32
41
  fileList: [],
33
42
  attachedFiles: [],
34
- fileMainButtons: [{ actionID: "attach", jsAction: "attachFiles", name: "Attach files"}],
35
- fileSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: "Cancel"}]
43
+ fileMainButtons: [
44
+ {
45
+ actionID: 'attach',
46
+ jsAction: 'attachFiles',
47
+ name: thePConn.getLocalizedValue('Attach files', '', '')
48
+ }
49
+ ], // 2nd and 3rd args empty string until typedef marked correctly
50
+ fileSecondaryButtons: [
51
+ {
52
+ actionID: 'cancel',
53
+ jsAction: 'cancel',
54
+ name: thePConn.getLocalizedValue('Cancel', '', '')
55
+ }
56
+ ] // 2nd and 3rd args empty string until typedef marked correctly
36
57
  };
37
58
  const [fileData, setFileData] = useState(fileTemp);
38
59
  const linkTemp = {
39
60
  showLinkModal: false,
40
61
  linksList: [],
41
62
  attachedLinks: [],
42
- linkMainButtons: [{ actionID: "attach", jsAction: "attachLinks", name: "Attach links"}],
43
- linkSecondaryButtons: [{ actionID: "cancel", jsAction: "cancel", name: "Cancel"}]
63
+ linkMainButtons: [
64
+ {
65
+ actionID: 'attach',
66
+ jsAction: 'attachLinks',
67
+ name: thePConn.getLocalizedValue('Attach links', '', '')
68
+ }
69
+ ], // 2nd and 3rd args empty string until typedef marked correctly
70
+ linkSecondaryButtons: [
71
+ {
72
+ actionID: 'cancel',
73
+ jsAction: 'cancel',
74
+ name: thePConn.getLocalizedValue('Cancel', '', '')
75
+ }
76
+ ] // 2nd and 3rd args empty string until typedef marked correctly
44
77
  };
45
78
  const [linkData, setLinkData] = useState(linkTemp);
46
79
  const [anchorEl, setAnchorEl] = useState(null);
47
80
  const open = Boolean(anchorEl);
48
- const [link, setLink] = useState({title: '', url: '', disable: true});
81
+ const [link, setLink] = useState({ title: '', url: '', disable: true });
49
82
  const [inProgress, setProgress] = useState(false);
50
83
  const [showViewAllModal, setViewAll] = useState(false);
51
84
  const [vaItems, setFullAttachments] = useState([]);
52
85
 
53
- function addAttachments(attsFromResp: Array<any> = []) {
54
- attsFromResp = attsFromResp.map((respAtt) => {
55
- const updatedAtt = {
56
- ...respAtt,
57
- meta: `${respAtt.category} . ${Utils.generateDateTime(respAtt.createTime, "DateTime-Since")}, ${
58
- respAtt.createdBy
59
- }`
60
- };
61
- if (updatedAtt.type === "FILE") {
62
- updatedAtt.nameWithExt = updatedAtt.fileName;
63
- }
64
- return updatedAtt;
65
- });
66
- return attsFromResp;
86
+ function addAttachments(attsFromResp: any[] = []) {
87
+ attsFromResp = attsFromResp.map(respAtt => {
88
+ const updatedAtt = {
89
+ ...respAtt,
90
+ meta: `${respAtt.category} . ${Utils.generateDateTime(respAtt.createTime, 'DateTime-Since')}, ${respAtt.createdBy}`
91
+ };
92
+ if (updatedAtt.type === 'FILE') {
93
+ updatedAtt.nameWithExt = updatedAtt.fileName;
94
+ }
95
+ return updatedAtt;
96
+ });
97
+ return attsFromResp;
67
98
  }
68
99
 
69
- function getListUtilityItemProps({
70
- att,
71
- cancelFile,
72
- downloadFile,
73
- deleteFile,
74
- removeFile
75
- }) {
100
+ function getListUtilityItemProps({ att, cancelFile, downloadFile, deleteFile, removeFile }) {
76
101
  let actions;
77
102
 
78
-
79
103
  if (att.progress && att.progress !== 100) {
80
104
  actions = [
81
105
  {
82
106
  id: `Cancel-${att.ID}`,
83
- text: "Cancel",
84
- icon: "times",
107
+ text: thePConn.getLocalizedValue('Cancel', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
108
+ icon: 'times',
85
109
  onClick: cancelFile
86
110
  }
87
111
  ];
88
112
  } else if (att.links) {
89
- const isFile = att.type === "FILE";
90
- const ID = att.ID.replace(/\s/gi, "");
113
+ const isFile = att.type === 'FILE';
114
+ const ID = att.ID.replace(/\s/gi, '');
91
115
  const actionsMap = new Map([
92
116
  [
93
- "download",
117
+ 'download',
94
118
  {
95
119
  id: `download-${ID}`,
96
- text: isFile ? "Download" : "Open",
97
- icon: isFile ? "download" : "open",
120
+ text: isFile ? thePConn.getLocalizedValue('Download', '', '') : thePConn.getLocalizedValue('Open', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
121
+ icon: isFile ? 'download' : 'open',
98
122
  onClick: downloadFile
99
123
  }
100
124
  ],
101
125
  [
102
- "delete",
126
+ 'delete',
103
127
  {
104
128
  id: `Delete-${ID}`,
105
- text: "Delete",
106
- icon: "trash",
129
+ text: thePConn.getLocalizedValue('Delete', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
130
+ icon: 'trash',
107
131
  onClick: deleteFile
108
132
  }
109
133
  ]
@@ -118,8 +142,8 @@ export default function FileUtility(props) {
118
142
  actions = [
119
143
  {
120
144
  id: `Remove-${att.ID}`,
121
- text: "Remove",
122
- icon: "trash",
145
+ text: thePConn.getLocalizedValue('Remove', '', ''), // 2nd and 3rd args empty string until typedef marked correctly
146
+ icon: 'trash',
123
147
  onClick: removeFile
124
148
  }
125
149
  ];
@@ -129,13 +153,13 @@ export default function FileUtility(props) {
129
153
  id: att.ID,
130
154
  visual: {
131
155
  icon: Utils.getIconForAttachment(att),
132
- progress: att.progress === 100 ? undefined: att.progress,
156
+ progress: att.progress === 100 ? undefined : att.progress
133
157
  },
134
158
  primary: {
135
159
  type: att.type,
136
160
  name: att.name,
137
- icon: "open",
138
- click: downloadFile,
161
+ icon: 'open',
162
+ click: downloadFile
139
163
  },
140
164
  secondary: {
141
165
  text: att.meta
@@ -147,35 +171,37 @@ export default function FileUtility(props) {
147
171
  function fileDownload(data, fileName, ext) {
148
172
  const file = ext ? `${fileName}.${ext}` : fileName;
149
173
  download(atob(data), file);
150
- };
174
+ }
151
175
 
152
176
  function downloadAttachedFile(att: any) {
153
177
  const attachUtils = PCore.getAttachmentUtils();
154
- const {ID, name, extension, type} = att;
178
+ const { ID, name, extension, type } = att;
155
179
  const context = thePConn.getContextName();
156
180
 
157
181
  attachUtils
158
- .downloadAttachment(ID, context)
159
- .then((content) => {
160
- if (type === "FILE") {
161
- fileDownload(content.data, name, extension);
162
- } else if (type === "URL") {
163
- let { data } = content;
164
- if (!/^(http|https):\/\//.test(data)) {
165
- data = `//${data}`;
182
+ // @ts-ignore - 3rd parameter "responseEncoding" is optional
183
+ .downloadAttachment(ID, context)
184
+ .then((content: any) => {
185
+ if (type === 'FILE') {
186
+ fileDownload(content.data, name, extension);
187
+ } else if (type === 'URL') {
188
+ let { data } = content;
189
+ if (!/^(http|https):\/\//.test(data)) {
190
+ data = `//${data}`;
191
+ }
192
+ window.open(content.data, '_blank');
166
193
  }
167
- window.open(content.data, "_blank");
168
- }
169
- })
170
- .catch();
194
+ })
195
+ .catch();
171
196
  }
172
197
 
173
198
  function deleteAttachedFile(att: any) {
174
199
  const attachUtils = PCore.getAttachmentUtils();
175
- const {ID} = att;
200
+ const { ID } = att;
176
201
  const context = thePConn.getContextName();
177
202
 
178
- attachUtils.deleteAttachment(ID, context)
203
+ attachUtils
204
+ .deleteAttachment(ID, context)
179
205
  .then(() => {
180
206
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
181
207
  getAttachments();
@@ -184,60 +210,57 @@ export default function FileUtility(props) {
184
210
  }
185
211
 
186
212
  const getAttachments = () => {
187
-
188
213
  const attachmentUtils = PCore.getAttachmentUtils();
189
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
214
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
190
215
 
191
- if (caseID && caseID !== "") {
216
+ if (caseID && caseID !== '') {
192
217
  const attPromise = attachmentUtils.getCaseAttachments(caseID, thePConn.getContextName());
193
218
 
194
- attPromise
195
- .then( (resp) => {
196
- const arFullListAttachments = addAttachments(resp);
197
- const attachmentsCount = arFullListAttachments.length;
198
- const arItems: any = arFullListAttachments.slice(0, 3).map((att) => {
199
- return getListUtilityItemProps({
200
- att,
201
- downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
202
- cancelFile: null,
203
- deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
204
- removeFile: null
205
- });
206
- });
207
- const viewAllarItems: any = arFullListAttachments.map((att) => {
208
- return getListUtilityItemProps({
209
- att,
210
- downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
211
- cancelFile: null,
212
- deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
213
- removeFile: null
214
- });
219
+ attPromise.then((resp: any) => {
220
+ const arFullListAttachments = addAttachments(resp);
221
+ const attachmentsCount = arFullListAttachments.length;
222
+ const arItems: any = arFullListAttachments.slice(0, 3).map(att => {
223
+ return getListUtilityItemProps({
224
+ att,
225
+ downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
226
+ cancelFile: null,
227
+ deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
228
+ removeFile: null
215
229
  });
216
- setProgress(false);
217
- setList((current) => {
218
- return {...current, count: attachmentsCount, data: arItems}
230
+ });
231
+ const viewAllarItems: any = arFullListAttachments.map(att => {
232
+ return getListUtilityItemProps({
233
+ att,
234
+ downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
235
+ cancelFile: null,
236
+ deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
237
+ removeFile: null
219
238
  });
220
- setFullAttachments(viewAllarItems);
221
239
  });
240
+ setProgress(false);
241
+ setList(current => {
242
+ return { ...current, count: attachmentsCount, data: arItems };
243
+ });
244
+ setFullAttachments(viewAllarItems);
245
+ });
222
246
  }
223
- }
247
+ };
224
248
 
225
249
  useEffect(() => {
226
250
  getAttachments();
227
251
  }, []);
228
252
 
229
-
230
253
  useEffect(() => {
231
254
  PCore.getPubSubUtils().subscribe(
232
- PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
255
+ (PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
233
256
  getAttachments,
234
- "caseAttachmentsUpdateFromCaseview"
257
+ 'caseAttachmentsUpdateFromCaseview'
235
258
  );
236
259
 
237
260
  return () => {
238
261
  PCore.getPubSubUtils().unsubscribe(
239
- PCore.getEvents().getCaseEvent().CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
240
- "caseAttachmentsUpdateFromCaseview"
262
+ (PCore.getEvents().getCaseEvent() as any).CASE_ATTACHMENTS_UPDATED_FROM_CASEVIEW,
263
+ 'caseAttachmentsUpdateFromCaseview'
241
264
  );
242
265
  };
243
266
  }, []);
@@ -245,19 +268,19 @@ export default function FileUtility(props) {
245
268
  function setNewFiles(arFiles) {
246
269
  let index = 0;
247
270
  for (const file of arFiles) {
248
- if (!validateMaxSize(file, 5)) {
271
+ if (!validateMaxSize(file, '5')) {
249
272
  file.error = true;
250
- file.meta = "File is too big. Max allowed size is 5MB.";
273
+ file.meta = 'File is too big. Max allowed size is 5MB.';
251
274
  }
252
275
  file.mimeType = file.type;
253
276
  file.icon = Utils.getIconFromFileType(file.type);
254
277
  file.ID = `${new Date().getTime()}I${index}`;
255
- index+=1;
278
+ index += 1;
256
279
  }
257
280
  return arFiles;
258
281
  }
259
282
 
260
- function getFiles(arFiles: Array<any>): Array<any> {
283
+ function getFiles(arFiles: any[]): any[] {
261
284
  return setNewFiles(arFiles);
262
285
  }
263
286
 
@@ -276,14 +299,12 @@ export default function FileUtility(props) {
276
299
  removeFile: null
277
300
  });
278
301
  });
279
- setFileData((current) => {
280
- return {...current, fileList: arFileList$, attachedFiles: myFiles}
302
+ setFileData(current => {
303
+ return { ...current, fileList: arFileList$, attachedFiles: myFiles };
281
304
  });
282
305
  }
283
306
 
284
-
285
-
286
- const handleClick = (event) => {
307
+ const handleClick = event => {
287
308
  setAnchorEl(event.currentTarget);
288
309
  };
289
310
 
@@ -292,8 +313,8 @@ export default function FileUtility(props) {
292
313
  };
293
314
 
294
315
  function onAddFilesClick() {
295
- setFileData((current) => {
296
- return {...current, showfileModal: true}
316
+ setFileData(current => {
317
+ return { ...current, showfileModal: true };
297
318
  });
298
319
  setAnchorEl(null);
299
320
  }
@@ -304,82 +325,78 @@ export default function FileUtility(props) {
304
325
  if (item !== null) {
305
326
  attachedFiles = attachedFiles.filter(ele => ele.ID !== item.id);
306
327
  fileList = fileList.filter(ele => ele.id !== item.id);
307
- setFileData((current) => {
308
- return {...current, fileList, attachedFiles}
328
+ setFileData(current => {
329
+ return { ...current, fileList, attachedFiles };
309
330
  });
310
331
  }
311
332
  }
312
333
 
313
334
  function closeFilePopup() {
314
- setFileData((current) => {
315
- return {...current, showfileModal: false}
335
+ setFileData(current => {
336
+ return { ...current, showfileModal: false };
316
337
  });
317
338
  }
318
339
 
319
340
  function onAttachFiles() {
320
341
  const attachmentUtils = PCore.getAttachmentUtils();
321
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
342
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
322
343
  const onUploadProgress = () => {};
323
344
  const errorHandler = () => {};
324
- closeFilePopup()
325
- if (fileData.attachedFiles && fileData.attachedFiles.length > 0 ) {
345
+ closeFilePopup();
346
+ if (fileData.attachedFiles && fileData.attachedFiles.length > 0) {
326
347
  setProgress(true);
327
348
  }
328
- for (const file of fileData.attachedFiles) {
329
- attachmentUtils
330
- .uploadAttachment(
331
- file,
332
- onUploadProgress,
333
- errorHandler,
334
- thePConn.getContextName()
335
- )
336
- .then((fileResponse) => {
337
- if (fileResponse.type === "File") {
338
- attachmentUtils.linkAttachmentsToCase(
339
- caseID,
340
- [ fileResponse ],
341
- "File",
342
- thePConn.getContextName()
343
- )
344
- .then(() => {
345
- setFileData((current) => {
346
- return {...current, fileList: [], attachedFiles: []};
347
- });
348
- getAttachments();
349
- })
350
- .catch();
349
+
350
+ Promise.allSettled(
351
+ fileData.attachedFiles.map(file => attachmentUtils.uploadAttachment(file, onUploadProgress, errorHandler, thePConn.getContextName()))
352
+ )
353
+ .then((fileResponses: any) => {
354
+ const uploadedFiles: any = [];
355
+ fileResponses.forEach(fileResponse => {
356
+ if (fileResponse.status === 'fulfilled') {
357
+ uploadedFiles.push(fileResponse.value);
358
+ }
359
+ });
360
+ if (uploadedFiles.length > 0) {
361
+ (attachmentUtils.linkAttachmentsToCase(caseID, uploadedFiles, 'File', thePConn.getContextName()) as Promise<any>)
362
+ .then(() => {
363
+ setFileData(current => {
364
+ return { ...current, fileList: [], attachedFiles: [] };
365
+ });
366
+ getAttachments();
367
+ })
368
+ .catch();
351
369
  }
352
370
  })
353
371
  .catch();
354
- }
355
372
  }
356
373
 
357
374
  function onAddLinksClick() {
358
- setLinkData((current) => {
359
- return {...current, showLinkModal: true}
375
+ setLinkData(current => {
376
+ return { ...current, showLinkModal: true };
360
377
  });
361
378
  setAnchorEl(null);
362
379
  }
363
380
 
364
381
  function closeAddLinksPopup() {
365
- setLinkData((current) => {
366
- return {...current, showLinkModal: false}
382
+ setLinkData(current => {
383
+ return { ...current, showLinkModal: false };
367
384
  });
368
385
  }
369
386
 
370
- const fieldlinkOnChange = (event) => {
387
+ const fieldlinkOnChange = event => {
371
388
  const title = event.target.value;
372
- setLink((current) => {
373
- const updatedData = {...current, title};
389
+ setLink(current => {
390
+ const updatedData = { ...current, title };
374
391
  updatedData.disable = !(updatedData.title && updatedData.url);
375
392
  return updatedData;
376
393
  });
377
- }
394
+ };
378
395
 
379
396
  function fieldurlOnChange(event) {
380
397
  const url = event.target.value;
381
- setLink((current) => {
382
- const updatedData = {...current, url}
398
+ setLink(current => {
399
+ const updatedData = { ...current, url };
383
400
  updatedData.disable = !(updatedData.title && updatedData.url);
384
401
  return updatedData;
385
402
  });
@@ -390,12 +407,12 @@ export default function FileUtility(props) {
390
407
  const localList: any = linkData.linksList.slice();
391
408
  const url = link.url;
392
409
  if (!/^(http|https):\/\//.test(link.url)) {
393
- link.url = `http://${link.url}`;
410
+ link.url = `http://${link.url}`;
394
411
  }
395
412
 
396
413
  // list for display
397
414
  let oLink: any = {};
398
- oLink.icon = "chain";
415
+ oLink.icon = 'chain';
399
416
  oLink.ID = `${new Date().getTime()}`;
400
417
  oLink = getListUtilityItemProps({
401
418
  att: oLink,
@@ -404,11 +421,11 @@ export default function FileUtility(props) {
404
421
  deleteFile: null,
405
422
  removeFile: null
406
423
  });
407
- oLink.type = "URL";
424
+ oLink.type = 'URL';
408
425
  oLink.primary.type = oLink.type;
409
- oLink.visual.icon = "chain";
426
+ oLink.visual.icon = 'chain';
410
427
  oLink.primary.name = link.title;
411
- oLink.primary.icon = "open";
428
+ oLink.primary.icon = 'open';
412
429
  oLink.secondary.text = url;
413
430
 
414
431
  localList.push(oLink);
@@ -422,11 +439,15 @@ export default function FileUtility(props) {
422
439
  attachedLink.url = url;
423
440
 
424
441
  attachedListTemp.push(attachedLink);
425
- setLinkData((current) => {
426
- return {...current, linksList: localList, attachedLinks: attachedListTemp}
442
+ setLinkData(current => {
443
+ return {
444
+ ...current,
445
+ linksList: localList,
446
+ attachedLinks: attachedListTemp
447
+ };
427
448
  });
428
449
  // clear values
429
- setLink({title: '', url: '', disable: true});
450
+ setLink({ title: '', url: '', disable: true });
430
451
  }
431
452
 
432
453
  function removeLinksFromList(item: any) {
@@ -435,133 +456,190 @@ export default function FileUtility(props) {
435
456
  if (item !== null) {
436
457
  attachedLinks = attachedLinks.filter(ele => ele.id !== item.id);
437
458
  linksList = linksList.filter(ele => ele.id !== item.id);
438
- setLinkData((current) => {
439
- return {...current, linksList, attachedLinks}
459
+ setLinkData(current => {
460
+ return { ...current, linksList, attachedLinks };
440
461
  });
441
462
  }
442
463
  }
443
464
 
444
465
  function onAttachLinks() {
445
466
  const attachmentUtils = PCore.getAttachmentUtils();
446
- const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
467
+ const caseID = thePConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID, ''); // 2nd arg empty string until typedef marked correctly
447
468
  const links = linkData.attachedLinks;
448
469
  closeAddLinksPopup();
449
470
  const linksToAttach = links.map((item: any) => ({
450
- type: "URL",
451
- category: "URL",
471
+ type: 'URL',
472
+ category: 'URL',
452
473
  url: item.url,
453
474
  name: item.linkTitle
454
475
  }));
455
476
 
456
477
  if (linksToAttach && linksToAttach.length > 0) {
457
478
  setProgress(true);
458
- attachmentUtils
459
- .linkAttachmentsToCase(caseID, linksToAttach, "URL", thePConn.getContextName())
460
- .then( () => {
461
- setLinkData((current) => {
462
- return {...current, linksList: [], attachedLinks: []};
463
- });
464
- getAttachments();
465
- })
466
- .catch(setProgress(false));
479
+ (attachmentUtils.linkAttachmentsToCase(caseID, linksToAttach, 'URL', thePConn.getContextName()) as Promise<any>)
480
+ .then(() => {
481
+ setLinkData(current => {
482
+ return { ...current, linksList: [], attachedLinks: [] };
483
+ });
484
+ getAttachments();
485
+ })
486
+ .catch(() => setProgress(false));
467
487
  }
468
488
  }
469
489
 
470
490
  return (
471
- <div className="psdk-utility">
472
- {inProgress && (<div className="progress-div"><CircularProgress /></div>)}
473
- <div className="psdk-header">
474
- <img className="psdk-file-utility-card-svg-icon" src={headerSvgIcon$}></img>
475
- <div className="header-text">{header}</div>
476
- <div className="psdk-utility-count" id="attachments-count">{list.count}</div>
477
- <div style={{flexGrow: 1}}></div>
491
+ <div className='psdk-utility'>
492
+ {inProgress && (
493
+ <div className='progress-div'>
494
+ <CircularProgress />
495
+ </div>
496
+ )}
497
+ <div className='psdk-header'>
498
+ <img className='psdk-file-utility-card-svg-icon' src={headerSvgIcon$} />
499
+ <div className='header-text'>{header}</div>
500
+ <div className='psdk-utility-count' id='attachments-count'>
501
+ {list.count}
502
+ </div>
503
+ <div style={{ flexGrow: 1 }} />
478
504
  <div>
479
505
  <IconButton
480
- id="long-button"
506
+ id='long-button'
481
507
  aria-controls={open ? 'simple-menu' : undefined}
482
508
  aria-expanded={open ? 'true' : undefined}
483
- aria-haspopup="true"
509
+ aria-haspopup='true'
484
510
  onClick={handleClick}
485
511
  >
486
- <MoreVertIcon />
512
+ <MoreVertIcon />
487
513
  </IconButton>
488
- <Menu style={{marginTop: '3rem'}}
489
- id="simple-menu"
490
- anchorEl={anchorEl}
491
- keepMounted
492
- open={Boolean(anchorEl)}
493
- onClose={handleClose}
494
- >
495
- <MenuItem style={{fontSize: '14px'}} onClick={onAddFilesClick}>Add Files</MenuItem>
496
- <MenuItem style={{fontSize: '14px'}} onClick={onAddLinksClick}>Add Links</MenuItem>
514
+ <Menu style={{ marginTop: '3rem' }} id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
515
+ <MenuItem style={{ fontSize: '14px' }} onClick={onAddFilesClick}>
516
+ {thePConn.getLocalizedValue('Add files', '', '')}
517
+ </MenuItem>{' '}
518
+ {/* 2nd and 3rd args empty string until typedef marked correctly */}
519
+ <MenuItem style={{ fontSize: '14px' }} onClick={onAddLinksClick}>
520
+ {thePConn.getLocalizedValue('Add links', '', '')}
521
+ </MenuItem>{' '}
522
+ {/* 2nd and 3rd args empty string until typedef marked correctly */}
497
523
  </Menu>
498
524
  </div>
499
525
  </div>
500
- {list.data.length > 0 && (<div style={{marginTop: '1rem'}}>
501
- <SummaryList arItems$={list.data}></SummaryList>
502
- </div>)}
503
- {list.count > 3 && (<div className="psdk-utility-view-all">
504
- <Button style={{textTransform: 'none'}} color="primary" onClick = {() => setViewAll(true)}>View all</Button>
505
- </div>)}
526
+ {list.data.length > 0 && (
527
+ <div style={{ marginTop: '1rem' }}>
528
+ <SummaryList arItems$={list.data} />
529
+ </div>
530
+ )}
531
+ {list.count > 3 && (
532
+ <div className='psdk-utility-view-all'>
533
+ <Button style={{ textTransform: 'none' }} color='primary' onClick={() => setViewAll(true)}>
534
+ View all
535
+ </Button>
536
+ </div>
537
+ )}
506
538
  {fileData.showfileModal && (
507
- <div className="psdk-dialog-background">
508
- <div className="psdk-modal-file-top">
509
- <h3>Add local files</h3>
510
- <div className="psdk-modal-body">
511
- <div className="psdk-modal-file-selector">
512
- <label htmlFor='upload-files'>
513
- <input style={{ display: 'none' }} id='upload-files' name='upload-files' type='file' multiple onChange={uploadMyFiles}/>
514
- <Button variant='outlined' color='primary' component="span">Upload file(s)</Button>
515
- </label>
539
+ <div className='psdk-dialog-background'>
540
+ <div className='psdk-modal-file-top'>
541
+ <h3>{thePConn.getLocalizedValue('Add local files', '', '')}</h3>
542
+ <div className='psdk-modal-body'>
543
+ <div className='psdk-modal-file-selector'>
544
+ <label htmlFor='upload-files'>
545
+ <input style={{ display: 'none' }} id='upload-files' name='upload-files' type='file' multiple onChange={uploadMyFiles} />
546
+ <Button variant='outlined' color='primary' component='span'>
547
+ {thePConn.getLocalizedValue('Attach files', '', '')}
548
+ </Button>{' '}
549
+ {/* 2nd and 3rd args empty string until typedef marked correctly */}
550
+ </label>
551
+ </div>
552
+ {fileData.fileList.length > 0 && (
553
+ <div style={{ marginTop: '1rem' }}>
554
+ <SummaryList menuIconOverride$='trash' arItems$={fileData.fileList} menuIconOverrideAction$={removeFileFromList} />
555
+ </div>
556
+ )}
557
+ {fileData.fileList.length === 0 && <div />}
558
+ <ActionButtonsForFileUtil
559
+ arMainButtons={fileData.fileMainButtons}
560
+ arSecondaryButtons={fileData.fileSecondaryButtons}
561
+ primaryAction={onAttachFiles}
562
+ secondaryAction={closeFilePopup}
563
+ />
516
564
  </div>
517
- {fileData.fileList.length > 0 && (<div style={{marginTop: '1rem'}}>
518
- <SummaryList menuIconOverride$='trash' arItems$={fileData.fileList} menuIconOverrideAction$={removeFileFromList}></SummaryList>
519
- </div>)}
520
- {fileData.fileList.length === 0 && (<div></div>)}
521
- <ActionButtonsForFileUtil arMainButtons={fileData.fileMainButtons} arSecondaryButtons={fileData.fileSecondaryButtons}
522
- primaryAction={onAttachFiles} secondaryAction={closeFilePopup}></ActionButtonsForFileUtil>
523
565
  </div>
524
566
  </div>
525
- </div>
526
567
  )}
527
568
  {linkData.showLinkModal && (
528
- <div className="psdk-dialog-background">
529
- <div className="psdk-modal-file-top">
530
- <h3>Add links</h3>
531
- <div className="psdk-modal-body">
532
- <div className="psdk-modal-links-row">
533
- <div className="psdk-links-two-column">
534
- <div className="psdk-modal-link-data">
535
- <TextField fullWidth variant="outlined" label="Link title" size="small" required={required} value={link.title} onChange={fieldlinkOnChange}/>
536
- </div>
537
- <div className="psdk-modal-link-data">
538
- <TextField fullWidth variant="outlined" label="URL" size="small" required={required} value={link.url} onChange={fieldurlOnChange}/>
539
- </div>
569
+ <div className='psdk-dialog-background'>
570
+ <div className='psdk-modal-file-top'>
571
+ <h3>{thePConn.getLocalizedValue('Add links', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
572
+ <div className='psdk-modal-body'>
573
+ <div className='psdk-modal-links-row'>
574
+ <div className='psdk-links-two-column'>
575
+ <div className='psdk-modal-link-data'>
576
+ <TextField
577
+ fullWidth
578
+ variant='outlined'
579
+ label='Link title'
580
+ size='small'
581
+ required={required}
582
+ value={link.title}
583
+ onChange={fieldlinkOnChange}
584
+ />
540
585
  </div>
541
- <div className="psdk-modal-link-add">
542
- <Button className="psdk-add-link-action" color="primary" variant="contained" component="span" onClick={addLink} disabled={link.disable}>Add Link</Button>
586
+ <div className='psdk-modal-link-data'>
587
+ <TextField
588
+ fullWidth
589
+ variant='outlined'
590
+ label='URL'
591
+ size='small'
592
+ required={required}
593
+ value={link.url}
594
+ onChange={fieldurlOnChange}
595
+ />
543
596
  </div>
544
597
  </div>
545
- {linkData.linksList.length > 0 && (<div style={{marginTop: '1rem'}}>
546
- <SummaryList menuIconOverride$='trash' arItems$={linkData.linksList} menuIconOverrideAction$={removeLinksFromList}></SummaryList>
547
- </div>)}
548
- <ActionButtonsForFileUtil arMainButtons={linkData.linkMainButtons} arSecondaryButtons={linkData.linkSecondaryButtons}
549
- primaryAction={onAttachLinks} secondaryAction={closeAddLinksPopup}></ActionButtonsForFileUtil>
598
+ <div className='psdk-modal-link-add'>
599
+ <Button
600
+ className='psdk-add-link-action'
601
+ color='primary'
602
+ variant='contained'
603
+ component='span'
604
+ onClick={addLink}
605
+ disabled={link.disable}
606
+ >
607
+ {thePConn.getLocalizedValue('Add link', '', '')}
608
+ </Button>{' '}
609
+ {/* 2nd and 3rd args empty string until typedef marked correctly */}
610
+ </div>
611
+ </div>
612
+ {linkData.linksList.length > 0 && (
613
+ <div style={{ marginTop: '1rem' }}>
614
+ <SummaryList menuIconOverride$='trash' arItems$={linkData.linksList} menuIconOverrideAction$={removeLinksFromList} />
615
+ </div>
616
+ )}
617
+ <ActionButtonsForFileUtil
618
+ arMainButtons={linkData.linkMainButtons}
619
+ arSecondaryButtons={linkData.linkSecondaryButtons}
620
+ primaryAction={onAttachLinks}
621
+ secondaryAction={closeAddLinksPopup}
622
+ />
550
623
  </div>
551
624
  </div>
552
625
  </div>
553
626
  )}
554
- {showViewAllModal && (<div className="psdk-dialog-background">
555
- <div className="psdk-modal-file-top">
556
- <div className="psdk-view-all-header">
557
- <h3>Attachments</h3>
627
+ {showViewAllModal && (
628
+ <div className='psdk-dialog-background'>
629
+ <div className='psdk-modal-file-top'>
630
+ <div className='psdk-view-all-header'>
631
+ <h3>{thePConn.getLocalizedValue('Attachments', '', '')}</h3> {/* 2nd and 3rd args empty string until typedef marked correctly */}
558
632
  {/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
559
- <button type="button" className="psdk-close-button" onClick = {() => setViewAll(false)}><img className="psdk-utility-card-actions-svg-icon" src={closeSvgIcon}></img></button>
633
+ <button type='button' className='psdk-close-button' onClick={() => setViewAll(false)}>
634
+ <img className='psdk-utility-card-actions-svg-icon' src={closeSvgIcon} />
635
+ </button>
636
+ </div>
637
+ <div className='psdk-view-all-body'>
638
+ <SummaryList arItems$={vaItems} />
639
+ </div>
560
640
  </div>
561
- <div className="psdk-view-all-body"><SummaryList arItems$={vaItems}></SummaryList></div>
562
641
  </div>
563
- </div>)}
642
+ )}
564
643
  </div>
565
-
566
- )
644
+ );
567
645
  }