@alwaysmeticulous/recorder-loader 2.0.2

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.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2022, Meticulous Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Meticulous Recorder loader
2
+
3
+ Utiliy package used to aid the injection of the Meticulous recorder snippet on web apps.
4
+
5
+ ## Installing
6
+
7
+ ```shell
8
+ npm install @alwaysmeticulous/recorder-loader --save
9
+ # or with yarn
10
+ yarn add @alwaysmeticulous/recorder-loader
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Within your app entrypoint:
16
+
17
+ ```javascript
18
+ import { loadAndStartRecorder } from '@alwaysmeticulous/recorder-loader'
19
+
20
+ async function startApp() {
21
+ // Start the Meticulous recorder before you initialise your app.
22
+ try {
23
+ await loadAndStartRecorder({
24
+ projectId: '<project ID>',
25
+ })
26
+ } catch (err) {
27
+ console.error(`Meticulous failed to initialise ${err}`)
28
+ }
29
+
30
+ // Initalise app after Meticulous' snippet, e.g:
31
+ ReactDOM.render(component, document.getElementById('root'))
32
+ }
33
+
34
+
35
+ startApp();
36
+ ```
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("MeticulousRecoderLoader",[],t):"object"==typeof exports?exports.MeticulousRecoderLoader=t():e.MeticulousRecoderLoader=t()}(self,(()=>(()=>{"use strict";var e={46:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.loadAndStartRecorder=void 0,t.loadAndStartRecorder=e=>{let t=!1;return new Promise(((o,r)=>{const i=e.maxMsToBlockFor||2e3;i>0&&setTimeout((()=>{t=!0,o()}),i);const n=document.createElement("script");n.type="text/javascript";const d=e.snippetsBaseUrl||"https://snippet.meticulous.ai";n.src=new URL("v1/stagingMeticulousSnippetManualInit.js",d).href,window.METICULOUS_RECORDING_TOKEN=e.projectId,e.uploadIntervalMs&&(window.METICULOUS_UPLOAD_INTERVAL_MS=e.uploadIntervalMs),e.commitHash&&(window.METICULOUS_APP_COMMIT_HASH=e.commitHash),e.snapshotLinkedStylesheets&&(window.METICULOUS_SNAPSHOT_LINKED_STYLESHEETS=e.snapshotLinkedStylesheets),n.onload=function(){var e;if(t)console.debug("Meticulous snippet abandoned due to max blocking time reached.");else{try{null===(e=window.__meticulous)||void 0===e||e.initialiseRecorder()}catch(e){r("Meticulous recorder failed to initialise.")}o()}},n.onerror=()=>{r("Meticulous recorder failed to initialise.")},document.head.appendChild(n)}))}}},t={};function o(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.loadAndStartRecorder=void 0;var t=o(46);Object.defineProperty(e,"loadAndStartRecorder",{enumerable:!0,get:function(){return t.loadAndStartRecorder}})})(),r})()));
@@ -0,0 +1 @@
1
+ export { loadAndStartRecorder } from "./loader";
@@ -0,0 +1,2 @@
1
+ import { LoaderOptions } from "./loader.types";
2
+ export declare const loadAndStartRecorder: (options: LoaderOptions) => Promise<void>;
@@ -0,0 +1,8 @@
1
+ export interface LoaderOptions {
2
+ projectId: string;
3
+ uploadIntervalMs?: number;
4
+ snapshotLinkedStylesheets?: boolean;
5
+ commitHash?: string;
6
+ maxMsToBlockFor?: number;
7
+ snippetsBaseUrl?: string;
8
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@alwaysmeticulous/recorder-loader",
3
+ "version": "2.0.2",
4
+ "license": "ISC",
5
+ "main": "dist/index.js",
6
+ "types": "dist/tsc/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "clean": "rimraf dist",
12
+ "dev": "webpack --config webpack.config.js --mode='development' --watch",
13
+ "build": "webpack --config webpack.config.js --mode='production'",
14
+ "format": "prettier --write src",
15
+ "lint": "eslint src --ext=ts,tsx,js --cache",
16
+ "lint:commit": "eslint --cache $(git diff --relative --name-only --diff-filter=ACMRTUXB master | grep -E \"(.js$|.ts$|.tsx$)\")",
17
+ "lint:fix": "eslint src --ext=ts,tsx,js --cache --fix"
18
+ },
19
+ "author": {
20
+ "name": "The Meticulous Team",
21
+ "email": "eng@meticulous.ai",
22
+ "url": "https://meticulous.ai"
23
+ },
24
+ "homepage": "https://github.com/alwaysmeticulous/meticulous-sdk",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/alwaysmeticulous/meticulous-sdk.git",
28
+ "directory": "packages/cli"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
32
+ },
33
+ "gitHead": "6ae3e8bdd04c2965406f6d61bd26fef61094da1a"
34
+ }