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

@guestlinelabs/react-auth

Package Overview
Dependencies
Maintainers
8
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guestlinelabs/react-auth - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

0

.eslintrc.js

@@ -0,0 +0,0 @@ module.exports = {

2

dist/tokens.d.ts

@@ -21,3 +21,3 @@ import React from 'react';

export declare function useTokens(): TokenData;
export declare function withTokens<X extends TokenData>(Component: React.ComponentType<X>): React.ComponentType<Subtract<X, TokenData>>;
export declare function withTokens<X extends TokenData>(Component: React.ComponentType<X>): React.FC<Subtract<X, TokenData>>;
export {};
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {

@@ -76,51 +63,10 @@ __assign = Object.assign || function(t) {

function withTokens(Component) {
var WithOIDC = /** @class */ (function (_super) {
__extends(WithOIDC, _super);
function WithOIDC() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = initialState;
_this.timer = null;
return _this;
}
WithOIDC.prototype.componentDidMount = function () {
this.refreshTokens();
};
WithOIDC.prototype.componentWillUnmount = function () {
if (this.timer) {
clearInterval(this.timer);
}
};
WithOIDC.prototype.refreshTokens = function () {
var _this = this;
window.guestline.user.tokensSubscriptions.push({
handler: function (err, _a) {
var idToken = _a.idToken, accessToken = _a.accessToken;
if (err) {
_this.setState({
loading: false,
error: err,
idToken: null,
accessToken: null,
});
}
else {
_this.setState({
loading: false,
error: null,
idToken: idToken,
accessToken: accessToken,
});
}
},
});
};
WithOIDC.prototype.render = function () {
var _a = this.state, idToken = _a.idToken, accessToken = _a.accessToken, loading = _a.loading, error = _a.error;
return (react_1.default.createElement(Component, __assign({ idToken: idToken, accessToken: accessToken, loading: loading, error: error }, this.props)));
};
return WithOIDC;
}(react_1.default.Component));
return WithOIDC;
var WithTokens = function (props) {
var tokenResults = useTokens();
// @ts-ignore: 'X' could be instantiated with a different subtype of constraint 'TokenData'
return react_1.default.createElement(Component, __assign({}, tokenResults, props));
};
return WithTokens;
}
exports.withTokens = withTokens;
//# sourceMappingURL=tokens.js.map

@@ -38,3 +38,3 @@ import * as t from 'io-ts';

interface LoginOptions {
scope: string;
scope?: string;
audience?: string;

@@ -41,0 +41,0 @@ appState?: {};

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

import { TokenPayload } from './types';
import React from 'react';
import { UserInfo } from './types';
declare type Subtract<T, K> = Omit<T, keyof K>;
declare type UserInfoData = {

@@ -13,5 +15,6 @@ loading: true;

error: null;
userInfo: TokenPayload;
userInfo: UserInfo;
};
export declare function useUserInfo(): UserInfoData;
export declare function withUserInfo<X extends UserInfoData>(Component: React.ComponentType<X>): React.ComponentType<Subtract<X, UserInfoData>>;
export {};

@@ -43,20 +43,22 @@ "use strict";

react_1.default.useEffect(function () {
var infoSub = function (error, data) {
if (error) {
dispatch({ type: 'setError', error: error });
}
else {
pipeable_1.pipe(types_1.TokenPayload.decode(data), Either_1.fold(function (decodeError) {
dispatch({
type: 'setError',
error: new Error(PathReporter_1.failure(decodeError).join('\n')),
});
}, function (userInfo) {
dispatch({ type: 'setUserInfo', userInfo: userInfo });
}));
}
var infoSub = {
handler: function (error, data) {
if (error) {
dispatch({ type: 'setError', error: error });
}
else {
pipeable_1.pipe(types_1.UserInfo.decode(data), Either_1.fold(function (decodeError) {
dispatch({
type: 'setError',
error: new Error(PathReporter_1.failure(decodeError).join('\n')),
});
}, function (userInfo) {
dispatch({ type: 'setUserInfo', userInfo: userInfo });
}));
}
},
};
window.guestline.authentication.subscriptions.push(infoSub);
window.guestline.user.infoSubscriptions.push(infoSub);
return function () {
window.guestline.authentication.subscriptions.splice(window.guestline.authentication.subscriptions.indexOf(infoSub), 1);
window.guestline.user.infoSubscriptions.splice(window.guestline.user.infoSubscriptions.indexOf(infoSub), 1);
};

@@ -67,2 +69,11 @@ }, []);

exports.useUserInfo = useUserInfo;
function withUserInfo(Component) {
var WithUserInfo = function (props) {
var userInfoResults = useUserInfo();
// @ts-ignore: 'X' could be instantiated with a different subtype of constraint 'UserInfoData'
return react_1.default.createElement(Component, __assign({}, userInfoResults, props));
};
return WithUserInfo;
}
exports.withUserInfo = withUserInfo;
//# sourceMappingURL=userInfo.js.map
{
"name": "@guestlinelabs/react-auth",
"version": "2.0.4",
"version": "2.0.5",
"description": "TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,0 +0,0 @@ # Introduction

@@ -0,0 +0,0 @@ import { AuthProvider, useAuth } from './auth';

@@ -100,3 +100,3 @@ import * as t from 'io-ts';

interface LoginOptions {
scope: string;
scope?: string;
audience?: string;

@@ -103,0 +103,0 @@ appState?: {}; // State to get back on the login-callback (e.g. to store the page to redirect to after login)

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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