{"version":3,"sources":["assets/src/modules/ElcaDisplayProductDocumentation/js/ElcaDisplayProductDocumentation.js"],"names":["geoLocalizationUserDoc","$","val","getJSON","data","ip","done","userIpCountry","jsonParse","JSON","parse","ErrorMessage","saveAccessAndCheckAllowedCountry","Ip","GeoLocationDateTime","IsoCode","Country","City","Region","alert","fail","always","css","dateTime","isocode","country","city","region","queryString","serialize","document","documentElement","lang","AsyncRequestManager","renderSyncRequest","ready","on","requestManager","productName","encodeURIComponent","text","language","attr","renderAsyncRequest","children","each","trim","this","find","hide","show"],"mappings":"AA0DA,SAASA,yBAC0B,SAA3BC,EAAE,gBAAgBC,OAElBD,EAAEE,QAAQ,oCACN,SAAUC,GACNH,EAAEE,QAAQ,2DAA6DC,EAAKC,GACxE,cAECC,KAAK,SAAUC,GACZ,IAAIC,EAAYC,KAAKC,MAAMH,GAE3B,IAAIC,EAAUG,aAWV,OARAC,iCACIJ,EAAUK,GACVL,EAAUM,oBACVN,EAAUO,QACVP,EAAUQ,QACVR,EAAUS,KACVT,EAAUU,QAEPX,EAVPY,MAAM,iDAcbC,KAAK,cAGLC,OAAO,WAEJpB,EAAE,qCAAqCqB,IAAI,UAAW,YAQ9E,SAASV,iCAAiCP,EAAIkB,EAAUC,EAASC,EAASC,EAAMC,GACxEC,EAAc,IACd3B,EAAE,sCAAsC4B,YACxC,OACAxB,EACA,aACAkB,EACA,YACAC,EACA,YACAC,EACA,SACAC,EACA,WACAC,EACA,SACAG,SAASC,gBAAgBC,MACR,IAAIC,qBACVC,kBAAkB,4CAA6CN,EAAa,qBAnH/F3B,EAAE6B,UAAUK,MAAM,WAEdlC,EAAE,4DAA4DmC,GAAG,SAC7D,WACInC,EAAE,uDAAuDqB,IAAI,UAAW,SACxE,IAAIe,EAAiB,IAAIJ,oBACrBK,EACAC,mBAAmBtC,EAAE,4EAChBuC,QACLC,EAAWxC,EAAE,QAAQyC,KAAK,QAE9BL,EAAeM,mBAAmB,4CAA6C,gBAAkBL,EAAa,qBAAqB,EAAOG,KAKlJxC,EAAE,6DAA6DmC,GAAG,SAC9D,WAEInC,EAAE,mEAAmE2C,SAAS,OAAOC,KAAK,WAEjF5C,EAAE6C,KAAK7C,EAAE8C,MAAMC,KAAK,SAASR,SAC9BvC,EAAE,6EAA6EC,OACS,IAAxFD,EAAE,6EAA6EC,OAC9ED,EAAE6C,KAAK7C,EAAE8C,MAAMC,KAAK,UAAUN,KAAK,UACpCzC,EAAE,kFAAkFC,OACS,IAA7FD,EAAE,kFAAkFC,MAMpFD,EAAE8C,MAAME,OAHRhD,EAAE8C,MAAMG,WAQxBjD,EAAE,kEAAkEmC,GAAG,SACnE,WAEInC,EAAE,mEAAmE2C,SAAS,OAAOC,KAAK,WACjF5C,EAAE6C,KAAK7C,EAAE8C,MAAMC,KAAK,SAASR,SAC1BvC,EAAE,6EAA6EC,OACS,IAAxFD,EAAE,6EAA6EC,OAClFD,EAAE6C,KAAK7C,EAAE8C,MAAMC,KAAK,UAAUN,KAAK,UAChCzC,EAAE,kFAAkFC,OACS,IAA7FD,EAAE,kFAAkFC,MAMxFD,EAAE8C,MAAME,OAHRhD,EAAE8C,MAAMG","file":"ElcaDisplayProductDocumentation.js","sourcesContent":["$(document).ready(function () {\r\n\r\n $(\"#mi-corpo-display-product-documentation-product-selector\").on('change',\r\n function () {\r\n $(\"#mi-corpo-display-product-documentation-loading-img\").css(\"display\", \"block\");\r\n var requestManager = new AsyncRequestManager();\r\n var productName =\r\n encodeURIComponent($('#mi-corpo-display-product-documentation-product-selector option:selected')\r\n .text());\r\n var language = $('html').attr('lang');\r\n\r\n requestManager.renderAsyncRequest('/userdocumentation-display/search-product', '?productName=' + productName, '#mi-corpo-userdoc', false, language);\r\n //requestManager.renderAsyncRequest('/userdocumentation-display/search-product', '?productName=' + $('#mi-corpo-display-product-documentation-product-selector option:selected').text(), '[data-widget=\"elcadisplayproductdocumentation\"]', true);\r\n //$(\"#mi-corpo-display-product-documentation-loading-img\").css(\"display\", \"none\");\r\n });\r\n\r\n $(\"#mi-corpo-display-product-documentation-language-selector\").on('change',\r\n function () {\r\n\r\n $('#mi-corpo-display-product-documentation-product-documents-links').children('div').each(function () {\r\n\r\n if (($.trim($(this).find(\".lang\").text()) ==\r\n $(\"#mi-corpo-display-product-documentation-language-selector option:selected\").val() ||\r\n $(\"#mi-corpo-display-product-documentation-language-selector option:selected\").val() == \"\") &&\r\n ($.trim($(this).find(\".categ\").attr('name')) ==\r\n $(\"#mi-corpo-display-product-documentation-document-type-selector option:selected\").val() ||\r\n $(\"#mi-corpo-display-product-documentation-document-type-selector option:selected\").val() == \"\") ){\r\n //display\r\n //console.log('found');\r\n $(this).show();\r\n } else {\r\n //hide row\r\n $(this).hide();\r\n }\r\n });\r\n });\r\n\r\n $(\"#mi-corpo-display-product-documentation-document-type-selector\").on('change',\r\n function () {\r\n\r\n $('#mi-corpo-display-product-documentation-product-documents-links').children('div').each(function () {\r\n if (($.trim($(this).find(\".lang\").text()) ==\r\n $(\"#mi-corpo-display-product-documentation-language-selector option:selected\").val() ||\r\n $(\"#mi-corpo-display-product-documentation-language-selector option:selected\").val() == \"\") &&\r\n ($.trim($(this).find(\".categ\").attr('name')) ==\r\n $(\"#mi-corpo-display-product-documentation-document-type-selector option:selected\").val() ||\r\n $(\"#mi-corpo-display-product-documentation-document-type-selector option:selected\").val() == \"\")) {\r\n //display\r\n //console.log('found');\r\n $(this).show();\r\n } else {\r\n //hide row\r\n $(this).hide();\r\n }\r\n });\r\n });\r\n});\r\n\r\nfunction geoLocalizationUserDoc() {\r\n if ($(\"#widgetBlock\").val() == \"False\") {\r\n\r\n $.getJSON(\"https://api.ipify.org?format=json\",\r\n function (data) {\r\n $.getJSON(\"/Sitefinity/Public/Services/GeoLocation/GeoLocation.svc/\" + data.ip,\r\n function () {\r\n })\r\n .done(function (userIpCountry) {\r\n var jsonParse = JSON.parse(userIpCountry);\r\n\r\n if (jsonParse.ErrorMessage) {\r\n alert(\"Error ocurred while detecting user location\");\r\n } else {\r\n saveAccessAndCheckAllowedCountry(\r\n jsonParse.Ip,\r\n jsonParse.GeoLocationDateTime,\r\n jsonParse.IsoCode,\r\n jsonParse.Country,\r\n jsonParse.City,\r\n jsonParse.Region\r\n );\r\n return userIpCountry;\r\n }\r\n\r\n })\r\n .fail(function () {\r\n //alert('fail=' + data);\r\n })\r\n .always(function () {\r\n //console.log( \"complete\" );\r\n $(\"#mi-corpo-elcauserdoc-loading-img\").css(\"display\", \"none\");\r\n\r\n });\r\n });\r\n }\r\n\r\n}\r\n\r\nfunction saveAccessAndCheckAllowedCountry(ip, dateTime, isocode, country, city, region) {\r\n var queryString = \"?\" +\r\n $(\".mi-corpo-UserDoc-hidden-data-form\").serialize() + \r\n \"&ip=\" +\r\n ip +\r\n \"&dateTime=\" +\r\n dateTime +\r\n \"&isocode=\" +\r\n isocode +\r\n \"&country=\" +\r\n country +\r\n \"&city=\" +\r\n city +\r\n \"®ion=\" +\r\n region +\r\n \"&lang=\" +\r\n document.documentElement.lang;\r\n var requestManager = new AsyncRequestManager();\r\n requestManager.renderSyncRequest('/UserDoc/saveAccessAndCheckAllowedCountry', queryString, '#mi-corpo-userdoc');\r\n}"]}