Advertisement
Guest User

Untitled

a guest
Jan 31st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.68 KB | None | 0 0
  1. !function(t,e){"function"==typeof define&&define.amd?define("frontAPI",[],e):"object"==typeof module&&module.exports?module.exports=e():t.frontAPI?t["frontAPI"+e().getVersion().replace(/\./g,"")]=e():t.frontAPI=e()}(window,function(t){function e(t,e){return t.replace(/\{(.+?)\}/g,function(t,n){return n in e?e[n]:t})}function n(t,n){var r;return r=e(t,{id:n.id||"",lang:n.lang||u,currency:n.currency||i,search:n.search||"",country_id:n.country_id||""}),n.urlParams&&(r+=n.urlParams),r}function r(t,e,n,r){if("function"!=typeof n&&(n=!1),(r=r||{}).data&&(r.data=JSON.stringify(r.data)),!1===n)return syncReq=a.send(e,r.data||"",function(){},t,!1,r.headers),syncReq.responseText?JSON.parse(syncReq.responseText):200===syncReq.status;s.push({url:e,data:r.data||"",callback:n,method:t,headers:r.headers})}var o,a,i,u,s;s={requestInProgress:!1,maxRequests:3,requests:0,queue:[],push:function(t){this.queue.push(t),this.requests<this.maxRequests&&this.shift()},shift:function(){var t,e,n;t=this,n=(e=this.queue.splice(0,this.maxRequests-this.requests)).length,this.requests+=n,e.forEach(function(e){a.send(e.url,e.data,function(n,r){if(429===r)return setTimeout(function(){t.queue.push(e),t.shift()},200),!1;"function"==typeof e.callback&&(n?e.callback(JSON.parse(n)):200===r?e.callback(!0):e.callback(!1)),t.requests-=1,t.queue.length&&t.shift()},e.method,!0,e.headers)})}},i=window.Shop&&Shop.values?Shop.values.currency||"PLN":"PLN",u=window.Shop&&Shop.lang?Shop.lang.name||"pl_PL":"pl_PL",(a={}).x=function(){var t,e,n;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(t=["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(t){}return e},a.send=function(e,n,r,o,i,u){var s,c;if(i===t&&(i=!0),(s=a.x()).open(o,e,i),s.onreadystatechange=function(){4==s.readyState&&r(s.responseText,s.status)},"POST"===o||"PUT"===o){for(c in u)u.hasOwnProperty(c)&&s.setRequestHeader(c,u[c]);s.setRequestHeader("Content-type","application/x-www-form-urlencoded")}return s.send(n),s},o={setCurrency:function(t){i=t},setLang:function(t){u=t},getCurrency:function(){return i},getLang:function(){return u},setMaxRequests:function(t){s.maxRequests=t},noConflict:function(){return this},getVersion:function(){return"1.0.5"},compareVersion:function(t){var e;return t=parseInt(t.replace(/\./g,"")),e=parseInt("1.0.5".replace(/\./g,"")),t>e?1:t<e?-1:0},getDefaults:function(t,e){return e=e||t||{},r("GET","/webapi/front/shop/defaults/",t)},getCountries:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/countries/{id}/",e),t)},login:function(t,e){return e=e||t||{},e.headers={Authorization:"Basic "+btoa(e.data.username+":"+e.data.password)},e.data=null,r("POST",n("/webapi/front/{lang}/auth/login/",e),t,e)},logout:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/auth/logout/",e),t,e)},remindPassword:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/auth/remind/",e),t,e)},authStatus:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/auth/status/",e),t,e)},getAFContactForm:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/contact-form/",e),t,e)},getAFOrderOnLoggedUser:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/order-logged-on-user/",e),t,e)},getAFOrderWithoutRegistration:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/order-without-registration/",e),t,e)},getAFOrderWithRegistration:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/order-with-registration/",e),t,e)},getAFUserRegistration:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/user-registration/",e),t,e)},getAFUserAccount:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/additional-fields/user-account/",e),t,e)},registerUser:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/user/register/",e),t,e)},editUser:function(t,e){return e=e||t||{},r("PUT",n("/webapi/front/{lang}/user/",e),t,e)},getUser:function(t,e){var o;return"interactive"!==document.readyState&&"complete"!==document.readyState||"1"!==(o=document.querySelectorAll("html")[0].getAttribute("data-fmc"))&&"2"!==o?(e=e||t||{},r("GET",n("/webapi/front/{lang}/user/",e),t,e)):{}},getUserAddress:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/user/address/",e),t,e)},addUserAddress:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/user/address/",e),t,e)},removeUserAddress:function(t,e){return e=e||t||{},r("DELETE",n("/webapi/front/{lang}/user/address/{id}",e),t,e)},editUserAddress:function(t,e){return e=e||t||{},r("PUT",n("/webapi/front/{lang}/user/address/{id}",e),t,e)},getUserOrders:function(t,e){var o;return e=e||t||{},"interactive"!==document.readyState&&"complete"!==document.readyState||"1"!==(o=document.querySelectorAll("html")[0].getAttribute("data-fmc"))&&"2"!==o?r("GET",n("/webapi/front/{lang}/user/orders/{id}",e),t,e):{}},getLanguages:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/languages/{id}",e),t,e)},getCurrencies:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/currencies/{id}",e),t,e)},getPages:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/pages/{id}",e),t,e)},getProduct:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/{id}",e),t,e)},getProductOption:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/products/{currency}/{id}/stock/",e),t,e)},getProductOptionValues:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/{id}/options/"+e.ids.join(","),e),t,e)},getProductRelated:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/{id}/related/",e),t,e)},getMainProducts:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/main/",e),t,e)},getNewProducts:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/news/",e),t,e)},getPotdProducts:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/day/",e),t,e)},getPromotionProducts:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/promotions/",e),t,e)},search:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/search/{search}",e),t,e)},getProducts:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/list/"+e.ids.join(","),e),t,e)},getProductsList:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/products/{currency}/list/",e),t,e)},getProductsFromCategory:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/{id}/products/{currency}/",e),t,e)},getFiltersFromCategory:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/{id}/filters/{currency}/",e),t,e)},getRootCategoryTree:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/main/",e),t,e)},getCategoryChildrens:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/{id}/children/",e),t,e)},getCategoryTree:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/{id}/tree/",e),t,e)},getCategory:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/{id}/",e),t,e)},getCategoryList:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/list/",e),t,e)},getCategories:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/categories/tree/",e),t,e)},getBasketInfo:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/basket/{currency}/",e),t,e)},addToBasket:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/basket/{currency}/",e),t,e)},setBasketInfo:function(t,e){return e=e||t||{},r("PUT",n("/webapi/front/{lang}/basket/{currency}/",e),t,e)},removeFromBasket:function(t,e){return e=e||t||{},r("DELETE",n("/webapi/front/{lang}/basket/{currency}/{id}/",e),t,e)},editBasketProductQuantity:function(t,e){return e=e||t||{},r("PUT",n("/webapi/front/{lang}/basket/{currency}/{id}/",e),t,e)},submitOrder:function(t,e){return e=e||t||{},r("POST",n("/webapi/front/{lang}/basket/{currency}/order/",e),t,e)},getPaczkomaty:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/basket/paczkomaty/",e),t,e)},getRegions:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/countries/{id}/regions",e),t,e)},getRegion:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/countries/{country_id}/regions/{id}",e),t,e)},getPage:function(t,e){return e=e||t||{},r("GET",n("/webapi/front/{lang}/pages/{id}",e),t,e)}};var c=document.createEvent("HTMLEvents");return c.initEvent("frontAPIReady",!1,!0),window.frontAPI=o,document.dispatchEvent(c),o});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement