@pega/react-sdk-components 0.25.5 → 0.25.6

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 (69) hide show
  1. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +1 -1
  2. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
  3. package/lib/components/field/RadioButtons/RadioButtons.js +1 -1
  4. package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
  5. package/lib/components/field/SelectableCard/utils.d.ts +0 -1
  6. package/lib/components/field/SelectableCard/utils.d.ts.map +1 -1
  7. package/lib/components/field/SelectableCard/utils.js +0 -3
  8. package/lib/components/field/SelectableCard/utils.js.map +1 -1
  9. package/lib/components/field/SemanticLink/SemanticLink.js +1 -1
  10. package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
  11. package/lib/components/helpers/attachmentShared.d.ts +2 -0
  12. package/lib/components/helpers/attachmentShared.d.ts.map +1 -0
  13. package/lib/components/helpers/attachmentShared.js +6 -0
  14. package/lib/components/helpers/attachmentShared.js.map +1 -0
  15. package/lib/components/helpers/formatters/Currency.d.ts +1 -0
  16. package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
  17. package/lib/components/helpers/formatters/Currency.js +8 -4
  18. package/lib/components/helpers/formatters/Currency.js.map +1 -1
  19. package/lib/components/helpers/formatters/index.d.ts +1 -0
  20. package/lib/components/helpers/formatters/index.d.ts.map +1 -1
  21. package/lib/components/helpers/object-utils.d.ts +9 -0
  22. package/lib/components/helpers/object-utils.d.ts.map +1 -0
  23. package/lib/components/helpers/object-utils.js +11 -0
  24. package/lib/components/helpers/object-utils.js.map +1 -0
  25. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.d.ts.map +1 -1
  26. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +2 -1
  27. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
  28. package/lib/components/infra/MultiStep/MultiStep.css +0 -2
  29. package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
  30. package/lib/components/template/AppShell/AppShell.js +4 -0
  31. package/lib/components/template/AppShell/AppShell.js.map +1 -1
  32. package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
  33. package/lib/components/template/CaseSummary/CaseSummary.js +56 -2
  34. package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
  35. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.d.ts.map +1 -1
  36. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js +3 -2
  37. package/lib/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.js.map +1 -1
  38. package/lib/components/widget/Attachment/Attachment.d.ts +3 -1
  39. package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
  40. package/lib/components/widget/Attachment/Attachment.js +241 -189
  41. package/lib/components/widget/Attachment/Attachment.js.map +1 -1
  42. package/lib/components/widget/Attachment/Attachment.types.d.ts +90 -0
  43. package/lib/components/widget/Attachment/Attachment.types.d.ts.map +1 -0
  44. package/lib/components/widget/Attachment/Attachment.types.js +2 -0
  45. package/lib/components/widget/Attachment/Attachment.types.js.map +1 -0
  46. package/lib/components/widget/Attachment/AttachmentUtils.d.ts +25 -0
  47. package/lib/components/widget/Attachment/AttachmentUtils.d.ts.map +1 -0
  48. package/lib/components/widget/Attachment/AttachmentUtils.js +255 -0
  49. package/lib/components/widget/Attachment/AttachmentUtils.js.map +1 -0
  50. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts +1 -0
  51. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
  52. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +21 -8
  53. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
  54. package/lib/components/widget/ToDo/ToDo.js +1 -1
  55. package/lib/components/widget/ToDo/ToDo.js.map +1 -1
  56. package/lib/mediaco/ToDo/ToDo.css +81 -0
  57. package/lib/mediaco/ToDo/ToDo.d.ts +16 -0
  58. package/lib/mediaco/ToDo/ToDo.d.ts.map +1 -0
  59. package/lib/mediaco/ToDo/ToDo.js +187 -0
  60. package/lib/mediaco/ToDo/ToDo.js.map +1 -0
  61. package/lib/mediaco/ToDo/index.d.ts +2 -0
  62. package/lib/mediaco/ToDo/index.d.ts.map +1 -0
  63. package/lib/mediaco/ToDo/index.js +2 -0
  64. package/lib/mediaco/ToDo/index.js.map +1 -0
  65. package/package.json +1 -1
  66. package/lib/components/helpers/attachmentHelpers.d.ts +0 -16
  67. package/lib/components/helpers/attachmentHelpers.d.ts.map +0 -1
  68. package/lib/components/helpers/attachmentHelpers.js +0 -94
  69. package/lib/components/helpers/attachmentHelpers.js.map +0 -1
@@ -0,0 +1,187 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useState } from 'react';
3
+ import { Button, Card, CardContent, CardHeader, Avatar, Typography, Badge, List, ListItem, ListItemText } from '@mui/material';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined';
6
+ import { useTheme } from '@mui/material/styles';
7
+ import makeStyles from '@mui/styles/makeStyles';
8
+ import useMediaQuery from '@mui/material/useMediaQuery';
9
+ import { Utils } from '../../components/helpers/utils';
10
+ import './ToDo.css';
11
+ const fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {
12
+ return PCore.getDataPageUtils()
13
+ .getDataAsync(datapage, context, {}, {
14
+ pageNumber: 1,
15
+ pageSize: numberOfRecords
16
+ }, {
17
+ select: Object.keys(fields).map(key => ({ field: PCore.getAnnotationUtils().getPropertyName(fields[key]) }))
18
+ }, {
19
+ invalidateCache: true,
20
+ additionalApiParams: {
21
+ includeTotalCount
22
+ }
23
+ })
24
+ .then(response => {
25
+ return {
26
+ ...response,
27
+ data: (Array.isArray(response?.data) ? response.data : []).map(row => Object.keys(fields).reduce((obj, key) => {
28
+ obj[key] = row[PCore.getAnnotationUtils().getPropertyName(fields[key])];
29
+ return obj;
30
+ }, {}))
31
+ };
32
+ });
33
+ };
34
+ const isChildCase = assignment => {
35
+ return assignment.isChild;
36
+ };
37
+ function topThreeAssignments(assignmentsSource) {
38
+ return Array.isArray(assignmentsSource) ? assignmentsSource.slice(0, 3) : [];
39
+ }
40
+ function getID(assignment) {
41
+ if (assignment.value) {
42
+ const refKey = assignment.value;
43
+ return refKey.substring(refKey.lastIndexOf(' ') + 1);
44
+ }
45
+ const refKey = assignment.ID;
46
+ const arKeys = refKey.split('!')[0].split(' ');
47
+ return arKeys[2];
48
+ }
49
+ const useStyles = makeStyles(theme => ({
50
+ root: {
51
+ marginBottom: theme.spacing(2),
52
+ paddingBottom: theme.spacing(1),
53
+ borderRadius: '8px'
54
+ },
55
+ avatar: {
56
+ backgroundColor: theme.palette.primary.light,
57
+ color: theme.palette.getContrastText(theme.palette.primary.light)
58
+ },
59
+ todoWrapper: {
60
+ borderLeft: '6px solid',
61
+ borderLeftColor: theme.palette.primary.light,
62
+ padding: theme.spacing(1),
63
+ margin: theme.spacing(1)
64
+ },
65
+ psdkTodoAssignmentStatus: {
66
+ backgroundColor: 'var(--app-neutral-light-color)',
67
+ borderRadius: '0.125rem',
68
+ color: theme.embedded.resolutionTextColor,
69
+ fontSize: '0.75rem',
70
+ fontWeight: 'bold',
71
+ lineHeight: 'calc(0.5rem * 2.5)',
72
+ height: 'calc(0.5rem * 2.5)',
73
+ padding: '0 0.5rem',
74
+ textTransform: 'uppercase'
75
+ },
76
+ getStartedButton: {
77
+ borderRadius: '18px',
78
+ textTransform: 'none',
79
+ width: '120px',
80
+ backgroundColor: theme.actionButtons.primary.backgroundColor
81
+ },
82
+ primaryButton: {
83
+ backgroundColor: theme.actionButtons.primary.backgroundColor,
84
+ color: theme.actionButtons.primary.color
85
+ }
86
+ }));
87
+ export default function ToDo(props) {
88
+ const { getPConnect, context, datasource = [], headerText = 'To do', showTodoList = true, myWorkList = {}, type = 'worklist', isConfirm = false } = props;
89
+ const CONSTS = PCore.getConstants();
90
+ const bLogging = true;
91
+ const currentUser = PCore.getEnvironmentInfo().getOperatorName() ?? '';
92
+ const currentUserInitials = Utils.getInitials(currentUser);
93
+ const assignmentsSource = datasource?.source || myWorkList?.source;
94
+ const [assignments, setAssignments] = useState(initAssignments());
95
+ const thePConn = getPConnect();
96
+ const classes = useStyles();
97
+ const theme = useTheme();
98
+ const isDesktop = useMediaQuery(theme.breakpoints.up('md'));
99
+ const localizedVal = PCore.getLocaleUtils().getLocaleValue;
100
+ const localeCategory = 'Todo';
101
+ const canPerform = assignments?.[0]?.canPerform === 'true' || assignments?.[0]?.canPerform === true;
102
+ const [count, setCount] = useState(0);
103
+ const { WORK_BASKET: { MY_WORK_LIST } } = PCore.getConstants();
104
+ function initAssignments() {
105
+ if (assignmentsSource) {
106
+ return topThreeAssignments(assignmentsSource);
107
+ }
108
+ // turn off todolist
109
+ return [];
110
+ }
111
+ const deferLoadWorklistItems = useCallback(responseData => {
112
+ setCount(responseData.totalCount);
113
+ setAssignments(responseData.data);
114
+ }, [MY_WORK_LIST]);
115
+ useEffect(() => {
116
+ if (Object.keys(myWorkList).length && myWorkList.datapage) {
117
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {
118
+ deferLoadWorklistItems(responseData);
119
+ });
120
+ }
121
+ }, []);
122
+ const getAssignmentId = assignment => {
123
+ return type === CONSTS.TODO ? assignment.ID : assignment.id;
124
+ };
125
+ const getPriority = assignment => {
126
+ return type === CONSTS.TODO ? assignment.urgency : assignment.priority;
127
+ };
128
+ const getAssignmentName = assignment => {
129
+ return type === CONSTS.TODO ? assignment.name : assignment.stepName;
130
+ };
131
+ function showToast(message) {
132
+ const theMessage = `Assignment: ${message}`;
133
+ console.error(theMessage);
134
+ }
135
+ function clickGo(assignment) {
136
+ const id = getAssignmentId(assignment);
137
+ let { classname = '' } = assignment;
138
+ const sTarget = thePConn.getContainerName();
139
+ const sTargetContainerName = sTarget;
140
+ const options = {
141
+ containerName: sTargetContainerName,
142
+ channelName: ''
143
+ };
144
+ if (classname === null || classname === '') {
145
+ classname = thePConn.getCaseInfo().getClassName();
146
+ }
147
+ if (sTarget === 'workarea') {
148
+ options.isActionFromToDoList = true;
149
+ options.target = '';
150
+ options.context = null;
151
+ options.isChild = isChildCase(assignment);
152
+ }
153
+ else {
154
+ options.isActionFromToDoList = false;
155
+ options.target = sTarget;
156
+ }
157
+ thePConn
158
+ .getActionsApi()
159
+ .openAssignment(id, classname, options)
160
+ .then(() => {
161
+ if (bLogging) {
162
+ console.log(`openAssignment completed`);
163
+ }
164
+ })
165
+ .catch(() => {
166
+ showToast(`Submit failed!`);
167
+ });
168
+ }
169
+ const renderTaskId = (type, getPConnect, showTodoList, assignment) => {
170
+ const displayID = getID(assignment);
171
+ if ((showTodoList && type !== CONSTS.TODO) || assignment.isChild === true) {
172
+ /* Supress link for todo inside flow step */
173
+ return _jsx(Button, { size: 'small', color: 'primary', children: `${assignment.name} ${getID(assignment)}` });
174
+ }
175
+ return displayID;
176
+ };
177
+ const getListItemComponent = assignment => {
178
+ if (isDesktop) {
179
+ return (_jsxs(_Fragment, { children: [localizedVal('Task in', localeCategory), renderTaskId(type, getPConnect, showTodoList, assignment), type === CONSTS.WORKLIST && assignment.status ? `\u2022 ` : undefined, type === CONSTS.WORKLIST && assignment.status ? _jsx("span", { className: 'psdk-todo-assignment-status', children: assignment.status }) : undefined, ` \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`] }));
180
+ }
181
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { size: 'small', color: 'primary', children: `${assignment.name} ${getID(assignment)}` }), ` \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`] }));
182
+ };
183
+ const getCount = () => (assignmentsSource ? assignmentsSource.length : type === CONSTS.WORKLIST ? count : 0);
184
+ const toDoContent = (_jsxs(_Fragment, { children: [showTodoList && (_jsx(CardHeader, { title: _jsx(Badge, { badgeContent: getCount(), overlap: 'rectangular', color: 'primary', children: _jsxs(Typography, { variant: 'h6', children: [headerText, "\u00A0\u00A0\u00A0"] }) }) })), _jsx(List, { children: assignments.map(assignment => (_jsxs("div", { className: 'psdk-todo-avatar-header', children: [_jsx(Avatar, { className: classes.avatar, style: { marginRight: '16px' }, children: currentUserInitials }), _jsxs("div", { style: { display: 'block' }, children: [_jsx(Typography, { variant: 'h6', children: assignment?.name }), `${localizedVal('Task in', localeCategory)} ${renderTaskId(type, getPConnect, showTodoList, assignment)} \u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`] }), (!isConfirm || canPerform) && (_jsx("div", { style: { marginLeft: 'auto' }, children: _jsx(IconButton, { id: 'go-btn', onClick: () => clickGo(assignment), size: 'large', children: _jsx(ArrowForwardIosOutlinedIcon, {}) }) }))] }, getAssignmentId(assignment)))) })] }));
185
+ return (_jsxs(_Fragment, { children: [type === CONSTS.WORKLIST && assignments?.length > 0 && (_jsxs(Card, { className: classes.root, children: [showTodoList && _jsx(CardHeader, { title: _jsxs(Typography, { variant: 'h6', children: [headerText, "\u00A0\u00A0\u00A0"] }) }), _jsx(CardContent, { style: { padding: 0 }, children: _jsx(List, { children: assignments.map(assignment => (_jsx(ListItem, { dense: true, onClick: () => clickGo(assignment), secondaryAction: _jsx(Button, { className: classes.getStartedButton, color: 'primary', variant: 'contained', onClick: () => clickGo(assignment), children: "Get started" }), children: _jsx(ListItemText, { primary: getAssignmentName(assignment), secondary: getListItemComponent(assignment) }) }, getAssignmentId(assignment)))) }) })] })), type === CONSTS.TODO && !isConfirm && _jsx(Card, { className: classes.todoWrapper, children: toDoContent }), type === CONSTS.TODO && isConfirm && _jsx(_Fragment, { children: toDoContent })] }));
186
+ }
187
+ //# sourceMappingURL=ToDo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToDo.js","sourceRoot":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,CAAC,UAAU,CAAC,CAUvB,CACZ,CAAC,GACG,GACK,IACT,CACR,EAEA,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,IAAI,KAAC,IAAI,IAAC,SAAS,EAAE,OAAO,CAAC,WAAW,YAAG,WAAW,GAAQ,EAChG,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,SAAS,IAAI,4BAAG,WAAW,GAAI,IACvD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport { Button, Card, CardContent, CardHeader, Avatar, Typography, Badge, List, ListItem, ListItemText } from '@mui/material';\nimport IconButton from '@mui/material/IconButton';\nimport ArrowForwardIosOutlinedIcon from '@mui/icons-material/ArrowForwardIosOutlined';\nimport { useTheme } from '@mui/material/styles';\nimport makeStyles from '@mui/styles/makeStyles';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport { Utils } from '../../components/helpers/utils';\nimport type { PConnProps } from '../../types/PConnProps';\n\nimport './ToDo.css';\n\nconst fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {\n return PCore.getDataPageUtils()\n .getDataAsync(\n datapage,\n context,\n {},\n {\n pageNumber: 1,\n pageSize: numberOfRecords\n },\n {\n select: Object.keys(fields).map(key => ({ field: PCore.getAnnotationUtils().getPropertyName(fields[key]) }))\n },\n {\n invalidateCache: true,\n additionalApiParams: {\n includeTotalCount\n }\n }\n )\n .then(response => {\n return {\n ...response,\n data: (Array.isArray(response?.data) ? response.data : []).map(row =>\n Object.keys(fields).reduce((obj, key) => {\n obj[key] = row[PCore.getAnnotationUtils().getPropertyName(fields[key])];\n return obj;\n }, {})\n )\n };\n });\n};\n\ninterface ToDoProps extends PConnProps {\n // If any, enter additional props that only exist on this component\n datasource?: any;\n myWorkList?: any;\n\n caseInfoID?: string;\n headerText?: string;\n\n itemKey?: string;\n showTodoList?: boolean;\n type?: string;\n\n context?: string;\n isConfirm?: boolean;\n}\n\nconst isChildCase = assignment => {\n return assignment.isChild;\n};\n\nfunction topThreeAssignments(assignmentsSource: any[]): any[] {\n return Array.isArray(assignmentsSource) ? assignmentsSource.slice(0, 3) : [];\n}\n\nfunction getID(assignment: any) {\n if (assignment.value) {\n const refKey = assignment.value;\n return refKey.substring(refKey.lastIndexOf(' ') + 1);\n }\n const refKey = assignment.ID;\n const arKeys = refKey.split('!')[0].split(' ');\n return arKeys[2];\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginBottom: theme.spacing(2),\n paddingBottom: theme.spacing(1),\n borderRadius: '8px'\n },\n avatar: {\n backgroundColor: theme.palette.primary.light,\n color: theme.palette.getContrastText(theme.palette.primary.light)\n },\n todoWrapper: {\n borderLeft: '6px solid',\n borderLeftColor: theme.palette.primary.light,\n padding: theme.spacing(1),\n margin: theme.spacing(1)\n },\n psdkTodoAssignmentStatus: {\n backgroundColor: 'var(--app-neutral-light-color)',\n borderRadius: '0.125rem',\n color: theme.embedded.resolutionTextColor,\n fontSize: '0.75rem',\n fontWeight: 'bold',\n lineHeight: 'calc(0.5rem * 2.5)',\n height: 'calc(0.5rem * 2.5)',\n padding: '0 0.5rem',\n textTransform: 'uppercase'\n },\n getStartedButton: {\n borderRadius: '18px',\n textTransform: 'none',\n width: '120px',\n backgroundColor: theme.actionButtons.primary.backgroundColor\n },\n primaryButton: {\n backgroundColor: theme.actionButtons.primary.backgroundColor,\n color: theme.actionButtons.primary.color\n }\n}));\n\nexport default function ToDo(props: ToDoProps) {\n const {\n getPConnect,\n context,\n datasource = [],\n headerText = 'To do',\n showTodoList = true,\n myWorkList = {},\n type = 'worklist',\n isConfirm = false\n } = props;\n\n const CONSTS = PCore.getConstants();\n\n const bLogging = true;\n const currentUser = PCore.getEnvironmentInfo().getOperatorName() ?? '';\n const currentUserInitials = Utils.getInitials(currentUser);\n const assignmentsSource = datasource?.source || myWorkList?.source;\n\n const [assignments, setAssignments] = useState<any[]>(initAssignments());\n\n const thePConn = getPConnect();\n const classes = useStyles();\n const theme = useTheme();\n const isDesktop = useMediaQuery(theme.breakpoints.up('md'));\n const localizedVal = PCore.getLocaleUtils().getLocaleValue;\n const localeCategory = 'Todo';\n const canPerform = assignments?.[0]?.canPerform === 'true' || assignments?.[0]?.canPerform === true;\n const [count, setCount] = useState(0);\n\n const {\n WORK_BASKET: { MY_WORK_LIST }\n } = PCore.getConstants();\n\n function initAssignments(): any[] {\n if (assignmentsSource) {\n return topThreeAssignments(assignmentsSource);\n }\n // turn off todolist\n return [];\n }\n\n const deferLoadWorklistItems = useCallback(\n responseData => {\n setCount(responseData.totalCount);\n setAssignments(responseData.data);\n },\n [MY_WORK_LIST]\n );\n\n useEffect(() => {\n if (Object.keys(myWorkList).length && myWorkList.datapage) {\n fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {\n deferLoadWorklistItems(responseData);\n });\n }\n }, []);\n\n const getAssignmentId = assignment => {\n return type === CONSTS.TODO ? assignment.ID : assignment.id;\n };\n\n const getPriority = assignment => {\n return type === CONSTS.TODO ? assignment.urgency : assignment.priority;\n };\n\n const getAssignmentName = assignment => {\n return type === CONSTS.TODO ? assignment.name : assignment.stepName;\n };\n\n function showToast(message: string) {\n const theMessage = `Assignment: ${message}`;\n console.error(theMessage);\n }\n\n function clickGo(assignment) {\n const id = getAssignmentId(assignment);\n let { classname = '' } = assignment;\n const sTarget = thePConn.getContainerName();\n const sTargetContainerName = sTarget;\n\n const options: any = {\n containerName: sTargetContainerName,\n channelName: ''\n };\n\n if (classname === null || classname === '') {\n classname = thePConn.getCaseInfo().getClassName();\n }\n\n if (sTarget === 'workarea') {\n options.isActionFromToDoList = true;\n options.target = '';\n options.context = null;\n options.isChild = isChildCase(assignment);\n } else {\n options.isActionFromToDoList = false;\n options.target = sTarget;\n }\n\n thePConn\n .getActionsApi()\n .openAssignment(id, classname, options)\n .then(() => {\n if (bLogging) {\n console.log(`openAssignment completed`);\n }\n })\n .catch(() => {\n showToast(`Submit failed!`);\n });\n }\n\n const renderTaskId = (type, getPConnect, showTodoList, assignment) => {\n const displayID = getID(assignment);\n\n if ((showTodoList && type !== CONSTS.TODO) || assignment.isChild === true) {\n /* Supress link for todo inside flow step */\n return <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>;\n }\n return displayID;\n };\n\n const getListItemComponent = assignment => {\n if (isDesktop) {\n return (\n <>\n {localizedVal('Task in', localeCategory)}\n {renderTaskId(type, getPConnect, showTodoList, assignment)}\n {type === CONSTS.WORKLIST && assignment.status ? `\\u2022 ` : undefined}\n {type === CONSTS.WORKLIST && assignment.status ? <span className='psdk-todo-assignment-status'>{assignment.status}</span> : undefined}\n {` \\u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}\n </>\n );\n }\n return (\n <>\n <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>\n {` \\u2022 ${localizedVal('Urgency', localeCategory)} ${getPriority(assignment)}`}\n </>\n );\n };\n\n const getCount = () => (assignmentsSource ? assignmentsSource.length : type === CONSTS.WORKLIST ? count : 0);\n\n const toDoContent = (\n <>\n {showTodoList && (\n <CardHeader\n title={\n <Badge badgeContent={getCount()} overlap='rectangular' color='primary'>\n <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>\n </Badge>\n }\n />\n )}\n <List>\n {assignments.map(assignment => (\n <div className='psdk-todo-avatar-header' key={getAssignmentId(assignment)}>\n <Avatar className={classes.avatar} style={{ marginRight: '16px' }}>\n {currentUserInitials}\n </Avatar>\n <div style={{ display: 'block' }}>\n <Typography variant='h6'>{assignment?.name}</Typography>\n {`${localizedVal('Task in', localeCategory)} ${renderTaskId(type, getPConnect, showTodoList, assignment)} \\u2022 ${localizedVal(\n 'Urgency',\n localeCategory\n )} ${getPriority(assignment)}`}\n </div>\n {(!isConfirm || canPerform) && (\n <div style={{ marginLeft: 'auto' }}>\n <IconButton id='go-btn' onClick={() => clickGo(assignment)} size='large'>\n <ArrowForwardIosOutlinedIcon />\n </IconButton>\n </div>\n )}\n </div>\n ))}\n </List>\n </>\n );\n\n return (\n <>\n {type === CONSTS.WORKLIST && assignments?.length > 0 && (\n <Card className={classes.root}>\n {showTodoList && <CardHeader title={<Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>} />}\n <CardContent style={{ padding: 0 }}>\n <List>\n {assignments.map(assignment => (\n <ListItem\n key={getAssignmentId(assignment)}\n dense\n onClick={() => clickGo(assignment)}\n secondaryAction={\n <Button className={classes.getStartedButton} color='primary' variant='contained' onClick={() => clickGo(assignment)}>\n Get started\n </Button>\n }\n >\n <ListItemText primary={getAssignmentName(assignment)} secondary={getListItemComponent(assignment)} />\n </ListItem>\n ))}\n </List>\n </CardContent>\n </Card>\n )}\n\n {type === CONSTS.TODO && !isConfirm && <Card className={classes.todoWrapper}>{toDoContent}</Card>}\n {type === CONSTS.TODO && isConfirm && <>{toDoContent}</>}\n </>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { default } from './ToDo';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mediaco/ToDo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './ToDo';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mediaco/ToDo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { default } from './ToDo';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-components",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "description": "React SDK Infrastructure: bridge and components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [
@@ -1,16 +0,0 @@
1
- export declare const isContentBinary: (headers: any) => any;
2
- export declare const isContentBase64: (headers: any) => any;
3
- export declare const fileDownload: (data: any, fileName: any, ext: any, headers: any) => void;
4
- export declare const fileDownloadVar: (content: any, type: any, name: any, extension: any) => void;
5
- export declare const useFileDownload: (context: any) => ({ ID, name, extension, type, category, responseType }: {
6
- ID: any;
7
- name: any;
8
- extension: any;
9
- type: any;
10
- category: any;
11
- responseType: any;
12
- }) => void;
13
- export declare const getIconFromFileType: (fileType: any) => string;
14
- export declare const validateMaxSize: (fileObj: any, maxSizeInMB: string) => boolean;
15
- export declare const isFileUploadedToServer: (file: any) => any;
16
- //# sourceMappingURL=attachmentHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachmentHelpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/attachmentHelpers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAG,YAAO,QAErC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAG,YAAO,QAErC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,SAAI,EAAE,aAAQ,EAAE,QAAG,EAAE,YAAO,SAUxD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,YAAO,EAAE,SAAI,EAAE,SAAI,EAAE,cAAS,SAa7D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAG,YAAO;;;;;;;UAwBrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAQ,KAAG,MAyB9C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,SAAS,GAAG,EAAE,aAAa,MAAM,KAAG,OAGnE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAG,SAAI,QAAkE,CAAC"}
@@ -1,94 +0,0 @@
1
- import { useCallback } from 'react';
2
- import download from 'downloadjs';
3
- export const isContentBinary = headers => {
4
- return headers && headers['content-transfer-encoding'] === 'binary';
5
- };
6
- export const isContentBase64 = headers => {
7
- return headers && headers['content-transfer-encoding'] === 'base64';
8
- };
9
- export const fileDownload = (data, fileName, ext, headers) => {
10
- const name = ext ? `${fileName}.${ext}` : fileName;
11
- // Temp fix: downloading EMAIl type attachment as html file
12
- if (ext === 'html') {
13
- download(isContentBase64(headers) ? atob(data) : data, name, 'text/html');
14
- }
15
- else if (isContentBinary(headers)) {
16
- download(data, name);
17
- }
18
- else {
19
- download(atob(data), name);
20
- }
21
- };
22
- export const fileDownloadVar = (content, type, name, extension) => {
23
- if (type === 'FILE' || type === undefined) {
24
- fileDownload(content.data, name, extension, content.headers);
25
- }
26
- else if (type === 'URL') {
27
- let { data } = content;
28
- if (!/^(http|https):\/\//.test(data)) {
29
- data = `//${data}`;
30
- }
31
- window.open(content.data, '_blank');
32
- }
33
- else if (type === 'EMAIL') {
34
- // Temp Fix: for EMAIL type attachment
35
- fileDownload(content.data, name, 'html', content.headers);
36
- }
37
- };
38
- export const useFileDownload = context => {
39
- return useCallback(({ ID, name, extension, type, category, responseType }) => {
40
- if (category !== 'pxDocument') {
41
- PCore.getAttachmentUtils()
42
- .downloadAttachment(ID, context, responseType)
43
- .then(content => {
44
- fileDownloadVar(content, type, name, extension);
45
- })
46
- .catch(console.error);
47
- }
48
- else {
49
- PCore.getAttachmentUtils()
50
- // @ts-expect-error
51
- .downloadDocument(ID, context, responseType)
52
- .then(content => {
53
- fileDownloadVar(content, type, name, extension);
54
- })
55
- .catch(console.error);
56
- }
57
- }, [context]);
58
- };
59
- export const getIconFromFileType = (fileType) => {
60
- let icon = 'document-doc';
61
- if (!fileType)
62
- return icon;
63
- if (fileType.startsWith('audio')) {
64
- icon = 'audio';
65
- }
66
- else if (fileType.startsWith('video')) {
67
- icon = 'video';
68
- }
69
- else if (fileType.startsWith('image')) {
70
- icon = 'picture';
71
- }
72
- else if (fileType.includes('pdf')) {
73
- icon = 'document-pdf';
74
- }
75
- else {
76
- const [, subtype] = fileType.split('/');
77
- const foundMatch = sources => {
78
- return sources.some(key => subtype.includes(key));
79
- };
80
- if (foundMatch(['excel', 'spreadsheet'])) {
81
- icon = 'document-xls';
82
- }
83
- else if (foundMatch(['zip', 'compressed', 'gzip', 'rar', 'tar'])) {
84
- icon = 'document-compress';
85
- }
86
- }
87
- return icon;
88
- };
89
- export const validateMaxSize = (fileObj, maxSizeInMB) => {
90
- const fileSize = (fileObj.size / 1048576).toFixed(2);
91
- return parseFloat(fileSize) < parseFloat(maxSizeInMB);
92
- };
93
- export const isFileUploadedToServer = file => file.responseProps && !file.responseProps.ID?.includes('temp');
94
- //# sourceMappingURL=attachmentHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachmentHelpers.js","sourceRoot":"","sources":["../../../src/components/helpers/attachmentHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,EAAE;IACvC,OAAO,OAAO,IAAI,OAAO,CAAC,2BAA2B,CAAC,KAAK,QAAQ,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,EAAE;IACvC,OAAO,OAAO,IAAI,OAAO,CAAC,2BAA2B,CAAC,KAAK,QAAQ,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;IAC3D,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnD,2DAA2D;IAC3D,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACnB,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5E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GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,OAAO,CAAC,EAAE;YAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC;QAEF,IAAI,UAAU,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;YACzC,IAAI,GAAG,cAAc,CAAC;QACxB,CAAC;aAAM,IAAI,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YACnE,IAAI,GAAG,mBAAmB,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAY,EAAE,WAAmB,EAAW,EAAE;IAC5E,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport download from 'downloadjs';\n\nexport const isContentBinary = headers => {\n return headers && headers['content-transfer-encoding'] === 'binary';\n};\n\nexport const isContentBase64 = headers => {\n return headers && headers['content-transfer-encoding'] === 'base64';\n};\n\nexport const fileDownload = (data, fileName, ext, headers) => {\n const name = ext ? `${fileName}.${ext}` : fileName;\n // Temp fix: downloading EMAIl type attachment as html file\n if (ext === 'html') {\n download(isContentBase64(headers) ? atob(data) : data, name, 'text/html');\n } else if (isContentBinary(headers)) {\n download(data, name);\n } else {\n download(atob(data), name);\n }\n};\n\nexport const fileDownloadVar = (content, type, name, extension) => {\n if (type === 'FILE' || type === undefined) {\n fileDownload(content.data, name, extension, content.headers);\n } else if (type === 'URL') {\n let { data } = content;\n if (!/^(http|https):\\/\\//.test(data)) {\n data = `//${data}`;\n }\n window.open(content.data, '_blank');\n } else if (type === 'EMAIL') {\n // Temp Fix: for EMAIL type attachment\n fileDownload(content.data, name, 'html', content.headers);\n }\n};\n\nexport const useFileDownload = context => {\n return useCallback(\n ({ ID, name, extension, type, category, responseType }) => {\n if (category !== 'pxDocument') {\n PCore.getAttachmentUtils()\n .downloadAttachment(ID, context, responseType)\n .then(content => {\n fileDownloadVar(content, type, name, extension);\n })\n\n .catch(console.error);\n } else {\n PCore.getAttachmentUtils()\n // @ts-expect-error\n .downloadDocument(ID, context, responseType)\n .then(content => {\n fileDownloadVar(content, type, name, extension);\n })\n\n .catch(console.error);\n }\n },\n [context]\n );\n};\n\nexport const getIconFromFileType = (fileType): string => {\n let icon = 'document-doc';\n if (!fileType) return icon;\n if (fileType.startsWith('audio')) {\n icon = 'audio';\n } else if (fileType.startsWith('video')) {\n icon = 'video';\n } else if (fileType.startsWith('image')) {\n icon = 'picture';\n } else if (fileType.includes('pdf')) {\n icon = 'document-pdf';\n } else {\n const [, subtype] = fileType.split('/');\n const foundMatch = sources => {\n return sources.some(key => subtype.includes(key));\n };\n\n if (foundMatch(['excel', 'spreadsheet'])) {\n icon = 'document-xls';\n } else if (foundMatch(['zip', 'compressed', 'gzip', 'rar', 'tar'])) {\n icon = 'document-compress';\n }\n }\n\n return icon;\n};\n\nexport const validateMaxSize = (fileObj: any, maxSizeInMB: string): boolean => {\n const fileSize = (fileObj.size / 1048576).toFixed(2);\n return parseFloat(fileSize) < parseFloat(maxSizeInMB);\n};\n\nexport const isFileUploadedToServer = file => file.responseProps && !file.responseProps.ID?.includes('temp');\n"]}