"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var o=0;o'.concat(t(e.value+" - "+e.text),"")},item:function(e,t){return'
'.concat(t(e.value+" - "+e.text),"
")}}}),s(".woo-feed-cat-map-spinner").remove()}).fail(u.ajax_fail)}},{key:"wooFeed_get_facebook_categories",value:function(){i.send("get_facebook_categories",{type:"GET",data:{_ajax_nonce:r.nonce,action:"get_facebook_categories"}}).then(function(e){s(".selectize-google-category").selectize({valueField:"value",labelField:"text",placeholder:"Select a Facebook category",searchField:["value","text"],options:e,render:{option:function(e,t){return'
'.concat(t(e.value+" - "+e.text),"
")},item:function(e,t){return'
'.concat(t(e.value+" - "+e.text),"
")}}}),s(".woo-feed-cat-map-spinner").remove()}).fail(u.ajax_fail)}}]),e}(),u={in_array:function(e,t){try{return-1!==t.indexOf(e)}catch(e){return!1}},selectize_render_item:function(e,t){return'
'.concat(t(e.text),"
")},ajax_fail:function(e){console.warn(e),alert(e.hasOwnProperty("statusText")&&e.hasOwnProperty("status")?r.ajax.error+"\n"+e.statusText+" ("+e.status+")":e)},sortable:function(e,o,a,n){return(e||s(".sorted_table")).each(function(){var e=s(this),t=e.find("tbody > tr:eq(0) > td").length||a||9;e.wf_sortable(d({containerSelector:"table",itemPath:"> tbody",itemSelector:"tr",handle:"i.wf_sortedtable",placeholder:''),onDrop:function(e,t,o,a){e.removeClass(t.group.options.draggedClass).removeAttr("style"),s("body").removeClass(t.group.options.bodyClass),e.find("input.wf_attributes").attr("name","default["+numb+"]"),n&&"function"==typeof n&&n(e,t,o,a)}},o))})},selectize:function(e,t){return(e||s("select.selectize")).not(".selectized").not(".selectize-google-category").each(function(){var e=s(this);e.selectize(d({create:e.data("create")||!1,plugins:e.data("plugins")?e.data("plugins").split(",").map(function(e){return e.trim()}):[],render:{item:u.selectize_render_item}},t))})},fancySelect:function(e,t){return(e||s("select.fancySelect")).not(".FancySelectInit").each(function(){s(this).fancySelect(d({maxItemShow:3},t))})},reindex_config_table:function(){s("#table-1").find("tbody tr").each(function(o,e){s(e).find("[name]").each(function(e,t){s(t).attr("name",s(t).attr("name").replace(/(\[\d\])/g,"[".concat(o,"]")))})})},common:function(){u.sortable(s(".sorted_table"),{},9,u.reindex_config_table),u.selectize(),u.fancySelect(s(".outputType")),wp.hooks.addAction("init_fancy_select","fancy_select",function(){u.fancySelect(s(".ctx-outputType"));u.fancySelect(s(".ctx-postStatus"))})},setLocalStorage:function(e,t){var o=!(2read this doc."),this._updateProgressStatus(t)}},{key:"_updateProgressBar",value:function(){var e=s(".feed-progress-percentage"),t=s(".feed-progress-bar-fill"),o="".concat(Math.round(this._progress),"%");t.css({width:o}),e.text(o)}}]),e}();c.wf={helper:u,feedEditor:g,generator:h},s(c).on("load",function(){null!==s(location).attr("href").match(/webappick.*feed/g)&&s("#wpbody-content").addClass("woofeed-body-content"),t(),postboxes.add_postbox_toggles(pagenow),(new h).init(),""!==r.generator.feed&&r.generator.regenerate,g.init(),u.common(),s(".wfmasterTooltip").hover(function(){var e=s(this),t=e.attr("wftitle");e.data("tipText",t).removeAttr("wftitle"),s('

').text(t).appendTo("body").fadeIn("slow")},function(){var e=s(this);e.attr("wftitle",e.data("tipText")),s(".wftooltip").remove()}).mousemove(function(e){s(".wftooltip").css({top:e.pageY+10,left:e.pageX+20})}),s(".generateFeed").validate(),s(l).on("blur",'input[name="wfDAttributeName"]',function(e){e.preventDefault();e=s(this).val();e=(e=e.toLowerCase()).split(" ").join("_"),s("#wfDAttributeCode").val(e)}).on("click","[data-toggle_slide]",function(e){e.preventDefault(),s(s(this).data("toggle_slide")).slideToggle("fast")}).on("click","#wf_newRow",function(){var e=s("#table-1 tbody"),t=s("#feed_config_template").text().trim().replace(/__idx__/g,e.find("tr").length);e.append(t),u.fancySelect(s(".outputType")),u.fancySelect(s(".ctx-outputType"))}).on("click",".single-feed-delete",function(e){e.preventDefault(),confirm(r.form.del_confirm)&&(c.location.href=s(this).attr("val"))}).on("click",".wf_clean_cache_wrapper",function(e){e.preventDefault();for(var o=s(".woo-feed-clean-cache-nonce").val(),a=s(".woo-feed-cache-loader"),n=["woo_feed_attributes","woo_feed_category_mapping","woo_feed_dynamic_attributes","woo_feed_attribute_mapping","woo_feed_wp_options"],t=(a.show(),0);tSelect Attribute','
Default
','
Strip Tags
','
UTF-8 Encode
','
htmlentities
','
Integer
','
Price
','
Rounded Price
','
Remove Space
','
CDATA
','
Remove Special Character
','
Remove ShortCodes
','
ucwords
','
ucfirst
','
strtoupper
','
strtolower
','
urlToSecure
','
urlToUnsecure
','
only_parent
','
parent
','
parent_if_empty
','
','
'].map(function(e){a.append(e)}),s(this).parents("tr").find(".fancy-picker-data")),i=["price","current_price","sale_price","price_with_tax","current_price_with_tax","sale_price_with_tax","shipping_cost"].includes(e)?(t="for_price","Price"):""!==e&&-1!==e.indexOf("wf_taxo")?(t="for_custom_taxo","parent_if_empty"):(t="for_all","Default");s(a).find(".fancy-picker-option").removeClass("selected"),"for_custom_taxo"===t||"for_price"===t?(s(a).find(".fancy-picker-option").each(function(){i===s(this).text().trim()&&(n.html("".concat(i,"")),o.find("option").text(i),o.find("option").val(s(this).data("value")),s(this).addClass("selected"))}),"for_price"===t&&(t=null!=(e=s("#feedCurrency").val())?e:wpf_ajax_obj.woocommerce.currency,s(this).closest("tr").find("td:eq(5) input").val(" "+t))):(a.each(function(){i===s(this).text()&&(s(this).addClass("selected"),n.text(i),o.find("option").text(i),o.find("option").val(s(this).data("value")))}),s(this).closest("tr").find("td:eq(5) input").val(""))}).on("click","#doaction, #doaction2",function(){return confirm(r.form.del_confirm_multi)}).on("change",".dType",function(){var e=s(this),t=e.val(),e=e.closest("tr");"pattern"===t?(e.find(".value_attribute").hide(),e.find(".value_pattern").show()):"attribute"===t?(e.find(".value_attribute").show(),e.find(".value_pattern").hide()):"remove"===t&&(e.find(".value_attribute").hide(),e.find(".value_pattern").hide())}).on("click",".delRow",function(e){e.preventDefault(),s(this).closest("tr").remove(),u.reindex_config_table()}).on("submit","#generateFeed",function(){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html(' '.concat(r.form.generate,""))}).on("submit","#updatefeed",function(e,t){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html(' '.concat(t&&t.save?r.form.save:r.form.generate,""))}).on("ready woo_feed_config_loaded",function(){"0"===s("#ftpenabled").val()?(s(".google-merchant-message").hide("slow"),s(".woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) input, .woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) select").attr("disabled","disabled")):("google"===s("#provider").val()?s(".google-merchant-message").show("slow"):s(".google-merchant-message").hide("slow"),s(".woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) input, .woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) select").removeAttr("disabled")),s("#ftpenabled").on("change",function(){"0"===s("#ftpenabled").val()?(s(".google-merchant-message").hide("slow"),s(".woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) input, .woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) select").attr("disabled","disabled")):(s(".woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) input, .woo-feed-ftp .ftpconfig tr:not(.ftpcontroller) select").removeAttr("disabled"),"google"===s("#provider").val()?s(".google-merchant-message").show("slow"):s(".google-merchant-message").hide("slow"))})}).on("change",".ftporsftp",function(){var e=s(this).val(),t=s(".ssh2_status");"sftp"===e?(t.show().css("color","dodgerblue").text(r.form.sftp_checking),i.post("get_ssh2_status",{_ajax_nonce:r.nonce,server:e}).then(function(e){"exists"===e?(t.css("color","#2CC185").text(r.form.sftp_available),setTimeout(function(){t.hide()},1500)):t.show().css("color","red").text(r.form.sftp_warning)}).fail(function(e){t.hide(),u.ajax_fail(e)})):t.hide()}).on("click",'[name="save_feed_config"]',function(e){e.preventDefault(),s("#updatefeed").trigger("submit",{save:!0})}).on("change",".woo_feed_status_input",function(){var e=s(this);i.post("update_feed_status",{_ajax_nonce:r.nonce,feedName:e.val(),status:e[0].checked?1:0})}),s(l).on("change",'[name="is_outOfStock"], [name="product_visibility"]',function(){var e=s(".out-of-stock-visibility");"n"===s('[name="is_outOfStock"]:checked').val()&&"1"===s('[name="product_visibility"]:checked').val()?e.show():e.hide()}).on("change",".attr_type",function(){var e=s(this),t=e.val(),e=e.closest("tr");"pattern"===t?(e.find(".wf_attr").hide(),e.find(".wf_attr").val(""),e.find(".wf_default").show()):(e.find(".wf_attr").show(),e.find(".wf_default").hide(),e.find(".wf_default").val(""))}).on("change",".wf_mattributes, .attr_type",function(){var e=s(this).closest("tr"),o=e.find(".wf_mattributes"),t=e.find(".attr_type"),a=e.find("td:eq(4)"),n=s("#provider").val();r.form.google_category.hasOwnProperty(o.val())&&"pattern"===t.val()&&u.in_array(n,r.form.google_category[o.val()])?0===a.find("select.selectize").length&&(a.find("input.wf_default").remove(),a.append(''),a.append(''.concat(r.learn_more,"")),f&&p||a.append(''),e=a.find(".wf_attributes select"),u.selectize(e,{preload:!0,placeholder:r.form.select_category,load:function(e,t){f?t(f):i.send("get_google_categories",{type:"GET",data:{_ajax_nonce:r.nonce,action:"get_google_categories",provider:n}}).then(function(e){t(f=e),a.find(".spinner").remove()}).fail(u.ajax_fail),p||"facebook"!==n||"fb_product_category"!==o.val()?t(p):i.send("get_facebook_categories",{type:"GET",data:{_ajax_nonce:r.nonce,action:"get_facebook_categories",provider:n}}).then(function(e){t(p=e),a.find(".spinner").remove()}).fail(u.ajax_fail)}})):"current_category"!==o.val()&&0===a.find("input.wf_default").length&&(a.find("span").remove(),a.append(''),"pattern"!==t.val())&&a.find("input.wf_default").hide()}).on("change","#feedType,#provider",function(e){var t=s("#feedType").val(),o=s("#provider").val(),a=s(".itemWrapper"),n=s(".wf_csvtxt");""!==t&&u.in_array(o,r.form.item_wrapper_hidden)&&a.hide(),"feedType"===e.target.id&&("csv"===t||"txt"===t||"tsv"===t?(n.show(),a.hide(),"tsv"===t?s("#delimiter option:last").prop("selected","selected"):"csv"===t&&s("#delimiter option:first").prop("selected","selected")):"xml"===t&&"custom"===o?(a.show(),n.hide()):"json"===t&&n.hide()),"custom"!==o&&a.hide()}).trigger("change"),s(l).on("click",'.woofeed-custom-fields [id*="-switcher"]',function(){s(this).closest("td").find(".switch-loader").show();var e=s(this).attr("id").split("-")[0],t=s(this).data("taxonomy"),o=s(this).prop("checked");new n(e,o,t)}).ready(function(){var e=s(".wapk-feed-buy-now-container");s(c).scroll(function(){s(c).scrollTop()<=5e3?e.addClass("fixed"):e.removeClass("fixed")})})}),s(l).on("click","#woo-feed-debug-log-download",function(e){e.preventDefault(),s("",{download:new Date+".log",href:URL.createObjectURL(new Blob([s("#woo-feed-debug-log").val()],{type:"text/plain"}))}).appendTo("body")[0].click()}).on("keyup","#filename",function(){var e=s("#filename").val();s("#utm_campaign").val(e)}).on("click",".wf-tab-name",function(e){s(".wf-tab-name.activate").removeClass("activate"),s(this).addClass("activate");var t=s(this).attr("for");s(".wf_tabs li.active").removeClass("active"),s(".wf_tabs .wf-tab-content#"+t).parent().addClass("active")}).on("change","#category-mapping-form #providers",function(){var e,t=s(this).find(":selected").val();s(".woo-feed-category-mapping-config-table").prepend('

Loading Mapping...

'),-1!==["google","facebook","pinterest","bing","bing_local_inventory","snapchat","tiktok"].indexOf(t)?(s('input[id*="cat_mapping_"]').css("display","none"),s(".wf_default.wf_attributes").css("display","block").css("width","100%"),e=new _,"facebook"===t?e.wooFeed_get_facebook_categories():e.wooFeed_get_google_categories()):(s('input[id*="cat_mapping_"]').css("display","block"),s(".wf_default.wf_attributes").css("display","none").css("width","100%"),s(".woo-feed-category-mapping-config-table .woo-feed-cat-map-spinner").css("display","none"))}).on("click",'span[id*="cat-map-"]',function(e){e.preventDefault();var o,e=s("#category-mapping-form #providers").val(),t=s(this).attr("id").replace(/[^\d.]/g,""),a="group-child-"+t;-1!==["google","facebook","pinterest","bing","bing_local_inventory","snapchat","tiktok"].indexOf(e)?(o=s(this).parents("tr").find(".selectized").val())&&s("."+a).parents("tr").find("select").each(function(e,t){s(t).data("selectize").setValue(o)}):(e=s("#cat_mapping_"+t).val(),s("."+a).parents("tr").find("input").val(e))}),s(l).ready(function(){var e=s("#providers").val(),t=new _;"edit-mapping"===new URL(c.location.href).searchParams.get("action")&&(s(".woo-feed-category-mapping-config-table").prepend('

Loading Mapping...

'),"facebook"===e?t.wooFeed_get_facebook_categories():t.wooFeed_get_google_categories())}),s(l).on("feed_editor_init",function(){var t=s(".merchant-info-section.feed_file_type .data").html().split(",").map(function(e){return e.trim().toLowerCase()}),e=s("#feedType");t.length?(e.find("option").each(function(){var e=s(this);e.val()&&!u.in_array(e.val(),t)?e.disabled(!0):e.disabled(!1)}),1===t.length&&e.find('option[value="'+t[0]+'"]').attr("selected","selected")):e.find("option").disabled(!1)}),s(l).on("ready",function(){s(l).on("feedEditor.init",function(){var i,t,r,e=s(this).find(":selected").val();-1!==["google","facebook","pinterest","bing","bing_local_inventory","snapchat","tiktok"].indexOf(e)&&(t={price:wpf_ajax_obj.woocommerce.currency,current_price:wpf_ajax_obj.woocommerce.currency,sale_price:wpf_ajax_obj.woocommerce.currency,price_with_tax:wpf_ajax_obj.woocommerce.currency,current_price_with_tax:wpf_ajax_obj.woocommerce.currency,sale_price_with_tax:wpf_ajax_obj.woocommerce.currency,weight:wpf_ajax_obj.woocommerce.weight,weight_unit:wpf_ajax_obj.woocommerce.weight,height:wpf_ajax_obj.woocommerce.dimension,length:wpf_ajax_obj.woocommerce.dimension,width:wpf_ajax_obj.woocommerce.dimension},void 0!==wpf_ajax_obj.feed_rules&&null!==wpf_ajax_obj.feed_rules&&(i=wpf_ajax_obj.feed_rules.feedCurrency),e=c.location.search,r=new URLSearchParams(e).get("action"),s(".wf_attr.wf_attributes").each(function(o,e){var a=s(e).val(),n=s('input[name^="suffix"]').eq(parseInt(o)).val();-1!==s.inArray(n,[" "+wpf_ajax_obj.woocommerce.currency," "+wpf_ajax_obj.woocommerce.weight," "+wpf_ajax_obj.woocommerce.dimension])&&s('input[name^="suffix"]').eq(parseInt(o)).val(""),s.each(t,function(e,t){a===e&&(t=null!=i?i:t,"undefined"!==r&&"edit-feed"!==r?s('input[name^="suffix"]').eq(parseInt(o)).val(" "+t):s('input[name^="suffix"]').eq(parseInt(o)).val(n))})}),s(l).trigger("feedEditor.after.free.postfix.update"))}),s("#wpf_import_file").on("change",function(e){"wpf"!==e.target.value.split("\\").pop().split(".").pop()&&(e.target.value="",alert("Please select a .wpf extension file"))}),wp.hooks.addAction("init_codemirror","codemirror",function(){var e=l.getElementById("editor_react");e&&((e=CodeMirror.fromTextArea(e,{lineNumbers:!0,mode:"xml",matchBrackets:!0})).setSize(null,620),e.on("change",function(e,t){c.localStorage.setItem("ctx_codemirror",e.getValue())}))})})}(jQuery,window,document,wp.ajax,wpf_ajax_obj); //# sourceMappingURL=woo-feed-admin.min.js.map