define('bitbucket/internal/feature/sync/banner/ref-sync-banner', [
    'jquery',
    'bitbucket/internal/feature/sync/common/ref-sync-common',
    'bitbucket/internal/util/promise',
    'exports'
], function(
    $,
    refSyncCommon,
    promiseUtil,
    exports
) {
    'use strict';

    exports.onReady = function() {
        $('#disable-ref-sync').click(function() {
            promiseUtil.spinner(
                $('<div class="spinner"></div>').insertAfter('#disable-ref-sync'),
                refSyncCommon.enableRefSyncing(false).done(function() {
                    $('#ref-sync-banner').remove();
                }));
        });
    };
});

jQuery(function() {
    require('bitbucket/internal/feature/sync/banner/ref-sync-banner').onReady();
});
