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

@pyramid-embed/embed-react

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pyramid-embed/embed-react - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

4

dist/components/pyramid-embed-container.d.ts

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

import { Component, RefObject } from 'react';
import React, { Component, RefObject } from 'react';
import { EmbedContentOptions, PyramidEmbedClient } from '@pyramid-embed/embed-js';

@@ -12,3 +12,3 @@ import { EmbedContainerProps } from '../internal-types';

componentDidUpdate(): void;
render(): JSX.Element;
render(): React.JSX.Element;
init(): Promise<void>;

@@ -15,0 +15,0 @@ embed(): void;

@@ -1,43 +0,25 @@

import { __awaiter, __extends, __generator } from "tslib";
import React, { Component } from 'react';
import { initializeAPI } from '../embed-utils';
var PyramidEmbedContainer = /** @class */ (function (_super) {
__extends(PyramidEmbedContainer, _super);
function PyramidEmbedContainer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.element = React.createRef();
return _this;
export class PyramidEmbedContainer extends Component {
constructor() {
super(...arguments);
this.element = React.createRef();
}
PyramidEmbedContainer.prototype.componentDidMount = function () {
componentDidMount() {
this.init();
};
PyramidEmbedContainer.prototype.componentDidUpdate = function () {
}
componentDidUpdate() {
this.embed();
};
PyramidEmbedContainer.prototype.render = function () {
}
render() {
return React.createElement("div", { ref: this.element, style: this.props.style, className: this.props.className });
};
PyramidEmbedContainer.prototype.init = function () {
return __awaiter(this, void 0, void 0, function () {
var host, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
host = this.props.host;
_a = this;
return [4 /*yield*/, initializeAPI(host, this.props)];
case 1:
_a.api = _b.sent();
this.embed();
return [2 /*return*/];
}
});
});
};
PyramidEmbedContainer.prototype.embed = function () {
}
async init() {
const { host } = this.props;
this.api = await initializeAPI(host, this.props);
this.embed();
}
embed() {
this.api.embed(this.element.current, this.props.options);
};
return PyramidEmbedContainer;
}(Component));
export { PyramidEmbedContainer };
//# sourceMappingURL=pyramid-embed-container.js.map
}
}

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

import { Component, RefObject } from 'react';
import React, { Component, RefObject } from 'react';
import { EmbedHubOptions, PyramidEmbedClient } from '@pyramid-embed/embed-js';

@@ -12,3 +12,3 @@ import { EmbedContainerProps } from '../internal-types';

componentDidUpdate(): void;
render(): JSX.Element;
render(): React.JSX.Element;
init(): Promise<void>;

@@ -15,0 +15,0 @@ embed(): void;

@@ -1,43 +0,25 @@

import { __awaiter, __extends, __generator } from "tslib";
import React, { Component } from 'react';
import { initializeAPI } from '../embed-utils';
var PyramidHubEmbedContainer = /** @class */ (function (_super) {
__extends(PyramidHubEmbedContainer, _super);
function PyramidHubEmbedContainer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.element = React.createRef();
return _this;
export class PyramidHubEmbedContainer extends Component {
constructor() {
super(...arguments);
this.element = React.createRef();
}
PyramidHubEmbedContainer.prototype.componentDidMount = function () {
componentDidMount() {
this.init();
};
PyramidHubEmbedContainer.prototype.componentDidUpdate = function () {
}
componentDidUpdate() {
this.embed();
};
PyramidHubEmbedContainer.prototype.render = function () {
}
render() {
return React.createElement("div", { ref: this.element, style: this.props.style, className: this.props.className });
};
PyramidHubEmbedContainer.prototype.init = function () {
return __awaiter(this, void 0, void 0, function () {
var host, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
host = this.props.host;
_a = this;
return [4 /*yield*/, initializeAPI(host, this.props)];
case 1:
_a.api = _b.sent();
this.embed();
return [2 /*return*/];
}
});
});
};
PyramidHubEmbedContainer.prototype.embed = function () {
}
async init() {
const { host } = this.props;
this.api = await initializeAPI(host, this.props);
this.embed();
}
embed() {
this.api.hub(this.element.current, this.props.options);
};
return PyramidHubEmbedContainer;
}(Component));
export { PyramidHubEmbedContainer };
//# sourceMappingURL=pyramid-hub-embed-container.js.map
}
}

@@ -1,59 +0,40 @@

import { __assign, __awaiter, __generator } from "tslib";
import { PyramidEmbedClient } from '@pyramid-embed/embed-js';
export function initializeAPI(host, loginData) {
return __awaiter(this, void 0, void 0, function () {
var api;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
api = new PyramidEmbedClient(host);
if (loginData.authFailureCallback) {
api.setAuthFailureCallback(loginData.authFailureCallback);
}
if (!!api.isLoggedIn) return [3 /*break*/, 2];
return [4 /*yield*/, authenticate(api, loginData)];
case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, api.init()];
case 3:
_a.sent();
return [2 /*return*/, api];
}
});
});
export async function initializeAPI(host, loginData) {
const api = new PyramidEmbedClient(host);
if (loginData.authFailureCallback) {
api.setAuthFailureCallback(loginData.authFailureCallback);
}
if (!api.isLoggedIn) {
await authenticate(api, loginData);
}
await api.init();
return api;
}
function authenticate(api, loginData) {
return __awaiter(this, void 0, void 0, function () {
var preparedLoginData, loginType, userName, password;
return __generator(this, function (_a) {
preparedLoginData = prepareLoginData(loginData);
loginType = preparedLoginData.loginType;
if (loginType === 'forms') {
userName = preparedLoginData.userName, password = preparedLoginData.password;
return [2 /*return*/, api.login(userName, password)];
}
else if (loginType === 'windows') {
return [2 /*return*/, api.loginWindowsAuth()];
}
else if (loginType === 'saml') {
return [2 /*return*/, api.loginSamlAuth(preparedLoginData.samlToken)];
}
else if (loginType === 'openid') {
return [2 /*return*/, api.loginOpenIdAuth(preparedLoginData.openIdToken)];
}
else if (preparedLoginData.authToken) {
api.setAuthToken(preparedLoginData.authToken);
return [2 /*return*/, preparedLoginData.authToken];
}
return [2 /*return*/, undefined];
});
});
async function authenticate(api, loginData) {
const preparedLoginData = prepareLoginData(loginData);
const { loginType } = preparedLoginData;
if (loginType === 'forms') {
const { userName, password } = preparedLoginData;
return api.login(userName, password);
}
else if (loginType === 'windows') {
return api.loginWindowsAuth();
}
else if (loginType === 'saml') {
return api.loginSamlAuth(preparedLoginData.samlToken);
}
else if (loginType === 'openid') {
return api.loginOpenIdAuth(preparedLoginData.openIdToken);
}
else if (preparedLoginData.authToken) {
api.setAuthToken(preparedLoginData.authToken);
return preparedLoginData.authToken;
}
return undefined;
}
function prepareLoginData(loginData) {
if (!loginData.loginType && loginData.userName && loginData.password) {
return __assign(__assign({}, loginData), { loginType: 'forms' });
return Object.assign(Object.assign({}, loginData), { loginType: 'forms' });
}
return loginData.loginType ? loginData : __assign(__assign({}, loginData), { loginType: 'none' });
return loginData.loginType ? loginData : Object.assign(Object.assign({}, loginData), { loginType: 'none' });
}
//# sourceMappingURL=embed-utils.js.map

@@ -5,2 +5,1 @@ export * from './types';

export * from '@pyramid-embed/embed-js';
//# sourceMappingURL=index.js.map
export {};
//# sourceMappingURL=internal-types.js.map
export {};
//# sourceMappingURL=types.js.map
{
"name": "@pyramid-embed/embed-react",
"version": "3.0.0",
"version": "4.0.0",
"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"
"clean" : "rimraf dist/",
"build": "npm run clean && tsc",
"build:publish": "npm run build && npm version patch && npm publish",
"build:publish:prod": "npm run build && npm publish",
"postinstall": "npm prune",
"build:package": "npm run build && npm pack"
},

@@ -16,16 +17,15 @@ "author": "Pyramid Analytics",

"dependencies": {
"@pyramid-embed/embed-js": "^3.0.0",
"react": "16.12.0",
"react-dom": "16.12.0",
"tslib": "2.5.0",
"typescript": "5.0.4"
"@pyramid-embed/embed-js": "^4.0.0",
"tslib": "^2.3.0"
},
"devDependencies": {
"@types/react": "16.9.19",
"@types/react-dom": "16.9.5",
"remove-files-webpack-plugin": "1.4.3",
"uglifyjs-webpack-plugin": "2.2.0",
"webpack": "4.43.0",
"webpack-cli": "3.3.12"
"@types/react": ">=16.0.0",
"@types/react-dom": ">=16.0.0",
"rimraf": "^5.0.5",
"typescript": "5.4.2"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
},
"files": [

@@ -32,0 +32,0 @@ "dist/**/*"

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