UNPKG

cinnecta-logs

Version:

Biblioteca para centralizar a configuração e eventos personalizados do Highlight.run, compatível com React e Next.js.

2 lines (1 loc) 1.44 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _highlightrun = require('highlight.run');var d=({filterName:r,filterValue:s,pathname:e})=>{_highlightrun.H.track("filter",{value:s,pathname:e,filterName:r})},k= exports.b =({downloadBody:r,pathname:s,timeTakenInDownload:e,segmentFilter:o,type:c})=>{_highlightrun.H.track("download",{downloadBody:r,pathname:s,timeTakenInDownload:e,...o&&{segmentFilter:o},...c&&{type:c}})},l= exports.c =({accessedModules:r,contractedModules:s,accessedPages:e,clientName:o})=>{let c=JSON.stringify(r),t=JSON.stringify(s),n=JSON.stringify(e);_highlightrun.H.track("user_modules",{accessedModules:c,accessedPages:n,...o&&{clientName:o},...s&&_optionalChain([s, 'optionalAccess', _ => _.length])>0&&{contractedModules:t}})},i= exports.d =()=>({trackFilterUsage:d,trackOnDownload:k,trackUserModules:l});exports.a = d; exports.b = k; exports.c = l; exports.d = i;