@pega/react-sdk-overrides 0.23.30 → 0.23.32

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.
@@ -680,7 +680,9 @@ export const readContextResponse = async (context, params) => {
680
680
  if (compositeKeys.length) {
681
681
  otherContext.setCompositeKeys(compositeKeys);
682
682
  }
683
- otherContext.fetchRowActionDetails = null;
683
+ if (otherContext) {
684
+ otherContext.fetchRowActionDetails = null;
685
+ }
684
686
  }
685
687
 
686
688
  const presetArray = [];
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
2
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
4
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -25,38 +26,64 @@ export default function QuickCreate(props: QuickCreateProps) {
25
26
  });
26
27
  };
27
28
 
28
- const cases: any = [];
29
- const envInfo = PCore.getEnvironmentInfo();
30
- if (
31
- classFilter &&
32
- envInfo.environmentInfoObject &&
33
- envInfo.environmentInfoObject.pyCaseTypeList &&
34
- envInfo.environmentInfoObject.pyCaseTypeList.length > 0
35
- ) {
36
- classFilter.forEach(item => {
37
- let icon = Utils.getImageSrc('polaris-solid', Utils.getSDKStaticConentUrl());
38
- let label = '';
29
+ const [quickCreatecases, setCases] = useState([]);
30
+
31
+ /* If the classFilter is empty and has no entries - we will default to the default set of case types
32
+ It will usually come from the envInfo but for Launchpad, this is not populated - instead get the list of cases from the store */
33
+ useEffect(() => {
34
+ const cases: any = [];
35
+ const defaultCases: any = [];
36
+ const envInfo = PCore.getEnvironmentInfo();
37
+ if (envInfo?.environmentInfoObject?.pyCaseTypeList) {
39
38
  envInfo.environmentInfoObject.pyCaseTypeList.forEach(casetype => {
40
- if (casetype.pyWorkTypeImplementationClassName === item) {
41
- icon = casetype.pxIcon && Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl());
42
- label = casetype.pyWorkTypeName ?? '';
39
+ if (casetype.pyWorkTypeName && casetype.pyWorkTypeImplementationClassName) {
40
+ defaultCases.push({
41
+ classname: casetype.pyWorkTypeImplementationClassName,
42
+ onClick: () => {
43
+ createCase(casetype.pyWorkTypeImplementationClassName);
44
+ },
45
+ ...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
46
+ label: casetype.pyWorkTypeName
47
+ });
48
+ }
49
+ });
50
+ } else {
51
+ const pConnectInAppContext = PCore.createPConnect({
52
+ options: { context: PCore.getConstants().APP.APP }
53
+ }).getPConnect();
54
+ const pyPortalInAppContext = pConnectInAppContext.getValue('pyPortal') as any;
55
+ pyPortalInAppContext?.pyCaseTypesAvailableToCreate?.forEach(casetype => {
56
+ if (casetype.pyClassName && casetype.pyLabel) {
57
+ defaultCases.push({
58
+ classname: casetype.pyClassName,
59
+ onClick: () => {
60
+ createCase(casetype.pyClassName);
61
+ },
62
+ ...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
63
+ label: casetype.pyLabel
64
+ });
43
65
  }
44
66
  });
45
- if (label !== '') {
46
- cases.push({
47
- label,
48
- onClick: () => {
49
- createCase(item);
50
- },
51
- ...(showCaseIcons && { icon })
67
+ }
68
+
69
+ /* If classFilter is not empty - filter from the list of defaultCases */
70
+ if (classFilter?.length > 0) {
71
+ classFilter.forEach(item => {
72
+ defaultCases.forEach(casetype => {
73
+ if (casetype.classname === item) {
74
+ cases.push(casetype);
75
+ }
52
76
  });
53
- }
54
- });
55
- }
77
+ });
78
+ setCases(cases);
79
+ } else {
80
+ setCases(defaultCases);
81
+ }
82
+ }, []);
56
83
 
57
84
  return (
58
85
  <div>
59
- <WssQuickCreate heading={heading} actions={cases} />
86
+ <WssQuickCreate heading={heading} actions={quickCreatecases} />
60
87
  </div>
61
88
  );
62
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.30",
3
+ "version": "0.23.32",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [