window.dataLayer = window.dataLayer || []; document.addEventListener('tdf_gtm_event', function(e) { if (!e || !e.detail || !e.detail.event) { return; } window.dataLayer.push(e.detail); }); (function () { // Visual-only override: the Order Summary Details page (and any other page using // Salesforce's standard Variant Attributes Display component) renders the raw // ProductAttribute.Membership_Type__c picklist value "Grad Gift" for both true Grad // Gift purchases and Tickets for Teens purchases, since Tickets for Teens has no // ticket inventory of its own and shares Grad Gift's ProductAttribute records. // This rewrites the rendered text only (no data/metadata change) to show both names, // mirroring Label.tdfMayorsProgram used elsewhere in the codebase. var TARGET_TEXT = "Membership Type: Grad Gift"; var REPLACEMENT_TEXT = "Membership Type: Grad Gift / Tickets for Teens"; function patch(node) { if (node.nodeType === Node.TEXT_NODE) { if (node.nodeValue && node.nodeValue.trim() === TARGET_TEXT) { node.nodeValue = node.nodeValue.replace(TARGET_TEXT, REPLACEMENT_TEXT); } return; } if (node.nodeType !== Node.ELEMENT_NODE) { return; } if (!node.children.length && node.textContent && node.textContent.trim() === TARGET_TEXT) { node.textContent = REPLACEMENT_TEXT; return; } for (var i = 0; i < node.childNodes.length; i++) { patch(node.childNodes[i]); } if (node.shadowRoot) { observe(node.shadowRoot); patch(node.shadowRoot); } } var observedRoots = new WeakSet(); function observe(root) { if (observedRoots.has(root)) { return; } observedRoots.add(root); patch(root); new MutationObserver(function (mutations) { mutations.forEach(function (m) { m.addedNodes.forEach(patch); if (m.type === "characterData" && m.target) { patch(m.target); } }); }).observe(root, { childList: true, subtree: true, characterData: true }); } function start() { observe(document.body); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", start); } else { start(); } })();