D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
stickain
/
davidsteele.com
/
wp-content
/
plugins
/
alidswoo
/
assets
/
js
/
aliexpress
/
Filename :
aliExtension.min.js
back
Copy
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=233)}({233:function(t,e,o){t.exports=o(234)},234:function(t,e){function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}jQuery((function(t){"undefined"!=typeof alidAjaxFront&&(ajaxurl=alidAjaxFront.ajaxurl),window.ajaxurl||(window.ajaxurl=window.location.origin+"/wp-admin/admin-ajax.php"),void 0===window.ADS&&(window.ADS={}),void 0===window.Base64&&(window.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){var e,o,n,r,a,i,s,d="",u=0;for(t=window.Base64._utf8_encode(t);u<t.length;)r=(e=t.charCodeAt(u++))>>2,a=(3&e)<<4|(o=t.charCodeAt(u++))>>4,i=(15&o)<<2|(n=t.charCodeAt(u++))>>6,s=63&n,isNaN(o)?i=s=64:isNaN(n)&&(s=64),d=d+this._keyStr.charAt(r)+this._keyStr.charAt(a)+this._keyStr.charAt(i)+this._keyStr.charAt(s);return d},decode:function(t){var e,o,n,r,a,i,s="",d=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<t.length;)e=this._keyStr.indexOf(t.charAt(d++))<<2|(r=this._keyStr.indexOf(t.charAt(d++)))>>4,o=(15&r)<<4|(a=this._keyStr.indexOf(t.charAt(d++)))>>2,n=(3&a)<<6|(i=this._keyStr.indexOf(t.charAt(d++))),s+=String.fromCharCode(e),64!==a&&(s+=String.fromCharCode(o)),64!==i&&(s+=String.fromCharCode(n));return s=Base64._utf8_decode(s)},_utf8_encode:function(t){t=t.replace(/\r\n/g,"\n");for(var e="",o=0;o<t.length;o++){var n=t.charCodeAt(o);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e},_utf8_decode:function(t){for(var e="",o=0,n=0,r=0,a=0;o<t.length;)(n=t.charCodeAt(o))<128?(e+=String.fromCharCode(n),o++):n>191&&n<224?(a=t.charCodeAt(o+1),e+=String.fromCharCode((31&n)<<6|63&a),o+=2):(a=t.charCodeAt(o+1),r=t.charCodeAt(o+2),e+=String.fromCharCode((15&n)<<12|(63&a)<<6|63&r),o+=3);return e}}),window.ADS.aliExtension=function(){var e,n={sleep:5e3,method:"iframe"},r={active:!1,stack:[],_observers:[],current:null};function a(t){if("object"===o(t))return t;try{t=JSON.parse(t)}catch(o){var e=t.search("{");return-1!==e&&a("{"+(t=t.substring(e+1)))}return t}function i(t){window.postMessage({type:"requestHtml",method:n.method,url:t},"*")}function s(t){return!!t&&window.Base64.decode(t)}function d(){return r.current=r.stack.pop(),r.current}function u(t,e){e=e||{},window.postMessage({source:"NAME_SOURCE_BG",action:t,info:e},"*")}function c(e){t.ajaxQueue({url:ajaxurl,dataType:"json",data:{action:"adsw_uploadExternalImages",ads_actions:"upload_images_list",product:e},type:"POST",success:function(t){(t=a(t)).hasOwnProperty("success")?(u("toBg:resultPublishProduct",{product:{id:t.id,title:t.title},response:{message:t.success,success:t.post_id}}),window.postMessage({type:"alids:importSuccess",product:e,response:t},"*")):(setTimeout((function(){c(t.product)}),1e3),u("toBg:resultPublishProduct",{product:{id:t.product.id},response:{message:t.product.message,success:"Import Images"}}))}})}function l(e){var o,n=new FormData;n.append("action","adsw_product_ali"),n.append("product",(o=JSON.stringify(e),btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode("0x"+e)}))))),t.ajaxQueue({url:ajaxurl,dataType:"json",data:n,contentType:!1,processData:!1,type:"POST",success:function(t){(t=a(t)).hasOwnProperty("error")?(u("toBg:resultPublishProduct",{product:e,response:t}),window.postMessage({type:"alids:importSuccess'",product:product,response:t},"*")):c(t)}})}function p(t,e){e=e||{},window.postMessage({type:"adsGoogleExtension:toBg",data:{action:t,info:e}},"*")}function f(e){return new Promise((function(o,n){t.ajax({url:ajaxurl,data:{action:"aliexpress_sezam_request",ads_action:"trackOrderUpdate",args:{order_id_ali:e}},type:"POST",dataType:"json",success:function(t){return o(a(t))}})}))}return{init:function(){e=this,window.addEventListener("message",(function(e){if(e.source===window&&e.data.type){if("responseHtml"===e.data.type){e.data.info.html=s(e.data.info.html),e.data.info.obj=(f=e.data.info.html,g=t("<div></div>"),t(g).append(f)),function(t,e){if(Object.keys(r._observers).length){var o,n=r._observers[t];for(o in n){var a=n[o];e.index=a.index,e.notifyLink=t,a.observer.call(a.context,e)}delete r._observers[t]}}(e.data.info.url,e.data.info),setTimeout((function(){var t=d();t?i(t):r.active=!1}),n.sleep);var p={html:e.data.info.html,error:e.data.info.error,code:e.data.info.code,url:e.data.info.url};window.ADS.Dispatcher&&window.ADS.Dispatcher.trigger("responseHtml:"+p.url,p)}var f,g;if("adsGoogleExtension:toShop"===e.data.type&&"toShop:productAli"!==e.data.info.info.ads_actions&&function(e){var n=e.info,r=n.data,i=new FormData;for(var s in i.append("action","ads_google_extension"),i.append("ads_actions",n.ads_actions),void 0!==n.productId&&i.append("product_id",n.productId),r){var d=r[s];"object"===o(d)&&(d=JSON.stringify(d)),i.append(s,d)}t.ajaxQueue({url:ajaxurl,data:i,contentType:!1,processData:!1,type:"POST",success:function(t){if((t=a(t))&&t.hasOwnProperty("done"))return window.ADS.Dispatcher&&window.ADS.Dispatcher.trigger("adsGoogleExtension:"+n.ads_actions,r),void window.postMessage({type:"adsGoogleExtension:toBg",data:{ads_actions:n.ads_actions,callback:n.callback,response:t},tabId:e.tabId},"*");window.postMessage({type:"adsGoogleExtension:toBg",data:{ads_actions:n.ads_actions,callback:n.callback,response:{error:"not response"}},tabId:e.tabId},"*")},error:function(){window.postMessage({type:"adsGoogleExtension:toBg",data:{ads_actions:n.ads_actions,callback:n.callback,response:{error:"error send"}},tabId:e.tabId},"*")}})}(e.data.info),"adsGoogleExtension:toShop"===e.data.type&&"toShop:productAli"===e.data.info.info.ads_actions&&window.ADS.Dispatcher.trigger("productAli:"+e.data.info.info.data.link,{product:e.data.info.info.data.product,code:e.data.info.info.data.code}),"adsGoogleExtension:parseProductPage"===e.data.type){e.data.info.html=s(e.data.info.html);var m=window.ADS.aliParseProduct.parseHtml(e.data.info.html,e.data.info.url);m.post_status="",t.ajaxQueue({url:ajaxurl,data:{action:"ads_google_extension",ads_actions:"generatePermalink",title:m.title},type:"POST",success:function(t){t=a(t),m.permalink=t.permalink,u("parseProductAli:done",{product:m,url:e.data.info.url})}})}if("adsGoogleExtension:PublicProductHtml"===e.data.type)e.data.info.html=s(e.data.info.html),l(window.ADS.aliParseProduct.parseHtml(e.data.info.html,e.data.info.url));"adsGoogleExtension:PublicProductObj"===e.data.type&&l(e.data.info.product),e.data.type&&"adsGoogleExtension:PublicProduct"===e.data.type&&function(e){var n=e.product,r=new FormData;for(var i in r.append("action","ads_google_extension"),r.append("ads_actions","publicProduct"),r.append("product_id",n.product_id),e){var s=e[i];"object"===o(s)&&(s=JSON.stringify(s)),r.append(i,s)}t.ajaxQueue({url:ajaxurl,dataType:"json",data:r,contentType:!1,processData:!1,type:"POST",success:function(t){(t=a(t)).hasOwnProperty("error")?(window.postMessage({type:"alids:importProduct",product:n,response:t},"*"),u("toBg:resultPublishProduct",{product:n,response:t})):c(t)}})}(e.data.info)}}),!1),t("body").on("test:extensions",(function(t){t.active&&window.ADS.aliExtension.addWebSite()})),t(document).on("imagesProduct:start",(function(t){var e=t.obj,o=e.params;e.total&&(o.response.message=t.response.message),u("toBg:resultPublishProduct",o)})),t(document).on("imagesProduct:next",(function(t){var e=t.obj,o=e.params;e.total&&(o.response.message=t.response.message),u("toBg:resultPublishProduct",o)})),t(document).on("imagesProduct:finish",(function(t){var e=t.obj,o=e.params;e.total&&(o.response.message=t.response.message),u("toBg:resultPublishProduct",o)}))},addTask:function(t,e,o,n){!function(t,e,o,n){var a=o||null;void 0===r._observers[t]&&(r._observers[t]=[]),r._observers[t].push({observer:e,context:a,index:n}),r.stack.push(t)}(t,e,o,n),r.active||(r.active=!0,i(d()))},reloadTask:function(){i(r.current)},startTask:function(t){i(t)},sleepTask:function(t){return n.sleep=1e3*t,"set sleep - "+t+"sec"},enableAjax:function(t){return n.method="ajax","set method - ajax"},enableIframe:function(t){return n.method="iframe","set method - iframe"},productByUrl:function(t){return e.page(t).then((function(e){return window.ADS.aliParseProduct.parseObj(e,t)}))},productAli:function(e){return new Promise((function(o,n){var r,i;t.ajax({url:ajaxurl,data:{action:"aliexpress_sezam_request",ads_action:"get_product_ali",product_id:(r=e,i=/\/(\d+_)?(\d+)\.html/.exec(r),i?i[2]:null)},type:"POST",success:function(t){return t=a(t),o(t)}})}))},productAli1:function(t){return new Promise((function(e,o){p("toBg:productAli",{link:t});var n=null;window.ADS.Dispatcher.one("productAli:"+t,(function(t){clearTimeout(n),e(t)}),this),n=setTimeout((function(){o("fail get page "+t)}),12e4)}))},page:function(t){return new Promise((function(o,n){var r=setTimeout((function(){n("fail get page "+t)}),12e4);e.addTask(t,(function(t){clearTimeout(r),o(t.obj)}),this)}))},getPage:function(t){return new Promise((function(o,n){var r=setTimeout((function(){n("fail get page "+t)}),12e4);e.addTask(t,(function(t){clearTimeout(r),o(t)}),this)}))},getTIPOrders:function(t){t=t.filter(Boolean);var e=[];for(var o in t)e.push(f(t[o]));return Promise.all(e).then((function(e){var o=[];for(var n in e)o.push({trackingNo:e[n]?e[n].tip:"",products:[{orderId:t,productId:null}]});return window.ADS.Dispatcher.trigger("adsGoogleExtension:setOrdersTIP",{ordersDetail:o}),e}))},getTIPOrder:function(t,e){return f(e).then((function(o){return!!o&&{orderIdStore:t,orderIdAli:e,tip:o.tip}})).then((function(t){return window.ADS.Dispatcher.trigger("adsGoogleExtension:setOrderTIP",{orderDetail:{trackingNo:t.tip},orderIdStore:t.orderIdStore}),t}))},getTIPAllOrders:function(){p("getTIPAllOrders")},placeOrderManually:function(t,e,o,n){p("placeOrderManually",{product_url:t,product_id:e,orderIdStore:o,product_url_origin:n})},getPageHtml:function(t,e){p("getPageHtml",{url:t,params:e})},auth:function(){var e={store:{name:store.name,url:store.site_url,linkImportStore:store.site_url}};t.ajaxQueue({url:ajaxurl,data:{action:"ads_oauth1",ads_action:"key",args:{}},type:"POST",dataType:"json",success:function(t){t=a(t),Object.assign(t,e),u("toBg:ApiStore:auth",t)}})},addWebSite:function(){u("toBg:ApiStore:add",{domain:store.site_url})},sendAliExtension:function(t,e){return function(t,e){return new Promise((function(o,n){e=e||{};var r="postMessageID_"+Date.now();window.addEventListener("message",(function t(e){if(e.source===window&&e.data.type)return"adsGoogleExtension:toStorePromise"===e.data.type&&e.data.postMessageID===r?(window.removeEventListener("message",t,!1),o(e.data.info)):void 0}),!1),window.postMessage({type:"adsGoogleExtension:toBgPromise",data:{postMessageID:r,action:t,info:e}},"*")}))}(t,e)}}}(),window.ADS.aliExtension.init(),window.imagesProduct=function(){var e={};function o(e,o,n){o=""!==o&&o instanceof jQuery?window.ADS.serialize(o):o,t.ajaxQueue({url:ajaxurl,data:{action:"adsw_uploadExternalImages",ads_actions:e,args:o},type:"POST",dataType:"json",success:n})}function n(a){e.links=a.links,e.current_link=a.current_link,a.hasOwnProperty("error")?t.event.trigger({type:"imagesProduct:error",obj:e,response:a}):void 0===a.links[a.current_link]?(t.event.trigger({type:"imagesProduct:end",obj:e,response:a}),o("apply_post",{post_id:e.post_id},r)):(t.event.trigger({type:"imagesProduct:next",obj:e,response:a}),o("load_image_post",{links:a.links,current_link:a.current_link,post_id:e.post_id},n))}function r(o){t.event.trigger({type:"imagesProduct:finish",obj:e,response:o})}function a(o){e.total=o.links.length,e.links=o.links,t.event.trigger({type:"imagesProduct:start",obj:e,response:o}),n(o)}return{upload:function(t,n){o("list_images_post",{post_id:(e={post_id:t,total:null,links:[],current_link:null,params:n}).post_id},a)}}}()}))}});