UNPKG

hud-sdk

Version:

Hud's Node SDK

2 lines 1.67 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(global,()=>(()=>{"use strict";var e={523:e=>{e.exports=require("./logger")},2546:e=>{e.exports=require("./lib")},5809:e=>{e.exports=require("./config")},7131:e=>{e.exports=require("./wrap")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.setContext=function(e){try{const o=(0,a.getInvestigationStorage)();if(void 0===o)return void(c||(i.app_logger.warning("HudContext warning: No Storage"),i.customer_logger.log(n.UserErrorLogs.SetContextBeforeRegister()),c=!0));if(!t.hudConfig.dynamicConfig.enableInvestigation)return;const r=o.getStore();if(void 0===r)return void(s||(i.app_logger.warning("HudContext warning: setContext called not inside async context. Skipping."),i.customer_logger.log(n.UserErrorLogs.SetContextNoAsyncContext()),s=!0));const g=(0,n.validateContext)(e);r.userContext={...r.userContext,...g}}catch(e){if(e instanceof n.HudContextValidationError)return void(p||(i.app_logger.warning("HudContext warning: failed to validate context. Skipping.",{error:e,stack:e instanceof Error&&null!==e?e.stack:void 0}),p=!0));g||(i.app_logger.warning("HudContext warning: failed to set context. Skipping.",{error:e,stack:e instanceof Error&&null!==e?e.stack:void 0}),g=!0)}};const t=o(5809),n=o(2546),i=o(523),a=o(7131);let s=!1,g=!1,c=!1,p=!1})(),r})()); //# sourceMappingURL=api.js.map