[FIX] FAB segnalazione/ARIA: icone FontAwesome -> SVG inline (regressione swap BI) + slot data-api-key
Icone: bug-reporter.js (nx-bell fa-bell, nx-bug fa-life-ring) + common.js ai-chat-fab/header/send (fa-wand-magic-sparkles, fa-paper-plane) erano FA, rimosso dallo swap BI -> cerchi vuoti. Sostituite con SVG inline (currentColor, self-contained). Verificato headless: 3 FAB renderizzano svg. Auth widget: cablato s.dataset.apiKey <- window.NEXUS_WIDGET_API_KEY (X-API-Key gateway AgileHub, era assente -> 401). _detectUser ora legge anche nis2_access_token. SERVE la chiave X-API-Key da AgileHub.
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
if (u.email) { CFG.userEmail = u.email; CFG.userName = u.name || u.full_name || CFG.userName; CFG.userRole = u.role || CFG.userRole; return; }
|
if (u.email) { CFG.userEmail = u.email; CFG.userName = u.name || u.full_name || CFG.userName; CFG.userRole = u.role || CFG.userRole; return; }
|
||||||
}
|
}
|
||||||
// 3. JWT decode da access_token / nexus_token
|
// 3. JWT decode da access_token / nexus_token
|
||||||
const token = sessionStorage.getItem('access_token') || sessionStorage.getItem('nexus_token') || localStorage.getItem('nexus_token');
|
const token = sessionStorage.getItem('access_token') || sessionStorage.getItem('nexus_token') || localStorage.getItem('nexus_token') || localStorage.getItem('nis2_access_token');
|
||||||
if (token && token.includes('.')) {
|
if (token && token.includes('.')) {
|
||||||
const payload = JSON.parse(atob(token.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')));
|
const payload = JSON.parse(atob(token.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')));
|
||||||
if (payload.email) { CFG.userEmail = payload.email; CFG.userName = payload.name || payload.full_name || CFG.userName; CFG.userRole = payload.role || CFG.userRole; }
|
if (payload.email) { CFG.userEmail = payload.email; CFG.userName = payload.name || payload.full_name || CFG.userName; CFG.userRole = payload.role || CFG.userRole; }
|
||||||
@@ -179,8 +179,8 @@
|
|||||||
const bar = document.createElement('div');
|
const bar = document.createElement('div');
|
||||||
bar.id = 'nx-bar';
|
bar.id = 'nx-bar';
|
||||||
bar.innerHTML = `
|
bar.innerHTML = `
|
||||||
<button id="nx-bell-btn" title="Notifiche"><i class="fas fa-bell"></i><span id="nx-bell-badge" style="display:none">0</span></button>
|
<button id="nx-bell-btn" title="Notifiche"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg><span id="nx-bell-badge" style="display:none">0</span></button>
|
||||||
<button id="nx-bug-btn" title="Chiedi supporto"><i class="fas fa-life-ring"></i></button>
|
<button id="nx-bug-btn" title="Chiedi supporto"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="4"/><line x1="4.93" y1="4.93" x2="9.17" y2="9.17"/><line x1="14.83" y1="14.83" x2="19.07" y2="19.07"/><line x1="14.83" y1="9.17" x2="19.07" y2="4.93"/><line x1="9.17" y1="14.83" x2="4.93" y2="19.07"/></svg></button>
|
||||||
`;
|
`;
|
||||||
document.body.appendChild(bar);
|
document.body.appendChild(bar);
|
||||||
|
|
||||||
|
|||||||
+8
-3
@@ -953,6 +953,11 @@ function switchLang(lang) {
|
|||||||
s.dataset.product = 'NIS2';
|
s.dataset.product = 'NIS2';
|
||||||
s.dataset.tenantId = '7';
|
s.dataset.tenantId = '7';
|
||||||
s.dataset.apiUrl = 'https://agilehub.agile.software';
|
s.dataset.apiUrl = 'https://agilehub.agile.software';
|
||||||
|
// X-API-Key per il gateway ticket AgileHub. Senza, il widget riceve 401
|
||||||
|
// "Header X-API-Key o Authorization: Bearer richiesto". Valorizzare con la
|
||||||
|
// chiave NIS2 emessa da AgileHub (prodotto NIS2, tenant 7). Inietta via
|
||||||
|
// window.NEXUS_WIDGET_API_KEY oppure hardcoda qui quando disponibile.
|
||||||
|
s.dataset.apiKey = (window.NEXUS_WIDGET_API_KEY || '');
|
||||||
s.dataset.userName = userName;
|
s.dataset.userName = userName;
|
||||||
s.dataset.userEmail = userEmail;
|
s.dataset.userEmail = userEmail;
|
||||||
s.dataset.userRole = userRole;
|
s.dataset.userRole = userRole;
|
||||||
@@ -972,7 +977,7 @@ function switchLang(lang) {
|
|||||||
+ 'background:linear-gradient(135deg,#7C3AED,#3B82F6);color:#fff;'
|
+ 'background:linear-gradient(135deg,#7C3AED,#3B82F6);color:#fff;'
|
||||||
+ 'box-shadow:0 6px 20px rgba(124,58,237,.4);font-size:22px;'
|
+ 'box-shadow:0 6px 20px rgba(124,58,237,.4);font-size:22px;'
|
||||||
+ 'display:flex;align-items:center;justify-content:center;';
|
+ 'display:flex;align-items:center;justify-content:center;';
|
||||||
fab.innerHTML = '<i class="fa-solid fa-wand-magic-sparkles"></i>';
|
fab.innerHTML = '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l1.8 4.6L18.5 9.5l-4.7 1.9L12 16l-1.8-4.6L5.5 9.5l4.7-1.9L12 3z"/></svg>';
|
||||||
document.body.appendChild(fab);
|
document.body.appendChild(fab);
|
||||||
|
|
||||||
var panel = document.createElement('div');
|
var panel = document.createElement('div');
|
||||||
@@ -1009,7 +1014,7 @@ function switchLang(lang) {
|
|||||||
'<div style="padding:14px 16px;background:linear-gradient(135deg,#7C3AED,#3B82F6);'
|
'<div style="padding:14px 16px;background:linear-gradient(135deg,#7C3AED,#3B82F6);'
|
||||||
+ 'color:#fff;display:flex;justify-content:space-between;align-items:center">'
|
+ 'color:#fff;display:flex;justify-content:space-between;align-items:center">'
|
||||||
+ '<div style="display:flex;align-items:center;gap:8px;font-weight:600">'
|
+ '<div style="display:flex;align-items:center;gap:8px;font-weight:600">'
|
||||||
+ '<i class="fa-solid fa-wand-magic-sparkles"></i> ARIA — Assistente NIS2'
|
+ '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px"><path d="M12 3l1.8 4.6L18.5 9.5l-4.7 1.9L12 16l-1.8-4.6L5.5 9.5l4.7-1.9L12 3z"/></svg> ARIA — Assistente NIS2'
|
||||||
+ '</div>'
|
+ '</div>'
|
||||||
+ '<button id="ai-chat-close" aria-label="Chiudi" style="background:none;'
|
+ '<button id="ai-chat-close" aria-label="Chiudi" style="background:none;'
|
||||||
+ 'border:none;color:#fff;font-size:18px;cursor:pointer">×</button>'
|
+ 'border:none;color:#fff;font-size:18px;cursor:pointer">×</button>'
|
||||||
@@ -1028,7 +1033,7 @@ function switchLang(lang) {
|
|||||||
+ '<button type="submit" style="padding:10px 14px;border:none;'
|
+ '<button type="submit" style="padding:10px 14px;border:none;'
|
||||||
+ 'border-radius:10px;background:linear-gradient(135deg,#7C3AED,#3B82F6);'
|
+ 'border-radius:10px;background:linear-gradient(135deg,#7C3AED,#3B82F6);'
|
||||||
+ 'color:#fff;font-weight:600;cursor:pointer">'
|
+ 'color:#fff;font-weight:600;cursor:pointer">'
|
||||||
+ '<i class="fa-solid fa-paper-plane"></i>'
|
+ '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>'
|
||||||
+ '</button>'
|
+ '</button>'
|
||||||
+ '</form>';
|
+ '</form>';
|
||||||
document.getElementById('ai-chat-close').onclick = function () {
|
document.getElementById('ai-chat-close').onclick = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user