@alwaysmeticulous/recorder-loader 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- export interface LoaderOptions {
1
+ interface LoaderOptions {
2
2
  projectId: string;
3
3
  uploadIntervalMs?: number;
4
4
  snapshotLinkedStylesheets?: boolean;
@@ -6,3 +6,6 @@ export interface LoaderOptions {
6
6
  maxMsToBlockFor?: number;
7
7
  snippetsBaseUrl?: string;
8
8
  }
9
+ export const loadAndStartRecorder: (options: LoaderOptions) => Promise<void>;
10
+
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;ACJD,OAAO,MAAM,sBAAsB,CACjC,OAAO,EAAE,aAAa,KACnB,OAAO,CAAC,IAAI,CAyEhB,CAAC","sources":["packages/recorder-loader/src/src/loader.types.ts","packages/recorder-loader/src/src/loader.ts","packages/recorder-loader/src/src/index.ts","packages/recorder-loader/src/index.ts"],"sourcesContent":[null,null,null,"export { loadAndStartRecorder } from \"./loader\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1 +1,52 @@
1
- !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})()));
1
+ function $parcel$export(e, n, v, s) {
2
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
3
+ }
4
+
5
+ $parcel$export(module.exports, "loadAndStartRecorder", () => $c97024bcb09807fa$export$9da0cde53b499187);
6
+ const $c97024bcb09807fa$var$DEFAULT_MAX_MS_TO_BLOCK_FOR = 2000;
7
+ const $c97024bcb09807fa$export$9da0cde53b499187 = ({ projectId: projectId , uploadIntervalMs: uploadIntervalMs , snapshotLinkedStylesheets: snapshotLinkedStylesheets , commitHash: commitHash , maxMsToBlockFor: maxMsToBlockFor_ , snippetsBaseUrl: snippetsBaseUrl , })=>{
8
+ let abandoned = false;
9
+ return new Promise((resolve, reject)=>{
10
+ const maxMsToBlockFor = maxMsToBlockFor_ ?? $c97024bcb09807fa$var$DEFAULT_MAX_MS_TO_BLOCK_FOR;
11
+ if (maxMsToBlockFor > 0) setTimeout(()=>{
12
+ abandoned = true;
13
+ resolve();
14
+ }, maxMsToBlockFor);
15
+ const script = document.createElement("script");
16
+ script.type = "text/javascript";
17
+ const baseSnippetsUrl = snippetsBaseUrl || "https://snippet.meticulous.ai";
18
+ script.src = new URL("v1/stagingMeticulousSnippetManualInit.js", baseSnippetsUrl).href;
19
+ // Setup configuration
20
+ window["METICULOUS_RECORDING_TOKEN"] = projectId;
21
+ if (uploadIntervalMs !== undefined) window["METICULOUS_UPLOAD_INTERVAL_MS"] = uploadIntervalMs;
22
+ if (commitHash !== undefined) window["METICULOUS_APP_COMMIT_HASH"] = commitHash;
23
+ if (snapshotLinkedStylesheets !== undefined) window["METICULOUS_SNAPSHOT_LINKED_STYLESHEETS"] = snapshotLinkedStylesheets;
24
+ script.onload = function() {
25
+ if (abandoned) {
26
+ console.debug("Meticulous snippet abandoned due to max blocking time reached.");
27
+ // At this point the promise has already resolved.
28
+ return;
29
+ }
30
+ const initialiseRecorder = window.__meticulous?.initialiseRecorder;
31
+ if (typeof initialiseRecorder !== "function") {
32
+ reject("Meticulous recorder failed to initialise.");
33
+ return;
34
+ }
35
+ try {
36
+ initialiseRecorder();
37
+ } catch (error) {
38
+ reject(error);
39
+ }
40
+ resolve();
41
+ };
42
+ script.onerror = ()=>{
43
+ reject("Meticulous recorder failed to initialise.");
44
+ };
45
+ document.head.appendChild(script);
46
+ });
47
+ };
48
+
49
+
50
+
51
+
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;ACEA,MAAM,iDAA2B,GAAG,IAAI,AAAC;AAElC,MAAM,yCAAoB,GAEZ,CAAC,aACpB,SAAS,CAAA,oBACT,gBAAgB,CAAA,6BAChB,yBAAyB,CAAA,cACzB,UA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AC;gBACpD,OAAO;aACR;YAED,IAAI;gBACF,kBAAkB,EAAE,CAAC;aACtB,CAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;YAED,OAAO,EAAE,CAAC;SACX,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,IAAM;YACrB,MAAM,CAAC,2CAA2C,CAAC,CAAC;SACrD,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KACnC,CAAC,CAAC;CACJ,AAAC;;AD/EF","sources":["packages/recorder-loader/src/index.ts","packages/recorder-loader/src/loader.ts"],"sourcesContent":["export { loadAndStartRecorder } from \"./loader\";\n","import { LoaderOptions } from \"./loader.types\";\n\nconst DEFAULT_MAX_MS_TO_BLOCK_FOR = 2000;\n\nexport const loadAndStartRecorder: (\n options: LoaderOptions\n) => Promise<void> = ({\n projectId,\n uploadIntervalMs,\n snapshotLinkedStylesheets,\n commitHash,\n maxMsToBlockFor: maxMsToBlockFor_,\n snippetsBaseUrl,\n}) => {\n let abandoned = false;\n\n return new Promise<void>((resolve, reject) => {\n const maxMsToBlockFor = maxMsToBlockFor_ ?? DEFAULT_MAX_MS_TO_BLOCK_FOR;\n\n if (maxMsToBlockFor > 0) {\n setTimeout(() => {\n abandoned = true;\n resolve();\n }, maxMsToBlockFor);\n }\n\n const script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n const baseSnippetsUrl = snippetsBaseUrl || \"https://snippet.meticulous.ai\";\n script.src = new URL(\n \"v1/stagingMeticulousSnippetManualInit.js\",\n baseSnippetsUrl\n ).href;\n\n // Setup configuration\n window[\"METICULOUS_RECORDING_TOKEN\"] = projectId;\n\n if (uploadIntervalMs !== undefined) {\n window[\"METICULOUS_UPLOAD_INTERVAL_MS\"] = uploadIntervalMs;\n }\n\n if (commitHash !== undefined) {\n window[\"METICULOUS_APP_COMMIT_HASH\"] = commitHash;\n }\n\n if (snapshotLinkedStylesheets !== undefined) {\n window[\"METICULOUS_SNAPSHOT_LINKED_STYLESHEETS\"] =\n snapshotLinkedStylesheets;\n }\n\n script.onload = function () {\n if (abandoned) {\n console.debug(\n \"Meticulous snippet abandoned due to max blocking time reached.\"\n );\n // At this point the promise has already resolved.\n return;\n }\n\n const initialiseRecorder = window.__meticulous?.initialiseRecorder;\n if (typeof initialiseRecorder !== \"function\") {\n reject(\"Meticulous recorder failed to initialise.\");\n return;\n }\n\n try {\n initialiseRecorder();\n } catch (error) {\n reject(error);\n }\n\n resolve();\n };\n script.onerror = () => {\n reject(\"Meticulous recorder failed to initialise.\");\n };\n\n document.head.appendChild(script);\n });\n};\n"],"names":[],"version":3,"file":"index.js.map"}
package/dist/module.js ADDED
@@ -0,0 +1,48 @@
1
+ const $5d774bdb3a883001$var$DEFAULT_MAX_MS_TO_BLOCK_FOR = 2000;
2
+ const $5d774bdb3a883001$export$9da0cde53b499187 = ({ projectId: projectId , uploadIntervalMs: uploadIntervalMs , snapshotLinkedStylesheets: snapshotLinkedStylesheets , commitHash: commitHash , maxMsToBlockFor: maxMsToBlockFor_ , snippetsBaseUrl: snippetsBaseUrl , })=>{
3
+ let abandoned = false;
4
+ return new Promise((resolve, reject)=>{
5
+ const maxMsToBlockFor = maxMsToBlockFor_ ?? $5d774bdb3a883001$var$DEFAULT_MAX_MS_TO_BLOCK_FOR;
6
+ if (maxMsToBlockFor > 0) setTimeout(()=>{
7
+ abandoned = true;
8
+ resolve();
9
+ }, maxMsToBlockFor);
10
+ const script = document.createElement("script");
11
+ script.type = "text/javascript";
12
+ const baseSnippetsUrl = snippetsBaseUrl || "https://snippet.meticulous.ai";
13
+ script.src = new URL("v1/stagingMeticulousSnippetManualInit.js", baseSnippetsUrl).href;
14
+ // Setup configuration
15
+ window["METICULOUS_RECORDING_TOKEN"] = projectId;
16
+ if (uploadIntervalMs !== undefined) window["METICULOUS_UPLOAD_INTERVAL_MS"] = uploadIntervalMs;
17
+ if (commitHash !== undefined) window["METICULOUS_APP_COMMIT_HASH"] = commitHash;
18
+ if (snapshotLinkedStylesheets !== undefined) window["METICULOUS_SNAPSHOT_LINKED_STYLESHEETS"] = snapshotLinkedStylesheets;
19
+ script.onload = function() {
20
+ if (abandoned) {
21
+ console.debug("Meticulous snippet abandoned due to max blocking time reached.");
22
+ // At this point the promise has already resolved.
23
+ return;
24
+ }
25
+ const initialiseRecorder = window.__meticulous?.initialiseRecorder;
26
+ if (typeof initialiseRecorder !== "function") {
27
+ reject("Meticulous recorder failed to initialise.");
28
+ return;
29
+ }
30
+ try {
31
+ initialiseRecorder();
32
+ } catch (error) {
33
+ reject(error);
34
+ }
35
+ resolve();
36
+ };
37
+ script.onerror = ()=>{
38
+ reject("Meticulous recorder failed to initialise.");
39
+ };
40
+ document.head.appendChild(script);
41
+ });
42
+ };
43
+
44
+
45
+
46
+
47
+ export {$5d774bdb3a883001$export$9da0cde53b499187 as loadAndStartRecorder};
48
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"ACEA,MAAM,iDAA2B,GAAG,IAAI,AAAC;AAElC,MAAM,yCAAoB,GAEZ,CAAC,aACpB,SAAS,CAAA,oBACT,gBAAgB,CAAA,6BAChB,yBAAyB,CAAA,cACzB,UAAU,CAAA,EACV,eAAe,EAAE,gBAAgB,CAAA,mBACjC,eAAe,CAAA,IAChB,GAAK;IACJ,IAAI,SAAS,GAAG,KAAK,AAAC;IAEtB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,GAAK;QAC5C,MAAM,eAAe,GAAG,gBAAgB,IAAI,iDAA2B,AAAC;QAExE,IAAI,eAAe,GAAG,CAAC,EACrB,UAAU,CAAC,IAAM;YACf,SAAS,GAAG,IAAI,CAAC;YACjB,OAAO,EAAE,CAAC;SACX,EAAE,eAAe,CAAC,CAAC;QAGtB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,AAAC;QAChD,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAChC,MAAM,eAAe,GAAG,eAAe,IAAI,+BAA+B,AAAC;QAC3E,MAAM,CAAC,GAAG,GAAG,IAAI,GAAG,CAClB,0CAA0C,EAC1C,eAAe,CAChB,CAAC,IAAI,CAAC;QAEP,sBAAsB;QACtB,MAAM,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;QAEjD,IAAI,gBAAgB,KAAK,SAAS,EAChC,MAAM,CAAC,+BAA+B,CAAC,GAAG,gBAAgB,CAAC;QAG7D,IAAI,UAAU,KAAK,SAAS,EAC1B,MAAM,CAAC,4BAA4B,CAAC,GAAG,UAAU,CAAC;QAGpD,IAAI,yBAAyB,KAAK,SAAS,EACzC,MAAM,CAAC,wCAAwC,CAAC,GAC9C,yBAAyB,CAAC;QAG9B,MAAM,CAAC,MAAM,GAAG,WAAY;YAC1B,IAAI,SAAS,EAAE;gBACb,OAAO,CAAC,KAAK,CACX,gEAAgE,CACjE,CAAC;gBACF,kDAAkD;gBAClD,OAAO;aACR;YAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,EAAE,kBAAkB,AAAC;YACnE,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE;gBAC5C,MAAM,CAAC,2CAA2C,CAAC,CAAC;gBACpD,OAAO;aACR;YAED,IAAI;gBACF,kBAAkB,EAAE,CAAC;aACtB,CAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;YAED,OAAO,EAAE,CAAC;SACX,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,IAAM;YACrB,MAAM,CAAC,2CAA2C,CAAC,CAAC;SACrD,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KACnC,CAAC,CAAC;CACJ,AAAC;;AD/EF","sources":["packages/recorder-loader/src/index.ts","packages/recorder-loader/src/loader.ts"],"sourcesContent":["export { loadAndStartRecorder } from \"./loader\";\n","import { LoaderOptions } from \"./loader.types\";\n\nconst DEFAULT_MAX_MS_TO_BLOCK_FOR = 2000;\n\nexport const loadAndStartRecorder: (\n options: LoaderOptions\n) => Promise<void> = ({\n projectId,\n uploadIntervalMs,\n snapshotLinkedStylesheets,\n commitHash,\n maxMsToBlockFor: maxMsToBlockFor_,\n snippetsBaseUrl,\n}) => {\n let abandoned = false;\n\n return new Promise<void>((resolve, reject) => {\n const maxMsToBlockFor = maxMsToBlockFor_ ?? DEFAULT_MAX_MS_TO_BLOCK_FOR;\n\n if (maxMsToBlockFor > 0) {\n setTimeout(() => {\n abandoned = true;\n resolve();\n }, maxMsToBlockFor);\n }\n\n const script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n const baseSnippetsUrl = snippetsBaseUrl || \"https://snippet.meticulous.ai\";\n script.src = new URL(\n \"v1/stagingMeticulousSnippetManualInit.js\",\n baseSnippetsUrl\n ).href;\n\n // Setup configuration\n window[\"METICULOUS_RECORDING_TOKEN\"] = projectId;\n\n if (uploadIntervalMs !== undefined) {\n window[\"METICULOUS_UPLOAD_INTERVAL_MS\"] = uploadIntervalMs;\n }\n\n if (commitHash !== undefined) {\n window[\"METICULOUS_APP_COMMIT_HASH\"] = commitHash;\n }\n\n if (snapshotLinkedStylesheets !== undefined) {\n window[\"METICULOUS_SNAPSHOT_LINKED_STYLESHEETS\"] =\n snapshotLinkedStylesheets;\n }\n\n script.onload = function () {\n if (abandoned) {\n console.debug(\n \"Meticulous snippet abandoned due to max blocking time reached.\"\n );\n // At this point the promise has already resolved.\n return;\n }\n\n const initialiseRecorder = window.__meticulous?.initialiseRecorder;\n if (typeof initialiseRecorder !== \"function\") {\n reject(\"Meticulous recorder failed to initialise.\");\n return;\n }\n\n try {\n initialiseRecorder();\n } catch (error) {\n reject(error);\n }\n\n resolve();\n };\n script.onerror = () => {\n reject(\"Meticulous recorder failed to initialise.\");\n };\n\n document.head.appendChild(script);\n });\n};\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/recorder-loader",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "license": "ISC",
5
+ "source": "src/index.ts",
5
6
  "main": "dist/index.js",
6
- "types": "dist/tsc/index.d.ts",
7
+ "module": "dist/module.js",
8
+ "types": "dist/index.d.ts",
7
9
  "files": [
8
10
  "dist"
9
11
  ],
10
12
  "scripts": {
11
13
  "clean": "rimraf dist",
12
- "dev": "webpack --config webpack.config.js --mode='development' --watch",
13
- "build": "webpack --config webpack.config.js --mode='production'",
14
+ "dev": "parcel watch",
15
+ "build": "parcel build",
14
16
  "format": "prettier --write src",
15
17
  "lint": "eslint src --ext=ts,tsx,js --cache",
16
18
  "lint:commit": "eslint --cache $(git diff --relative --name-only --diff-filter=ACMRTUXB master | grep -E \"(.js$|.ts$|.tsx$)\")",
@@ -33,5 +35,5 @@
33
35
  "bugs": {
34
36
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
35
37
  },
36
- "gitHead": "7877ff5ec26784ede52e453ecc1ba2d7d10cb929"
38
+ "gitHead": "8575a3f05a170aac70a1d5fba4b7e724497b4837"
37
39
  }
@@ -1 +0,0 @@
1
- export { loadAndStartRecorder } from "./loader";
@@ -1,2 +0,0 @@
1
- import { LoaderOptions } from "./loader.types";
2
- export declare const loadAndStartRecorder: (options: LoaderOptions) => Promise<void>;