1/** 2 * Created by florent on 01/06/15. 3 */ 4//Le contenu du titre est charge ici pour ne pas afficher le contenu non formate tant que Angular nest pas charge 5//$('title').html("{{$state.current.data.pageTitle | translate}} | {{'TITLE_SHOP' | translate}}"); 6 7function _burnedconnection($localStorage, $rootScope, commonConfig){ 8 delete $localStorage[commonConfig.currentInstance.keylogin].access_token; 9 delete $localStorage[commonConfig.currentInstance.keylogin].user; 10 for(var p in $rootScope.user){ 11 delete $rootScope.user[p]; 12 } 13}; 14 15function ssoConnected() { 16 console.log("ssoConnected"); 17} 18 19function ssoNotConnected() { 20 console.log("ssoNotConnected"); 21} 22 23function isEmptyString(ob){ 24 if(ob !== undefined && ob !== null && ob !== ""){ 25 return false; 26 } 27 return true; 28} 29 30//Chargement du angular 31var AboShopApp = angular.module('AboShopApp',[ 32 'vcRecaptcha', 33 'ui.router', 34 'pascalprecht.translate', 35 'ngStorage', //store and read localstorage 36 'angular.filter', //Filter 37 'angulartics', //Google Analytics 38 'angulartics.google.analytics', //Google Analytics 39 'angulike' 40]) 41 .constant("commonConfig", {} ) 42 .run(function($rootScope, $http, $state, $localStorage, $localStorageGlobal, dico, $templateCache, TbsWS, Auth, $location, cartManager, $q, productsManager, commonConfig, $anchorScroll, $analytics, $timeout, $interval, $filter, $window, pooolManager, pixelFbManager, googleTagManager, linkedInTagManager, atInternetManager, didomiManager, pianoManager, marfeelManager, seo, $browser, configManager, customerManager, categoriesManager) { 43 //On set limage en premier pour etre sur de lavoir meme dans les 404 44 $rootScope.logoimg = "img/logo.png?v="+commonConfig.forceversion; 45 $rootScope.errors = []; 46 $rootScope.preferredLanguage = $localStorageGlobal.preferredLanguage || commonConfig.currentInstance.langue; 47 console.log($rootScope.preferredLanguage); 48 49 //Permet de catcher les erreurs dans le changement de route (resolve de app.routing.js) 50 $rootScope.$on( '$stateChangeError', function (event, toState, toParams, fromState, fromParams, error) { 51 console.error( 'Resolve Error: ', error); 52 TbsWS.addError(error); 53 TbsWS.tryLogErrors(error); 54 }); 55 56 $rootScope.$on( '$stateChangeStart', function (event, toState, toParams, fromState, fromParams, error) { 57 googleTagManager.changePageInProgress(); 58 }); 59 60 $rootScope.signin = {}; 61 $rootScope.signin.login = ""; 62 $rootScope.signin.password = ""; 63 64 $rootScope.signin.resetInProgress = function(){ 65 $rootScope.signin.inProgress=false; 66 delete $rootScope.signin.mail; 67 delete $rootScope.signin.civilite; 68 delete $rootScope.signin.prenom; 69 delete $rootScope.signin.nom; 70 }; 71 $rootScope.signin.resetInProgress(); 72 73 console.log(" suite run app"); 74 75 $(document).ready(function(){ 76 window.gtmCta = function gtmCta() { 77 var buttonText = jQuery(this).text(); 78 $rootScope.gtmClickCta(buttonText, window.location.pathname); 79 }; 80 81 let bindFirst = function bindFirst(name, fn, object) { 82 if ($._data(object, 'events') !== undefined) { 83 let handlers = $._data(object, 'events')[name.split('.')[0]]; 84 for (let i = 0 ; i < handlers.length ; i++) { 85 if (handlers[i] !== undefined && handlers[i].handler === fn) { 86 return; 87 } 88 } 89 } 90 object.addEventListener(name, fn); 91 let listEvents = $._data(object, 'events'); 92 if (listEvents !== undefined) { 93 let handlers = $._data(object, 'events')[name.split('.')[0]]; 94 let handler = handlers.pop(); 95 handlers.splice(0, 0, handler); 96 } 97 }; 98 99 window.addEventGtmCta = function addEventGtmCta() { 100 const buttonsList = $(".btn"); 101 for (let i = 0 ; i < buttonsList.length ; i++) { 102 bindFirst('click', gtmCta, buttonsList[i]); 103 } 104 const noButtonList = $(".gtm-cta"); 105 for (let i = 0 ; i < noButtonList.length ; i++) { 106 bindFirst('click', gtmCta, noButtonList[i]); 107 } 108 }; 109 110 // Options de l'observateur 111 var config = { attributes: true, childList: true, subtree : true }; 112 // Selectionne le noeud dont les mutations seront observées 113 var targetNode = $("body")[0]; 114 // Créé une instance de l'observateur lié à la fonction addEventGtmCta 115 var observer = new MutationObserver(addEventGtmCta); 116 // Commence à observer le noeud cible pour les mutations précédemment configurées 117 observer.observe(targetNode, config); 118 }); 119 120 $rootScope.initTrackingManager = function initTrackingManager() { 121 let deferred = $q.defer(); 122 123 console.log(" init TrackingManager"); 124 googleTagManager.pushVpv({ 125 'user_is_connected': Auth.isClientConnecte(), 126 'user_id': undefined, 127 'user_city': undefined 128 }); 129 pooolManager.init(); 130 if (commonConfig.didomiId === undefined) { 131 pixelFbManager.init(); 132 googleTagManager.init(); 133 } else { 134 didomiManager.init(); 135 } 136 linkedInTagManager.init(); 137 atInternetManager.init(); 138 pianoManager.init(); 139 marfeelManager.init(); 140 141 deferred.resolve(); 142 return deferred.promise; 143 } 144
145 $rootScope.checkCallBackQiota = function checkCallBackQiota() { 146 let deferred = $q.defer(); 147 148 //On debranche le plus tot possible sur le sso si necessaire 149 if(commonConfig.oAuthExterne !== undefined && commonConfig.oAuthExterne.ssoQiota === true){ 150 let qiotaStorage = Auth.readQiotaStorage(); 151 152 if(qiotaStorage.authorizeIsDone){ 153 console.log("Back from qiota : autologin"); 154 let code = Auth.getCodeAuthorizeAndDeleteStorage(); 155 if(code !== undefined && code !== null) { 156 console.log(code); 157 Auth.getExternalToken(code).then( 158 function success (token){ 159 console.log(token); 160 if(token !== undefined && token !== null && token !== "") { 161 //Si aucun client n'était connecté ou si le token a changé (client différent), on force la reconnexion 162 Auth.loginFromCookie(token).then(function(){ 163 $rootScope.doSetCustomerToCartOnNextReadCart = true; 164 $rootScope.doRefreshCartOnNextReadCart = true; 165 deferred.resolve(); 166 }, function(error){ 167 deferred.resolve(); 168 }); 169 } else { 170 deferred.resolve(); 171 } 172 } 173 ); 174 } else { 175 deferred.resolve(); 176 } 177 178 } else if(qiotaStorage.logoutIsDone) { 179 Auth.deleteStorageQiota(); 180 if(Auth.isClientConnecte()) { 181 console.log("Back from qiota : logout"); 182 _doLogout(true); 183 } 184 deferred.resolve(); 185 } else { 186 console.log("Check authorize"); 187 Auth.setAuthorizeIsInProgress(); 188 let redirect_uri = commonConfig.commonroot + "/content/sso/backconnected.html"; 189 let error_uri = commonConfig.commonroot + "/content/sso/backnotconnected.html";
190 let client_id = commonConfig.oAuthExterne.client_id; 191 let authorizeUrl = commonConfig.oAuthExterne.urlAuthorize; 192 193 let clocation = authorizeUrl+'?response_type=code&client_id='+client_id+'&scope=email&redirect_uri='+ redirect_uri + '&error_uri=' + error_uri; 194 console.log(clocation); 195 deferred.reject(clocation); 196 } 197 } else { 198 deferred.resolve(); 199 } 200 201 return deferred.promise; 202 203 } 204 205 $rootScope.initApplication = function initApplication() { 206 $rootScope.facebookAppId = '[FacebookAppId]'; // set your facebook app id here 207 $rootScope.loadingerror = false; 208 $rootScope.errorOccured = false; 209 $rootScope.loadIsEnded = false; 210 $rootScope.appisready = false; 211 $rootScope.appisclose = false; 212 $rootScope.editaddress={}; 213 $rootScope.editaddress.value=0; 214 $rootScope.editaddress.address={}; 215 $rootScope.temp = {}; 216 $rootScope.pageunauthorized = 'common/login'; 217 $rootScope.privatePage = false; 218 219 $rootScope.editorName = commonConfig.currentInstance.editor; 220 $rootScope.companyName = commonConfig.currentInstance.company; 221 222 $rootScope.signin.resetInProgress(); 223 } 224 225 $rootScope.attachEvent = function attachEvent(fOnMessage, storeFunction){ 226 if(storeFunction === undefined){ 227 storeFunction = true; 228 } 229 //console.log("attachEvent"); 230 //console.log(fOnMessage); 231 // Create IE + others compatible event handler 232 let eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 233 let eventer = window[eventMethod]; 234 let messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; 235 236 if(storeFunction) { 237 $rootScope.currentFOnMessage = fOnMessage; 238 } 239 eventer(messageEvent,fOnMessage,false); 240 } 241 242 $rootScope.detachEventAndRemove = function detachEventAndRemove(fOnMessage, e){ 243 // Create IE + others compatible event handler 244 let eventMethod = window.removeEventListener ? "removeEventListener" : "detachEvent"; 245 let eventer = window[eventMethod]; 246 let messageEvent = eventMethod == "detachEvent" ? "onmessage" : "message"; 247 248 //console.log("detachEventAndRemove"); 249 //console.log(fOnMessage); 250 eventer(messageEvent,fOnMessage); 251 $rootScope.removeIframe(e); 252 } 253 254 $rootScope.detachEvent = function detachEvent(fOnMessage){ 255 // Create IE + others compatible event handler 256 let eventMethod = window.removeEventListener ? "removeEventListener" : "detachEvent"; 257 let eventer = window[eventMethod]; 258 let messageEvent = eventMethod == "detachEvent" ? "onmessage" : "message"; 259 console.log("detachEvent"); 260 console.log(fOnMessage); 261 262 eventer(messageEvent,fOnMessage); 263 } 264 265 $rootScope.removeIframe = function removeIframe(e){ 266 if(e.source !== undefined && e.source.frameElement !== undefined && e.source.frameElement.id !== undefined) { 267 console.log("removeIframe id="+e.source.frameElement.id); 268 $('#' + e.source.frameElement.id).remove(); 269 } 270 } 271 272 $rootScope.callBackLogin = function callBackLogin(e) { 273 console.log("callBackLogin id=" + e.source.frameElement.id + " data=" + e.data); 274 console.log(e.data); 275 $rootScope.detachEventAndRemove($rootScope.currentFOnMessage, e); 276 }; 277 278 $rootScope.callBackLogout = function callBackLogout(e) { 279 $rootScope.detachEvent($rootScope.currentFOnMessage); 280 console.log("callBackLogout id=" + e.source.frameElement.id + " data=" + e.data); 281 let patternLogout = 'logout'; 282 if(e.origin === window.location.origin && e.source.location.pathname === commonConfig.rooturl + '/core/content/sso/silentiframelogout.html' && e.data === patternLogout) { 283 _doLogout(true); 284 } else { 285 console.log("Ignore event "+e.data); 286 } 287 $rootScope.removeIframe(e); 288 }; 289 290 $rootScope.callBackAuthorize = function callBackAuthorize(e) { 291 if(e && e.source && e.source.frameElement) { 292 console.log("callBackAuthorize id=" + (e.source.frameElement.id ? e.source.frameElement.id : "unknown") + " data=" + (e.data? e.data : "unknown")); 293 } 294 let patternNotConnected = 'not_connected'; 295 let patternCode = 'code='; 296 let doLogout = false; 297 let data = e.data; 298 299 if(e.origin === window.location.origin) { 300 301 if(data === null || data === undefined) { 302 throw Exception("data is null or undefined"); 303 } 304 305 if ((typeof data === 'string' || data instanceof String) === false) { 306 throw Exception("data is not a string" + data); 307 } 308 309 if((data.startsWith(patternCode) || data.startsWith(patternNotConnected)) === false) { 310 console.log("Ignore event "+data); 311 $rootScope.detachEventAndRemove($rootScope.currentFOnMessage, e); 312 return; 313 } 314 315 //Si on vient de liframe de login on minifie la fenetre iframe 316 let loginIframe = document.getElementById('loginIframe'); 317 if(loginIframe !== null){ 318 if (loginIframe.contentWindow === e.source) { 319 $(loginIframe).height(0); 320 } 321 } 322 if(e.source.location.pathname === commonConfig.rooturl + '/core/content/sso/silentiframenotconnected.html' && data.startsWith(patternNotConnected)) { 323 if(Auth.isClientConnecte()) { 324 doLogout = true; 325 } 326 afterCheckAuthorize(doLogout); 327 } else if(e.source.location.pathname === commonConfig.rooturl + '/core/content/sso/silentiframe.html' && data.startsWith(patternCode)) { 328 329 //console.log(data);
330 let code = data.substring(patternCode.length); 331 if(commonConfig.oAuthExterne.ssoQiota && commonConfig.oAuthExterne.callBackCodeEnabled && commonConfig.oAuthExterne.callBackCode !== undefined){ 332 //fin du login qiota 333 commonConfig.oAuthExterne.callBackCode(code); 334 } else { 335 //auto connexion 336 Auth.getExternalToken(code).then( 337 function success (token){ 338 if(token !== undefined && token !== null && token !== "") { 339 //Si aucun client n'était connecté ou si le token a changé (client différent), on force la reconnexion 340 Auth.loginFromCookie(token).then(function(){ 341 $rootScope.doSetCustomerToCartOnNextReadCart = true; 342 afterCheckAuthorize(doLogout); 343 }, function(error){}); 344 } else { 345 afterCheckAuthorize(doLogout); 346 } 347 } 348 ); 349 } 350 } else if(commonConfig.logcall) { 351 console.error(e.source.location.pathname+' not match'); 352 } 353 } else if(_.contains(["https://loginpp.qiota.com","https://connexion.groupe-telegramme.fr"],e.origin)) { 354 355 if((data !== undefined && data.contains("link") && data.contains('code=')) === false){ 356 console.log("Ignore event "+data); 357 $rootScope.detachEventAndRemove($rootScope.currentFOnMessage, e); 358 return; 359 } 360 data = JSON.parse(data); 361 data = data.link.substring(data.link.indexOf('code=')); 362 363 //Si on vient de liframe de login on minifie la fenetre iframe 364 let loginIframe = document.getElementById('loginIframe'); 365 if(loginIframe !== null){ 366 if (loginIframe.contentWindow === e.source) { 367 $(loginIframe).height(0); 368 } 369 }
370 let code = data.substring(patternCode.length); 371 if(commonConfig.oAuthExterne.ssoQiota === false && commonConfig.oAuthExterne.callBackCodeEnabled && commonConfig.oAuthExterne.callBackCode !== undefined){ 372 //fin du login 373 commonConfig.oAuthExterne.callBackCode(code); 374 } 375 } else { 376 throw Exception(e.origin + " vs " + window.location.origin); 377 } 378 $rootScope.detachEventAndRemove($rootScope.currentFOnMessage, e); 379 }; 380 381 $rootScope.initSilentIFrame = function initSilentIFrame(idFrame, url, fOnload, fOnMessage) { 382 const existingIframe = document.getElementById(idFrame); 383 384 if (existingIframe) { 385 document.body.removeChild(existingIframe); 386 } 387 const iframe = document.createElement('iframe'); 388 iframe.id = idFrame; 389 let urlIframe = commonConfig.commonroot+"/content/sso/"+url+"?v="+commonConfig.forceversion; 390 //iframe.setAttribute('src', commonConfig.commonroot+"/content/sso/"+url+"?v="+commonConfig.forceversion); 391 //iframe.setAttribute('src', commonConfig.commonroot+"/content/sso/"+url+"?v="+commonConfig.forceversion); 392 //iframe.setAttribute('sandbox', "allow-scripts allow-same-origin allow-storage-access-by-user-activation"); 393 if(commonConfig.oAuthExterne.displaySilentIframe === false) { 394 iframe.setAttribute('style','position: absolute; width: 1px; height: 1px; inset: -9999px; display: none;'); 395 } 396 if(fOnload !== undefined) { 397 iframe.onload = fOnload; 398 } else { 399 iframe.onload = function onload() { 400 var ob = Object.assign({}, commonConfig.oAuthExterne); 401 if(ob.callBackCode !== undefined){ 402 delete ob.callBackCode; 403 } 404 ob.commonroot = commonConfig.commonroot; 405 ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 406 iframe.contentWindow.postMessage(ob,iframe.contentWindow.origin); 407 }; 408 } 409 if(fOnMessage !== undefined) { 410 $rootScope.attachEvent(fOnMessage); 411 } 412 document.body.appendChild(iframe); 413 iframe.contentWindow.location.replace(urlIframe); 414 } 415 416 function _doLogout(withRedirect) { 417 _burnedconnection($localStorage, $rootScope, commonConfig); 418 Auth.doLogout().then( 419 function(){ 420 TbsWS.refreshConnexion(); 421 cartManager.resetCart(); 422 googleTagManager.userInfosEvent(customerManager.getCustomer); 423 if(withRedirect){ 424 $rootScope.goPage(undefined); 425 } 426 } 427 ); 428 } 429 430 $rootScope.doLogout = function doLogout() { 431 function _internLogout(withRedirect){ 432 if (commonConfig.oAuthExterne != null && commonConfig.oAuthExterne.urlLogout != null) { 433 Auth.tryDoExternalLogout(false); 434 } else { 435 _doLogout(true); 436 } 437 } 438 if(!Auth.isClientConnecte() && !Auth.clientWasConnecte()){ 439 $rootScope.goPage(undefined); 440 } else if(Auth.clientWasConnecte()){ 441 _internLogout(true); 442 } else { 443 Auth.setClientWasConnecte(true); 444 Auth.setDeconnexionAuto(false); 445 _internLogout(true); 446 } 447 }; 448 449 $rootScope.doSilentLogout = function doSilentLogout() { 450 _doLogout(false); 451 } 452 453 $rootScope.calculateRemise = function calculateRemise(remiseStr,quantite){ 454 let str = ""; 455 if(remiseStr){ 456 let remise = parseFloat(remiseStr.replace(",",".")); 457 str = ""+(remise * quantite).toFixed(2); 458 str = str.replace(".",","); 459 let arrayOfStrings = str.split(","); 460 if(arrayOfStrings.length == 2 && arrayOfStrings[1].length == 1){ 461 str = str+"0"; 462 } 463 } 464 return str; 465 }; 466 467 $rootScope.doLogoutWithoutRefresh= function doLogoutWithoutRefresh() { 468 _burnedconnection($localStorage, $rootScope, commonConfig); 469 cartManager.resetCart(); 470 }; 471 472 $rootScope.addToCart = function addToCart(product, quantite) { 473 cartManager.addToCart(product, quantite); 474 }; 475 476 $rootScope.addToCartEvent = function addToCartEvent($event, product, quantite) { 477 $event.stopPropagation(); 478 $rootScope.addToCart(product, quantite); 479 480 if (commonConfig.atInternetId !== undefined){ 481 if(product.devis !== undefined && product.devis){ 482 var type = ''; 483 if (product.tarif.arrondiSurTtc) { 484 type = 'PARTICULIER'; 485 } else { 486 type = 'PRO'; 487 } 488 atInternetManager.send({name: 'confirmation', chapter1: 'boutiqueMM-' + commonConfig.target, chapter2: 'abonnement', chapter3: type + '-' + product.libelle, level2: '74'}); 489 } 490 } 491 }; 492 493 $rootScope.addToCartIdEvent = function addToCartIdEvent($event, idProduct, quantite) { 494 $event.stopPropagation(); 495 var product = {}; 496 product.refProduit = idProduct; 497 498 productsManager.loadProduct(product).then( 499 function(product){ 500 $rootScope.addToCart(product, quantite); 501 } 502 ,function(error) { 503 console.error('Ajout du produit impossible'); 504 } 505 ); 506 }; 507 508 $rootScope.activate = function activate($event, link) { 509 $event.stopPropagation(); 510 window.location = link; 511 }; 512 513 $rootScope.getAbsoluteHrefPageCms = function getAbsoluteHrefPageCms( name ) { 514 let url = _getHrefPage('common/cms/'+name); 515 return _callExterne(url); 516 }; 517 518 $rootScope.getLinkRemoveHtml = function ( htmlLink ) { 519 let url = htmlLink.replace(/<(?:.|\n)*?>/gm, ''); 520 return url; 521 }; 522 523 function _addBaseUrl(url){ 524 url.url = commonConfig.baseurl+seo.getRealPath(url.url); 525 url.url = url.url.replace('//','/'); 526 } 527 528 function _callExterne(url){ 529 if (!_urlModule(url)) { 530 _addBaseUrl(url); 531 } 532 return url.url; 533 } 534 535 function _callInterne(url){ 536 if (_urlModule(url)) { 537 $window.location.href = url.url; 538 } else { 539 $location.path(seo.getRealPath(url.url)).search($location.search()); 540 } 541 } 542 543 function _urlModule(url) { 544 let ok = false; 545 546 if (commonConfig.module != undefined && !(_.contains(seo.getRoutesExclues(), url.url) || url.url.startsWith('/common/trylog') || url.url.startsWith(seo.getRealPath('/common/trylog')))){
547 const isUrlProfil = (url.url.startsWith('/common/profil') || url.url.startsWith(seo.getRealPath('/common/profil'))); 548 let urlModule = ''; 549 if (commonConfig.module.profil && isUrlProfil) { 550 urlModule = commonConfig.module.profil; 551 ok = true; 552 } else if (commonConfig.module.others && !isUrlProfil) { 553 urlModule = commonConfig.module.others; 554 ok = true; 555 } 556 if (ok) { 557 url.url = _urlStripSlash(urlModule + seo.getRealPath(url.url)); 558 } 559 } 560 return ok; 561 } 562 563 function _urlStripSlash(url) { 564 return url.replace(/^((https?:)?\/\/)?(.*)/, function (_, scheme, _, url) { 565 if(scheme == null) scheme = ''; 566 return scheme + url.replace('//','/'); 567 }); 568 } 569 570 $rootScope.getUrlExterne = function getUrlExterne(product){ 571 let url = "", urlParams = ""; 572 if (product.urlExterne != null && product.urlExterne != '') { 573 let full = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 574 full=full+commonConfig.baseurl; 575 if (product.urlExterne.startsWith(full)) { 576 let indexCut = product.urlExterne.indexOf('?'); 577 if(indexCut === -1) { 578 indexCut = product.urlExterne.length; 579 } 580 url = product.urlExterne.substring(full.length, indexCut); 581 if(url.startsWith('/') === false) { 582 url = '/'+url; 583 } 584 url = seo.getRealPath(url); 585 } else { 586 587 if(product.refProduit !== undefined && product.refProduit != null) { 588 urlParams += "refProduit="+product.refProduit; 589 } 590 if(product.tarif !== undefined && product.tarif != null){ 591 if(product.tarif.refTarif !== undefined && product.tarif.refTarif != null) { 592 urlParams += (urlParams != "" ? "&" : "") + "refTarif="+product.tarif.refTarif; 593 } 594 if(product.tarif.codeTarif !== undefined && product.tarif.codeTarif != null) { 595 urlParams += (urlParams != "" ? "&" : "") + "codeTarif="+product.tarif.codeTarif; 596 } 597 } 598 if(urlParams != "") { 599 url = product.urlExterne + (product.urlExterne.includes("?") ? "&" : "?" ) + urlParams; 600 } 601 } 602 } 603 return url; 604 } 605 606 $rootScope.getAbsoluteHrefProduct = function getAbsoluteHrefProduct( product, refAboEchu ) { 607 if (product != null && product.estUnProduitExterne) { 608 return $rootScope.getUrlExterne(product); 609 } else { 610 let url = productsManager.getHrefProduct(product, refAboEchu); 611 return _callExterne(url); 612 } 613 }; 614 615 $rootScope.openExterne = function openExterne(product, forceNewTab){ 616 let url = $rootScope.getUrlExterne(product); 617 if (url != null && url != '') { 618 if(url.startsWith('http') || forceNewTab){ 619 $window.open(url, '_blank'); 620 } else { 621 $location.path(url); 622 } 623 } 624 } 625 626 $rootScope.goProduct = function (event, product, libAction, refAboEchu) { 627 // piano tracking 628 pianoManager.sendEvent('click.action', { 629 click: $filter('translate')(libAction) || (product.affLibAcheterProduits ? product.libAcheterProduits : $filter('translate')(product.dicoShopNow || 'DICO_SHOP_NOW')), 630 click_chapter1: product.libelle 631 }); 632 if ((event !== undefined && event.ctrlKey) || product.estUnProduitExterne) { 633 $rootScope.openExterne(product, (event !== undefined && event.ctrlKey)); 634 } else { 635 _callInterne(productsManager.getHrefProduct(product, refAboEchu)); 636 } 637 }; 638 639 $rootScope.getAbsoluteHrefCategorie = function ( categorie ) { 640 let url = categoriesManager.getHrefCategorie(categorie); 641 return _callExterne(url); 642 }; 643 644 $rootScope.goCategorie = function (event, categorie ) { 645 if (event !== undefined && event.ctrlKey) { 646 $window.open($rootScope.getAbsoluteHrefCategorie(categorie), '_blank'); 647 } else { 648 _callInterne(categoriesManager.getHrefCategorie(categorie)); 649 } 650 }; 651 652 $rootScope.goPageForceReload = function goPageForceReload(event, name) { 653 if (event !== undefined && event.ctrlKey) { 654 $window.open($rootScope.getAbsoluteHrefPage(name), '_blank'); 655 } else { 656 let url = _getHrefPage(name); 657 $window.location.href = _callExterne(url); 658 } 659 }; 660 661 $rootScope.goPageCart = function goPageCart(event, libAction) { 662 if (event != null && event.type === 'click') { 663 // piano tracking 664 pianoManager.sendEvent('click.action', { 665 click: $filter('translate')(libAction || 'DICO_PANIER') 666 });
667 } 668 $rootScope.goPage(event, 'common/cart'); 669 }; 670 671 $rootScope.goPage = function goPage(event, name) { 672 if (event !== undefined && event.ctrlKey) { 673 $window.open($rootScope.getAbsoluteHrefPage(name), '_blank'); 674 } else { 675 _callInterne(_getHrefPage(name)); 676 } 677 }; 678 679 $rootScope.getAbsoluteHrefPage = function ( name ) { 680 let url = _getHrefPage(name); 681 return _callExterne(url); 682 }; 683 684 function _getHrefPage( name ) { 685 let ob = TbsWS.getUrlHome(); 686 if(name && name !== undefined){ 687 ob.url = '/' + name; 688 } 689 return ob; 690 }; 691 692 $rootScope.goPageCms = function goPageCms(event, name ) { 693 $rootScope.goPage(event,'common/cms/'+name); 694 }; 695 696 $rootScope.getCurrentUrl = function getCurrentUrl() { 697 var url = commonConfig.clientroot+$location.path(); 698 //console.log(url); 699 return url; 700 }; 701 702 $rootScope.openModalShare = function openModalShare(title) { 703 var path = $location.absUrl(); 704 $rootScope.openModalSharePrivate(title,path); 705 }; 706 707 $rootScope.isDicoSet = function isDicoSet(value){ 708 if(value !== undefined && value != null){ 709 let isSet = false; 710 let traduction = $filter('translate')(value); 711 isSet = !(!traduction || 0 === traduction.length); 712 if(isSet && traduction == value){ 713 isSet = false; 714 } 715 return isSet; 716 } else { 717 return false; 718 } 719 }; 720 721 var initconnexion = null; 722 723 $rootScope.silentCheckAuthorize = function silentCheckAuthorize() { 724 console.log("silentCheckAuthorize"); 725 let filename = (commonConfig.oAuthExterne.ssoQiota ? "silentiframeauthorizeqiota.html" : "silentiframeauthorize.html") 726 $rootScope.initSilentIFrame("silentAboshopAuthorizeIframe", filename, undefined, $rootScope.callBackAuthorize); 727 } 728 729 /*function silentCheckAuthorize2(){ 730 function onload() { 731 var ob = Object.assign({}, commonConfig.oAuthExterne); 732 if(ob.callBackCode !== undefined){ 733 delete ob.callBackCode; 734 } 735 ob.commonroot = commonConfig.commonroot; 736 ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 737 iframe.contentWindow.postMessage(ob,iframe.contentWindow.origin); 738 }; 739 740 var ob = Object.assign({}, commonConfig.oAuthExterne); 741 if(ob.callBackCode !== undefined){ 742 delete ob.callBackCode; 743 } 744 ob.commonroot = commonConfig.commonroot; 745 ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 746 747 748 let redirect_uri = ob.commonroot + "/content/sso/silentiframe.html"; 749 let error_uri = ob.commonroot + "/content/sso/silentiframenotconnected.html"; 750 let client_id = ob.client_id; 751 let authorizeUrl = ob.urlAuthorize; 752 let referer = ob.referer; 753 let patternCode = 'code='; 754 let code; 755 let doLogout = false; 756 757 let clocation = authorizeUrl+'&referer='+referer; 758 function reqListener () { 759 try { 760 let json = JSON.parse(this.responseText); 761 let clocation = error_uri; 762 if(json.ret !== undefined){ 763 if(json.ret === "success" && json.url !== undefined && json.url.indexOf(patternCode) > 0) { 764 code = json.url.substring(json.url.indexOf(patternCode)+patternCode.length); 765 } 766 } 767 if(code === undefined) { 768 if(Auth.isClientConnecte()) { 769 doLogout = true; 770 } 771 afterCheckAuthorize(doLogout); 772 } else { 773 if(Auth.isClientConnecte()) { 774 afterCheckAuthorize(doLogout); 775 } else { 776 console.log("code="+code); 777 if(commonConfig.oAuthExterne.ssoQiota && commonConfig.oAuthExterne.callBackCodeEnabled && commonConfig.oAuthExterne.callBackCode !== undefined){ 778 //fin du login qiota 779 commonConfig.oAuthExterne.callBackCode(code); 780 } else { 781 //auto connexion 782 Auth.getExternalToken(code).then( 783 function success (token){ 784 if(token !== undefined && token !== null && token !== "") { 785 Auth.loginFromCookie(token).then(function(){ 786 afterCheckAuthorize(doLogout); 787 }, function(error){}); 788 } else { 789 afterCheckAuthorize(doLogout); 790 } 791 } 792 ); 793 } 794 } 795 } 796 797 //window.location = clocation; 798 } catch(e){ 799 console.error(e); 800 console.log(this.responseText); 801 } 802 } 803 804 var oReq = new XMLHttpRequest(); 805 oReq.onload = reqListener; 806 oReq.open("get", clocation, true); 807 oReq.withCredentials = true; 808 oReq.send(); 809 }*/ 810 811 function afterCheckAuthorize(doLogout){ 812 if(initconnexion !== undefined){ 813 if($rootScope.loadingerror){ 814 initconnexion.reject(); 815 } else { 816 //A chaque chargement de page, on scroll vers le haut de la page 817 $anchorScroll(); 818 //On logge analytics et poool 819 $timeout(function() {
820 let currenturl = $rootScope.getCurrentUrl(); 821 $analytics.pageTrack(currenturl); 822 if(_.contains(commonConfig.pooolurls, currenturl)){ 823 pooolManager.send("page-view","subscription"); 824 } else { 825 pooolManager.send("page-view","page"); 826 } 827 if(commonConfig.pixelfacebookurls.length == 0 || _.contains(commonConfig.pixelfacebookurls, currenturl)){ 828 if (commonConfig.facebookConsent) { 829 pixelFbManager.init(); 830 pixelFbManager.send('track', 'PageView'); 831 } 832 } 833 if (commonConfig.googletagmanagerid !== undefined) { 834 googleTagManager.pushVpv({ 835 'user_is_connected': Auth.isClientConnecte(), 836 'user_id': $rootScope.user.id, 837 'user_city': $rootScope.user.ville 838 }); 839 } 840 if(_.contains(commonConfig.atInternetUrls, currenturl)) { 841 if (currenturl.indexOf("professionnel") > 0) { 842 atInternetManager.send({name: 'Les_offres', chapter1: 'boutiqueMM-' + commonConfig.target, chapter2: 'abonnement', chapter3: 'PRO', level2: '74'}); 843 } else if (currenturl.indexOf("particulier") > 0) { 844 atInternetManager.send({name: 'Les_offres', chapter1: 'boutiqueMM-' + commonConfig.target, chapter2: 'abonnement', chapter3: 'PARTICULIER', level2: '74'}); 845 } else if (currenturl.indexOf("abonnement") > 0) { 846 atInternetManager.send({name: 'homepage', chapter1: 'boutiqueMM-' + commonConfig.target, chapter2: 'abonnement', chapter3: 'accueil', level2: '74'}); 847 } else { 848 atInternetManager.send({name: 'homepage', chapter1: 'boutique-' + commonConfig.target, chapter2: 'abonnement', chapter3: 'accueil', level2: '74'}); 849 } 850 } 851 if(doLogout){ 852 $rootScope.doLogoutWithoutRefresh(); 853 } 854 },5); 855 856 googleTagManager.userInfosEvent(customerManager.getCustomer); 857 // piano tracking 858 pianoManager.customerInfos(); 859 if($rootScope.appisready){ 860 console.log("appisready"); 861 initconnexion.resolve(true); 862 } else { 863 $rootScope.appisready = true; 864 console.log("Init appisready"); 865 cartManager.loadCart(); 866 initconnexion.resolve(true); 867 } 868 } 869 } 870 } 871 872 $rootScope.gtmClickCta = function gtmClickCta(ctaName, ctaCategory) { 873 if (ctaName) { 874 googleTagManager.clickCta($filter('translate')(ctaName), ctaCategory); 875 } 876 } 877 878 $rootScope.tryInitPage = function tryInitPage($scope, ignoreAuthorize){ 879 $rootScope.privatePage=false; 880 $rootScope.skipPianoPageDisplay=false; 881 googleTagManager.pageCategory = null; 882 // piano tracking 883 pianoManager.removeCoreProperty('page'); 884 pianoManager.addCoreProperty('page_chapter1', ''); 885 pianoManager.addCoreProperty('page_chapter2', ''); 886 887 //On check lurl courante pour savoir si elle a des metas 888 //$state.current.data.seo = data.seo; 889 890 let search = $location.search(); 891 if(search !== undefined && search.profil !== undefined && typeof(search.profil) !== "boolean"){ 892 commonConfig.profil = search.profil; 893 } 894 if(commonConfig.profil === undefined || commonConfig.profil === null){ 895 commonConfig.profil = ""; 896 } 897 $scope.profil = commonConfig.profil; 898 $rootScope.profil = $scope.profil; 899 900 if($window !== undefined){ 901 var body = $window.document.body; 902 if(body !== undefined){ 903 body.className = commonConfig.profil; 904 } 905 } 906 907 $rootScope.display404=false; 908 $rootScope.displaymessage=false; 909 initconnexion = $q.defer(); 910 911 if(ignoreAuthorize !== undefined && ignoreAuthorize){ 912 $timeout(function() { 913 initconnexion.resolve(true); 914 },100); 915 } else if (commonConfig.oAuthExterne != null && commonConfig.oAuthExterne.urlAuthorize != null && commonConfig.oAuthExterne.ssoQiota == false) { 916 $rootScope.silentCheckAuthorize(); 917 } else { 918 afterCheckAuthorize(); 919 } 920 921 return initconnexion.promise; 922 923 }; 924 925 function _tryLoadMeta(cStateLoad){ 926 let currentSeo; 927 if($state.current.data !== undefined && $state.current.data.seoMap !== undefined && $state.current.data.seoMap.length > 0) { 928 currentSeo = _.findWhere($state.current.data.seoMap, {urlRewrite: $location.path()}); 929 if(currentSeo !== undefined) { 930 console.log("Load metas from urlRewrite "+currentSeo.urlRewrite); 931 seo.loadMetaInDom(currentSeo); 932 _endLoaded(cStateLoad); 933 } 934 $state.current.data.seoMap = []; 935 } 936 937 if(currentSeo === undefined){ 938 if(seo.isUrlRewrite($location.path())){ 939 let data = {}; 940 data.key = "url"; 941 data.value = seo.getOldPath($location.path()); 942 TbsWS.call("getseo/"+$rootScope.preferredLanguage,'public',data) 943 .then(function(seoData){ 944 if(seoData) { 945 console.log("Load metas from " + seoData.urlRewrite); 946 seo.loadMetaInDom(seoData); 947 } 948 _endLoaded(cStateLoad); 949 }); 950 } else { 951 _endLoaded(cStateLoad); 952 } 953 } 954 955 // GTM page view 956 googleTagManager.pageViewEvent($filter('translate')($state.current.data.pageTitle)); 957 958 function _endLoaded(cStateLoad){ 959 seo.loadUrlCanonique(); 960 $rootScope.loadIsEnded = cStateLoad; 961 _tryUpdatePrerender(); 962 TbsWS.tryLogErrors(); 963 } 964 } 965 966 function _tryUpdatePrerender(){ 967 if(commonConfig.prerenderEnabled && $window.location.href.endsWith("loading") === false && $rootScope.privatePage === false){ 968 TbsWS.call('prerender/' + Auth.encodeUrl($window.location.href),'public').then(function(result){ 969 console.log("prerenderio for " + $window.location.href); 970 });
971 } 972 $rootScope.privatePage = false; 973 } 974 975 $rootScope.isAuthorized = function isAuthorized(){ 976 $rootScope.privatePage=true; 977 var deferred = $q.defer(); 978 979 TbsWS.call('isauthorized','private').then( 980 function(access){ 981 deferred.resolve(access); 982 } 983 ,function(error) { 984 deferred.reject(error); 985 } 986 ); 987 988 return deferred.promise; 989 }; 990 991 $rootScope.tryEndPage = function tryEndPage(){ 992 $timeout(function() { 993 if (!commonConfig.loadTrackingManager) { 994 $rootScope.initTrackingManager().then( 995 function () { 996 tryEndPage2(); 997 commonConfig.loadTrackingManager = true; 998 } 999 ); 1000 } else { 1001 tryEndPage2(); 1002 } 1003 },500); 1004 }; 1005 1006 function tryEndPage2(){ 1007 googleTagManager.sendVpv(); 1008 1009 // piano : positionner le nom de page avant l'envoi du page.display 1010 // On ne renseigne le libellé générique de la route qu'en dernier recours : 1011 // si un contrôleur a déjà positionné un nom de page spécifique (nom de catégorie 1012 // pour les listes, libellé produit pour les magazines), on le conserve (ifEmpty=true). 1013 if($state.current !== undefined && $state.current.data !== undefined){ 1014 pianoManager.addCoreProperty('page', $filter('translate')($state.current.data.pageTitle), true); 1015 } 1016 1017 function _sendPianoPageDisplay(){ 1018 if(!$rootScope.skipPianoPageDisplay){ 1019 pianoManager.sendEvent('page.display', {}); 1020 } 1021 } 1022 1023 if(commonConfig.dico.title === undefined){ 1024 TbsWS.getJson("dico/"+$rootScope.preferredLanguage+'.json') 1025 .then(function(dico){ 1026 commonConfig.dico.title = dico["title"]["title"]; 1027 if($state.current !== undefined && $state.current.data !== undefined){ 1028 $('title').html($filter('translate')($state.current.data.pageTitle)+" | "+ commonConfig.dico.title); 1029 } else { 1030 $('title').html(commonConfig.dico.title); 1031 } 1032 _sendPianoPageDisplay(); 1033 marfeelManager.trackNewPage(); 1034 if ($("#custommessagetbs").length ) { 1035 $("#custommessagetbs").show(); 1036 } 1037 _tryLoadMeta(true); 1038 }); 1039 } else if($state.current.data !== undefined){ 1040 $('title').html($filter('translate')($state.current.data.pageTitle)+" | "+ commonConfig.dico.title); 1041 _sendPianoPageDisplay(); 1042 marfeelManager.trackNewPage(); 1043 if ($("#custommessagetbs").length ) { 1044 $("#custommessagetbs").show(); 1045 } 1046 _tryLoadMeta(true); 1047 } else { 1048 $('title').html(commonConfig.dico.title); 1049 _sendPianoPageDisplay(); 1050 marfeelManager.trackNewPage(); 1051 _tryLoadMeta(false); 1052 } 1053 } 1054 1055 $rootScope.getAbsoluteHrefMenuEvent = function getAbsoluteHrefMenuEvent(item) { 1056 let url = commonConfig.baseurl+_getHrefPage('common/cms/'+name); 1057 if(item.type == "cms"){ 1058 url = $rootScope.getAbsoluteHrefPageCms(item.id); 1059 } else if(item.type == "page"){ 1060 url = $rootScope.getAbsoluteHrefPage(item.id); 1061 } else if(item.type == "produit"){ 1062 if(item.refProduit === undefined){ 1063 item.refProduit = item.id; 1064 } 1065 url = $rootScope.getAbsoluteHrefProduct(item); 1066 } else if(item.type == "categorie"){ 1067 if(item.refCategorie === undefined){ 1068 item.refCategorie = item.id; 1069 } 1070 url = $rootScope.getAbsoluteHrefCategorie(item); 1071 } 1072 return _urlStripSlash(url); 1073 }; 1074 1075 $rootScope.openMenuEvent = function openMenuEvent($event, item) { 1076 if (item.type == "cms") { 1077 $rootScope.goPageCms($event,item.id); 1078 } else if (item.type == "page") { 1079 $rootScope.goPage($event,item.id); 1080 } else if (item.type == "produit") { 1081 if(item.refProduit === undefined){ 1082 item.refProduit = item.id; 1083 } 1084 $rootScope.goProduct($event, item); 1085 } else if (item.type == "categorie"){ 1086 if(item.refCategorie === undefined){ 1087 item.refCategorie = item.id; 1088 } 1089 $rootScope.goCategorie($event, item); 1090 } else if (item.type == "script") { 1091 $window.location.href = item.value; 1092 } 1093 /* ferme la navbar si ouverte */ 1094 $rootScope.closeNavbar(); 1095 }; 1096 1097 $rootScope.closeNavbar = function () { 1098 var nav = angular.element(document.querySelector('#nav-toggle')); 1099 if (nav.hasClass('in')) { 1100 angular.element('#nav-toggle').collapse('hide'); 1101 } 1102 }; 1103 1104 $rootScope.addQtePanier = function addQtePanier(ligne,qte) { 1105 if(ligne !== undefined && qte !== undefined){ 1106 $rootScope.spinnerShow(); 1107 cartManager.addQuantity(ligne, parseInt(ligne.quantite)+parseInt(qte)).then(function(status){ 1108 $rootScope.spinnerHide().then( 1109 function(){ 1110 if(!status){ 1111 $rootScope.openModalInformation('DICO_INFORMATION','DICO_ERREUR_CART_AJOUT_PRODUIT_DANS_PANIER'); 1112 } 1113 } 1114 ); 1115 });
1116 } 1117 }; 1118 1119 $rootScope.spinnerShow = function spinnerShow(){ 1120 $('#SpinnerModal').modal('show'); 1121 }; 1122 1123 $rootScope.spinnerHide = function spinnerHide(){ 1124 var deferred = $q.defer(); 1125 $timeout(function() { 1126 var $el = $('#SpinnerModal'); 1127 if($el.css('display') !== 'none') { 1128 $el.on('hidden.bs.modal', function () { 1129 $el.off('hidden.bs.modal'); 1130 $timeout(function() { 1131 deferred.resolve(true); 1132 }); 1133 }).modal('hide'); 1134 } else { 1135 $timeout(function() { 1136 deferred.resolve(true); 1137 }); 1138 } 1139 },500); 1140 1141 return deferred.promise; 1142 }; 1143 1144 function _getQiotaUrl(){ 1145 let url = commonConfig.oAuthExterne.urlFront; 1146 let redirect_uri = commonConfig.commonroot + "/content/sso/backconnected.html"; 1147 //ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 1148 url += "?redirect_uri="+redirect_uri+"&referer="+commonConfig.oAuthExterne.referer+"&uri_referer="+commonConfig.clientroot; 1149 return url; 1150 } 1151 1152 $rootScope.getAbsoluteLoginExterne = function getAbsoluteLoginExterne(){ 1153 /* 1154 if(commonConfig.oAuthExterne !== undefined && commonConfig.oAuthExterne.ssoQiota){ 1155 return _getQiotaUrl(); 1156 }*/ 1157 return "#"; 1158 }; 1159 1160 $rootScope.callloginexterneQiota = function callloginexterneQiota(fromButtonLogin, inNewWindow){ 1161 console.log("Redirect to extern portal Qiota"); 1162 if(fromButtonLogin){ 1163 Auth.setLoginIsInProgress(); 1164 } 1165 let url = _getQiotaUrl(); 1166 if(inNewWindow){ 1167 $window.open(url,"_blank"); 1168 } else { 1169 function checkLoadIsEndedToDoRedirection(){ 1170 if($rootScope.loadIsEnded){ 1171 $interval.cancel(stopTime); 1172 $window.open(url,"_self"); 1173 } 1174 } 1175 let stopTime = $interval(checkLoadIsEndedToDoRedirection, 50) 1176 } 1177 } 1178 1179 $rootScope.callloginexterne = function callloginexterne($event){ 1180 let fromButtonLogin = false; 1181 if($event !== null && $event !== undefined){ 1182 $event.stopPropagation(); 1183 fromActionLogin = true; 1184 } 1185 if(commonConfig.oAuthExterne !== undefined && commonConfig.oAuthExterne.ssoQiota){ 1186 $rootScope.callloginexterneQiota(false,false); 1187 } else { 1188 var urlexterne = (commonConfig.idpurl===undefined?"":commonConfig.idpurl); 1189 $rootScope.spinnerShow(); 1190 var ts = Math.floor(Date.now() / 1000); 1191 TbsWS.call('getkeyidp/'+ts,'public').then(function(result){ 1192 $rootScope.spinnerHide().then( 1193 function(){ 1194 if(result !== undefined && result.key == "keyidp" && result.value !== undefined){ 1195 var callback = commonConfig.clientroot+'/common/autologin'; 1196 ts = "ts="+ts; 1197 val = "val="+result.value; 1198 callback = "url="+callback; 1199 var url = urlexterne + '?' + ts+ '&' + val + '&' + callback; 1200 $window.open(url,"_self"); 1201 } 1202 } 1203 ); 1204 }); 1205 } 1206 }; 1207 1208 $rootScope.initAfterRunning = function initAfterRunning(){ 1209 if($rootScope.initUrlsOk && $rootScope.initWaitControllerOk){ 1210 console.log("All is ready"); 1211 $timeout(function() { 1212 let baseHref = $browser.baseHref(); 1213 if(commonConfig.saveCurrentUrl !== undefined) { 1214 let index = commonConfig.saveCurrentUrl.indexOf(window.location.hostname) + window.location.hostname.length; 1215 if(index > 0){ 1216 let path = commonConfig.saveCurrentUrl.substring(index); 1217 index = path.indexOf(baseHref) + baseHref.length; 1218 if(index > 0){ 1219 path = path.substring(index); 1220 if(path.startsWith('/') === true){ 1221 path = path.substring(1); 1222 } 1223 delete commonConfig.saveCurrentUrl; 1224 console.log("go to init path /"+path); 1225 if(path === "loading") { 1226 path = ""; 1227 } 1228 $rootScope.goPage(undefined, path); 1229 } 1230 } 1231 } 1232 },10); 1233 } 1234 }; 1235 1236 $rootScope.filtrepaiement = function filtrepaiement(cart, pfiltre) { 1237 var deferred = $q.defer(); 1238 var messages = {}; 1239 messages.DICO_INCOMPATIBILITE_TARIFS="DICO_INCOMPATIBILITE_TARIFS"; 1240 messages.DICO_ONLY_PRELEVEMENTS="DICO_ONLY_PRELEVEMENTS"; 1241 messages.DICO_ONLY_CB_CHEQUES="DICO_ONLY_CB_CHEQUES"; 1242 1243 if (cart.lignes !== undefined && cart.lignes.length > 0) { 1244 var incbcheques = false; //pour un tarif non présent dans la liste prelevements 1245 var inprelevements = false;//pour un tarif présent dans la liste prelevements 1246 for (var i=0; i<cart.lignes.length; i++) { 1247 var ligne = cart.lignes[i];
1248 if (ligne.produit !== undefined && ligne.produit.tarif !== undefined && ligne.produit.tarif.codeTarif !== undefined) { 1249 if (ligne.produit.tarif.tarifPreleve) { 1250 inprelevements = true; 1251 } else { 1252 incbcheques = true; 1253 } 1254 } 1255 } 1256 if (inprelevements && incbcheques) { 1257 deferred.resolve(messages.DICO_INCOMPATIBILITE_TARIFS); 1258 } else if (pfiltre && inprelevements && !incbcheques){ 1259 deferred.resolve(messages.DICO_ONLY_PRELEVEMENTS); 1260 } else if (pfiltre && !inprelevements && incbcheques) { 1261 deferred.resolve(messages.DICO_ONLY_CB_CHEQUES); 1262 } 1263 } 1264 deferred.resolve(""); 1265 return deferred.promise; 1266 }; 1267 1268 if(commonConfig.oAuthExterne !== undefined && commonConfig.oAuthExterne.urlFront !== undefined && commonConfig.oAuthExterne.displayFrontSilentIframe) { 1269 const iframe = document.createElement('iframe'); 1270 let url = commonConfig.oAuthExterne.urlFront; 1271 if(commonConfig.oAuthExterne.ssoQiota){ 1272 let redirect_uri = commonConfig.commonroot + "/content/sso/silentiframe.html"; 1273 //ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 1274 url += "?redirect_uri="+redirect_uri+"&referer="+commonConfig.oAuthExterne.referer+"&uri_referer="+commonConfig.clientroot+"&iframe=true"; 1275 } 1276 iframe.setAttribute('src', url); 1277 document.body.appendChild(iframe); 1278 } 1279 1280 if(commonConfig.oAuthExterne !== undefined && commonConfig.oAuthExterne.urlFront2 !== undefined && commonConfig.oAuthExterne.displayFrontSilentIframe) { 1281 const iframe = document.createElement('iframe'); 1282 let url = commonConfig.oAuthExterne.urlFront2; 1283 if(commonConfig.oAuthExterne.ssoQiota){ 1284 let redirect_uri = commonConfig.commonroot + "/content/sso/silentiframe.html"; 1285 //ob.referer = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); 1286 url += "?redirect_uri="+redirect_uri+"&referer="+commonConfig.oAuthExterne.referer+"&uri_referer="+commonConfig.clientroot+"&iframe=true"; 1287 } 1288 iframe.setAttribute('src', url); 1289 document.body.appendChild(iframe); 1290 } 1291 1292 //initAfterRunning(); 1293 console.log("end run app"); 1294 } 1295 ); 1296 1297var Latinise={};Latinise.latin_map={"Ã�":"A","Ãâ":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ã�":"A","Ãâ":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ãâ":"A","Þ":"A","æ":"A","à ":"A","Ạ":"A","Ãâ¬":"A","Ãâ¬":"A","Ả":"A","Ãâ":"A","Ãâ¬":"A","Ãâ":"A","Ãâ¦":"A","ú":"A","á¸â¬":"A","ú":"A","ÃÆ":"A","êŲ":"AA","Ãâ ":"AE","ü":"AE","â":"AE","êÅ´":"AO","êŶ":"AU","êŸ":"AV","êź":"AV","êż":"AY","á¸â":"B","á¸â":"B","Ã�":"B","á¸â ":"B","ÃÆ":"B","Ãâ":"B","Ãâ ":"C","ÃÅ":"C","Ãâ¡":"C","á¸Ë":"C","ÃË":"C","ÃÅ ":"C","Ãâ¡":"C","û":"C","ÃŽ":"D","�":"D","á¸â":"D","Ḋ":"D","á¸Å":"D","ÃÅ ":"D","Ḏ":"D","ò":"D","Ãâ¦":"D","Ã�":"D","Ãâ¹":"D","ñ":"DZ","Ãâ":"DZ","Ãâ°":"E","Ãâ":"E","ÃÅ¡":"E","è":"E","á¸Å":"E","ÃÅ ":"E","Ế":"E","á»â ":"E","á»â¬":"E","á»â":"E","á»â":"E","á¸Ë":"E","Ãâ¹":"E","Ãâ":"E","Ẹ":"E","Ãâ":"E","ÃË":"E","Ẻ":"E","Ãâ ":"E","Ãâ":"E","á¸â":"E","á¸â":"E","ÃË":"E","Ãâ ":"E","Ẽ":"E","Ḛ":"E","�":"ET","Ḟ":"F","Ãâ":"F","ô":"G","Þ":"G","æ":"G","â":"G","ÃÅ":"G","à ":"G","Ãâ":"G","Ḡ":"G","ä":"G","Ḫ":"H","Þ":"H","Ḩ":"H","ä":"H","â±§":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","æ":"H","Ã�":"I","ì":"I","Ã�":"I","ÃŽ":"I","Ã�":"I","Ḯ":"I","ð":"I","Ị":"I","ÃË":"I","ÃÅ":"I","á»Ë":"I","ÃÅ ":"I","ê":"I","î":"I","Ãâ":"I","è":"I","Ḭ":"I","�":"D","�":"F","�":"G","êžâ":"R","êžâ":"S","êžâ ":"T","�":"IS","ô":"J","ÃË":"J","Ḱ":"K","è":"K","ö":"K","Ⱪ":"K","ê�â":"K","Ḳ":"K","ÃË":"K","Ḵ":"K","ê�â¬":"K","ê�â":"K","ù":"L","ý":"L","ý":"L","û":"L","Ḽ":"L","Ḷ":"L","Ḹ":"L","â± ":"L","ê�Ë":"L","Ḻ":"L","ÿ":"L","â±¢":"L","ÃË":"L","à �":"L","Ãâ¡":"LJ","Ḿ":"M","á¹â¬":"M","á¹â":"M","â±®":"M","à Æ":"N","à â¡":"N","à â¦":"N","Ṋ":"N","á¹â":"N","á¹â ":"N","ø":"N","Ã�":"N","á¹Ë":"N","à ":"N","Ãâ¹":"N","Ãâ":"N","ÃÅ ":"NJ","Ãâ":"O","à Ž":"O","Ãâ":"O","Ãâ":"O","�":"O","á»Ë":"O","á»â":"O","á»â":"O","á»â":"O","Ãâ":"O","ê":"O","î":"O","ð":"O","á»Å":"O","à �":"O","ÃÅ":"O","Ãâ":"O","Ỏ":"O","à ":"O","Ớ":"O","Ợ":"O","á»Å":"O","Ở":"O","á» ":"O","ÃŽ":"O","�":"O","ê�Å":"O","à Å":"O","á¹â":"O","�":"O","ß":"O","ê":"O","ì":"O","ÃË":"O","þ":"O","Ãâ¢":"O","á¹Å":"O","Ṏ":"O","ì":"O","â":"OI","�":"OO","Ã�":"E","Ãâ ":"O","â":"OU","á¹â":"P","á¹â":"P","ê�â":"P","ä":"P","ê�â":"P","â±£":"P","�":"P","ê�Ë":"Q","ê�â":"Q","à â":"R","à Ë":"R","à â":"R","á¹Ë":"R","Ṛ":"R","á¹Å":"R","Ã�":"R","Ãâ":"R","Ṟ":"R","ÃÅ":"R","Ɽ":"R","êž":"C","ÃŽ":"E","à š":"S","Ṥ":"S","à ":"S","Ṧ":"S","à ž":"S","à Å":"S","ÃË":"S","á¹ ":"S","á¹¢":"S","Ṩ":"S","à ¤":"T","à ¢":"T","á¹°":"T","ÃÅ¡":"T","þ"
1297:"T","Ṫ":"T","Ṭ":"T","ì":"T","á¹®":"T","î":"T","Ã
¦":"T","Ɐ":"A","êžâ¬":"L","ÃÅ":"M","Ãâ¦":"V","êŨ":"TZ","ÃÅ¡":"U","Ã
¬":"U","Ãâ":"U","Ãâº":"U","á¹¶":"U","ÃÅ":"U","Ãâ":"U","Ãâ¢":"U","Ãâº":"U","Ãâ¢":"U","á¹²":"U","Ụ":"U","Ã
°":"U","Ãâ":"U","Ãâ¢":"U","Ủ":"U","ï":"U","Ứ":"U","á»°":"U","Ừ":"U","Ử":"U","á»®":"U","Ãâ":"U","Ã
ª":"U","Ṻ":"U","Ã
²":"U","Ã
®":"U","Ã
¨":"U","Ṹ":"U","á¹´":"U","�":"V","á¹¾":"V","ò":"V","á¹¼":"V","ê� ":"VY","áºâ":"W","Ã
´":"W","áºâ":"W","áºâ ":"W","áºË":"W","áºâ¬":"W","â±²":"W","áºÅ":"X","Ẋ":"X","Ã�":"Y","Ã
¶":"Y","Ã
¸":"Y","Ẏ":"Y","á»´":"Y","Ỳ":"Y","ó":"Y","á»¶":"Y","Ỿ":"Y","ò":"Y","ÃŽ":"Y","Ỹ":"Y","Ã
¹":"Z","Ã
½":"Z","�":"Z","Ⱬ":"Z","Ã
»":"Z","áºâ":"Z","ä":"Z","áºâ":"Z","õ":"Z","ò":"IJ","Ã
â":"OE","á´â¬":"A","á´�":"AE","Ãâ¢":"B","á´Æ":"B","á´â":"C","á´â¦":"D","á´â¡":"E","êŰ":"F","â":"G","Ãâº":"G","ÃÅ":"H","ê":"I","Ã�":"R","á´Š":"J","á´â¹":"K","ß":"L","á´Å":"L","á´�":"M","ô":"N","á´�":"O","ö":"OE","á´�":"O","á´â¢":"OU","á´Ë":"P","Ãâ¬":"R","á´Ž":"N","á´â¢":"R","êű":"S","á´âº":"T","â±»":"E","á´š":"R","á´Å":"U","á´ ":"V","á´¡":"W","Ã�":"Y","á´¢":"Z","á":"a","ÃÆ":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ÃŽ":"a","â":"a","ấ":"a","áºÂ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ß":"a","ç":"a","á":"a","ạ":"a","Ã�":"a","à ":"a","ả":"a","ÃÆ":"a","Ã�":"a","Ãâ¦":"a","�":"a","ẚ":"a","ÃÂ¥":"a","û":"a","�":"a","â±¥":"a","ã":"a","êų":"aa","æ":"ae","ý":"ae","ã":"ae","êŵ":"ao","êÅ·":"au","êŹ":"av","êÅ»":"av","êŽ":"ay","á¸Æ":"b","á¸â¦":"b","Ãâ":"b","á¸â¡":"b","ᵬ":"b","á¶â¬":"b","Ãâ¬":"b","ÃÆ":"b","õ":"o","Ãâ¡":"c","Ã�":"c","ç":"c","á¸â°":"c","Ãâ°":"c","Ãâ¢":"c","Ãâ¹":"c","ÃË":"c","ü":"c","Ã�":"d","á¸â":"d","á¸â":"d","á":"d","á¸â¹":"d","�":"d","Ãâ":"d","á¶â":"d","�":"d","áµÂ":"d","�":"d","Ãâ":"d","Ãâ":"d","ÃÅ":"d","ñ":"i","÷":"j","ß":"j","Ãâ":"j","ó":"dz","Ãâ ":"dz","é":"e","Ãâ¢":"e","Ãâº":"e","é":"e","�":"e","ê":"e","ế":"e","á»â¡":"e","�":"e","á»Æ":"e","á»â¦":"e","á¸â¢":"e","ë":"e","Ãâ":"e","ẹ":"e","Ãâ¦":"e","è":"e","ẻ":"e","Ãâ¡":"e","Ãâ":"e","á¸â":"e","á¸â¢":"e","ⱸ":"e","Ãâ¢":"e","á¶â":"e","Ãâ¡":"e","ẽ":"e","á¸âº":"e","�":"et","ḟ":"f","Ãâ":"f","áµ®":"f","á¶â":"f","õ":"g","ß":"g","ç":"g","ã":"g","Ã�":"g","á":"g","à ":"g","ḡ":"g","á¶Æ":"g","ÃÂ¥":"g","ḫ":"h","ß":"h","ḩ":"h","ÃÂ¥":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","æ":"h","áºâ":"h","ç":"h","Ãâ¢":"hv","ÃÂ":"i","ÃÂ":"i","Ã�":"i","î":"i","ï":"i","ḯ":"i","á»â¹":"i","Ãâ°":"i","ì":"i","á»â°":"i","Ãâ¹":"i","ë":"i","ï":"i","á¶â":"i","è":"i","é":"i","á¸Â":"i","�":"d","�":"f","áµ¹":"g","êžÆ":"r","êžâ¦":"s","êžâ¡":"t","ê�Â":"is","ð":"j","õ":"j","Ã�":"j","Ãâ°":"j","ḱ":"k","é":"k","÷":"k","ⱪ":"k","ê�Æ":"k","ḳ":"k","Ãâ¢":"k","ḵ":"k","á¶â":"k","�":"k","ê�â¦":"k","ú":"l","ÃÅ¡":"l","ì":"l","þ":"l","ü":"l","ḽ":"l","ô":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ê�â°":"l","ḻ":"l","Ã
â¬":"l","ë":"l","á¶â¦":"l","ÃÂ":"l","Ã
â":"l","Ãâ°":"lj","Ã
¿":"s","áºÅ":"s","áºâº":"s","�":"s","ḿ":"m","�":"m","á¹Æ":"m","ñ":"m","ᵯ":"m","á¶â ":"m","Ã
â":"n","Ã
Ë":"n","Ã
â ":"n","á¹â¹":"n","õ":"n","á¹â¦":"n","á¹â¡":"n","ù":"n","ò":"n","á¹â°":"n","Þ":"n","áµ°":"n","á¶â¡":"n","ó":"n","ñ":"n","ÃÅ":"nj","ó":"o","Ã
�":"o","Ãâ":"o","ô":"o","á»â":"o","á»â¢":"o","á»â":"o","á»â¢":"o","á»â":"o","ö":"o","ë":"o","ï":"o","ñ":"o","�":"o","Ã
â":"o","Ã�":"o","ò":"o","�":"o","á":"o","á»âº":"o","ợ":"o","�":"o","ở":"o","ỡ":"o","Ã�":"o","ê�â¹":"o","�":"o","ⱺ":"o","Ã
�":"o","á¹â":"o","á¹â":"o","ë":"o","ÃÂ":"o","ø":"o","ÿ":"o","õ":"o","�":"o","�":"o","ÃÂ":"o","ã":"oi","�":"oo","Ãâº":"e","á¶â":"e","Ãâ":"o","á¶â":"o","ã":"ou","á¹â¢":"p","á¹â":"p","ê�â":"p","ÃÂ¥":"p","áµ±":"p","á¶Ë":"p","ê�â¢":"p","áµ½":"p","ê�â":"p","ê�â¢":"q","à ":"q","Ãâ¹":"q","ê�â":"q","Ã
â¢":"r","Ã
â¢":"r","Ã
â":"r","á¹â¢":"r","á¹âº":"r","�":"r","Ãâ":"r","þ":"r","áµ³":"r","Ãâ":"r","ṟ":"r","ü":"r","áµ²":"r","á¶â°":"r","Ã�":"r","ý":"r","ââ â":"c","êÅ¿":"c","ÃË":"e","ÿ":"r","Ã
âº":"s","á¹¥":"s","Ã
¡":"s","á¹§":"s","Ã
Ÿ":"s","Ã
�":"s","Ãâ¢":"s","ṡ":"s","á¹£":"s","ṩ":"s","Ãâ":"s","áµ´":"s","á¶Š":"s","ÿ":"s","á":"g","á´â":"o","á´â":"o","á´�":"u","Ã
Â¥":"t","Ã
£":"t","á¹±":"t","Ãâº":"t","ö":"t","áºâ":"t","ⱦ":"t","ṫ":"t","á¹Â":"t","ÃÂ":"t","ṯ"
1297:"t","áµµ":"t","ë":"t","ÃË":"t","à §":"t","ᵺ":"th","Ã�":"a","á´â":"ae","Ã�":"e","áµ·":"g","ÃÂ¥":"h","î":"h","ï":"h","á´â°":"i","Þ":"k","�":"l","ï":"m","ð":"m","á´â":"oe","ù":"r","û":"r","ú":"r","â±¹":"r","Ãâ¡":"t","ÃÅ":"v","Ã�":"w","ÃŽ":"y","êÅ©":"tz","ú":"u","à Â":"u","Ãâ":"u","û":"u","á¹·":"u","ü":"u","ÃË":"u","ÃÅ¡":"u","ÃÅ":"u","Ãâ":"u","á¹³":"u","ụ":"u","à ±":"u","Ãâ¢":"u","ù":"u","á»§":"u","ð":"u","ứ":"u","á»±":"u","ừ":"u","á»Â":"u","ữ":"u","Ãâ":"u","à «":"u","á¹»":"u","à ³":"u","á¶â¢":"u","à ¯":"u","à ©":"u","á¹¹":"u","á¹µ":"u","ᵫ":"ue","�":"um","â±´":"v","�":"v","ṿ":"v","Ãâ¹":"v","á¶Å":"v","â±±":"v","á¹½":"v","�":"vy","áºÆ":"w","à µ":"w","áºâ¦":"w","áºâ¡":"w","áºâ°":"w","�":"w","â±³":"w","áºË":"w","�":"x","áºâ¹":"x","�":"x","ý":"y","à ·":"y","ÿ":"y","�":"y","ỵ":"y","ỳ":"y","ô":"y","á»·":"y","ỿ":"y","ó":"y","áºâ¢":"y","Ã�":"y","ỹ":"y","à º":"z","à ¾":"z","áºâ":"z","Ãâ":"z","ⱬ":"z","à ¼":"z","áºâ":"z","ÃÂ¥":"z","áºâ¢":"z","áµ¶":"z","á¶Ž":"z","Ã�":"z","ö":"z","Ãâ¬":"z","ï¬â¬":"ff","ï¬Æ":"ffi","ï¬â":"ffl","�":"fi","ï¬â":"fl","ó":"ij","à â":"oe","ï¬â ":"st","ââ�":"a","âââ":"e","áµ¢":"i","â±¼":"j","âââ":"o","áµ£":"r","ᵤ":"u","áµ¥":"v","âââ":"x"}; 1298String.prototype.latinise=function(){return this.replace(/[^A-Za-z0-9\[\] ]/g,function(a){return Latinise.latin_map[a]||a;});}; 1299String.prototype.latinize=String.prototype.latinise; 1300String.prototype.isLatin=function(){return this==this.latinise();}; 1301 1302String.prototype.dicoReplace = function() { 1303 return this.toLowerCase().latinize().replace(/[\W\s]+/g," ").replace(/\s/g, '') 1304 .replace(/[1]/g, "UN").replace(/[2]/g, "DEUX").replace(/[3]/g, "TROIS").replace(/[4]/g, "QUATRE") 1305 .replace(/[5]/g, "CINQ").replace(/[6]/g, "SIX").replace(/[7]/g, "SEPT").replace(/[8]/g, "HUIT").replace(/[9]/g, "NEUF") 1306 .replace(/[0]/g, "ZERO") 1307 .toUpperCase(); 1308}; 1309 1310if (typeof String.prototype.startsWith != 'function') { 1311 // see below for better implementation! 1312 String.prototype.startsWith = function (str){ 1313 return this.indexOf(str) === 0; 1314 }; 1315}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.