react-use-hotjar
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.0.13](https://github.com/olavoparno/react-use-hotjar/compare/v1.0.12...v1.0.13) (2021-03-09) | ||
### [1.0.12](https://github.com/olavoparno/react-use-hotjar/compare/v1.0.11...v1.0.12) (2021-03-08) | ||
@@ -7,0 +9,0 @@ |
@@ -5,3 +5,7 @@ declare type TUseHotjar = { | ||
}; | ||
export declare function useHotjar(): TUseHotjar; | ||
export default useHotjar; | ||
declare type TUseAppendHeadScript = { | ||
appendHeadScript: (scriptText: string, scriptId: string) => boolean; | ||
}; | ||
export declare function useAppendHeadScript(): TUseAppendHeadScript; | ||
export default function useHotjar(): TUseHotjar; | ||
export {}; |
@@ -1,1 +0,2 @@ | ||
import{useMemo as t,useCallback as r}from"react";function n(){var n=function(){var n=r((function(t,r){try{var n=document.getElementById(r)||document.createElement("script");return n.id=r,n.innerText=t,n.crossOrigin="anonymous",document.head.appendChild(n),!0}catch(t){return!1}}),[]);return t((function(){return{appendHeadScript:n}}),[n])}().appendHeadScript,e=r((function(t,r,e){var i=n("(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:"+t+",hjsv:"+r+"};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');","hotjar-init-script");return e&&"function"==typeof e&&e("Hotjar ready: "+i),i}),[n]),i=r((function(t,r,e){try{var i="string"!=typeof r?JSON.stringify(r):r,o=n('var userId="'+t+'" || null;window.hj("identify",userId,'+i+");","hotjar-identify-script");return e&&"function"==typeof e&&e("Hotjar identified: "+o),o}catch(t){return console.error("Hotjar error:",t),!1}}),[n]);return t((function(){return{initHotjar:e,identifyHotjar:i}}),[e,i])}export default n;export{n as useHotjar}; | ||
import{useMemo as t,useCallback as r}from"react";function n(){var n=r((function(t,r){try{var n=document.getElementById(r)||document.createElement("script");return n.id=r,n.innerText=t,n.crossOrigin="anonymous",document.head.appendChild(n),!0}catch(t){return!1}}),[]);return t((function(){return{appendHeadScript:n}}),[n])}function e(){var e=n().appendHeadScript,i=r((function(t,r,n){var i=e("(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:"+t+",hjsv:"+r+"};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');","hotjar-init-script");return n&&"function"==typeof n&&n("Hotjar ready: "+i),i}),[e]),o=r((function(t,r,n){try{var i="string"!=typeof r?JSON.stringify(r):r,o=e('var userId="'+t+'" || null;window.hj("identify",userId,'+i+");","hotjar-identify-script");return n&&"function"==typeof n&&n("Hotjar identified: "+o),o}catch(t){return console.error("Hotjar error:",t),!1}}),[e]);return t((function(){return{initHotjar:i,identifyHotjar:o}}),[i,o])}export default e;export{n as useAppendHeadScript}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,1 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(){var e=function(){var e=t.useCallback((function(t,e){try{var r=document.getElementById(e)||document.createElement("script");return r.id=e,r.innerText=t,r.crossOrigin="anonymous",document.head.appendChild(r),!0}catch(t){return!1}}),[]);return t.useMemo((function(){return{appendHeadScript:e}}),[e])}().appendHeadScript,r=t.useCallback((function(t,r,n){var i=e("(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:"+t+",hjsv:"+r+"};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');","hotjar-init-script");return n&&"function"==typeof n&&n("Hotjar ready: "+i),i}),[e]),n=t.useCallback((function(t,r,n){try{var i="string"!=typeof r?JSON.stringify(r):r,a=e('var userId="'+t+'" || null;window.hj("identify",userId,'+i+");","hotjar-identify-script");return n&&"function"==typeof n&&n("Hotjar identified: "+a),a}catch(t){return console.error("Hotjar error:",t),!1}}),[e]);return t.useMemo((function(){return{initHotjar:r,identifyHotjar:n}}),[r,n])}exports.default=e,exports.useHotjar=e; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(){var e=t.useCallback((function(t,e){try{var r=document.getElementById(e)||document.createElement("script");return r.id=e,r.innerText=t,r.crossOrigin="anonymous",document.head.appendChild(r),!0}catch(t){return!1}}),[]);return t.useMemo((function(){return{appendHeadScript:e}}),[e])}exports.default=function(){var r=e().appendHeadScript,n=t.useCallback((function(t,e,n){var i=r("(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:"+t+",hjsv:"+e+"};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');","hotjar-init-script");return n&&"function"==typeof n&&n("Hotjar ready: "+i),i}),[r]),i=t.useCallback((function(t,e,n){try{var i="string"!=typeof e?JSON.stringify(e):e,a=r('var userId="'+t+'" || null;window.hj("identify",userId,'+i+");","hotjar-identify-script");return n&&"function"==typeof n&&n("Hotjar identified: "+a),a}catch(t){return console.error("Hotjar error:",t),!1}}),[r]);return t.useMemo((function(){return{initHotjar:n,identifyHotjar:i}}),[n,i])},exports.useAppendHeadScript=e; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-use-hotjar", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Adds Hotjar capabilities as custom hooks", | ||
@@ -13,2 +13,3 @@ "author": "Olavo Parno", | ||
"module": "dist/index.es.js", | ||
"types": "dist/index.d.ts", | ||
"jsnext:main": "dist/index.es.js", | ||
@@ -26,3 +27,3 @@ "engines": { | ||
"hooks": { | ||
"pre-commit": "npm run lint" | ||
"pre-commit": "npm run lint && npm run test:coverage && npm run make-badges && git add 'README.md'" | ||
} | ||
@@ -36,10 +37,22 @@ }, | ||
"scripts": { | ||
"test": "cross-env CI=1 react-scripts test --env=jsdom", | ||
"test:coverage": "npm run test -- --coverage", | ||
"prebuild": "rm -rf dist", | ||
"build": "rollup -c", | ||
"build": "rollup -c && tsc -d --emitDeclarationOnly --noEmit false --declarationDir dist", | ||
"start": "rollup -c -w", | ||
"prepare": "npm run build", | ||
"predeploy": "cd example && npm install && npm run build", | ||
"deploy": "gh-pages -d example/build", | ||
"format": "prettier --write src/**/*.{js,jsx,ts,tsx}", | ||
"lint": "eslint --fix src/**/*.{js,jsx,ts,tsx}", | ||
"release": "standard-version" | ||
"release": "standard-version", | ||
"make-badges": "istanbul-badges-readme" | ||
}, | ||
"jest": { | ||
"coverageReporters": [ | ||
"lcov", | ||
"json-summary" | ||
] | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
@@ -49,31 +62,38 @@ "react": "^17.0.1" | ||
"devDependencies": { | ||
"@babel/core": "^7.13.1", | ||
"@babel/runtime": "^7.13.1", | ||
"@babel/core": "^7.13.10", | ||
"@babel/runtime": "^7.13.10", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@rollup/plugin-url": "^6.0.0", | ||
"@testing-library/react-hooks": "^5.1.0", | ||
"@types/jest": "^26.0.20", | ||
"@types/react": "^17.0.2", | ||
"@typescript-eslint/eslint-plugin": "^4.15.2", | ||
"@typescript-eslint/parser": "^4.15.2", | ||
"eslint": "^7.20.0", | ||
"@types/react": "^17.0.3", | ||
"@typescript-eslint/eslint-plugin": "^4.17.0", | ||
"@typescript-eslint/parser": "^4.17.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.21.0", | ||
"eslint-config-airbnb": "^18.2.1", | ||
"eslint-config-airbnb-typescript-prettier": "^4.1.0", | ||
"eslint-config-prettier": "^8.0.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-react": "^7.22.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"husky": "^5.1.1", | ||
"eslint-config-airbnb-typescript-prettier": "^4.1.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^5.1.3", | ||
"istanbul-badges-readme": "^1.2.0", | ||
"prettier": "^2.2.1", | ||
"gh-pages": "^3.1.0", | ||
"react": "^17.0.1", | ||
"react-scripts": "^4.0.3", | ||
"rollup": "^2.39.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"react-test-renderer": "^17.0.1", | ||
"rollup": "^2.41.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"tslib": "^2.1.0", | ||
"standard-version": "^9.1.1", | ||
"typescript": "^4.1.5" | ||
"typescript": "^4.2.3" | ||
} | ||
} |
@@ -13,2 +13,6 @@ <img align="right" alt="traffic" src="https://pv-badge.herokuapp.com/total.svg?repo_id=olavoparno-react-use-hotjar"/> | ||
| Statements | Branches | Functions | Lines | | ||
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ | | ||
| ![Statements](https://img.shields.io/badge/Coverage-96.77%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-96.55%25-brightgreen.svg) | | ||
## Table of Contents | ||
@@ -15,0 +19,0 @@ |
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
16149
8
22
146
35