Load Jira AP JS API dynamically
import initAP from 'jira-ap'
initAP({ sizeToParent: true }).then(AP => {
AP.flag.create({
title: 'Successfully created a flag.',
body: 'This is a flag.',
type: 'success',
actions: {
'actionkey': 'Click me'
}
})
})
Code based on this article https://developer.atlassian.com/cloud/jira/platform/about-the-javascript-api/
You may need some polyfills: