1/** 2 * <build-badge> â enterprise build-identity badge (vendored from the shared 3 * @mindhyve/build-badge; kept byte-identical). Served statically and mounted 4 * 5 * â THIS COPY IS NOT UPDATED BY ANYTHING. The canonical repo force-syncs itself 6 * into every ORG MIRROR on push, but nothing re-vendors it into this file â so a 7 * fix landed upstream does not reach mindhyve.ai until someone edits here too. 8 * opacity 0.5 -> 0.6 (2026-08-28) matches platform-build-identity PR 671: element 9 * opacity composites text AND the badge's own background toward the page, which 10 * dropped the effective pair to #717173 on #0d0e11 = 3.91:1, under the 4.5:1 AA 11 * needs at 11px. 0.6 measures 5.15:1. Lighthouse was failing six URLs on it. 12 * Nor is this copy byte-identical any more â it is reformatted â so a future 13 * re-vendor is a diff to read, not a blind overwrite. 14 * in index.html so it appears on every screen regardless of routing. Renders 15 * version+commit on every environment (prod included); the STAGING/QA strip 16 * shows only off-prod. Reads /version.json (single canonical source). 17 */ 18class BuildBadge extends HTMLElement { 19 static get observedAttributes() { 20 return ['src']; 21 } 22 23 connectedCallback() { 24 this.attachShadow({ mode: 'open' }); 25 this._render({ version: '', commit: '' }); 26 this._load(); 27 } 28 29 attributeChangedCallback() { 30 if (this.shadowRoot) this._load(); 31 } 32 33 async _load() { 34 const src = this.getAttribute('src') || '/version.json'; 35 try { 36 const embedded = 37 typeof window !== 'undefined' && window.__BUILD__ ? window.__BUILD__ : null; 38 const data = embedded || (await (await fetch(src, { cache: 'no-store' })).json()); 39 this._render(data); 40 } catch { 41 this._render(null); 42 } 43 } 44 45 _render(data) { 46 if (!this.shadowRoot) return; 47 if (!data || !data.version) { 48 this.shadowRoot.innerHTML = ''; 49 return; 50 } 51 const version = String(data.version); 52 const commit = String(data.commit || '').slice(0, 7); 53 const env = String(data.environment || 'production').toLowerCase(); 54 const isProd = env === 'production' || env === 'prod'; 55 const label = commit ? `${version}+${commit}` : version; 56 57 if (typeof document !== 'undefined' && !document.querySelector('meta[name="build-version"]')) { 58 const m = document.createElement('meta'); 59 m.name = 'build-version'; 60 m.content = label; 61 document.head && document.head.appendChild(m); 62 } 63 64 this.shadowRoot.innerHTML = ` 65 <style> 66 :host { 67 position: fixed; right: 8px; bottom: 8px; z-index: 2147483647; 68 font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; 69 pointer-events: none; user-select: none; 70 } 71 .wrap { display: flex; align-items: center; gap: 6px; } 72 .badge { 73 padding: 2px 7px; border-radius: 999px; 74 background: rgba(20, 20, 22, 0.55); color: rgba(255, 255, 255, 0.82); 75 backdrop-filter: blur(4px); opacity: 0.6; transition: opacity 0.15s ease; 76 /* Informational only â never intercept taps. Keeping this 77 pointer-events:none (was :auto) stops the fixed corner badge from 78 stealing taps from bottom-right UI (consent buttons, nav, FABs) 79 across every app that mounts it. */ 80 pointer-events: none; 81 } 82 .strip { 83 padding: 2px 7px; border-radius: 999px; font-weight: 700; 84 letter-spacing: 0.05em; text-transform: uppercase; 85 background: #b45309; color: #fff; opacity: 0.9; 86 } 87 </style> 88 <div class="wrap"> 89 ${isProd ? '' : `<span class="strip">${env}</span>`} 90 <span class="badge" title="Build ${label} · ${env}">${label}</span> 91 </div> 92 `; 93 } 94} 95 96if (typeof customElements !== 'undefined' && !customElements.get('build-badge')) { 97 customElements.define('build-badge', BuildBadge); 98}
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.