Différences entre les versions de « MediaWiki:Common.js »

Ligne 3 : Ligne 3 :
  
 
$( function () {
 
$( function () {
setTimeout(function() {
+
setTimeout(function() {
 
window.botpressWebChat.init({  
 
window.botpressWebChat.init({  
        host: '/chatTest',  
+
host: '/chatTest',  
        botId: 'production',  
+
        botId: 'production',  
        locale: 'fr',  
+
        locale: 'fr',  
        botConvoDescription: 'nous sommes en test',  
+
        botConvoDescription: 'nous sommes en test',  
        enableReset: true,  
+
        enableReset: true,  
        showConversationsButton: false,  
+
        showConversationsButton: false,  
        enableTranscriptDownload: false,  
+
        enableTranscriptDownload: false,  
        showUserName: false,  
+
        showUserName: false,  
        showPoweredBy: false,  
+
        showPoweredBy: false,  
        botName: 'Test',  
+
        botName: 'Test',  
        extraStylesheet: '/default-emulator.css',
+
        extraStylesheet: '/default-emulator.css',
        botConvoTitle: 'Tech',
+
        botConvoTitle: 'Tech',
        enableArrowNavigation: true,
+
        enableArrowNavigation: true,
        exposeStore: true
+
        exposeStore: true
 +
});
 +
},1000);
 +
 
 +
      window.addEventListener("message", (event) => {
 +
if (event.data && event.data.name === "webchatLoaded") {
 +
window.botpressWebChat.mergeConfig({
 +
layoutWidth: "100%",
 +
});
 +
}
 
         });
 
         });
 
          
 
          
+
window.addEventListener('message', function(event) {
   
+
if (event.data.name === 'webchatReady') {
},1000);
+
window.botpressWebChat.sendEvent({
 +
type: 'proactive-trigger',
 +
channel: 'web',
 +
payload: { text: 'Salut' }
 +
})
 +
}
 +
});
 +
 
});
 
});

Version du 24 novembre 2021 à 18:21

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
mw.loader.load( "/chatTest/assets/modules/channel-web/inject.js");

$( function () {
	setTimeout(function() {
		window.botpressWebChat.init({ 
			host: '/chatTest', 
        	botId: 'production', 
        	locale: 'fr', 
        	botConvoDescription: 'nous sommes en test', 
        	enableReset: true, 
        	showConversationsButton: false, 
        	enableTranscriptDownload: false, 
        	showUserName: false, 
        	showPoweredBy: false, 
        	botName: 'Test', 
        	extraStylesheet: '/default-emulator.css',
        	botConvoTitle: 'Tech',
        	enableArrowNavigation: true,
        	exposeStore: true
		});
	},1000);

	       window.addEventListener("message", (event) => {
			if (event.data && event.data.name === "webchatLoaded") {
				window.botpressWebChat.mergeConfig({
					layoutWidth: "100%",
				});
			}
        });
        
	window.addEventListener('message', function(event) {
		if (event.data.name === 'webchatReady') {
			window.botpressWebChat.sendEvent({
				type: 'proactive-trigger',
				channel: 'web',
				payload: { text: 'Salut' }
			})
		}
	});
	
});

La dernière modification de cette page a été faite le 24 novembre 2021 à 18:21.