Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/mgt-element

Package Overview
Dependencies
Maintainers
12
Versions
831
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/mgt-element - npm Package Compare versions

Comparing version 2.2.0-next.msal2provider.178cdd7 to 2.2.0-next.msal2provider.617820d

2

dist/es6/components/baseComponent.d.ts

@@ -145,2 +145,4 @@ /**

private setLoadingState;
private handleProviderUpdates;
private handleActiveAccountUpdates;
private handleLocalizationChanged;

@@ -147,0 +149,0 @@ private handleDirectionChanged;

@@ -76,2 +76,4 @@ /**

this.handleDirectionChanged = this.handleDirectionChanged.bind(this);
this.handleProviderUpdates = this.handleProviderUpdates.bind(this);
this.handleActiveAccountUpdates = this.handleActiveAccountUpdates.bind(this);
this.handleDirectionChanged();

@@ -147,2 +149,4 @@ this.handleLocalizationChanged();

LocalizationHelper.removeOnDirectionUpdated(this.handleDirectionChanged);
Providers.removeProviderUpdatedListener(this.handleProviderUpdates);
Providers.removeActiveAccountChangedListener(this.handleActiveAccountUpdates);
}

@@ -161,3 +165,4 @@ /**

this._isFirstUpdated = true;
Providers.onProviderUpdated(() => this.requestStateUpdate());
Providers.onProviderUpdated(this.handleProviderUpdates);
Providers.onActiveAccountChanged(this.handleActiveAccountUpdates);
this.requestStateUpdate();

@@ -275,2 +280,11 @@ }

}
handleProviderUpdates() {
this.requestStateUpdate();
}
handleActiveAccountUpdates() {
return __awaiter(this, void 0, void 0, function* () {
this.clearState();
this.requestStateUpdate();
});
}
handleLocalizationChanged() {

@@ -277,0 +291,0 @@ LocalizationHelper.updateStringsForTag(this.tagName, this.strings);

@@ -27,4 +27,14 @@ /**

graph: IGraph;
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
protected isMultipleAccountDisabled: boolean;
private _state;
private _loginChangedDispatcher;
private _activeAccountChangedDispatcher;
get isMultiAccountDisabled(): boolean;
/**

@@ -82,4 +92,38 @@ * returns state of Provider

/**
* uses scopes to receive access token
* Returns all signed in accounts.
*
* @return {*} {any[]}
* @memberof IProvider
*/
getAllAccounts?(): IProviderAccount[];
/**
* Switch between two signed in accounts
*
* @param {*} user
* @memberof IProvider
*/
setActiveAccount?(user: IProviderAccount): void;
/**
* Event handler when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
onActiveAccountChanged(eventHandler: EventHandler<ActiveAccountChanged>): void;
/**
* Removes event handler for when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
removeActiveAccountChangedHandler(eventHandler: EventHandler<ActiveAccountChanged>): void;
/**
* Fires event when active account changes
*
* @memberof IProvider
*/
private fireActiveAccountChanged;
/**
* uses scopes to recieve access token
*
* @param {...string[]} scopes

@@ -101,2 +145,10 @@ * @returns {Promise<string>}

/**
* ActiveAccountChanged Event
*
* @export
* @interface ActiveAccountChanged
*/
export interface ActiveAccountChanged {
}
/**
* loginChangedEvent

@@ -145,2 +197,11 @@ *

}
/**
* Account details
*
* @export
*/
export declare type IProviderAccount = {
username?: string;
id: string;
};
//# sourceMappingURL=IProvider.d.ts.map

@@ -18,5 +18,17 @@ /**

constructor() {
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
this.isMultipleAccountDisabled = true;
this._loginChangedDispatcher = new EventDispatcher();
this._activeAccountChangedDispatcher = new EventDispatcher();
this._state = ProviderState.Loading;
}
get isMultiAccountDisabled() {
return this.isMultipleAccountDisabled;
}
/**

@@ -72,4 +84,39 @@ * returns state of Provider

/**
* uses scopes to receive access token
* Switch between two signed in accounts
*
* @param {*} user
* @memberof IProvider
*/
setActiveAccount(user) {
this.fireActiveAccountChanged();
}
/**
* Event handler when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
onActiveAccountChanged(eventHandler) {
this._activeAccountChangedDispatcher.add(eventHandler);
}
/**
* Removes event handler for when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
removeActiveAccountChangedHandler(eventHandler) {
this._activeAccountChangedDispatcher.remove(eventHandler);
}
/**
* Fires event when active account changes
*
* @memberof IProvider
*/
fireActiveAccountChanged() {
this._activeAccountChangedDispatcher.fire({});
}
/**
* uses scopes to recieve access token
*
* @param {...string[]} scopes

@@ -76,0 +123,0 @@ * @returns {Promise<string>}

@@ -44,2 +44,18 @@ /**

/**
* Fires event when Provider changes state
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
static onActiveAccountChanged(event: EventHandler<any>): void;
/**
* Remove event handler
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
static removeActiveAccountChangedListener(event: EventHandler<any>): void;
/**
* Gets the current signed in user

@@ -61,5 +77,7 @@ *

private static _eventDispatcher;
private static _activeAccountChangedDispatcher;
private static _globalProvider;
private static _me;
private static handleProviderStateChanged;
private static handleActiveAccountChanged;
}

@@ -66,0 +84,0 @@ /**

@@ -39,5 +39,7 @@ /**

this._globalProvider.removeStateChangedHandler(this.handleProviderStateChanged);
this._globalProvider.removeActiveAccountChangedHandler(this.handleActiveAccountChanged);
}
if (provider) {
provider.onStateChanged(this.handleProviderStateChanged);
provider.onActiveAccountChanged(this.handleActiveAccountChanged);
}

@@ -69,2 +71,22 @@ this._globalProvider = provider;

/**
* Fires event when Provider changes state
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
static onActiveAccountChanged(event) {
this._activeAccountChangedDispatcher.add(event);
}
/**
* Remove event handler
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
static removeActiveAccountChangedListener(event) {
this._activeAccountChangedDispatcher.remove(event);
}
/**
* Gets the current signed in user

@@ -113,4 +135,8 @@ *

}
static handleActiveAccountChanged() {
Providers._activeAccountChangedDispatcher.fire(null);
}
}
Providers._eventDispatcher = new EventDispatcher();
Providers._activeAccountChangedDispatcher = new EventDispatcher();
/**

@@ -117,0 +143,0 @@ * on Provider Change State

2

package.json
{
"name": "@microsoft/mgt-element",
"version": "2.2.0-next.msal2provider.178cdd7",
"version": "2.2.0-next.msal2provider.617820d",
"description": "Microsoft Graph Toolkit base classes",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/microsoftgraph/microsoft-graph-toolkit",

@@ -116,2 +116,4 @@ /**

this.handleDirectionChanged = this.handleDirectionChanged.bind(this);
this.handleProviderUpdates = this.handleProviderUpdates.bind(this);
this.handleActiveAccountUpdates = this.handleActiveAccountUpdates.bind(this);
this.handleDirectionChanged();

@@ -141,2 +143,4 @@ this.handleLocalizationChanged();

LocalizationHelper.removeOnDirectionUpdated(this.handleDirectionChanged);
Providers.removeProviderUpdatedListener(this.handleProviderUpdates);
Providers.removeActiveAccountChangedListener(this.handleActiveAccountUpdates);
}

@@ -156,3 +160,4 @@

this._isFirstUpdated = true;
Providers.onProviderUpdated(() => this.requestStateUpdate());
Providers.onProviderUpdated(this.handleProviderUpdates);
Providers.onActiveAccountChanged(this.handleActiveAccountUpdates);
this.requestStateUpdate();

@@ -286,2 +291,11 @@ }

private handleProviderUpdates() {
this.requestStateUpdate();
}
private async handleActiveAccountUpdates() {
this.clearState();
this.requestStateUpdate();
}
private handleLocalizationChanged() {

@@ -288,0 +302,0 @@ LocalizationHelper.updateStringsForTag(this.tagName, this.strings);

@@ -29,4 +29,16 @@ /**

public graph: IGraph;
/**
* Enable/Disable multi account functionality
*
* @protected
* @type {boolean}
* @memberof IProvider
*/
protected isMultipleAccountDisabled: boolean = true;
private _state: ProviderState;
private _loginChangedDispatcher = new EventDispatcher<LoginChangedEvent>();
private _activeAccountChangedDispatcher = new EventDispatcher<ActiveAccountChanged>();
public get isMultiAccountDisabled(): boolean {
return this.isMultipleAccountDisabled;
}
/**

@@ -106,4 +118,51 @@ * returns state of Provider

/**
* uses scopes to receive access token
* Returns all signed in accounts.
*
* @return {*} {any[]}
* @memberof IProvider
*/
public getAllAccounts?(): IProviderAccount[];
/**
* Switch between two signed in accounts
*
* @param {*} user
* @memberof IProvider
*/
public setActiveAccount?(user: IProviderAccount) {
this.fireActiveAccountChanged();
}
/**
* Event handler when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
public onActiveAccountChanged(eventHandler: EventHandler<ActiveAccountChanged>) {
this._activeAccountChangedDispatcher.add(eventHandler);
}
/**
* Removes event handler for when Active account changes
*
* @param {EventHandler<ActiveAccountChanged>} eventHandler
* @memberof IProvider
*/
public removeActiveAccountChangedHandler(eventHandler: EventHandler<ActiveAccountChanged>) {
this._activeAccountChangedDispatcher.remove(eventHandler);
}
/**
* Fires event when active account changes
*
* @memberof IProvider
*/
private fireActiveAccountChanged() {
this._activeAccountChangedDispatcher.fire({});
}
/**
* uses scopes to recieve access token
*
* @param {...string[]} scopes

@@ -129,2 +188,9 @@ * @returns {Promise<string>}

/**
* ActiveAccountChanged Event
*
* @export
* @interface ActiveAccountChanged
*/
export interface ActiveAccountChanged {}
/**
* loginChangedEvent

@@ -175,1 +241,11 @@ *

}
/**
* Account details
*
* @export
*/
export type IProviderAccount = {
username?: string;
id: string;
};

@@ -36,2 +36,3 @@ /**

this._globalProvider.removeStateChangedHandler(this.handleProviderStateChanged);
this._globalProvider.removeActiveAccountChangedHandler(this.handleActiveAccountChanged);
}

@@ -41,2 +42,3 @@

provider.onStateChanged(this.handleProviderStateChanged);
provider.onActiveAccountChanged(this.handleActiveAccountChanged);
}

@@ -72,2 +74,24 @@

/**
* Fires event when Provider changes state
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
public static onActiveAccountChanged(event: EventHandler<any>) {
this._activeAccountChangedDispatcher.add(event);
}
/**
* Remove event handler
*
* @static
* @param {EventHandler<ProvidersChangedState>} event
* @memberof Providers
*/
public static removeActiveAccountChangedListener(event: EventHandler<any>) {
this._activeAccountChangedDispatcher.remove(event);
}
/**
* Gets the current signed in user

@@ -113,2 +137,4 @@ *

private static _activeAccountChangedDispatcher: EventDispatcher<any> = new EventDispatcher<any>();
private static _globalProvider: IProvider;

@@ -125,2 +151,6 @@ private static _me: User;

}
private static handleActiveAccountChanged() {
Providers._activeAccountChangedDispatcher.fire(null);
}
}

@@ -127,0 +157,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

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