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

@devboldly/react-use-google-analytics-embed-api

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devboldly/react-use-google-analytics-embed-api - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

dist/hooks/global-namespace.d.ts

14

dist/hooks/useAuthAuthorize.js

@@ -9,7 +9,11 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var react_use_window_global_1 = require("@devboldly/react-use-window-global");
var global_namespace_1 = __importDefault(require("./global-namespace"));
var useAuthorized_1 = require("./useAuthorized");
exports.useAuthAuthorize = function (gapiLoader, clientId, containerId, onSignIn) {
var globalNamespace = '__REACT_GOOGLE_ANALYTICS_DASHBOARD__';
var refreshedRequiredKeyName = 'refreshRequired';

@@ -20,5 +24,7 @@ // This hook will pull the global value from the previous render only.

// So on the second render and after, we want to indicate that a refresh is required.
var _a = react_use_window_global_1.useWindowGlobal(globalNamespace, refreshedRequiredKeyName, false), refreshRequired = _a[1];
var _a = react_use_window_global_1.useWindowGlobal(global_namespace_1.default, refreshedRequiredKeyName, false), refreshRequired = _a[1];
var _b = react_use_window_global_1.useWindowGlobal(global_namespace_1.default, useAuthorized_1.authorizedKeyName, false), setAuthorized = _b[2];
React.useEffect(function () {
var signInHandler = function () {
setAuthorized(true);
if (typeof onSignIn !== 'undefined') {

@@ -30,3 +36,3 @@ onSignIn();

// If a refresh isn't required (since authorize can only be called once)
if (!win[globalNamespace][refreshedRequiredKeyName]) {
if (!win[global_namespace_1.default][refreshedRequiredKeyName]) {
if (gapiLoader.ready && gapiLoader.gapi) {

@@ -40,3 +46,3 @@ gapiLoader.gapi.analytics.auth.on('signIn', signInHandler);

// Authorize can only be called once so we need to track whether a refresh is required.
win[globalNamespace][refreshedRequiredKeyName] = true;
win[global_namespace_1.default][refreshedRequiredKeyName] = true;
}

@@ -43,0 +49,0 @@ }

@@ -6,3 +6,4 @@ import { GoogleAnalyticsEmbedAPI } from './GoogleAnalyticsEmbedAPI';

error: Error | undefined;
authorized: boolean;
}
export declare const useGoogleAnalyticsEmbedApi: () => GoogleAnalyticsEmbedAPILoader;

@@ -12,2 +12,3 @@ "use strict";

var react_use_window_global_1 = require("@devboldly/react-use-window-global");
var useAuthorized_1 = require("./useAuthorized");
var globalNamespace = '__USE_GOOGLE_ANALYTICS_EMBED_API_HOOK__';

@@ -19,2 +20,3 @@ var scriptRequestedKey = 'scriptRequested';

var _b = React.useState(false), hookReady = _b[0], setHookReady = _b[1];
var authorized = useAuthorized_1.useAuthorized();
var _c = React.useState(undefined), gapi = _c[0], setGapi = _c[1];

@@ -70,3 +72,3 @@ var _d = react_use_window_global_1.useWindowGlobal(globalNamespace, gapiAnalyticsReadyKey, false), scriptReadyLoading = _d[0], scriptReady = _d[1], setScriptReady = _d[2];

}, [scriptReadyLoading, scriptReady, setScriptReady]);
return { ready: hookReady, gapi: gapi, error: error };
return { ready: hookReady, gapi: gapi, error: error, authorized: authorized };
};

@@ -73,0 +75,0 @@ /**

{
"name": "@devboldly/react-use-google-analytics-embed-api",
"version": "0.0.16",
"version": "0.0.17",
"author": "Dev Boldly <devboldly@gmail.com>",

@@ -18,3 +18,7 @@ "description": "React hook to async load the Google Analytics Embed API.",

"predeploy": "npm run build && git add dist && git diff-index --quiet HEAD || git commit -m \"Build and deploy.\" && git push && npm version patch -m \"Build and deploy.\"",
"deploy": "npm publish --access public"
"deploy": "npm publish --access public",
"docz:dev": "docz dev",
"docz:build": "docz build",
"docz:serve": "docz build && docz serve",
"docz:clean": "rm -rf .docz/.cache"
},

@@ -34,4 +38,4 @@ "license": "MIT",

"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "^16.13.0",
"react-dom": "^16.13.0"
},

@@ -48,20 +52,20 @@ "devDependencies": {

"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react-hooks": "^3.2.1",
"@testing-library/react": "^9.5.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/jest": "^25.1.4",
"@types/node": "^13.9.0",
"@types/react-dom": "^16.9.5",
"@types/react": "^16.9.23",
"@types/react-dom": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"babel-loader": "^8.0.6",
"eslint": "^6.8.0",
"docz": "^2.2.0",
"eslint-plugin-json": "^2.1.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-app": "^6.2.1",
"eslint-plugin-react-hooks": "^2.5.0",
"eslint-plugin-react": "^7.19.0",
"eslint": "^6.8.0",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-helmet": "^6.0.0-beta.2",
"react-test-renderer": "^16.13.0",

@@ -68,0 +72,0 @@ "ts-jest": "^25.2.1",

<h2 align="center">
<a href="https://github.com/devboldly/react-use-google-analytics-embed-api">
react-use-google-analytics-embed-api
</a>
React Google Analytics Embed API Hook
<br/>
<small><a href="https://github.com/devboldly/react-use-google-analytics-embed-api">
@devboldly/react-use-google-analytics-embed-api
</a></small>
</h2>

@@ -16,9 +18,10 @@ <h3 align="center">

</a>
<a href="https://app.netlify.com/sites/react-use-google-analytics-embed-api/deploys">
<img src="https://api.netlify.com/api/v1/badges/94e467a6-9cac-4ff6-9ed3-734974c3603d/deploy-status" alt="Netlify Status"/>
</a>
</p>
## Installation
## Documentation
```
npm i @devboldly/react-use-google-analytics-embed-api
```
Read the **[official documentation](https://react-use-google-analytics-embed-api.netlify.com/)**.

@@ -38,6 +41,20 @@ ## Overview

## Usage
### Installation
This section will contain instructions on how to use the library.
```
npm i @devboldly/react-use-google-analytics-embed-api
```
### ExampleComponent
```jsx
<ExampleComponent text="Example Component"/>
```
### useExample Hook
```jsx
const [value, setValue] = useExample("Example value");
```
## TypeScript

@@ -47,8 +64,18 @@

<hr/>
## Contributing
## MIT License
Open source software is awesome and so are you. 😎
This project is covered under the [MIT License](https://en.wikipedia.org/wiki/MIT_License).
Feel free to submit a pull request for bugs or additions, and make sure to update tests as appropriate. Even the smallest changes help.
For major changes, open an issue first to discuss what you'd like to change.
## ⭐ Found It Helpful? [Star It!](https://github.com/devboldly/react-use-google-analytics-embed-api/stargazers)
More stars means more development love. So if you found this project helpful, [star it](https://github.com/devboldly/react-use-google-analytics-embed-api/stargazers)! [👉⭐](https://github.com/devboldly/react-use-google-analytics-embed-api/stargazers)
## License
This project is covered under the [MIT License](https://en.wikipedia.org/wiki/MIT_License):
```

@@ -74,2 +101,2 @@ Copyright © 2020 DevBoldly https://devboldly.com

SOFTWARE.
```
```
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