AJS.sidebar collapse and expand event is not working in 9.4.6

Hi Team,

We have upgraded our Jira instance from 8.20 to 9.4.6 on test environment to check if all our scripts are running and not broken.

I have fixed some scripts by dividing them into type=‘module’ and ‘javascript’ but sidebar collapse and expand events are not working.

Below is my code:

I am using the script in announcement banner.

Thanks in advance,