1import { getActiveLocale, tText } from './client-utils.js'; 2 3const updateVatNote = (node, { selectedVat, includesVat = false, locale = getActiveLocale() } = {}) => { 4 if (!node) { 5 return; 6 } 7 8 const percentage = Number(selectedVat); 9 const label = 10 includesVat && 11 Number.isFinite(percentage) && 12 percentage > 0 && 13 typeof globalThis.PRICE_CORE?.calculateDisplayPrice === 'function' 14 ? tText('backend.common.pricing.vatIncluded', { 15 locale, 16 vars: { percentage: { $val: percentage } }, 17 }) 18 : ''; 19 20 node.textContent = label; 21 node.hidden = !label; 22}; 23 24const appendVatMenuNote = (menu, options) => { 25 const note = document.createElement('span'); 26 note.id = `${menu.id}-vat-note`; 27 note.className = 'price-vat-note price-vat-note-menu'; 28 note.dataset.priceVatMenuNote = ''; 29 note.dataset.dropdownFooter = ''; 30 updateVatNote(note, options); 31 menu.appendChild(note); 32 33 if (note.hidden) { 34 menu.removeAttribute('aria-describedby'); 35 } else { 36 menu.setAttribute('aria-describedby', note.id); 37 } 38}; 39 40export { appendVatMenuNote, updateVatNote };
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.