Skip to content

Commit

Permalink
Merge pull request #42 from cursorinsight/denes-capacitor
Browse files Browse the repository at this point in the history
feat: Implement changes to integrate with the ci-trap-capacitor Ionic plugin
  • Loading branch information
denessapi authored Apr 8, 2024
2 parents 6568b18 + 2798669 commit 59264ab
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 65 deletions.
157 changes: 131 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "ci-trap-web",
"version": "1.0.5",
"version": "1.0.6",
"description": "Lightweight mouse and touch event tracker library for browsers.",
"main": "dist/trap-umd.min.js",
"module": "src/trap.js",
"types": "dist/trap.d.ts",
"scripts": {
"build": "npm run build:prod",
"build:prod": "cross-env NODE_ENV=production rollup -c",
Expand Down Expand Up @@ -64,6 +65,7 @@
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.6",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.16.5",
"babel-jest": "^29.6.0",
Expand All @@ -82,6 +84,9 @@
"jest-websocket-mock": "^2.4.0",
"jsdom": "^22.1.0",
"rollup": "^3.26.0",
"rollup-plugin-dotenv": "^0.5.0"
"rollup-plugin-dotenv": "^0.5.0",
"rollup-plugin-dts": "^6.1.0",
"tslib": "^2.6.2",
"typescript": "^5.4.3"
}
}
12 changes: 12 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import commonjs from '@rollup/plugin-commonjs';
import rollupDotenv from 'rollup-plugin-dotenv';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';

const env = dotenv.config();
dotenvExpand.expand(env);
Expand Down Expand Up @@ -91,6 +93,16 @@ export default [{
plugins: [
terser(terserOptions),
],
}, {
// Typescript Type definitions
input: 'src/trap.js',

output: [{ file: 'dist/trap.d.ts', format: 'es' }],

plugins: [
typescript(),
dts(),
],
}, {
// Browser friendly, preconfigured, IIFE tracker module
input: 'src/tracker.js',
Expand Down
7 changes: 0 additions & 7 deletions src/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ class HTTP extends Transport {
simpleAutoBind(this);
}

// `url` setter
//
// It replaces ${sessionId} and ${streamId} occurences with their values.
set url(url) {
this._url = this.createUrl(url);
}

// `enableCompression` setter
set enableCompression(enableCompression) {
this._enableCompression = !!enableCompression;
Expand Down
6 changes: 6 additions & 0 deletions src/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ class Metadata {
this.submit();
}

// Remove custom metadata by key
remove(key) {
delete this._customMetadata[key];
this.submit();
}

// Return custom, user-defined metadata
get custom() {
return this._customMetadata;
Expand Down
9 changes: 8 additions & 1 deletion src/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ class Transport {
this._enableCompression = DEFAULT_TRAP_ENABLE_COMPRESSION;

// Set default URL
this.url = DEFAULT_TRAP_SERVER_URL;
this._url = this.createUrl(DEFAULT_TRAP_SERVER_URL);
}

// `url` setter
//
// It replaces ${sessionId} and ${streamId} occurences with their values.
set url(url) {
this._url = this.createUrl(url);
}

createUrl(url) {
Expand Down
Loading

0 comments on commit 59264ab

Please sign in to comment.