Skip to content

Commit eb9f312

Browse files
authored
refactor: event subscription for assignment completion handling (#460)
1 parent 01891dd commit eb9f312

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ export const FlowContainer = (props: FlowContainerProps) => {
266266
setHasCaseMessages(true);
267267
setShowConfirm(true);
268268

269-
// publish this "assignmentFinished" for mashup, need to get approved as a standard
270-
PCore.getPubSubUtils().publish('assignmentFinished');
271-
272269
// debugger;
273270
setCheckSvg(Utils.getImageSrc('check', Utils.getSDKStaticConentUrl()));
274271
} else {

packages/react-sdk-components/src/samples/Embedded/MainScreen/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ export default function MainScreen(props: MainScreenProps) {
8787
// Subscribe to the EVENT_CANCEL event to handle the assignment cancellation
8888
PCore.getPubSubUtils().subscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, () => cancelAssignment(), 'cancelAssignment');
8989

90-
// Subscribe to the 'assignmentFinished' event to handle assignment completion
91-
PCore.getPubSubUtils().subscribe('assignmentFinished', () => assignmentFinished(), 'assignmentFinished');
90+
// Subscribe to the END_OF_ASSIGNMENT_PROCESSING event to handle assignment completion
91+
PCore.getPubSubUtils().subscribe(
92+
PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.END_OF_ASSIGNMENT_PROCESSING,
93+
() => assignmentFinished(),
94+
'endOfAssignmentProcessing'
95+
);
9296

9397
return () => {
9498
// unsubscribe to the events
9599
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'cancelAssignment');
96-
PCore.getPubSubUtils().unsubscribe('assignmentFinished', 'assignmentFinished');
100+
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.END_OF_ASSIGNMENT_PROCESSING, 'endOfAssignmentProcessing');
97101
};
98102
});
99103

0 commit comments

Comments
 (0)