@pega/custom-dx-components 2.0.8 → 2.0.9

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 (142) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +29 -7
  3. package/src/tasks/create/index.js +46 -6
  4. package/src/tasks/create/templates/Constellation/Field/Boolean/Boolean.js.mustache +38 -0
  5. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +26 -0
  6. package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +145 -0
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +44 -0
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/event-utils.js.mustache +18 -0
  9. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +171 -0
  10. package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
  11. package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +195 -0
  12. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +327 -0
  13. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +44 -0
  14. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +254 -0
  15. package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +7 -0
  16. package/src/tasks/create/templates/Constellation/Field/Date/suggestions-handler.js +10 -0
  17. package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +256 -0
  18. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +93 -0
  19. package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js +286 -0
  20. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +327 -0
  21. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +44 -0
  22. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +252 -0
  23. package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +7 -0
  24. package/src/tasks/create/templates/Constellation/Field/DateTime/suggestions-handler.js +10 -0
  25. package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +278 -0
  26. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +44 -0
  27. package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.js.mustache +18 -0
  28. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +272 -0
  29. package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +7 -0
  30. package/src/tasks/create/templates/Constellation/Field/Decimal/suggestions-handler.js +10 -0
  31. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +291 -0
  32. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
  33. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.js.mustache +18 -0
  34. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +300 -0
  35. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +7 -0
  36. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/suggestions-handler.js +10 -0
  37. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +93 -0
  38. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
  39. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.js.mustache +18 -0
  40. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +275 -0
  41. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +7 -0
  42. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/suggestions-handler.js +10 -0
  43. package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +347 -0
  44. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +44 -0
  45. package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.js.mustache +18 -0
  46. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +335 -0
  47. package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +7 -0
  48. package/src/tasks/create/templates/Constellation/Field/Integer/suggestions-handler.js +10 -0
  49. package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +114 -0
  50. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +44 -0
  51. package/src/tasks/create/templates/Constellation/Field/Picklist/event-utils.js.mustache +18 -0
  52. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +308 -0
  53. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
  54. package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +7 -0
  55. package/src/tasks/create/templates/Constellation/Field/Picklist/suggestions-handler.js +10 -0
  56. package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +62 -0
  57. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +44 -0
  58. package/src/tasks/create/templates/Constellation/Field/Text/index.jsx.mustache +60 -0
  59. package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +7 -0
  60. package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +111 -0
  61. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +44 -0
  62. package/src/tasks/create/templates/Constellation/Field/Text-Email/event-utils.js.mustache +18 -0
  63. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +189 -0
  64. package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +7 -0
  65. package/src/tasks/create/templates/Constellation/Field/Text-Email/suggestions-handler.js +10 -0
  66. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
  67. package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.js +27 -0
  68. package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +111 -0
  69. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +44 -0
  70. package/src/tasks/create/templates/Constellation/Field/Text-Input/event-utils.js.mustache +18 -0
  71. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +196 -0
  72. package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +7 -0
  73. package/src/tasks/create/templates/Constellation/Field/Text-Input/suggestions-handler.js +10 -0
  74. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
  75. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +111 -0
  76. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
  77. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/event-utils.js.mustache +18 -0
  78. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +189 -0
  79. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +7 -0
  80. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/suggestions-handler.js +10 -0
  81. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
  82. package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +123 -0
  83. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
  84. package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.js.mustache +18 -0
  85. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +223 -0
  86. package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +7 -0
  87. package/src/tasks/create/templates/Constellation/Field/Text-Phone/suggestions-handler.js +10 -0
  88. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
  89. package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +237 -0
  90. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +44 -0
  91. package/src/tasks/create/templates/Constellation/Field/Text-URL/event-utils.js.mustache +18 -0
  92. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +232 -0
  93. package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +7 -0
  94. package/src/tasks/create/templates/Constellation/Field/Text-URL/suggestions-handler.js +10 -0
  95. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
  96. package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +185 -0
  97. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
  98. package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.jsx.mustache +213 -0
  99. package/src/tasks/create/templates/Constellation/Field/TimeofDay/styles.js.mustache +7 -0
  100. package/src/tasks/create/templates/Constellation/Field/TimeofDay/suggestions-handler.js +10 -0
  101. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +286 -0
  102. package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
  103. package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +35 -0
  104. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +99 -0
  105. package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +7 -0
  106. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
  107. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +42 -0
  108. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +99 -0
  109. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +7 -0
  110. package/src/tasks/create/templates/Constellation/Template/FORM/DefaultForm.svg +29 -0
  111. package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +45 -0
  112. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +49 -0
  113. package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +7 -0
  114. package/src/tasks/create/templates/Constellation/Template/FORM-region/TwoColumn.svg +38 -0
  115. package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +27 -0
  116. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +43 -0
  117. package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
  118. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.js.mustache +29 -0
  119. package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
  120. package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +32 -0
  121. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +68 -0
  122. package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -0
  123. package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +7 -0
  124. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +226 -0
  125. package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
  126. package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +23 -0
  127. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +75 -0
  128. package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +7 -0
  129. package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
  130. package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +59 -0
  131. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
  132. package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +7 -0
  133. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.js.mustache +73 -0
  134. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
  135. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.js.mustache +239 -0
  136. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +66 -0
  137. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
  138. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +7 -0
  139. package/src/tasks/init/template/package.json.mustache +6 -1
  140. package/src/tasks/publish/bundle/builder/index.js +49 -5
  141. package/src/tasks/publish/bundle/builder/webpack.config.js +7 -3
  142. package/src/tasks/validator/index.js +107 -8
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "allowedApplications": {{{ALLOWEDAPPS}}},
9
+ "componentKey": "{{COMPONENT_KEY}}",
10
+ "type": "{{TYPE}}",
11
+ "subtype": {{{SUB_TYPE}}},
12
+ "icon": "OneColumnPage.svg",
13
+ "properties": [
14
+ {
15
+ "name": "label",
16
+ "label": "Label value",
17
+ "format": "TEXT"
18
+ }
19
+ ],
20
+ "defaultConfig": {
21
+ "label": "@L $this.label"
22
+ }
23
+ }
@@ -0,0 +1,75 @@
1
+ import { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Table, Text } from '@pega/cosmos-react-core';
4
+
5
+ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
6
+
7
+
8
+ // Duplicated runtime code from Constellation Design System Component
9
+
10
+ // props passed in combination of props from property panel (config.json) and run time props from Constellation
11
+ // any default values in config.pros should be set in defaultProps at bottom of this file
12
+ export default function {{COMPONENT_CLASS_NAME}}(props) {
13
+ const { getPConnect, label } = props;
14
+ const pConn = getPConnect();
15
+ const [history, setHistory] = useState([]);
16
+ const [isLoading, setIsLoading] = useState(true);
17
+ const caseID = pConn.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
18
+ const context = pConn.getContextName();
19
+
20
+ const columns = [
21
+ { renderer: 'date', label: pConn.getLocalizedValue('Date') },
22
+ { renderer: 'description', label: pConn.getLocalizedValue('Description') },
23
+ { renderer: 'user', label: pConn.getLocalizedValue('Performed by') }
24
+ ];
25
+
26
+ useEffect(() => {
27
+ const payload = { dataViewParameters: [{ CaseInstanceKey: caseID }] };
28
+ PCore.getDataApiUtils()
29
+ .getData('D_pyWorkHistory', payload, context)
30
+ .then((response) => {
31
+ setIsLoading(false);
32
+ if (response.data.data !== null) {
33
+ setHistory(
34
+ response.data.data.map((entry, index) => {
35
+ {{! pick new delimiteres for mustache }}
36
+ {{=<% %>=}}
37
+ return {
38
+ date: new Date(entry.pxTimeCreated).toLocaleString(),
39
+ description: <Text style={{ wordBreak: 'break-word' }}>{entry.pyMessageKey}</Text>,
40
+ user: entry.pyPerformer,
41
+ id: index
42
+ };
43
+ <%={{ }}=%> {{! revert delimiteres for mustache }}
44
+ })
45
+ );
46
+ } else {
47
+ setHistory([]);
48
+ }
49
+ })
50
+ .catch(() => {
51
+ setHistory([]);
52
+ setIsLoading(false);
53
+ });
54
+ }, [caseID, context]);
55
+ return (
56
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
57
+ <Table
58
+ title={pConn.getLocalizedValue(label)}
59
+ columns={columns}
60
+ data={history}
61
+ loading={isLoading}
62
+ loadingMessage={pConn.getLocalizedValue('Loading case history')}
63
+ />
64
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
65
+ );
66
+
67
+ }
68
+
69
+ {{COMPONENT_CLASS_NAME}}.defaultProps = {
70
+
71
+ };
72
+
73
+ {{COMPONENT_CLASS_NAME}}.propTypes = {
74
+ getPConnect: PropTypes.func.isRequired
75
+ };
@@ -0,0 +1,7 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ export default styled.div(() => {
4
+ return css`
5
+ margin: 8px 0;
6
+ `;
7
+ });
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="100px" height="70px" viewBox="0 0 100 70" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>1 col </title>
4
+ <defs>
5
+ <rect id="path-1" x="0" y="0" width="100" height="70"></rect>
6
+ </defs>
7
+ <g id="Concepts" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="Templates" transform="translate(-98.000000, -108.000000)">
9
+ <g id="Change-template" transform="translate(42.000000, 36.000000)">
10
+ <g id="1-col-" transform="translate(56.000000, 72.000000)">
11
+ <mask id="mask-2" fill="white">
12
+ <use xlink:href="#path-1"></use>
13
+ </mask>
14
+ <rect stroke="#A5A8BC" stroke-width="0.5" x="0.25" y="0.25" width="99.5" height="69.5"></rect>
15
+ <g id="white" mask="url(#mask-2)" fill="#FFFFFF">
16
+ <g transform="translate(3.000000, 3.000000)" id="Rectangle">
17
+ <rect x="0" y="0" width="94" height="66.5"></rect>
18
+ </g>
19
+ </g>
20
+ <g id="gray" mask="url(#mask-2)" fill="#8084A7">
21
+ <g transform="translate(6.000000, 6.000000)" id="Rectangle">
22
+ <rect x="0" y="-2.84217094e-14" width="88" height="77.8"></rect>
23
+ </g>
24
+ </g>
25
+ <g id="labels" mask="url(#mask-2)" font-family="OpenSans-Semibold, Open Sans" font-size="11" font-weight="500">
26
+ <g transform="translate(44.000000, 17.000000)" id="A">
27
+ <text>
28
+ <tspan x="0.75" y="12" fill="#FFFFFF">A</tspan>
29
+ </text>
30
+ </g>
31
+ </g>
32
+ </g>
33
+ </g>
34
+ </g>
35
+ </g>
36
+ </svg>
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "allowedApplications": {{{ALLOWEDAPPS}}},
9
+ "componentKey": "{{COMPONENT_KEY}}",
10
+ "type": "{{TYPE}}",
11
+ "subtype": {{{SUB_TYPE}}},
12
+ "icon": "OneColumnPage.svg",
13
+ "properties": [
14
+ {
15
+ "name": "description",
16
+ "label": "Description",
17
+ "format": "TEXT",
18
+ "defaultValue": "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos."
19
+ },
20
+ {
21
+ "name": "whatsnewlink",
22
+ "label": "What's new link",
23
+ "format": "TEXT",
24
+ "defaultValue": "https://design.pega.com"
25
+ },
26
+ {
27
+ "name": "image",
28
+ "label": "Image link",
29
+ "format": "TEXT",
30
+ "defaultValue": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+"
31
+ },
32
+ {
33
+ "name": "datasource",
34
+ "label": "Data source for details",
35
+ "defaultValue": "@DATASOURCE D_pyAnnouncements.pxResults",
36
+ "format": "DATASOURCE",
37
+ "required": true,
38
+ "properties": [
39
+ {
40
+ "name": "name",
41
+ "label": "Label",
42
+ "defaultValue": "@P .pyLabel"
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "label": "Conditions",
48
+ "format": "GROUP",
49
+ "properties": [
50
+ {
51
+ "name": "visibility",
52
+ "label": "Visibility",
53
+ "format": "VISIBILITY"
54
+ }
55
+ ]
56
+ }
57
+ ],
58
+ "defaultConfig": {}
59
+ }
@@ -0,0 +1,48 @@
1
+ import PropTypes from 'prop-types';
2
+ import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work';
3
+
4
+ import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
5
+
6
+
7
+ // Duplicated runtime code from Constellation Design System Component
8
+
9
+ // props passed in combination of props from property panel (config.json) and run time props from Constellation
10
+ // any default values in config.pros should be set in defaultProps at bottom of this file
11
+ export default function {{COMPONENT_CLASS_NAME}}(props) {
12
+
13
+ const { header, description, datasource, whatsnewlink, image } = props;
14
+ let details = [];
15
+ if (datasource && datasource.source) {
16
+ details = datasource.source.map((item) => {
17
+ return item.name;
18
+ });
19
+ }
20
+ return (
21
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
22
+ <PegaAppAnnouncement
23
+ heading={header}
24
+ description={description}
25
+ details={details}
26
+ whatsNewLink={whatsnewlink}
27
+ image={image.replace(/ /g, '+')}
28
+ />
29
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
30
+ );
31
+
32
+ }
33
+
34
+ {{COMPONENT_CLASS_NAME}}.defaultProps = {
35
+ header: PropTypes.string,
36
+ description: PropTypes.string,
37
+ datasource: PropTypes.instanceOf(Object),
38
+ whatsnewlink: PropTypes.string,
39
+ image: PropTypes.string
40
+ };
41
+
42
+ {{COMPONENT_CLASS_NAME}}.propTypes = {
43
+ header: '',
44
+ description: '',
45
+ image: '',
46
+ datasource: [],
47
+ whatsnewlink: ''
48
+ };
@@ -0,0 +1,7 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ export default styled.div(() => {
4
+ return css`
5
+ margin: 8px 0;
6
+ `;
7
+ });
@@ -0,0 +1,73 @@
1
+ import { useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Avatar as CosmosAvatar } from '@pega/cosmos-react-core';
4
+
5
+ function Avatar(props) {
6
+ const { metaObj, showStatus } = props;
7
+ const [imageBlobUrl, setImageBlobUrl] = useState(null);
8
+ let userName;
9
+ let userIdentifier;
10
+
11
+ // TODO Below if conditions can be removed once we have apis to get worklist/mywork info
12
+ // This is non CaseView case (Dashboard, MyWork etc)
13
+ if (!metaObj) {
14
+ userName = PCore.getEnvironmentInfo().getOperatorName();
15
+ userIdentifier = PCore.getEnvironmentInfo().getOperatorIdentifier();
16
+ } else {
17
+ userName = metaObj.name;
18
+ userIdentifier = metaObj.ID;
19
+ }
20
+ if (!userName && userIdentifier) {
21
+ userName = userIdentifier;
22
+ }
23
+
24
+ useEffect(() => {
25
+ const imageKey = !metaObj ? PCore.getEnvironmentInfo().getOperatorImageInsKey() : metaObj.image;
26
+ if (imageKey) {
27
+ PCore.getAssetLoader()
28
+ .getSvcImage(imageKey)
29
+ .then((blob) => window.URL.createObjectURL(blob))
30
+ .then((imagePath) => setImageBlobUrl(imagePath));
31
+ }
32
+ }, []);
33
+
34
+ if (showStatus) {
35
+ const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
36
+ const [userState, setUserState] = useState(currentState === 'online' ? 'active' : 'inactive');
37
+
38
+ const handleUserStateChange = ({ state }) => {
39
+ setUserState(state === 'online' ? 'active' : 'inactive');
40
+ };
41
+
42
+ useEffect(() => {
43
+ const subId = PCore.getMessagingServiceManager()
44
+ .getUserPresence()
45
+ .subscribe(userIdentifier, handleUserStateChange);
46
+
47
+ return function cleanup() {
48
+ PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
49
+ };
50
+ }, []);
51
+ return <CosmosAvatar name={userName} imageSrc={imageBlobUrl} status={userState} />;
52
+ }
53
+
54
+ // Do not render when userName does not exists
55
+ // TODO : In CNR case, pxRequestor is not available, please remove this condition once it populates
56
+ if (!userName) {
57
+ return null;
58
+ }
59
+
60
+ return <CosmosAvatar name={userName} imageSrc={imageBlobUrl} />;
61
+ }
62
+
63
+ Avatar.propTypes = {
64
+ metaObj: PropTypes.objectOf(PropTypes.any),
65
+ showStatus: PropTypes.bool
66
+ };
67
+
68
+ Avatar.defaultProps = {
69
+ metaObj: null,
70
+ showStatus: false
71
+ };
72
+
73
+ export default Avatar;
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="100px" height="70px" viewBox="0 0 100 70" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>1 col </title>
4
+ <defs>
5
+ <rect id="path-1" x="0" y="0" width="100" height="70"></rect>
6
+ </defs>
7
+ <g id="Concepts" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="Templates" transform="translate(-98.000000, -108.000000)">
9
+ <g id="Change-template" transform="translate(42.000000, 36.000000)">
10
+ <g id="1-col-" transform="translate(56.000000, 72.000000)">
11
+ <mask id="mask-2" fill="white">
12
+ <use xlink:href="#path-1"></use>
13
+ </mask>
14
+ <rect stroke="#A5A8BC" stroke-width="0.5" x="0.25" y="0.25" width="99.5" height="69.5"></rect>
15
+ <g id="white" mask="url(#mask-2)" fill="#FFFFFF">
16
+ <g transform="translate(3.000000, 3.000000)" id="Rectangle">
17
+ <rect x="0" y="0" width="94" height="66.5"></rect>
18
+ </g>
19
+ </g>
20
+ <g id="gray" mask="url(#mask-2)" fill="#8084A7">
21
+ <g transform="translate(6.000000, 6.000000)" id="Rectangle">
22
+ <rect x="0" y="-2.84217094e-14" width="88" height="77.8"></rect>
23
+ </g>
24
+ </g>
25
+ <g id="labels" mask="url(#mask-2)" font-family="OpenSans-Semibold, Open Sans" font-size="11" font-weight="500">
26
+ <g transform="translate(44.000000, 17.000000)" id="A">
27
+ <text>
28
+ <tspan x="0.75" y="12" fill="#FFFFFF">A</tspan>
29
+ </text>
30
+ </g>
31
+ </g>
32
+ </g>
33
+ </g>
34
+ </g>
35
+ </g>
36
+ </svg>
@@ -0,0 +1,239 @@
1
+ import { useState, useEffect, Fragment } from 'react';
2
+ import {
3
+ Link,
4
+ Button,
5
+ Popover,
6
+ Flex,
7
+ useOuterEvent,
8
+ useElement,
9
+ Progress,
10
+ FormField,
11
+ useTheme
12
+ } from '@pega/cosmos-react-core';
13
+ import { Glimpse } from '@pega/cosmos-react-work';
14
+ import PropTypes from 'prop-types';
15
+
16
+ import Avatar from './Avatar';
17
+
18
+ const Operator = (props) => {
19
+ const { id, name, label, testId, helperText, externalUser, metaObj } = props;
20
+ const [isOpen, setIsOpen] = useState(false);
21
+ const [isLoading, setIsLoading] = useState(true);
22
+ const [popoverTarget, setPopoverTarget] = useState(null);
23
+ const [popoverEl, setPopoverEl] = useElement(null);
24
+ const [popoverContent, setpopoverContent] = useState(null);
25
+ const theme = useTheme();
26
+
27
+ /* If the id has changed, we need to reset the popover */
28
+ useEffect(() => {
29
+ setPopoverTarget(null);
30
+ }, [id]);
31
+
32
+
33
+ {{! pick new delimiteres for mustache }}
34
+ {{=<% %>=}}
35
+
36
+ const OperatorPreview = () => {
37
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
38
+ const localeCategory = 'Operator';
39
+ setpopoverContent(
40
+ <Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
41
+ );
42
+ if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
43
+ const fields = [
44
+ {
45
+ id: 'pyFirstName',
46
+ name: localizedVal('Name', localeCategory),
47
+ value: externalUser.name
48
+ },
49
+ {
50
+ id: 'pyEmail1',
51
+ name: localizedVal('Email', localeCategory),
52
+ value:
53
+ externalUser.email !== '' ? <Link href={`mailto:${externalUser.email}`}>{externalUser.email}</Link> : ''
54
+ },
55
+ {
56
+ id: 'pyPhoneNumber',
57
+ name: localizedVal('Phone', localeCategory),
58
+ value: externalUser.phone !== '' ? <Link href={`tel:${externalUser.phone}`}>{externalUser.phone}</Link> : ''
59
+ }
60
+ ];
61
+ setIsLoading(false);
62
+ setpopoverContent(
63
+ <Glimpse
64
+ visual={
65
+ <Avatar
66
+ metaObj={{
67
+ name: externalUser.name
68
+ }}
69
+ />
70
+ }
71
+ primary={externalUser.name}
72
+ secondary={[externalUser.position]}
73
+ fields={fields}
74
+ />
75
+ );
76
+ } else {
77
+ const { getOperatorDetails } = PCore.getUserApi();
78
+ getOperatorDetails(id)
79
+ .then((res) => {
80
+ if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
81
+ const fields = [
82
+ {
83
+ id: 'pyOrganization',
84
+ name: localizedVal('Organization', localeCategory),
85
+ value: res.data.pyOperatorInfo.pyOrganization
86
+ },
87
+ {
88
+ id: 'pyTelephone',
89
+ name: localizedVal('Telephone', localeCategory),
90
+ value:
91
+ res.data.pyOperatorInfo.pyTelephone !== '' ? (
92
+ <Link href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>
93
+ {res.data.pyOperatorInfo.pyTelephone}
94
+ </Link>
95
+ ) : (
96
+ ''
97
+ )
98
+ },
99
+ {
100
+ id: 'pyEmailAddress',
101
+ name: localizedVal('Email address', localeCategory),
102
+ value:
103
+ res.data.pyOperatorInfo.pyEmailAddress !== '' ? (
104
+ <Link href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>
105
+ {res.data.pyOperatorInfo.pyEmailAddress}
106
+ </Link>
107
+ ) : (
108
+ ''
109
+ )
110
+ },
111
+ {
112
+ id: 'ReportToUserName',
113
+ name: localizedVal('Reports to', localeCategory),
114
+ value: res.data.pyOperatorInfo.pyReportToUserName
115
+ }
116
+ ];
117
+ setIsLoading(false);
118
+ setpopoverContent(
119
+ <Glimpse
120
+ visual={
121
+ <Avatar
122
+ metaObj={{
123
+ image: res.data.pyOperatorInfo.pyImageInsKey || '',
124
+ name: res.data.pyOperatorInfo.pyUserName
125
+ }}
126
+ />
127
+ }
128
+ primary={res.data.pyOperatorInfo.pyUserName}
129
+ secondary={[res.data.pyOperatorInfo.pyPosition]}
130
+ fields={fields}
131
+ />
132
+ );
133
+ } else {
134
+ setIsLoading(false);
135
+ setpopoverContent(<Flex container={{ pad: 1 }}>{localizedVal('Operator not found', localeCategory)}</Flex>);
136
+ }
137
+ })
138
+ .catch(() => {
139
+ setIsLoading(false);
140
+ setpopoverContent(
141
+ <Flex container={{ pad: 1 }}>{localizedVal('Error loading the operator profile', localeCategory)}</Flex>
142
+ );
143
+ });
144
+ }
145
+ };
146
+
147
+ <%={{ }}=%> {{! revert delimiteres for mustache }}
148
+
149
+ const clickAction = (e) => {
150
+ setPopoverTarget(e.currentTarget);
151
+ setIsOpen(!isOpen);
152
+ if (popoverTarget === null) {
153
+ OperatorPreview();
154
+ }
155
+ };
156
+
157
+ const hidePopover = () => {
158
+ if (isOpen) {
159
+ setIsOpen(false);
160
+ }
161
+ };
162
+ useOuterEvent('mousedown', [popoverEl, popoverTarget], hidePopover); // Call the method on clicking outside these elements
163
+ const hideOnEscape = (e) => {
164
+ if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
165
+ };
166
+
167
+ const comp = (
168
+ <Fragment>
169
+ {metaObj ? (
170
+ <Button
171
+ variant='text'
172
+ aria-haspopup
173
+ aria-expanded={isOpen}
174
+ onClick={clickAction}
175
+ onKeyDown={hideOnEscape}
176
+ data-test-id={testId}
177
+ style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
178
+ >
179
+ <Avatar metaObj={metaObj}></Avatar>
180
+ </Button>
181
+ ) : (
182
+ <Button
183
+ variant='link'
184
+ aria-haspopup
185
+ aria-expanded={isOpen}
186
+ onClick={clickAction}
187
+ onKeyDown={hideOnEscape}
188
+ data-test-id={testId}
189
+ style={label !== null ? { width: 'max-content', height: theme.components.input.height } : undefined}
190
+ >
191
+ {name}
192
+ </Button>
193
+ )}
194
+
195
+ {isOpen && (
196
+ <Popover
197
+ ref={setPopoverEl}
198
+ groupId='operator'
199
+ target={popoverTarget}
200
+ placement='bottom-start'
201
+ style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
202
+ strategy='fixed'
203
+ >
204
+ {popoverContent}
205
+ </Popover>
206
+ )}
207
+ </Fragment>
208
+ );
209
+
210
+ if (label !== null) {
211
+ return (
212
+ <FormField label={label} info={helperText}>
213
+ {comp}
214
+ </FormField>
215
+ );
216
+ }
217
+
218
+ return comp;
219
+ };
220
+
221
+ Operator.propTypes = {
222
+ name: PropTypes.string,
223
+ id: PropTypes.string,
224
+ label: PropTypes.string,
225
+ testId: PropTypes.string,
226
+ helperText: PropTypes.string,
227
+ metaObj: PropTypes.object
228
+ };
229
+
230
+ Operator.defaultProps = {
231
+ name: '',
232
+ id: '',
233
+ label: null,
234
+ testId: null,
235
+ helperText: null,
236
+ metaObj: null
237
+ };
238
+
239
+ export default Operator;
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "{{COMPONENT_KEY}}",
3
+ "label": "{{COMPONENT_LABEL}}",
4
+ "description": "{{DESCRIPTION}}",
5
+ "organization": "{{ORGANIZATION}}",
6
+ "version": "{{VERSION}}",
7
+ "library": "{{LIBRARY}}",
8
+ "allowedApplications": {{{ALLOWEDAPPS}}},
9
+ "componentKey": "{{COMPONENT_KEY}}",
10
+ "type": "{{TYPE}}",
11
+ "subtype": {{{SUB_TYPE}}},
12
+ "icon": "OneColumnPage.svg",
13
+ "properties": [
14
+ {
15
+ "name": "title",
16
+ "label": "Label value",
17
+ "format": "TEXT"
18
+ },
19
+ {
20
+ "format": "SELECT",
21
+ "label": "Usage",
22
+ "name": "label",
23
+ "defaultValue": "Create operator",
24
+ "localize": true,
25
+ "source": [
26
+ {
27
+ "key": "Create operator",
28
+ "value": "Create operator"
29
+ },
30
+ {
31
+ "key": "Update operator",
32
+ "value": "Update operator"
33
+ },
34
+ {
35
+ "key": "Resolve operator",
36
+ "value": "Resolve operator"
37
+ }
38
+ ]
39
+ },
40
+
41
+ {
42
+ "label": "Conditions",
43
+ "format": "GROUP",
44
+ "properties": [
45
+ {
46
+ "name": "visibility",
47
+ "label": "Visibility",
48
+ "format": "VISIBILITY"
49
+ }
50
+ ]
51
+ }
52
+ ],
53
+ "defaultConfig": {
54
+ "label": "Create operator",
55
+ "title": "Create operator",
56
+ "createLabel": "@L Created",
57
+ "updateLabel": "@L Updated",
58
+ "createOperator": "@USER .pxCreateOperator",
59
+ "updateOperator": "@USER .pxUpdateOperator",
60
+ "createDateTime": "@P .pxCreateDateTime",
61
+ "updateDateTime": "@P .pxUpdateDateTime",
62
+ "resolveLabel": "@L Resolved",
63
+ "resolveOperator": "@USER .pyResolvedUserID",
64
+ "resolveDateTime": "@P .pyResolvedTimestamp"
65
+ }
66
+ }