jQuery(document).ready(function ($) {
  $(document).on('click', '.notice-info.is-dismissible .notice-dismiss', function () {
    var $notice = $(this).closest('.notice-info')

    // Only handle our specific notice
    if (!$notice.find('.storeagent-connect-notice').length) {
      return
    }

    $.ajax({
      url: storeagentConnectNotice.ajaxUrl,
      type: 'POST',
      data: {
        action: 'storeagent_dismiss_connect_notice',
        nonce: storeagentConnectNotice.nonce,
      },
    })
  })
})
