Skip to content

Commit 1d995a9

Browse files
Fullname index.html
1 parent a612979 commit 1d995a9

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

index.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="box">
1919
<h1>Dati Utente</h1>
2020

21-
<div class="info-row"><strong>name:</strong> <span id="disp-name">...</span></div>
21+
<div class="info-row"><strong>fullname:</strong> <span id="disp-name">...</span></div>
2222
<div class="info-row"><strong>userType:</strong> <span id="disp-type">...</span></div>
2323
<div class="info-row"><strong>nationality:</strong> <span id="disp-nat">...</span></div>
2424
<div class="info-row"><strong>userId:</strong> <span id="disp-id">...</span></div>
@@ -35,40 +35,41 @@ <h1>Dati Utente</h1>
3535
console.log("--> INIT SALESFORCE START <--");
3636

3737
try {
38-
// 1. DEFINIZIONE VARIABILI (Tutto dentro la funzione per sicurezza scope)
39-
// Usiamo un oggetto per pulizia, ma puoi usare const separate
38+
// 1. DEFINIZIONE VARIABILI
39+
//
4040
const userData = {
41-
firstName: "Mario Rossi", // Ho cambiato nome var per evitare conflitti con window.name
41+
fullname: "Mario Rossi",
4242
userType: "consultant",
4343
nationality: "IT",
4444
userId: "12345"
4545
};
4646

47-
// 2. AGGIORNAMENTO INTERFACCIA (Così vediamo cosa stiamo per inviare)
48-
document.getElementById('disp-name').innerText = userData.firstName;
47+
// 2. AGGIORNAMENTO INTERFACCIA Per vedere cosa stiamo per inviare all'agente )
48+
document.getElementById('disp-name').innerText = userData.fullname;
4949
document.getElementById('disp-type').innerText = userData.userType;
5050
document.getElementById('disp-nat').innerText = userData.nationality;
5151
document.getElementById('disp-id').innerText = userData.userId;
5252

5353
// --- IMPOSTAZIONI SALESFORCE ---
5454
embeddedservice_bootstrap.settings.language = 'it';
55+
// Impedisce all'utente di scrivere mentre l'agente sta scrivendo
5556
embeddedservice_bootstrap.settings.enableUserInputForConversationWithBot = false;
5657

57-
// 3. GESTIONE EVENTO "PRONTO"
58+
// 3. GESTIONE EVENTO
5859
window.addEventListener("onEmbeddedMessagingReady", () => {
5960
console.log(">>> EVENTO: Messaging Ready. Invio parametri...");
6061

6162
try {
6263
// Qui usiamo le variabili definite poche righe sopra (Closure corretta)
6364
embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({
64-
"name": userData.firstName,
65+
"fullname": userData.fullname,
6566
"userType": userData.userType,
6667
"nationality": userData.nationality,
6768
"userId": userData.userId
6869
});
69-
70+
//
7071
console.log(">>> Parametri Hidden impostati con successo:", userData);
71-
document.getElementById('status-msg').innerText = "Chat Pronta & Parametri Inviati!";
72+
document.getElementById('status-msg').innerText = "Chat Pronta";
7273
document.getElementById('status-msg').style.color = "green";
7374

7475
} catch (e) {
@@ -78,8 +79,8 @@ <h1>Dati Utente</h1>
7879
}
7980
});
8081

81-
// 4. INIZIALIZZAZIONE (Bootstrap)
82-
// Nota: Ho mantenuto gli ID specifici del tuo secondo script (devai2)
82+
83+
// ID specifici dell'agente
8384
embeddedservice_bootstrap.init(
8485
'00DUA000003hFV7',
8586
'ai_chogangroupspa_com',

0 commit comments

Comments
 (0)