@alwaysmeticulous/recorder-loader
Advanced tools
Comparing version 2.5.0 to 2.6.1
@@ -1,1 +0,52 @@ | ||
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("MeticulousRecoderLoader",[],o):"object"==typeof exports?exports.MeticulousRecoderLoader=o():e.MeticulousRecoderLoader=o()}(self,(()=>(()=>{"use strict";var e={46:(e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.loadAndStartRecorder=void 0,o.loadAndStartRecorder=({projectId:e,uploadIntervalMs:o,snapshotLinkedStylesheets:t,commitHash:r,maxMsToBlockFor:i,snippetsBaseUrl:n})=>{let d=!1;return new Promise(((c,s)=>{const a=null!=i?i:2e3;a>0&&setTimeout((()=>{d=!0,c()}),a);const u=document.createElement("script");u.type="text/javascript";const l=n||"https://snippet.meticulous.ai";u.src=new URL("v1/stagingMeticulousSnippetManualInit.js",l).href,window.METICULOUS_RECORDING_TOKEN=e,void 0!==o&&(window.METICULOUS_UPLOAD_INTERVAL_MS=o),void 0!==r&&(window.METICULOUS_APP_COMMIT_HASH=r),void 0!==t&&(window.METICULOUS_SNAPSHOT_LINKED_STYLESHEETS=t),u.onload=function(){var e;if(d)return void console.debug("Meticulous snippet abandoned due to max blocking time reached.");const o=null===(e=window.__meticulous)||void 0===e?void 0:e.initialiseRecorder;if("function"==typeof o){try{o()}catch(e){s(e)}c()}else s("Meticulous recorder failed to initialise.")},u.onerror=()=>{s("Meticulous recorder failed to initialise.")},document.head.appendChild(u)}))}}},o={};function t(r){var i=o[r];if(void 0!==i)return i.exports;var n=o[r]={exports:{}};return e[r](n,n.exports,t),n.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.loadAndStartRecorder=void 0;var o=t(46);Object.defineProperty(e,"loadAndStartRecorder",{enumerable:!0,get:function(){return o.loadAndStartRecorder}})})(),r})())); | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
$parcel$export(module.exports, "loadAndStartRecorder", () => $c97024bcb09807fa$export$9da0cde53b499187); | ||
const $c97024bcb09807fa$var$DEFAULT_MAX_MS_TO_BLOCK_FOR = 2000; | ||
const $c97024bcb09807fa$export$9da0cde53b499187 = ({ projectId: projectId , uploadIntervalMs: uploadIntervalMs , snapshotLinkedStylesheets: snapshotLinkedStylesheets , commitHash: commitHash , maxMsToBlockFor: maxMsToBlockFor_ , snippetsBaseUrl: snippetsBaseUrl , })=>{ | ||
let abandoned = false; | ||
return new Promise((resolve, reject)=>{ | ||
const maxMsToBlockFor = maxMsToBlockFor_ ?? $c97024bcb09807fa$var$DEFAULT_MAX_MS_TO_BLOCK_FOR; | ||
if (maxMsToBlockFor > 0) setTimeout(()=>{ | ||
abandoned = true; | ||
resolve(); | ||
}, maxMsToBlockFor); | ||
const script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
const baseSnippetsUrl = snippetsBaseUrl || "https://snippet.meticulous.ai"; | ||
script.src = new URL("v1/stagingMeticulousSnippetManualInit.js", baseSnippetsUrl).href; | ||
// Setup configuration | ||
window["METICULOUS_RECORDING_TOKEN"] = projectId; | ||
if (uploadIntervalMs !== undefined) window["METICULOUS_UPLOAD_INTERVAL_MS"] = uploadIntervalMs; | ||
if (commitHash !== undefined) window["METICULOUS_APP_COMMIT_HASH"] = commitHash; | ||
if (snapshotLinkedStylesheets !== undefined) window["METICULOUS_SNAPSHOT_LINKED_STYLESHEETS"] = snapshotLinkedStylesheets; | ||
script.onload = function() { | ||
if (abandoned) { | ||
console.debug("Meticulous snippet abandoned due to max blocking time reached."); | ||
// At this point the promise has already resolved. | ||
return; | ||
} | ||
const initialiseRecorder = window.__meticulous?.initialiseRecorder; | ||
if (typeof initialiseRecorder !== "function") { | ||
reject("Meticulous recorder failed to initialise."); | ||
return; | ||
} | ||
try { | ||
initialiseRecorder(); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
resolve(); | ||
}; | ||
script.onerror = ()=>{ | ||
reject("Meticulous recorder failed to initialise."); | ||
}; | ||
document.head.appendChild(script); | ||
}); | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@alwaysmeticulous/recorder-loader", | ||
"version": "2.5.0", | ||
"version": "2.6.1", | ||
"license": "ISC", | ||
"source": "src/index.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/tsc/index.d.ts", | ||
"module": "dist/module.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
@@ -12,4 +14,4 @@ "dist" | ||
"clean": "rimraf dist", | ||
"dev": "webpack --config webpack.config.js --mode='development' --watch", | ||
"build": "webpack --config webpack.config.js --mode='production'", | ||
"dev": "parcel watch", | ||
"build": "parcel build", | ||
"format": "prettier --write src", | ||
@@ -37,3 +39,3 @@ "lint": "eslint src --ext=ts,tsx,js --cache", | ||
}, | ||
"gitHead": "7877ff5ec26784ede52e453ecc1ba2d7d10cb929" | ||
"gitHead": "8575a3f05a170aac70a1d5fba4b7e724497b4837" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16150
9
101