Window.ap is not available in mac safari jira cloud while loading modals

AP context is not available while opening modals in safari browser in mac in jira cloud

Hi @DhineshDhanapal ,

I just ran a test and was able to call AP.context.getContext() successfully in Safari on the Mac. Are you able to re-test and provide further details if it’s still a problem for you.

Regards,
Dugald

Hi @dmorrow,
can you share some example for them?
My use case is, on component load, I need to get custom data passed to the modal.
useEffect(() => {
if (window.AP && window.AP.dialog) {
window.AP.dialog.getCustomData(function (custProps) {
console.log(custProps);
});
}
},);
here I am not able to find window.AP object.

Hi @DhineshDhanapal ,

My test case involved calling AP.context.getContext() within a button click handler:

  onGetContextButtonClick = () => {
    this.setState({
      errorMessage: undefined,
      busy: true
    });
    AP.context.getContext((context) => {
      console.log('Callback from AP.context.getContext:', context);
      this.setState({
        context: context,
        busy: false
      });
    });
  };

I wonder if your useEffect hook is running before the AP object is bootstrapped?

Whilst you’re working this out, you might like to use the debug version of all.js:

<script src="https://connect-cdn.atl-paas.net/all-debug.js"></script>

See also https://developer.atlassian.com/cloud/jira/software/about-the-javascript-api/#debugging-all-js.

Regards,
Dugald

Hi @dmorrow ,
I am using
< script src=“https://connect-cdn.atl-paas.net/all.js” data-options=“sizeToParent:true” async> .
I am not able to get AP object in window in mac safari particularly. but when we use AP without window container, I am getting error like AP is not defined. I am still looking for a solution to get the context object on page load using useEffect.

Regards,
Dhinesh Dhanapal