@pyramid-embed/embed-react
Advanced tools
Comparing version 2.0.8 to 2.0.11
@@ -1,10 +0,14 @@ | ||
import React, { Component, RefObject } from "react"; | ||
import { PyramidEmbedClient, EmbedOptions } from "@pyramid-embed/embed-js"; | ||
import React, { Component, RefObject } from 'react'; | ||
import { EmbedOptions, PyramidEmbedClient } from '@pyramid-embed/embed-js'; | ||
declare type AuthenticationType = 'none' | 'forms' | 'windows' | 'saml'; | ||
interface Props { | ||
host: string; | ||
options: EmbedOptions; | ||
userName?: string; | ||
password?: string; | ||
host: string; | ||
samlToken?: string; | ||
style?: React.CSSProperties; | ||
className?: string; | ||
options: EmbedOptions; | ||
authFailureCallback?: () => void; | ||
loginType?: AuthenticationType; | ||
} | ||
@@ -16,8 +20,11 @@ export declare class PyramidEmbedContainer extends Component<Props> { | ||
constructor(props: Props); | ||
embed: () => void; | ||
componentDidMount(): void; | ||
componentDidUpdate(): void; | ||
render(): JSX.Element; | ||
get authenticationType(): AuthenticationType; | ||
authenticate(): Promise<string>; | ||
init(): Promise<void>; | ||
embed(): void; | ||
} | ||
export {}; | ||
//# sourceMappingURL=pyramid-embed-container.d.ts.map |
@@ -1,5 +0,5 @@ | ||
import { __extends } from "tslib"; | ||
import React, { Component } from "react"; | ||
import { PyramidEmbedClient } from "@pyramid-embed/embed-js"; | ||
import uuid from "uuid/v4"; | ||
import { __awaiter, __extends, __generator } from "tslib"; | ||
import React, { Component } from 'react'; | ||
import { PyramidEmbedClient } from '@pyramid-embed/embed-js'; | ||
import uuid from 'uuid/v4'; | ||
var PyramidEmbedContainer = /** @class */ (function (_super) { | ||
@@ -10,5 +10,2 @@ __extends(PyramidEmbedContainer, _super); | ||
_this.element = React.createRef(); | ||
_this.embed = function () { | ||
_this.api.embed(_this.element.current, _this.props.options); | ||
}; | ||
_this.containerId = uuid(); | ||
@@ -18,5 +15,3 @@ return _this; | ||
PyramidEmbedContainer.prototype.componentDidMount = function () { | ||
var _a = this.props, host = _a.host, userName = _a.userName, password = _a.password; | ||
this.api = new PyramidEmbedClient(host); | ||
this.api.init(userName, password).then(this.embed); | ||
this.init(); | ||
}; | ||
@@ -29,2 +24,74 @@ PyramidEmbedContainer.prototype.componentDidUpdate = function () { | ||
}; | ||
Object.defineProperty(PyramidEmbedContainer.prototype, "authenticationType", { | ||
get: function () { | ||
var _a = this.props, loginType = _a.loginType, userName = _a.userName, password = _a.password; | ||
if (!loginType && userName && password) { | ||
return 'forms'; | ||
} | ||
if (loginType) { | ||
return loginType; | ||
} | ||
return 'none'; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
PyramidEmbedContainer.prototype.authenticate = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var loginType, token, _a, userName, password; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
loginType = this.authenticationType; | ||
if (!(loginType === 'forms')) return [3 /*break*/, 2]; | ||
_a = this.props, userName = _a.userName, password = _a.password; | ||
return [4 /*yield*/, this.api.login(userName, password)]; | ||
case 1: | ||
token = _b.sent(); | ||
return [3 /*break*/, 6]; | ||
case 2: | ||
if (!(loginType === 'windows')) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.api.loginWindowsAuth()]; | ||
case 3: | ||
token = _b.sent(); | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
if (!(loginType === 'saml')) return [3 /*break*/, 6]; | ||
return [4 /*yield*/, this.api.loginSamlAuth(this.props.samlToken)]; | ||
case 5: | ||
token = _b.sent(); | ||
_b.label = 6; | ||
case 6: return [2 /*return*/, token]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PyramidEmbedContainer.prototype.init = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, host, authFailureCallback; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = this.props, host = _a.host, authFailureCallback = _a.authFailureCallback; | ||
this.api = new PyramidEmbedClient(host); | ||
if (authFailureCallback) { | ||
this.api.setAuthFailureCallback(authFailureCallback); | ||
} | ||
if (!!this.api.isLoggedIn) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.authenticate()]; | ||
case 1: | ||
_b.sent(); | ||
_b.label = 2; | ||
case 2: return [4 /*yield*/, this.api.init()]; | ||
case 3: | ||
_b.sent(); | ||
this.embed(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
PyramidEmbedContainer.prototype.embed = function () { | ||
this.api.embed(this.element.current, this.props.options); | ||
}; | ||
return PyramidEmbedContainer; | ||
@@ -31,0 +98,0 @@ }(Component)); |
{ | ||
"name": "@pyramid-embed/embed-react", | ||
"version": "2.0.8", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "tsc", | ||
"build:publish": "tsc && npm version patch && npm publish", | ||
"build:publish:prod": "tsc && npm publish", | ||
"postinstall": "npm prune" | ||
}, | ||
"author": "Pyramid Analytics", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@pyramid-embed/embed-js": "2.0.45", | ||
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"uuid": "3.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "16.9.19", | ||
"@types/react-dom": "16.9.5", | ||
"@types/uuid": "3.4.6", | ||
"remove-files-webpack-plugin": "1.4.3", | ||
"tsc": "1.20150623.0", | ||
"typescript": "3.7.5", | ||
"uglifyjs-webpack-plugin": "2.2.0", | ||
"webpack": "4.43.0", | ||
"webpack-cli": "3.3.12" | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
] | ||
"name": "@pyramid-embed/embed-react", | ||
"version": "2.0.11", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "tsc", | ||
"build:publish": "tsc && npm version patch && npm publish", | ||
"build:publish:prod": "tsc && npm publish", | ||
"postinstall": "npm prune" | ||
}, | ||
"author": "Pyramid Analytics", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@pyramid-embed/embed-js": "2.0.57", | ||
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"uuid": "3.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "16.9.19", | ||
"@types/react-dom": "16.9.5", | ||
"@types/uuid": "3.4.6", | ||
"remove-files-webpack-plugin": "1.4.3", | ||
"tsc": "1.20150623.0", | ||
"typescript": "3.7.5", | ||
"uglifyjs-webpack-plugin": "2.2.0", | ||
"webpack": "4.43.0", | ||
"webpack-cli": "3.3.12" | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9917
128
+ Added@pyramid-embed/embed-js@2.0.57(transitive)
- Removed@pyramid-embed/embed-js@2.0.45(transitive)