<style>
    .tooltip-inner {
        max-width: 500px !important;
    }

    body {
        max-height: 100%;
        background: #f0f0f1;
    }

    #tvc_popup_box {
        width: 500px;
        overflow: hidden;
        background: #eee;
        box-shadow: 0 0 10px black;
        border-radius: 10px;
        position: absolute;
        top: 30%;
        left: 40%;
        display: none;
    }
</style>
<div id="msbing_box">
    <form id="mmcsetings_form" class="convpixsetting-inner-box">
        <div id="analytics_box_UA" class="py-1">
            <div class="row">
                <div class="col-6">
                    <div class="py-1">
                        <div class="row pt-2">
                            <div class="col-12">
                                <h5 class="d-flex align-items-center mb-1 text-dark">
                                    <b><?php esc_html_e("Microsoft Merchant Center Store:", "enhanced-e-commerce-for-woocommerce-store"); ?></b>
                                    <?php if (!empty($microsoft_merchant_center_id)) { ?>
                                        <span class="material-symbols-outlined text-success ms-1 fs-6">check_circle</span>
                                    <?php } ?>
                                </h5>
                                <div class="d-flex align-items-center">
                                    <select id="microsoft_merchant_center_id" name="microsoft_merchant_center_id" class="form-select form-select-lg mb-3 selecttwo valtoshow_inpopup_this" style="width: 100%" <?php echo esc_attr($is_sel_disable); ?>>
                                        <?php if (!empty($microsoft_merchant_center_id)) { ?>
                                            <option value="<?php echo esc_attr($microsoft_merchant_center_id); ?>" selected><?php echo esc_attr($microsoft_merchant_center_id); ?></option>
                                        <?php } ?>
                                        <option value="">Select Account</option>
                                    </select>
                                    <button type="button" class="btn btn-sm d-flex conv-enable-selection conv-link-blue align-items-center">
                                        <span class="material-symbols-outlined md-18">edit</span>
                                        <span class="px-1">Edit</span>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="py-1">
                        <div class="row pt-2">
                            <div class="col-12">
                                <h5 class="d-flex align-items-center mb-1 text-dark">
                                    <b><?php esc_html_e("Microsoft Merchant Catalog Id:", "enhanced-e-commerce-for-woocommerce-store"); ?></b>
                                    <?php if (!empty($microsoft_merchant_center_id)) { ?>
                                        <span class="material-symbols-outlined text-success ms-1 fs-6">check_circle</span>
                                    <?php } ?>
                                </h5>
                                <div class="d-flex align-items-center">
                                    <select id="ms_catalog_id" name="ms_catalog_id" class="form-select form-select-lg mb-3 selecttwo valtoshow_inpopup_this" style="width: 100%" <?php echo esc_attr($is_sel_disable); ?>>
                                        <?php if (!empty($ms_catalog_id)) { ?>
                                            <option value="<?php echo esc_attr($ms_catalog_id); ?>" selected><?php echo esc_attr($ms_catalog_id); ?></option>
                                        <?php } ?>
                                        <option value="">Select Microsoft Merchant Catalog ID</option>
                                    </select>
                                    <button type="button" class="btn btn-sm d-flex conv-enable-selection conv-link-blue align-items-center">
                                        <span class="material-symbols-outlined md-18">edit</span>
                                        <span class="px-1">Edit</span>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-6">
                    <div class="col-12 d-flex col-12 flex-row pt-1 mt-3 conv_create_new_merchant_card rounded px-3 py-3">
                        <div class="col-12 py-2">
                            <!-- Show this after creation -->
                            <div class="alert-message d-flex">
                                <div class="alert alert-success text-start d-none after-mmc-acc-creation">
                                    New Microsoft Merchant Center Store With Id: <span id="new_mmc_id"></span> is created
                                    successfully.
                                </div>
                            </div>
                            <?php
                            if (isset($is_site_verified) === TRUE && $is_site_verified === '1') {  ?>
                            <?php } else { ?>
                                <h5 class="p-1 alert alert-danger d-flex align-items-center justify-content-center">
                                    You site is not verified yet!
                                    <span class="material-symbols-outlined text-danger fs-5 site_verified">
                                        sync_problem
                                    </span>
                                </h5>

                            <?php } ?>
                            <div class="d-flex justify-content-between align-items-center before-mmc-acc-creation
                            <?php echo (isset($is_site_verified) === TRUE && $is_site_verified === '1') ? '' : 'disabledsection'; ?>">

                                <div class="pe-2" style="max-width:300px">
                                    <h5 class="text-dark mb-0">Do not have an store?</h5>
                                    <span class="text-dark fs-12">
                                        By using Pmax Campaign and Feed Sync with a Microsoft Bing Ads account, you can simplify campaign management, improve conversions, and increase product visibility, ultimately driving more sales and revenue for your business.
                                    </span>
                                </div>
                                <div class="align-self-center conv_create_mmc_new_when_notexist <?php echo !empty($microsoft_merchant_center_id) ? 'disabledsection' : '' ?>" bis_skin_checked="1">
                                    <a id="conv_create_mmc_new_btn" class="btn btn-primary px-5" style="cursor:pointer" data-bs-toggle="modal" data-bs-target="#conv_create_new_merchant">
                                        <?php esc_html_e("Create New", "enhanced-e-commerce-for-woocommerce-store"); ?>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <div class="col-12 flex-row pt-3 row d-none for now">
                <div class="col-5">
                    <label class="text-dark">Site Verified</label>
                    <span class="material-symbols-outlined fs-6" data-bs-toggle="tooltip" data-bs-placement="right" data-container="body" title="When you verify your website, you let Google know that you're the owner of the website. You're the website owner if you have the ability to make edits to your website content. Not the website owner? Work together with your website owner or admin to verify the website.">
                        info
                    </span>
                </div>
                <div class="col-6 site_verifiedDiv">
                    <?php
                    if (isset($is_site_verified) === TRUE && $is_site_verified === '1') { ?>
                        <span class="material-symbols-outlined text-success fs-5 site_verified" style="cursor:default">
                            check_circle
                        </span>
                    <?php } else { ?>
                        <span class="material-symbols-outlined text-danger fs-5 site_verified" onclick="call_site_verified()" style="cursor:pointer">
                            sync_problem
                        </span>
                    <?php }
                    ?>
                </div>
            </div>
            <div class="col-12 flex-row pt-3 row domain_claimDiv  d-none for now">
                <div class="col-5">
                    <label class="text-dark">Domain Claim</label>
                    <span class="material-symbols-outlined fs-6" data-bs-toggle="tooltip" data-bs-placement="right" data-container="body" title="When you claim your website, it gives you the right to use your website in connection with your Merchant Center account. First you need to verify your website and then you can claim it. Only the user who verified the website can claim it.">
                        info
                    </span>
                </div>
                <div class="col-6">
                    <?php if ($is_domain_claim === '1') { ?>
                        <span class="material-symbols-outlined text-success fs-5 domain_claim" style="cursor:default">
                            check_circle
                        </span>
                    <?php } else { ?>
                        <span class="material-symbols-outlined text-danger fs-5 domain_claim" onclick="call_domain_claim()" style="cursor:pointer">
                            sync_problem
                        </span>
                    <?php }
                    ?>
                </div>
            </div>


        </div>
    </form>
</div>

<input type="hidden" id="valtoshow_inpopup" value="Microsoft Merchant Center Store:" />
<input type="hidden" id="conversios_onboarding_nonce" value="<?php echo esc_attr(wp_create_nonce('conversios_onboarding_nonce')); ?>" />
<input type="hidden" id="feedType" name="feedType" value="<?php echo isset($_GET['feedType']) && $_GET['feedType'] != '' ? esc_attr(sanitize_text_field(wp_unslash($_GET['feedType']))) : '' ?>" />
<!-- Create New Ads Account Modal -->
<div class="modal fade" id="conv_create_new_merchant" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="staticBackdropLabel" aria-hidden="true" style="z-index: 9999;">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content">
            <form id="conv_form_new_bing_merchant">
                <div class="modal-body text-start">
                    <div class="row">
                        <div class="col-12 pe-4">
                            <div id="before_gadsacccreated_text" class="mb-1 fs-6 before-bing-acc-creation">
                                <h5 class="modal-title my-3" id="staticBackdropLabel">
                                    <span id="before_gadsacccreated_title">
                                        <?php esc_html_e("Create New Microsoft Merchant Center Store", "enhanced-e-commerce-for-woocommerce-store"); ?>
                                    </span>
                                    <span id="after_gadsacccreated_title" class="d-none after-ads-acc-creation">
                                        <?php esc_html_e("New Microsoft Merchant Center Store Created", "enhanced-e-commerce-for-woocommerce-store"); ?>
                                    </span>
                                </h5>
                                <div id="create_bing_error" class="alert alert-danger d-none" role="alert">
                                    <small></small>
                                </div>

                                <div class="mb-3">
                                    <div class="form-group mt-2">
                                        <span class="inner-text">Store Name</span> <span class="text-danger">*</span>
                                        <input class="form-control mb-2" type="text" id="store_name" name="store_name" value="" placeholder="" required>
                                    </div>

                                    <div class="form-group mt-3">
                                        <span class="inner-text">Notification E-mail</span> <span class="text-danger">*</span>
                                        <input class="form-control mb-2" type="text" id="notification_email" name="notification_email" value="<?php echo esc_attr($g_email); ?>" placeholder="" required>
                                    </div>
                                    <div class="form-group mt-3">
                                        <span class="inner-text">Store URL</span> <span class="text-danger">*</span>
                                        <input class="form-control mb-0" readonly type="text" id="store_url" name="store_url" value="<?php echo esc_url(home_url()); ?>" required>
                                    </div>

                                    <input type="hidden" id="notification_language" name="notification_language" value="en-US" required>

                                    <div class="form-group mt-3">
                                        <input id="bing_concent" name="concent" class="form-check-input" type="checkbox" value="1" required style="float:none">
                                        <label class="form-check-label fs-12" for="concent">
                                            <?php esc_html_e("I accept the", "enhanced-e-commerce-for-woocommerce-store"); ?>
                                            <a class="fs-14" target="_blank" href="<?php echo esc_url("https://www.microsoft.com/en-gb/servicesagreement"); ?>"><?php esc_html_e("terms & conditions", "enhanced-e-commerce-for-woocommerce-store"); ?></a>
                                            <span class="text-danger"> *</span>
                                        </label>
                                    </div>

                                </div>

                            </div>
                            <!-- Show this after creation -->
                            <div class="onbrdpp-body alert alert-primary text-start d-none after-bing-acc-creation">
                                New Microsoft Bing Ads Account With Id: <span id="new_bing_id"></span> is created
                                successfully.
                            </div>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <div class="me-auto">
                        <button id="create_merchant_account_new" class="btn conv-blue-bg text-white before-mmc-acc-creation me-auto">
                            <span id="gadsinviteloader" class="spinner-grow spinner-grow-sm d-none" role="status" aria-hidden="true"></span>
                            <?php esc_html_e("Create", "enhanced-e-commerce-for-woocommerce-store"); ?>
                        </button>

                        <button type="button" class="ms-3 btn btn-secondary me-auto" data-bs-dismiss="modal" id="model_close_mmc_creation">
                            <?php esc_html_e("Close", "enhanced-e-commerce-for-woocommerce-store"); ?>
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="modal fade" id="conv_save_error_modal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" style="z-index: 99999">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header border-0 pb-0">

            </div>
            <div class="modal-body text-center p-0">
                <img style="width:184px;" src="<?php echo esc_url(CONVPFM_ENHANCAD_PLUGIN_URL . '/admin/images/logos/error_logo.png'); ?>">
                <h3 class="fw-normal pt-3">Error</h3>
                <span id="conv_save_error_txt" class="mb-1 lh-lg"></span>
            </div>
            <div class="modal-footer border-0 pb-4 mb-1">
                <button class="btn conv-yellow-bg m-auto text-white" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script>
    jQuery(document).on('show.bs.modal', '#conv_create_new_merchant', function() {
        jQuery.fn.modal.Constructor.prototype.enforceFocus = function() {};
        jQuery.fn.modal.Constructor.prototype._enforceFocus = function() {};

        jQuery(".selectthree").select2({
            minimumResultsForSearch: 5,
            dropdownParent: jQuery('#conv_create_mmc_selectthree'),
            placeholder: function() {
                jQuery(this).data('placeholder');
            }
        });
    })

    jQuery(document).on('select2:select', '#microsoft_ads_subaccount_id', function(e) {
        if (jQuery(this).val() != "" && jQuery(this).val() != undefined) {
            conv_change_loadingbar("show");
            var selele = jQuery(".conv-enable-selection").closest(".conv-mmcsettings").find(
                "select.microsoft_merchant_center_id");
            list_microsoft_merchant_account(convpfm_data, selele);
        }
    });

    jQuery(document).on('select2:select', '#microsoft_merchant_center_id', function(e) {
        if (jQuery(this).val() != "" && jQuery(this).val() != undefined) {
            conv_change_loadingbar("show");
            var selele = jQuery(".conv-enable-selection").closest(".conv-mmcsettings").find(
                "select.ms_catalog_id");
            list_microsoft_catalog_account(convpfm_data, selele);
        }
    });

    jQuery('.conv-enable-selection').click(function() {
        jQuery(this).addClass('disabled');
        /*var selele = jQuery('.conv-enable-selection').closest(".conv-hideme-gasettings").find(
            "select.ga_analytic_account_id");
        var currele = jQuery(this).closest(".conv-hideme-gasettings").find(
            "select.ga_analytic_account_id");*/

        if (jQuery(this).parent().find('select').attr('id') == 'microsoft_merchant_center_id') {
            list_microsoft_merchant_account();
        }
        if (jQuery(this).parent().find('select').attr('id') == 'ms_catalog_id') {
            var account_id = jQuery("#microsoft_ads_manager_id").val();
            list_microsoft_catalog_account();
        }
        // if (jQuery(this).parent().find('select').attr('id') == 'microsoft_ads_pixel_id') {
        //     var account_id = jQuery("#microsoft_ads_manager_id").val();
        //     var subaccount_id = jQuery("#microsoft_ads_subaccount_id").val();
        //     if (account_id != "" && subaccount_id != "") {
        //         list_microsoft_ads_get_UET_tag(account_id, subaccount_id);
        //     }
        // }
    });

    // jQuery(document).on("click", ".conv-btn-connect-enabled-microsoft", function(e) {
    //     e.preventDefault();
    //     var has_error = 0;
    //     var selected_vals = {};
    //     jQuery("#msbing_box").find("select").each(function() {
    //         if (!jQuery(this).val() || jQuery(this).val() == "" || jQuery(this).val() ==
    //             "undefined") {
    //             has_error = 1;
    //             return;
    //         } else {
    //             selected_vals[jQuery(this).attr('name')] = jQuery(this).val();
    //         }
    //     });
    // });
    jQuery("#conv_form_new_bing_merchant").on('submit', function(e) {
        e.preventDefault();

        var form = jQuery(this);

        // Add disabled class & disable form elements
        form.addClass('disabled');
        form.find("input, select, textarea, button").prop("disabled", true);
        jQuery("#create_merchant_account_new").addClass("disabled");

        var store_name = jQuery("#store_name").val();
        var store_url = jQuery("#store_url").val();
        var notification_email = jQuery("#notification_email").val();
        var notification_language = jQuery("#mmnotification_languagec_country").val();

        var data = {
            action: "convpfm_create_microsoft_merchant_center_account",
            store_name: store_name,
            store_url: store_url,
            notification_email: notification_email,
            notification_language: notification_language,
            account_id: jQuery('#microsoft_ads_manager_id').val(),
            subaccount_id: jQuery('#microsoft_ads_subaccount_id').val(),
            subscription_id: subscription_id,
            //tvc_data: tvc_data,
            conversios_onboarding_nonce: "<?php echo esc_js(wp_create_nonce('conversios_onboarding_nonce')); ?>"
        };
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: convpfm_ajax_url,
            data: data,
            beforeSend: function() {
                jQuery('#gadsinviteloader').removeClass('d-none');
            },
            success: function(response, status) { //console.log(response);
                form.removeClass('disabled');
                form.find("input, select, textarea, button").prop("disabled", false);
                jQuery("#create_merchant_account_new").removeClass("disabled");

                if (response.error === true) {
                    jQuery("#conv_create_new_bing").modal('hide');
                    var error_msg = "There was error to create merchant center store:" + response.errors;
                    getAlertMessageAll(
                        'info',
                        'Error',
                        message = error_msg,
                        icon = 'info',
                        buttonText = 'Ok',
                        buttonColor = '#FCCB1E',
                        iconImageSrc =
                        '<img src="<?php echo esc_url(CONVPFM_ENHANCAD_PLUGIN_URL . '/admin/images/logos/conv_error_logo.png'); ?>"/ >'
                    );

                } else {
                    jQuery("#conv_create_new_bing").modal('hide');
                    jQuery("#new_mmc_id").text(response.data.merchantId);
                    jQuery(".before-mmc-acc-creation").addClass("d-none");
                    jQuery(".after-mmc-acc-creation").removeClass("d-none");
                    jQuery("#model_close_mmc_creation").text("Created, close now");
                    var convpfm_data = "<?php echo esc_js(wp_json_encode($convpfm_data)); ?>";
                    list_microsoft_merchant_account(convpfm_data, "", response.data.merchantId, response.data.storeName);
                }

            },
            complete: function() {
                jQuery('#gadsinviteloader').addClass('d-none');
            }
        });

        form.removeClass('disabled');
        form.find("input, select, textarea, button").prop("disabled", false);
        jQuery("#create_merchant_account_new").removeClass("disabled");

    });

    function list_microsoft_merchant_account(convpfm_data, selelement, new_mmc_id = "", new_merchant_id = "") {
        conv_change_loadingbar("show");
        jQuery(".conv-enable-selection").addClass('hidden');
        var selectedValue = '0';
        var conversios_onboarding_nonce = "<?php echo esc_js(wp_create_nonce('conversios_onboarding_nonce')); ?>";
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: convpfm_ajax_url,
            data: {
                action: "convpfm_list_microsoft_merchant_account",
                convpfm_data: convpfm_data,
                account_id: jQuery('#microsoft_ads_manager_id').val(),
                subaccount_id: jQuery('#microsoft_ads_subaccount_id').val(),
                subscription_id: subscription_id,
                conversios_onboarding_nonce: conversios_onboarding_nonce
            },
            success: function(response) {
                var btn_cam = 'mmc_list';
                if (response.error === false) {
                    var error_msg = 'null';
                    jQuery('#microsoft_merchant_center_id').empty();
                    // jQuery('#microsoft_merchant_center_id').append(jQuery('<option>', {
                    //     value: "",
                    //     text: "Select Microsoft Merchant Center Store"
                    // }));
                    if (response.data.length == 0) {
                        jQuery('#microsoft_merchant_center_id').html('<option value="">No Microsoft Merchant Accounts associated with this account</option>');
                        jQuery('#microsoft_ads_subaccount_id').prop("disabled", false);
                        getAlertMessageAll(
                            'info',
                            'Error',
                            message = 'There are no Microsoft Merchant Accounts associated with email.',
                            icon = 'info',
                            buttonText = 'Ok',
                            buttonColor = '#FCCB1E',
                            iconImageSrc =
                            '<img src="<?php echo esc_url(CONVPFM_ENHANCAD_PLUGIN_URL . '/admin/images/logos/conv_error_logo.png'); ?>"/ >'
                        );
                    } else if (response.data.length > 0) {
                        jQuery.each(response.data, function(key, value) {

                            jQuery('#microsoft_merchant_center_id').append(jQuery('<option>', {
                                value: value.merchantId,
                                "data-merchant_id": value.merchantId,
                                text: value.storeName + ' (' + value.merchantId + ')',
                                selected: "selected"
                            }));

                        });
                        jQuery(".conv-mc-settings").removeClass("disabledsection");
                        list_microsoft_catalog_account();

                        //jQuery('#tvc-mmc-acc-edit').hide();
                    } else {
                        if (new_mmc_id != "" && new_mmc_id != undefined) {
                            jQuery('#microsoft_merchant_center_id').append(jQuery('<option>', {
                                value: new_mmc_id,
                                "data-merchant_id": new_mmc_id,
                                text: storeName + ' (' + new_mmc_id + ')',
                                selected: "selected"
                            }));
                            jQuery(".conv-mc-settings").removeClass("disabledsection");
                            list_microsoft_catalog_account()

                        } else {
                            jQuery(".conv_create_mmc_new_when_notexist").removeClass("disabledsection");
                            getAlertMessageAll(
                                'info',
                                'Error',
                                message = 'There are no Microsoft merchant center stores associated with email.',
                                icon = 'info',
                                buttonText = 'Ok',
                                buttonColor = '#FCCB1E',
                                iconImageSrc =
                                '<img src="<?php echo esc_url(CONVPFM_ENHANCAD_PLUGIN_URL . '/admin/images/logos/conv_error_logo.png'); ?>"/ >'
                            );
                            console.log("error", "There are no Microsoft merchant center stores associated with email.");
                        }
                    }

                } else {
                    var error_msg = response.errors;
                    console.log("error", error_msg);
                    //add_message("error", "There are no Microsoft merchant center stores associated with email.");
                    // console.log("error",
                    //     "There are no Microsoft merchant center  stores associated with email.");
                }
                jQuery('#microsoft_merchant_center_id').select2();
                setTimeout(function() {}, 2000);
                jQuery('#microsoft_merchant_center_id').prop('disabled', false);
                conv_change_loadingbar("hide");
            }
        });
    }

    function save_ms_target_country(ms_target_country) {
        var conversios_onboarding_nonce = "<?php echo esc_js(wp_create_nonce('conversios_onboarding_nonce')); ?>";
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: convpfm_ajax_url,
            data: {
                action: "convpfm_save_ms_target_country",
                subscription_id: subscription_id,
                ms_target_country: ms_target_country,
                conversios_onboarding_nonce: conversios_onboarding_nonce
            },
            success: function(res) {
                console.log("Target country saved:", res);
            }
        });
    }

    function list_microsoft_catalog_account() {
        conv_change_loadingbar("show");
        jQuery(".conv-enable-catalog-selection").addClass('hidden');
        var selectedValue = '0';
        var conversios_onboarding_nonce = "<?php echo esc_js(wp_create_nonce('conversios_onboarding_nonce')); ?>";
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: convpfm_ajax_url,
            data: {
                action: "convpfm_list_microsoft_catalog_account",
                account_id: jQuery('#microsoft_ads_manager_id').val(),
                subaccount_id: jQuery('#microsoft_ads_subaccount_id').val(),
                microsoft_merchant_center_id: jQuery('#microsoft_merchant_center_id').val(),
                subscription_id: subscription_id,
                conversios_onboarding_nonce: conversios_onboarding_nonce
            },
            success: function(response) {

                if (response.error === false) {
                    var error_msg = 'null';
                    jQuery('#ms_catalog_id').empty();
                    if (response.data.length > 0) {
                        var ms_target_country = response.data[0].market;
                        if (ms_target_country) {
                            save_ms_target_country(ms_target_country);
                        }
                        jQuery.each(response.data, function(key, value) {
                            jQuery('#ms_catalog_id').append(jQuery('<option>', {
                                value: value.id,
                                "data-merchant_id": value.id,
                                text: value.name + ' (' + value.id + ')',
                                selected: "selected"
                            }));

                        });

                        jQuery(".conv-btn-connect").removeClass("conv-btn-connect-disabled");
                        jQuery(".conv-btn-connect").removeClass("conv-btn-disconnect");
                        jQuery(".conv-btn-connect").addClass("conv-btn-connect-enabled-microsoft");

                        //jQuery('#tvc-mmc-acc-edit').hide();
                    } else {

                        getAlertMessageAll(
                            'info',
                            'Error',
                            message = 'There are no Microsoft merchant catalog associated with email.',
                            icon = 'info',
                            buttonText = 'Ok',
                            buttonColor = '#FCCB1E',
                            iconImageSrc =
                            '<img src="<?php echo esc_url(CONVPFM_ENHANCAD_PLUGIN_URL . '/admin/images/logos/conv_error_logo.png'); ?>"/ >'
                        );
                        console.log("error", "There are no Microsoft merchant catalog associated with email.");

                    }

                } else {
                    var error_msg = response.errors;
                    //add_message("error", "There are no Microsoft merchant center stores associated with email.");
                    // console.log("error",
                    //     "There are no Microsoft merchant center  stores associated with email.");
                }
                jQuery('#ms_catalog_id').select2();
                setTimeout(function() {}, 2000);
                jQuery('#ms_catalog_id').prop('disabled', false);
                conv_change_loadingbar("hide");
            }
        });
    }
</script>