1- <!DOCTYPE html>
2- < html lang ="it ">
3- < head >
4- < meta charset ="UTF-8 " />
5- < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
6- < title > Demo Salesforce - Multi-Language Test</ title >
7- < style >
8- body { font-family : 'Segoe UI' , Arial, sans-serif; display : flex; justify-content : center; align-items : center; min-height : 100vh ; background : # f4f6f9 ; margin : 0 ; }
9- .box { background : # fff ; padding : 30px ; border : 1px solid # e0e0e0 ; border-radius : 12px ; box-shadow : 0 10px 40px rgba (0 , 0 , 0 , 0.08 ); text-align : left; width : 380px ; }
10- h1 { margin : 0 0 25px ; font-size : 26px ; text-align : center; color : # 1a1a1a ; }
11-
12- .input-group { margin-bottom : 15px ; }
13- .input-group label { display : block; font-size : 13px ; color : # 555 ; margin-bottom : 5px ; font-weight : 600 ; }
14-
15- /* Stile uniforme per input e select */
16- select , input [type = "text" ] {
17- width : 100% ;
18- padding : 8px 10px ;
19- border-radius : 4px ;
20- border : 1px solid # ccc ;
21- font-size : 14px ;
22- box-sizing : border-box; /* Assicura che il padding non sballi la larghezza */
23- font-family : inherit;
24- }
25-
26- .btn-start { display : block; width : 100% ; padding : 12px ; background-color : # 0070d2 ; color : white; border : none; border-radius : 6px ; font-size : 16px ; cursor : pointer; margin-top : 25px ; transition : background 0.3s ; }
27- .btn-start : hover { background-color : # 005fb2 ; }
28- .btn-start : disabled { background-color : # ccc ; cursor : not-allowed; }
29-
30- .status { font-size : 13px ; text-align : center; color : # 0969da ; margin-top : 15px ; font-weight : 600 ; min-height : 20px ;}
31-
32- .section-title { font-size : 12px ; text-transform : uppercase; color : # 999 ; margin-top : 20px ; margin-bottom : 10px ; border-bottom : 1px solid # eee ; padding-bottom : 5px ; }
33- </ style >
34- </ head >
35- < body >
36-
37- < div class ="box ">
38- < h1 > Test Agentforce</ h1 >
39-
40- < div class ="input-group " style ="background-color: #fafffa; border: 1px solid #cce5cc; padding: 10px; border-radius: 6px; ">
41- < label for ="language-picker "> Lingua Chat</ label >
42- < select id ="language-picker ">
43- < option value ="it "> Italiano (IT)</ option >
44- < option value ="en_US "> English (US)</ option >
45- < option value ="es "> Español (ES)</ option >
46- < option value ="fr "> Français (FR)</ option >
47- </ select >
48- </ div >
49-
50- < div class ="section-title "> Dati Utente</ div >
51-
52- < div class ="input-group ">
53- < label for ="inp-fullname "> Nome Completo (fullname)</ label >
54- < input type ="text " id ="inp-fullname " value ="Mario Rossi " placeholder ="Es. Mario Rossi ">
55- </ div >
56-
57- < div class ="input-group ">
58- < label for ="inp-type "> Tipo Utente (userType)</ label >
59- < input type ="text " id ="inp-type " value ="consultant " placeholder ="Es. consultant ">
60- </ div >
61-
62- < div class ="input-group ">
63- < label for ="inp-id "> ID Utente (userId)</ label >
64- < input type ="text " id ="inp-id " value ="12345 " placeholder ="Es. 12345 ">
65- </ div >
66-
67- < div class ="input-group ">
68- < label for ="inp-nationality "> Nazionalità (nationality)</ label >
69- < input type ="text " id ="inp-nationality " value ="IT " placeholder ="Es. IT ">
70- </ div >
71-
72- < button id ="start-btn " class ="btn-start " onclick ="startChatSession() "> Inizializza Chat</ button >
73-
74- < div id ="status-msg " class ="status "> Configura e clicca Inizializza</ div >
75-
76- < p style ="text-align:center; color:#999; font-size:11px; margin-top:25px; ">
77- Chogan Demo Environment
78- </ p >
79- </ div >
80-
81- < script type ='text/javascript '>
1+ < script type ='text/javascript '>
822
833 function startChatSession ( ) {
844 // Disabilita il bottone
@@ -108,9 +28,10 @@ <h1>Test Agentforce</h1>
10828
10929 try {
11030 // 1. IMPOSTAZIONI DEL CANALE (UI del Widget)
31+ // Usa SOLO embeddedservice_bootstrap, non embedded_svc
11132 embeddedservice_bootstrap . settings . language = langCode ;
112- embedded_svc . settings . loadingText = "..."
11333
34+ // Disabilita input utente se si parla col bot (opzionale)
11435 embeddedservice_bootstrap . settings . enableUserInputForConversationWithBot = false ;
11536
11637 // 2. GESTIONE EVENTO PRE-CHAT
@@ -124,7 +45,6 @@ <h1>Test Agentforce</h1>
12445 "userType" : userData . userType ,
12546 "nationality" : userData . nationality ,
12647 "userId" : userData . userId ,
127- // Passiamo la lingua selezionata dinamicamente
12848 "Language" : langCode
12949 } ;
13050
@@ -155,12 +75,7 @@ <h1>Test Agentforce</h1>
15575
15676 } catch ( err ) {
15777 console . error ( 'Errore critico durante Init:' , err ) ;
158- document . getElementById ( 'status-msg' ) . innerText = "Errore Init" ;
78+ document . getElementById ( 'status-msg' ) . innerText = "Errore Init: " + err . message ;
15979 }
16080 } ;
16181 </ script >
162-
163- < script type ='text/javascript ' src ='https://chogangroup--devai2.sandbox.my.site.com/ESWaichogangroupspacom1764335835157/assets/js/bootstrap.min.js '> </ script >
164-
165- </ body >
166- </ html >
0 commit comments