PageSourceSearch

https://boutique.transitionsenergies.com/core/aboshop/app.js?v=

js transitionsenergies.com collected 2026-10-02 10:08:29 UTC 61,109 bytes, 1,315 lines download raw bytes

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","Dz":"D","Ç…":"D","Ä�":"D","Æ‹":"D","DZ":"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","Lj":"L","Å�":"L","LJ":"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":"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","dž":"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":"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":"ff","ffi":"ffi","ffl":"ffl","�":"fi","fl":"fl","ij":"ij","œ":"oe","st":"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.