New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-use-hotjar

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-hotjar - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

LICENSE

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### [1.1.2](https://github.com/olavoparno/react-use-hotjar/compare/v1.1.1...v1.1.2) (2021-05-10)
### [1.1.1](https://github.com/olavoparno/react-use-hotjar/compare/v1.1.0...v1.1.1) (2021-04-27)

@@ -7,0 +9,0 @@

4

dist/dependencies.d.ts
export declare type TUserInfo = Record<string | number, string | number | Date | boolean>;
export interface IUseHotjar {
readyState: boolean;
initHotjar: (hotjarId: number, hotjarVersion: number, logCallback?: (...data: unknown[]) => void) => boolean;
initHotjar: (hotjarId: number, hotjarVersion: number, hotjarDebug?: boolean, logCallback?: (...data: unknown[]) => void) => boolean;
identifyHotjar: (userId: string, userInfo: TUserInfo, logCallback?: (...data: unknown[]) => void) => boolean;

@@ -9,5 +9,5 @@ stateChange: (relativePath: string, logCallback?: ((...data: unknown[]) => void) | undefined) => boolean;

export declare const appendHeadScript: (scriptText: string, scriptId: string) => boolean;
export declare function hotjarInitScript(hotjarId: number, hotjarVersion: number): boolean;
export declare function hotjarInitScript(hotjarId: number, hotjarVersion: number, hotjardebug: boolean): boolean;
export declare function hotjarStateChangeScript(relativePath: string): void;
export declare function hotjarIdentifyScript(userId: string | null, userInfo: TUserInfo): void;
export declare function checkReadyState(): boolean;

@@ -1,2 +0,2 @@

import{useState as t,useMemo as r,useCallback as n}from"react";function e(t,r){var n="undefined"!=typeof window;if(!n)return!1;if(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}}("(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")&&n&&window.hj)return!0;throw Error("Hotjar initialization failed!")}function o(){var o=!("undefined"==typeof window||!window.hj),i=t(r((function(){return o}),[o])),a=i[0],d=i[1],h=n((function(t,r,n){try{return e(t,r),d(!0),n&&"function"==typeof n&&n("Hotjar ready: true"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),u=n((function(t,r,n){try{return function(t,r){if("undefined"!=typeof window&&window.hj)return window.hj("identify",t,r);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t,r),n&&"function"==typeof n&&n("Hotjar identified"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),c=n((function(t,r){try{return function(t){if("undefined"!=typeof window&&window.hj)return window.hj("stateChange",t);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t),r&&"function"==typeof r&&r("Hotjar stateChanged"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]);return r((function(){return{readyState:a,stateChange:c,initHotjar:h,identifyHotjar:u}}),[a,c,h,u])}export default o;
import{useState as t,useMemo as r,useCallback as n}from"react";function e(t,r,n){var e="undefined"!=typeof window;if(!e)return!1;if(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}}("(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+",hjdebug:"+n+"};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")&&e&&window.hj)return!0;throw Error("Hotjar initialization failed!")}function o(){var o=!("undefined"==typeof window||!window.hj),i=t(r((function(){return o}),[o])),a=i[0],d=i[1],h=n((function(t,r,n,o){try{return e(t,r,!!n),d(!0),o&&"function"==typeof o&&o("Hotjar ready: true"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),u=n((function(t,r,n){try{return function(t,r){if("undefined"!=typeof window&&window.hj)return window.hj("identify",t,r);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t,r),n&&"function"==typeof n&&n("Hotjar identified"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),c=n((function(t,r){try{return function(t){if("undefined"!=typeof window&&window.hj)return window.hj("stateChange",t);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t),r&&"function"==typeof r&&r("Hotjar stateChanged"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]);return r((function(){return{readyState:a,stateChange:c,initHotjar:h,identifyHotjar:u}}),[a,c,h,u])}export default o;
//# sourceMappingURL=index.es.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(t,e){var r="undefined"!=typeof window;if(!r)return!1;if(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}}("(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")&&r&&window.hj)return!0;throw Error("Hotjar initialization failed!")}exports.default=function(){var r=!("undefined"==typeof window||!window.hj),n=t.useState(t.useMemo((function(){return r}),[r])),o=n[0],i=n[1],a=t.useCallback((function(t,r,n){try{return e(t,r),i(!0),n&&"function"==typeof n&&n("Hotjar ready: true"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),u=t.useCallback((function(t,e,r){try{return function(t,e){if("undefined"!=typeof window&&window.hj)return window.hj("identify",t,e);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t,e),r&&"function"==typeof r&&r("Hotjar identified"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),c=t.useCallback((function(t,e){try{return function(t){if("undefined"!=typeof window&&window.hj)return window.hj("stateChange",t);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t),e&&"function"==typeof e&&e("Hotjar stateChanged"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]);return t.useMemo((function(){return{readyState:o,stateChange:c,initHotjar:a,identifyHotjar:u}}),[o,c,a,u])};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react");function e(t,e,r){var n="undefined"!=typeof window;if(!n)return!1;if(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}}("(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+",hjdebug:"+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")&&n&&window.hj)return!0;throw Error("Hotjar initialization failed!")}exports.default=function(){var r=!("undefined"==typeof window||!window.hj),n=t.useState(t.useMemo((function(){return r}),[r])),o=n[0],i=n[1],a=t.useCallback((function(t,r,n,o){try{return e(t,r,!!n),i(!0),o&&"function"==typeof o&&o("Hotjar ready: true"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),u=t.useCallback((function(t,e,r){try{return function(t,e){if("undefined"!=typeof window&&window.hj)return window.hj("identify",t,e);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t,e),r&&"function"==typeof r&&r("Hotjar identified"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]),c=t.useCallback((function(t,e){try{return function(t){if("undefined"!=typeof window&&window.hj)return window.hj("stateChange",t);throw Error("Hotjar is not available! Is Hotjar initialized?")}(t),e&&"function"==typeof e&&e("Hotjar stateChanged"),!0}catch(t){return console.error("Hotjar error:",t),!1}}),[]);return t.useMemo((function(){return{readyState:o,stateChange:c,initHotjar:a,identifyHotjar:u}}),[o,c,a,u])};
//# sourceMappingURL=index.js.map
{
"name": "react-use-hotjar",
"version": "1.1.1",
"version": "1.1.2",
"description": "Adds Hotjar capabilities as custom hooks",

@@ -5,0 +5,0 @@ "author": "Olavo Parno",

@@ -48,3 +48,3 @@ <img align="right" alt="traffic" src="https://pv-badge.herokuapp.com/total.svg?repo_id=olavoparno-react-use-hotjar"/>

React.useEffect(() => {
initHotjar(1234567, 6, myCustomLogger);
initHotjar(1234567, 6, false, myCustomLogger);
}, [initHotjar]);

@@ -93,3 +93,3 @@

| readyState | States if Hotjar is ready | N/A | N/A |
| initHotjar | Initialize method | (hotjarId: number, hotjarVersion: number, loggerCallback?: console[method]) | (1933331, 6, console.info) |
| initHotjar | Initialize method | (hotjarId: number, hotjarVersion: number, hotjarDebug?: boolean, loggerCallback?: console[method]) | (1933331, 6, false, console.info) |
| identifyHotjar | User identify API method | (userId: string, userInfo: object, loggerCallback?: console[method]) | ('abcde-12345-12345', {name:"Olli",surname:"Parno",address:"Streets of Tomorrow"}, console.log) |

@@ -102,3 +102,4 @@ | stateChange | Relative path state change | (relativePath: string, loggerCallback?: console[method]) | ('route/logged-route/user?registered=true') |

2. `hotjarVersion`: Hotjar's current version ex.: 6
3. `logCallback`: Optional callback for logging wether Hotjar is ready or not
3. `hotjarDebug`: Optional Debug Mode to see hotjar logs in console ex.: true
4. `logCallback`: Optional callback for logging wether Hotjar is ready or not

@@ -109,2 +110,3 @@ ```tsx

hotjarVersion: string,
hotjarDebug?: boolean,
logCallback?: () => void

@@ -148,2 +150,3 @@ ) => boolean;

<td align="center"><a href="https://paqmind.com"><img src="https://avatars.githubusercontent.com/u/2128182?v=4?s=70" width="70px;" alt=""/><br /><sub><b>Ivan Kleshnin</b></sub></a><br /><a href="https://github.com/olavoparno/react-use-hotjar/commits?author=ivan-kleshnin" title="Code">💻</a> <a href="#ideas-ivan-kleshnin" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://ajayvarghese.netlify.app/"><img src="https://avatars.githubusercontent.com/u/12490903?v=4?s=70" width="70px;" alt=""/><br /><sub><b>Ajay Varghese</b></sub></a><br /><a href="https://github.com/olavoparno/react-use-hotjar/commits?author=ajayvarghese" title="Code">💻</a> <a href="#ideas-ajayvarghese" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>

@@ -150,0 +153,0 @@ </table>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc