posthog-js
Version:
Posthog-js allows you to automatically capture usage and send events to PostHog.
3 lines (2 loc) • 2.08 kB
JavaScript
!function(){"use strict";var r="undefined"!=typeof window?window:void 0,o="undefined"!=typeof globalThis?globalThis:r;null!=o&&o.XMLHttpRequest&&new o.XMLHttpRequest;var n="undefined"!=typeof globalThis?globalThis:r;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});var e=null!=r?r:{},i=function(o,n){var e=(void 0===n?{}:n).debugEnabled,t={q(n){if(r&&(r.POSTHOG_DEBUG||e)&&void 0!==r.console&&r.console){for(var i=("__rrweb_original__"in r.console[n]?r.console[n].__rrweb_original__:r.console[n]),t=arguments.length,a=new Array(t>1?t-1:0),l=1;t>l;l++)a[l-1]=arguments[l];i(o,...a)}},debug(){for(var r=arguments.length,o=new Array(r),n=0;r>n;n++)o[n]=arguments[n];t.q("debug",...o)},info(){for(var r=arguments.length,o=new Array(r),n=0;r>n;n++)o[n]=arguments[n];t.q("log",...o)},warn(){for(var r=arguments.length,o=new Array(r),n=0;r>n;n++)o[n]=arguments[n];t.q("warn",...o)},error(){for(var r=arguments.length,o=new Array(r),n=0;r>n;n++)o[n]=arguments[n];t.q("error",...o)},critical(){for(var r=arguments.length,n=new Array(r),e=0;r>e;e++)n[e]=arguments[e];console.error(o,...n)},uninitializedWarning(r){t.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>i(o+" "+r,n)};return t},t=(0,i("[PostHog.js]").createLogger)("[PostHog Intercom integration]"),a=new Set,l=void 0;e.__PosthogExtensions__=e.__PosthogExtensions__||{},e.__PosthogExtensions__.integrations=e.__PosthogExtensions__.integrations||{},e.__PosthogExtensions__.integrations.intercom={start(r){var o;if(null!=(o=r.config.integrations)&&o.intercom){var n=e.Intercom;n?(l=r.onSessionId((o=>{var e,i;a.has(o)||(e=r.get_session_replay_url(),i=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id()),n("update",{latestPosthogReplayURL:e,latestPosthogPersonURL:i}),n("trackEvent","posthog:sessionInfo",{replayUrl:e,personUrl:i}),a.add(o))})),t.info("integration started")):t.warn("Intercom not found while initializing the integration")}},stop(){null==l||l(),l=void 0}}}();
//# sourceMappingURL=intercom-integration.js.map