Huge News!Announcing our $40M Series B led by Abstract Ventures.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.22 to 0.0.23

26

dist/hooks/useAuthAuthorize.d.ts
import { GoogleAnalyticsEmbedAPILoader } from './useGoogleAnalyticsEmbedApi';
export declare const useAuthAuthorize: (gapiLoader: GoogleAnalyticsEmbedAPILoader, clientId: string, containerId: string, onSignIn?: (() => void) | undefined) => boolean;
export interface AuthorizeOptions {
/** The client ID of your project in the [developers console](https://console.developers.google.com/project). */
clientId: string;
/** The ID of an HTML element in the DOM that will host the sign-in button. You may also pass a reference to the element itself. */
container: string;
/** The text to display before a logged in user's email address. Defaults to `'You are logged in as: '`. */
userInfoLabel: string;
/** A list of Google API auth scopes that your application is requesting. To see all available scopes, visit the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/). For Google Analytics API auth scopes see the developer guides for [Configuration](https://developers.google.com/analytics/devguides/config) and [Reporting](https://developers.google.com/analytics/devguides/reporting) resources. */
scopes: string[];
/**
* Indicates whether the `scopes` option replaces the default Embed API scopes or adds to them. Specifying `false` (the default) will add to the default scopes, and specifying `true` will replace them with the ones specified by the `scopes` option.
*
* The default scopes value is: `['https://www.googleapis.com/auth/analytics.readonly']`.
*
* Note: authenticating via the Embed API requires access to the user's basic profile. Those scopes cannot be overwritten.
*/
overwriteDefaultScopes: boolean;
/**
* If you already have a valid access token, you can pass it to the authorize method directly and the user will not be prompted to authorize. For details on how to retrieve an access token, see the [OAuth 2.0 documentation](https://developers.google.com/identity/protocols/oauth2).
*/
serverAuth: {
access_token: string;
};
}
export declare const useAuthAuthorize: (gapiLoader: GoogleAnalyticsEmbedAPILoader, options: AuthorizeOptions, onSignIn?: (() => void) | undefined) => boolean;

6

dist/hooks/useAuthAuthorize.js

@@ -17,3 +17,3 @@ "use strict";

var useAuthorized_1 = require("./useAuthorized");
exports.useAuthAuthorize = function (gapiLoader, clientId, containerId, onSignIn) {
exports.useAuthAuthorize = function (gapiLoader, options, onSignIn) {
var refreshedRequiredKeyName = 'refreshRequired';

@@ -39,4 +39,4 @@ // This hook will pull the global value from the previous render only.

gapiLoader.gapi.analytics.auth.authorize({
container: containerId,
clientid: clientId,
container: options.container,
clientid: options.clientId,
});

@@ -43,0 +43,0 @@ // Set this directly to prevent a rerender.

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

import { GoogleAnalyticsEmbedAPILoader } from './useGoogleAnalyticsEmbedApi';
export declare const authorizedKeyName = "authorized";
export declare const useAuthorized: (gapiLoader: GoogleAnalyticsEmbedAPILoader) => boolean;
export declare const useAuthorized: () => boolean;

@@ -16,4 +16,6 @@ "use strict";

var global_namespace_1 = __importDefault(require("./global-namespace"));
var useGoogleAnalyticsEmbedApi_1 = require("./useGoogleAnalyticsEmbedApi");
exports.authorizedKeyName = 'authorized';
exports.useAuthorized = function (gapiLoader) {
exports.useAuthorized = function () {
var gapiLoader = useGoogleAnalyticsEmbedApi_1.useGoogleAnalyticsEmbedApi();
var _a = react_use_window_global_1.useWindowGlobal(global_namespace_1.default, exports.authorizedKeyName, false), loading = _a[0], authorized = _a[1], setAuthorized = _a[2];

@@ -20,0 +22,0 @@ React.useEffect(function () {

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

@@ -5,0 +5,0 @@ "description": "React hook to async load the Google Analytics Embed API.",

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