1/** 2 * New Relic Browser loader â multi-environment 3 * Environments: Prod, Stage AâF, Preprod A/B 4 * 5 * Stage A host: https://stage.optimum.net/ (local Grunt: local.stage2.optimum.net) 6 * 7 * Replace xxxxx with values from deployment config: 8 * NEW_RELIC_APP_NAME, NEW_RELIC_BROWSER_ACCOUNT_ID, NEW_RELIC_BROWSER_TRUST_KEY, 9 * NEW_RELIC_BROWSER_AGENT_ID, NEW_RELIC_BROWSER_LICENSE_KEY, 10 * NEW_RELIC_BROWSER_APPLICATION_ID, NEW_RELIC_BROWSER_BEACON, NEW_RELIC_BROWSER_ERROR_BEACON 11 */ 12(function () { 13 'use strict'; 14 15 // From NR snippet: nr-loader-spa-1.322.0.min.js (update when NR agent version changes) 16 var NR_LOADER_SRC = 'https://js-agent.newrelic.com/nr-loader-spa-1.322.0.min.js'; 17 18 var host = window.location.host; 19 20 if (/^localhost$|^127\.0\.0\.1$/.test(host)) { 21 return; 22 } 23 24 // PCI / PII: do not load Browser agent on payment or high-sensitivity phone pages 25 var path = window.location.pathname || ''; 26 if ( 27 /\/pay-bill(\/|$)/.test(path) || 28 /\/quickpay(\/|$)/.test(path) || 29 /\/payment-options(\/|$)/.test(path) || 30 /\/manage-payments(\/|$)/.test(path) || 31 /\/automatic-payments(\/|$)/.test(path) || 32 /\/allow-payment(\/|$)/.test(path) || 33 /\/phone\/voicemail(\/|$)/.test(path) || 34 /\/phone\/callhistory(\/|$)/.test(path) || 35 /\/phone\/international\/call-history(\/|$)/.test(path) || 36 /\/phone\/international-call(\/|$)/.test(path) || 37 /\/phone\/features\/directorylisting(\/|$)/.test(path) 38 ) { 39 return; 40 } 41 42 var ENV_CONFIG = { 43 44 prod: { 45 appName: 'ccc-app-optimumnet-prod', 46 accountID: '7760460', 47 trustKey: '7760460', 48 agentID: '1431956947', 49 licenseKey: 'NRBR-562d37e1c987c55c9ed', 50 applicationID: '1431956947', 51 beacon: 'bam.nr-data.net', 52 errorBeacon: 'bam.nr-data.net' 53 }, 54 55 stageA: { 56 appName: 'ccc-app-optimumnet-stage-a', 57 accountID: '7760460', 58 trustKey: '7760460', 59 agentID: '1431956939', 60 licenseKey: 'NRBR-562d37e1c987c55c9ed', 61 applicationID: '1431956939', 62 beacon: 'bam.nr-data.net', 63 errorBeacon: 'bam.nr-data.net' 64 }, 65 66 stageB: { 67 appName: 'ccc-app-optimumnet-stage-b', 68 accountID: '7760460', 69 trustKey: '7760460', 70 agentID: '1431956940', 71 licenseKey: 'NRBR-562d37e1c987c55c9ed', 72 applicationID: '1431956940', 73 beacon: 'bam.nr-data.net', 74 errorBeacon: 'bam.nr-data.net' 75 }, 76 77 stageC: { 78 appName: 'ccc-app-optimumnet-stage-c', 79 accountID: '7760460', 80 trustKey: '7760460', 81 agentID: '1431956941', 82 licenseKey: 'NRBR-562d37e1c987c55c9ed', 83 applicationID: '1431956941', 84 beacon: 'bam.nr-data.net', 85 errorBeacon: 'bam.nr-data.net' 86 }, 87 88 stageD: { 89 appName: 'ccc-app-optimumnet-stage-d', 90 accountID: '7760460', 91 trustKey: '7760460', 92 agentID: '1431956942', 93 licenseKey: 'NRBR-562d37e1c987c55c9ed', 94 applicationID: '1431956942', 95 beacon: 'bam.nr-data.net', 96 errorBeacon: 'bam.nr-data.net' 97 }, 98 99 stageE: { 100 appName: 'ccc-app-optimumnet-stage-e', 101 accountID: '7760460', 102 trustKey: '7760460', 103 agentID: '1431956943', 104 licenseKey: 'NRBR-562d37e1c987c55c9ed', 105 applicationID: '1431956943', 106 beacon: 'bam.nr-data.net', 107 errorBeacon: 'bam.nr-data.net' 108 }, 109 stageF: { 110 appName: 'ccc-app-optimumnet-stage-f', 111 accountID: '7760460', 112 trustKey: '7760460', 113 agentID: '1431956944', 114 licenseKey: 'NRBR-562d37e1c987c55c9ed', 115 applicationID: '1431956944', 116 beacon: 'bam.nr-data.net', 117 errorBeacon: 'bam.nr-data.net' 118 }, 119 120 preprodA: { 121 appName: 'ccc-app-optimumnet-preprod-a', 122 accountID: '7760460', 123 trustKey: '7760460', 124 agentID: '1431956945', 125 licenseKey: 'NRBR-562d37e1c987c55c9ed', 126 applicationID: '1431956945', 127 beacon: 'bam.nr-data.net', 128 errorBeacon: 'bam.nr-data.net' 129 }, 130 131 preprodB: { 132 appName: 'ccc-app-optimumnet-preprod-b', 133 accountID: '7760460', 134 trustKey: '7760460', 135 agentID: '1431956946', 136 licenseKey: 'NRBR-562d37e1c987c55c9ed', 137 applicationID: '1431956946', 138 beacon: 'bam.nr-data.net', 139 errorBeacon: 'bam.nr-data.net' 140 } 141 }; 142 143 function getOolEnv() { 144 var cookies = document.cookie.split(';'); 145 var i; 146 var cookie; 147 148 for (i = 0; i < cookies.length; i++) { 149 cookie = cookies[i].replace(/^\s+/, ''); 150 if (cookie.indexOf('oolenv_=') === 0) { 151 return decodeURIComponent(cookie.substring('oolenv_='.length)); 152 } 153 } 154 return null; 155 } 156
157 function getEnvKey(hostname) { 158 var oolenv = getOolEnv(); 159 160 if ((/www|espanol/).test(hostname)) { 161 return 'prod'; 162 } 163 164 if ((/preprod|preview\.preprod/).test(hostname)) { 165 if ((/preview\.preprod/).test(hostname) || oolenv === 'A') { 166 return 'preprodA'; 167 } 168 return 'preprodB'; 169 } 170 if ((/stage-f/).test(hostname)) { 171 return 'stageF'; 172 } 173 174 if ((/stage-e/).test(hostname)) { 175 return 'stageE'; 176 } 177 if ((/stage-d/).test(hostname)) { 178 return 'stageD'; 179 } 180 if ((/stage\.lbsa2/).test(hostname)) { 181 return 'stageC'; 182 } 183 if ((/stage\.lbsa/).test(hostname)) { 184 return 'stageB'; 185 } 186 // Stage A: https://stage.optimum.net/ 187 if ((/stage\.optimum\.net/).test(hostname)) { 188 return 'stageA'; 189 } 190 // Local Grunt dev â uses Stage A NR config 191 if ((/local\.stage2/).test(hostname)) { 192 return 'stageA'; 193 } 194 195 return null; 196 } 197 198 var envKey = getEnvKey(host); 199 var cfg = ENV_CONFIG[envKey]; 200 201 if (!cfg) { 202 return; 203 } 204 205 function initNewRelic(cfg) { 206 window.NREUM || (window.NREUM = {}); 207 208 NREUM.init = { 209 browser_consent_mode: { enabled: false }, 210 privacy: { cookies_enabled: true }, 211 performance: { capture_measures: true }, 212 213 // Keep Session Replay off unless Privacy + CMP approve 214 session_replay: { enabled: false }, 215 216 ajax: { 217 deny_list: [ 218 cfg.beacon || 'bam.nr-data.net', 219 'pay-bill', 220 'payment', 221 'quickpay', 222 'creditCard', 223 'credit-card', 224 'billing', 225 'password', 226 'reset-password', 227 'authenticate', 228 'token', 229 // Phone / voicemail / call-history APIs (TN often in query string) 230 'phone/sdl/vm', 231 'phone/streamwide', 232 'phone/streamwideV2', 233 'playmessage', 234 'getmessage', 235 'callhistory', 236 'call-history', 237 'directorylisting' 238 ], 239 capture_payloads: 'none' 240 }, 241 242 // Mask residual PII in page/Ajax URLs and JS errors 243 obfuscate: [ 244 { 245 regex: { 246 pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}', 247 flags: 'gi' 248 }, 249 replacement: '[EMAIL_REDACTED]' 250 }, 251 { 252 regex: { 253 pattern: '(?:email|phone|tn|TN|ssn|account(?:Id|Number)?|cust(?:omer)?Id|userId|token|access[_-]?token|session[_-]?id|auth|selPhnum|selectedPhone)=([^&\\s#/]+)', 254 flags: 'gi' 255 }, 256 replacement: '[PARAM_REDACTED]' 257 }, 258 { 259 // Formatted US phone: (123) 456-7890, 123-456-7890, 123.456.7890 260 regex: { 261 pattern: '(?:\\+?1[-.\\s]?)?\\(?\\d{3}\\)?[-.\\s]?\\d{3}[-.\\s]?\\d{4}\\b', 262 flags: 'g' 263 }, 264 replacement: '[PHONE_REDACTED]' 265 }, 266 { 267 // Bare 10-digit US phone (and optional leading 1 â 11 digits) 268 regex: { 269 pattern: '\\b(?:1)?\\d{10}\\b', 270 flags: 'g' 271 }, 272 replacement: '[PHONE_REDACTED]' 273 }, 274 { 275 regex: { 276 pattern: '\\b\\d{12,19}\\b', 277 flags: 'g' 278 }, 279 replacement: '[DIGITS_REDACTED]' 280 }, 281 { 282 regex: { 283 pattern: '\\b\\d{3}-\\d{2}-\\d{4}\\b', 284 flags: 'g' 285 }, 286 replacement: '[SSN_REDACTED]' 287 } 288 ] 289 }; 290 291 NREUM.loader_config = { 292 accountID: cfg.accountID, 293 trustKey: cfg.trustKey, 294 agentID: cfg.agentID, 295 licenseKey: cfg.licenseKey, 296 applicationID: cfg.applicationID 297 }; 298 299 NREUM.info = { 300 beacon: cfg.beacon, 301 errorBeacon: cfg.errorBeacon, 302 licenseKey: cfg.licenseKey, 303 applicationID: cfg.applicationID, 304 sa: 1 305 }; 306 307 var loaderSrc = cfg.loaderSrc || NR_LOADER_SRC; 308 309 var s = document.createElement('script'); 310 s.type = 'text/javascript'; 311 s.charset = 'UTF-8'; 312 s.src = loaderSrc; 313 s.async = true; 314 s.onerror = function () { 315 if (window.console && console.error) { 316 console.error('New Relic agent failed to load:', loaderSrc); 317 } 318 }; 319 320 var firstScript = document.getElementsByTagName('script')[0]; 321 if (firstScript && firstScript.parentNode) { 322 firstScript.parentNode.insertBefore(s, firstScript); 323 } else { 324 (document.head || document.getElementsByTagName('head')[0]).appendChild(s); 325 } 326 } 327 328 initNewRelic(cfg); 329})();
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.