1/** 2 * PostHog exception breadcrumbs for complex flows. 3 * 4 * Usage: 5 * posthog.addExceptionStep('User selected file from iCloud'); 6 * // or 7 * addExceptionStep('Resume upload API request', { flow: 'resume_upload' }); 8 * 9 * Steps attach to the next captured exception as $exception_steps in PostHog. 10 */ 11(function (window) { 12 function addExceptionStep(message, properties) { 13 if (!message || typeof message !== 'string') { 14 return; 15 } 16 17 var ph = window.posthog; 18 if (ph && typeof ph.addExceptionStep === 'function') { 19 ph.addExceptionStep(message, properties || {}); 20 } 21 } 22 23 function isIosFilePicker() { 24 return /iPad|iPhone|iPod/.test(navigator.userAgent || ''); 25 } 26 27 /** Call when user picks a file â especially before upload/parse API calls. */ 28 function trackFileSelectedStep(file, flow, extra) { 29 if (!file) { 30 return; 31 } 32 33 var message = isIosFilePicker() 34 ? 'User selected file from iCloud' 35 : 'User selected file'; 36 37 var props = { 38 flow: flow || 'file_upload', 39 file_name: file.name, 40 file_size: file.size, 41 file_type: file.type || '', 42 }; 43 44 if (extra && typeof extra === 'object') { 45 for (var key in extra) { 46 if (Object.prototype.hasOwnProperty.call(extra, key)) { 47 props[key] = extra[key]; 48 } 49 } 50 } 51 52 addExceptionStep(message, props); 53 } 54 55 window.addExceptionStep = addExceptionStep; 56 window.trackFileSelectedStep = trackFileSelectedStep; 57})(window);
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.