Skip to content

Commit f5539ea

Browse files
author
Sharma
committed
Fixed pyConfirm isn't visible
1 parent e82d4c9 commit f5539ea

File tree

1 file changed

+13
-90
lines changed
  • packages/react-sdk-components/src/components/infra/Containers/FlowContainer

1 file changed

+13
-90
lines changed

packages/react-sdk-components/src/components/infra/Containers/FlowContainer/FlowContainer.tsx

Lines changed: 13 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { getComponentFromMap } from '../../../../bridge/helpers/sdk_component_ma
1111
import { withSimpleViewContainerRenderer } from '../SimpleView/SimpleView';
1212

1313
import { addContainerItem, getToDoAssignments, showBanner, hasContainerItems } from './helpers';
14-
import { PConnProps } from '../../../../types/PConnProps';
14+
import type { PConnProps } from '../../../../types/PConnProps';
1515
import { LocalizationProvider } from '@mui/x-date-pickers';
1616
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
1717

@@ -58,7 +58,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
5858
const AlertBanner = getComponentFromMap('AlertBanner');
5959

6060
const pCoreConstants = PCore.getConstants();
61-
const PCoreVersion = PCore.getPCoreVersion();
6261
const { TODO } = pCoreConstants;
6362
const todo_headerText = 'To do';
6463

@@ -78,6 +77,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
7877
const getPConnect = getPConnectOfActiveContainerItem || getPConnectOfFlowContainer;
7978
const thePConn = getPConnect();
8079
const containerName = assignmentNames && assignmentNames.length > 0 ? assignmentNames[0] : '';
80+
const bShowBanner = showBanner(getPConnect);
8181
// const [init, setInit] = useState(true);
8282
// const [fcState, setFCState] = useState({ hasError: false });
8383

@@ -104,7 +104,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
104104
function getBuildName(): string {
105105
const ourPConn = getPConnect();
106106

107-
// let { getPConnect, name } = this.pConn$.pConn;
108107
const context = ourPConn.getContextName();
109108
let viewContainerName = ourPConn.getContainerName();
110109

@@ -113,7 +112,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
113112
}
114113

115114
function getTodoVisibility() {
116-
const caseViewMode = getPConnect().getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
115+
const caseViewMode = getPConnect().getValue('context_data.caseViewMode');
117116
if (caseViewMode && caseViewMode === 'review') {
118117
return true;
119118
}
@@ -123,16 +122,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
123122
function initComponent() {
124123
const ourPConn = getPConnect();
125124

126-
// debugging/investigation help
127-
// console.log(`${ourPConn.getComponentName()}: children update for main draw`);
128-
129-
// const oData = ourPConn.getDataObject();
130-
131-
// const activeActionLabel = "";
132-
// const child0_getPConnect = arNewChildren[0].getPConnect();
133-
134-
// this.templateName$ = this.configProps$["template"];
135-
136125
// debugger;
137126
setShowTodo(getTodoVisibility());
138127

@@ -156,63 +145,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
156145
}
157146
}, [isInitialized, hasItems]);
158147

159-
function isCaseWideLocalAction() {
160-
const ourPConn = getPConnect();
161-
162-
const actionID = ourPConn.getValue(pCoreConstants.CASE_INFO.ACTIVE_ACTION_ID, ''); // 2nd arg empty string until typedefs properly allow optional
163-
const caseActions = ourPConn.getValue(pCoreConstants.CASE_INFO.AVAILABLEACTIONS, ''); // 2nd arg empty string until typedefs properly allow optional
164-
let bCaseWideAction = false;
165-
if (caseActions && actionID) {
166-
const actionObj = caseActions.find(caseAction => caseAction.ID === actionID);
167-
if (actionObj) {
168-
bCaseWideAction = actionObj.type === 'Case';
169-
}
170-
}
171-
return bCaseWideAction;
172-
}
173-
174-
function hasChildCaseAssignments() {
175-
const ourPConn = getPConnect();
176-
177-
const childCases = ourPConn.getValue(pCoreConstants.CASE_INFO.CHILD_ASSIGNMENTS, ''); // 2nd arg empty string until typedefs properly allow optional
178-
// const allAssignments = [];
179-
return !!(childCases && childCases.length > 0);
180-
}
181-
182-
function hasAssignments() {
183-
const ourPConn = getPConnect();
184-
185-
let bHasAssignments = false;
186-
const assignmentsList: any[] = ourPConn.getValue(pCoreConstants.CASE_INFO.D_CASE_ASSIGNMENTS_RESULTS, ''); // 2nd arg empty string until typedefs properly allow optional
187-
const isEmbedded = window.location.href.includes('embedded');
188-
let bAssignmentsForThisOperator = false;
189-
// 8.7 includes assignments in Assignments List that may be assigned to
190-
// a different operator. So, see if there are any assignments for
191-
// the current operator
192-
if (PCoreVersion?.includes('8.7') || isEmbedded) {
193-
const thisOperator = PCore.getEnvironmentInfo().getOperatorIdentifier();
194-
for (const assignment of assignmentsList) {
195-
if (assignment.assigneeInfo.ID === thisOperator) {
196-
bAssignmentsForThisOperator = true;
197-
}
198-
}
199-
} else {
200-
bAssignmentsForThisOperator = true;
201-
}
202-
// Bail out if there isn't an assignmentsList
203-
if (!assignmentsList) {
204-
return bHasAssignments;
205-
}
206-
207-
const bHasChildCaseAssignments = hasChildCaseAssignments();
208-
209-
if (bAssignmentsForThisOperator || bHasChildCaseAssignments || isCaseWideLocalAction()) {
210-
bHasAssignments = true;
211-
}
212-
213-
return bHasAssignments;
214-
}
215-
216148
// From SDK-WC updateSelf - so do this in useEffect that's run only when the props change...
217149
useEffect(() => {
218150
setBuildName(getBuildName());
@@ -222,29 +154,21 @@ export const FlowContainer = (props: FlowContainerProps) => {
222154

223155
let loadingInfo: any;
224156
try {
225-
loadingInfo = thePConn.getLoadingStatus(''); // 1st arg empty string until typedefs properly allow optional
157+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
158+
loadingInfo = thePConn.getLoadingStatus();
226159
} catch (ex) {
227160
// eslint-disable-next-line no-console
228161
console.error(`${thePConn.getComponentName()}: loadingInfo catch block`);
229162
}
230163

231-
// let configProps = this.thePConn.resolveConfigProps(this.thePConn.getConfigProps());
232-
233-
if (!loadingInfo) {
234-
// turn off spinner
235-
// this.psService.sendMessage(false);
236-
}
237-
238-
const caseViewMode = thePConn.getValue('context_data.caseViewMode', ''); // 2nd arg empty string until typedefs properly allow optional
164+
const caseViewMode = thePConn.getValue('context_data.caseViewMode');
239165
const { CASE_INFO: CASE_CONSTS } = pCoreConstants;
240166
if (caseViewMode && caseViewMode === 'review') {
241167
setTimeout(() => {
242168
// updated for 8.7 - 30-Mar-2022
243169
const todoAssignments = getToDoAssignments(thePConn);
244-
if (todoAssignments && todoAssignments.length > 0) {
245-
setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID, '')); // 2nd arg empty string until typedefs properly allow optional
246-
setTodoDatasource({ source: todoAssignments });
247-
}
170+
setCaseInfoID(thePConn.getValue(CASE_CONSTS.CASE_INFO_ID));
171+
setTodoDatasource({ source: todoAssignments });
248172
setShowTodo(true);
249173
setShowTodoList(false);
250174
}, 100);
@@ -255,11 +179,12 @@ export const FlowContainer = (props: FlowContainerProps) => {
255179
}
256180

257181
// if have caseMessage show message and end
258-
const theCaseMessages = localizedVal(thePConn.getValue('caseMessages', ''), localeCategory); // 2nd arg empty string until typedefs properly allow optional
182+
const theCaseMessages = localizedVal(thePConn.getValue('caseMessages'), localeCategory);
259183

260-
// caseMessages's behavior has changed in 24.2, and hence it doesn't let Optional Action work.
261-
// Changing the below condition for now. Was: (theCaseMessages || !hasAssignments())
262-
if (!hasAssignments()) {
184+
const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), itemKey);
185+
const bConfirmView = rootInfo && bShowBanner;
186+
187+
if (bConfirmView) {
263188
// Temp fix for 8.7 change: confirmationNote no longer coming through in caseMessages$.
264189
// So, if we get here and caseMessages$ is empty, use default value in DX API response
265190
setCaseMessages(theCaseMessages || localizedVal('Thank you! The next step in this case has been routed appropriately.', localeCategory));
@@ -279,8 +204,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
279204
const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
280205
const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
281206

282-
const bShowBanner = showBanner(getPConnect);
283-
284207
const displayPageMessages = () => {
285208
let hasBanner = false;
286209
const messages = pageMessages ? pageMessages.map(msg => localizedVal(msg.message, 'Messages')) : pageMessages;

0 commit comments

Comments
 (0)