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

@twreporter/universal-header

Package Overview
Dependencies
Maintainers
4
Versions
342
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twreporter/universal-header - npm Package Compare versions

Comparing version 2.0.3-beta-3 to 2.0.3-beta-4

18

dist/components/icons.js

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

_this._handleLogIconClick = function (e, isAuthed, branch) {
_this._handleLogIconClick = function (e, isAuthed, releaseBranch) {
e.preventDefault();

@@ -140,7 +140,7 @@ var redirectURL = window.location.href;

if (isAuthed) {
window.location = _links.default.getLogoutLink(branch).to + '?' + query;
window.location = _links.default.getLogoutLink(releaseBranch).to + '?' + query;
return;
}
window.location = _links.default.getLoginLink(branch).to + '?' + query;
window.location = _links.default.getLoginLink(releaseBranch).to + '?' + query;
};

@@ -180,3 +180,3 @@

var isAuthed = _ref.isAuthed,
branch = _ref.branch,
releaseBranch = _ref.releaseBranch,
theme = _ref.theme;

@@ -190,3 +190,3 @@

onClick: function onClick(e) {
_this2._handleLogIconClick(e, isAuthed, branch);
_this2._handleLogIconClick(e, isAuthed, releaseBranch);
}

@@ -209,3 +209,3 @@ }, isAuthed ? _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(LogOutIcon, null), _react.default.createElement("span", null, _services.default.serviceLabels.logout)) : _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(LogInIcon, null), _react.default.createElement("span", null, _services.default.serviceLabels.login)));

}), _react.default.createElement(HideOnDesktop, null, _react.default.createElement(_headerContext.default.Consumer, null, function (_ref3) {
var branch = _ref3.branch,
var releaseBranch = _ref3.releaseBranch,
isLinkExternal = _ref3.isLinkExternal,

@@ -216,3 +216,3 @@ theme = _ref3.theme;

var link = _links.default.getSearchLink(isLinkExternal, branch);
var link = _links.default.getSearchLink(isLinkExternal, releaseBranch);

@@ -223,3 +223,3 @@ return _react.default.createElement(_customizedLink.default, link, _react.default.createElement(SearchIcon, null), _react.default.createElement("span", null, _services.default.serviceLabels.search));

}, _react.default.createElement(_headerContext.default.Consumer, null, function (_ref4) {
var branch = _ref4.branch,
var releaseBranch = _ref4.releaseBranch,
isLinkExternal = _ref4.isLinkExternal,

@@ -230,3 +230,3 @@ theme = _ref4.theme;

var link = _links.default.getBookmarksLink(isLinkExternal, branch);
var link = _links.default.getBookmarksLink(isLinkExternal, releaseBranch);

@@ -233,0 +233,0 @@ return _react.default.createElement(_customizedLink.default, link, _react.default.createElement(BookmarkIcon, null), _react.default.createElement("span", null, _services.default.serviceLabels.bookmarks));

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

return _react.default.createElement(_react.default.Fragment, null, slideDownPanelJSX, _react.default.createElement(_headerContext.default.Consumer, null, function (_ref) {
var branch = _ref.branch,
var releaseBranch = _ref.releaseBranch,
isLinkExternal = _ref.isLinkExternal,

@@ -113,3 +113,3 @@ theme = _ref.theme;

bgColor: bgColor
}, _react.default.createElement(_customizedLink.default, _links.default.getLogoLink(isLinkExternal, branch), _react.default.createElement(Logo, null)), _react.default.createElement(Hamburger, {
}, _react.default.createElement(_customizedLink.default, _links.default.getLogoLink(isLinkExternal, releaseBranch), _react.default.createElement(Logo, null)), _react.default.createElement(Hamburger, {
onClick: _this2.handleOnHamburgerClick

@@ -116,0 +116,0 @@ }, _react.default.createElement(Stroke, null), _react.default.createElement(Stroke, null), _react.default.createElement(Stroke, null)));

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

key: "_handleSubmit",
value: function _handleSubmit(e, branch, isLinkExternal) {
value: function _handleSubmit(e, releaseBranch, isLinkExternal) {
e.preventDefault();

@@ -139,3 +139,3 @@ var keywords = this.state.keywords;

if (window) {
window.location = "".concat(_links.default.getSearchLink(isLinkExternal, branch).to, "?q=").concat(keywords);
window.location = "".concat(_links.default.getSearchLink(isLinkExternal, releaseBranch).to, "?q=").concat(keywords);
}

@@ -173,7 +173,7 @@ }

}, !isSearchOpened ? null : _react.default.createElement(_headerContext.default.Consumer, null, function (_ref) {
var branch = _ref.branch,
var releaseBranch = _ref.releaseBranch,
isLinkExternal = _ref.isLinkExternal;
return _react.default.createElement(SearchBoxContainer, {
onSubmit: function onSubmit(e) {
_this2._handleSubmit(e, branch, isLinkExternal);
_this2._handleSubmit(e, releaseBranch, isLinkExternal);
},

@@ -180,0 +180,0 @@ onReset: _this2._onReset,

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

var branchPropTypes = _propTypes.default.oneOf([_releaseBranch.default.master, _releaseBranch.default.test, _releaseBranch.default.staging, _releaseBranch.default.release]);
var releaseBranchPropTypes = _propTypes.default.oneOf([_releaseBranch.default.master, _releaseBranch.default.test, _releaseBranch.default.staging, _releaseBranch.default.release]);

@@ -23,3 +23,3 @@ var themePropTypes = _propTypes.default.oneOf([_theme.default.normal, _theme.default.transparent, _theme.default.photography, _theme.default.index]);

theme: themePropTypes,
releaseBranch: branchPropTypes,
releaseBranch: releaseBranchPropTypes,
isLinkExternal: _propTypes.default.bool

@@ -26,0 +26,0 @@ };

@@ -289,4 +289,4 @@ "use strict";

key: "__prepareServiceProps",
value: function __prepareServiceProps(branch, isAuthed, isLinkExternal) {
var serviceLinks = _links.default.getServiceLinks(isLinkExternal, branch);
value: function __prepareServiceProps(releaseBranch, isAuthed, isLinkExternal) {
var serviceLinks = _links.default.getServiceLinks(isLinkExternal, releaseBranch);

@@ -324,3 +324,3 @@ var serviceProps = _services.default.serviceOrder.map(function (key) {

key: "__prepareChannelProps",
value: function __prepareChannelProps(branch, isLinkExternal) {
value: function __prepareChannelProps(releaseBranch, isLinkExternal) {
var channelProps = _channels.default.channelOrder.map(function (key) {

@@ -332,3 +332,3 @@ return {

pathname: _channels.default.channelPathnames[key],
link: _links.default.getChannelLinks(isLinkExternal, branch)[key]
link: _links.default.getChannelLinks(isLinkExternal, releaseBranch)[key]
};

@@ -341,3 +341,3 @@ });

key: "__prepareCategoriesProps",
value: function __prepareCategoriesProps(branch, isLinkExternal, channelProps) {
value: function __prepareCategoriesProps(releaseBranch, isLinkExternal, channelProps) {
channelProps[channelProps.length - 1].dropDownMenu = _categories.default.categoryOrder.map(function (key) {

@@ -348,3 +348,3 @@ return {

pathname: _categories.default.categoryPathnames[key],
link: _links.default.getCategoryLinks(isLinkExternal, branch)[key]
link: _links.default.getCategoryLinks(isLinkExternal, releaseBranch)[key]
};

@@ -351,0 +351,0 @@ });

@@ -41,3 +41,11 @@ "use strict";

//theme="normal"
//releaseBranch="staging"
///>
//<StandaloneHeader
//theme="photography"
//releaseBranch="release"
///>
//<StandaloneHeader
//theme="transparent"
///>
//</Provider>

@@ -44,0 +52,0 @@ //), document.getElementById('app'))

@@ -24,13 +24,13 @@ "use strict";

var defaultBranch = _releaseBranch.default.master;
var defaultReleaseBranch = _releaseBranch.default.master;
var defaultIsExternal = false;
function __getLinks(isExternal, branch, baseURL, paths) {
function __getLinks(isExternal, releaseBranch, baseURL, paths) {
var rtn = {};
if (isExternal) {
if (baseURL.hasOwnProperty(branch)) {
if (baseURL.hasOwnProperty(releaseBranch)) {
for (var key in paths) {
rtn[key] = {
to: baseURL[branch] + paths[key],
to: baseURL[releaseBranch] + paths[key],
isExternal: isExternal

@@ -54,7 +54,7 @@ };

function __getLink(isExternal, branch, baseURL, path) {
function __getLink(isExternal, releaseBranch, baseURL, path) {
if (isExternal) {
if (baseURL.hasOwnProperty(branch)) {
if (baseURL.hasOwnProperty(releaseBranch)) {
return {
to: baseURL[branch] + path,
to: baseURL[releaseBranch] + path,
isExternal: isExternal

@@ -77,4 +77,4 @@ };

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return __getLinks(isExternal, branch, _baseUrl.main, _categories.categoryPathnames);
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return __getLinks(isExternal, releaseBranch, _baseUrl.main, _categories.categoryPathnames);
}

@@ -84,10 +84,10 @@

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return __getLinks(isExternal, branch, _baseUrl.main, _channels.channelPathnames);
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return __getLinks(isExternal, releaseBranch, _baseUrl.main, _channels.channelPathnames);
}
function getLogoutLink() {
var branch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultBranch;
var releaseBranch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultReleaseBranch;
return {
to: _baseUrl.api[branch] + _services.servicePathnames.logout,
to: _baseUrl.api[releaseBranch] + _services.servicePathnames.logout,
isExternal: true

@@ -98,5 +98,5 @@ };

function getLoginLink() {
var branch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultBranch;
var releaseBranch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultReleaseBranch;
return {
to: _baseUrl.accounts[branch] + _services.servicePathnames.login,
to: _baseUrl.accounts[releaseBranch] + _services.servicePathnames.login,
isExternal: true

@@ -108,4 +108,4 @@ };

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return __getLink(isExternal, branch, _baseUrl.main, _services.servicePathnames.bookmarks);
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return __getLink(isExternal, releaseBranch, _baseUrl.main, _services.servicePathnames.bookmarks);
}

@@ -115,4 +115,4 @@

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return __getLink(isExternal, branch, _baseUrl.main, _services.servicePathnames.search);
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return __getLink(isExternal, releaseBranch, _baseUrl.main, _services.servicePathnames.search);
}

@@ -122,4 +122,4 @@

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return __getLink(isExternal, branch, _baseUrl.main, '');
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return __getLink(isExternal, releaseBranch, _baseUrl.main, '');
}

@@ -131,4 +131,4 @@

var isExternal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultIsExternal;
var branch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultBranch;
return _ref = {}, _defineProperty(_ref, _services.serviceKeys.bookmarks, getBookmarksLink(isExternal, branch)), _defineProperty(_ref, _services.serviceKeys.login, getLoginLink(branch)), _defineProperty(_ref, _services.serviceKeys.logout, getLogoutLink(branch)), _defineProperty(_ref, _services.serviceKeys.search, getSearchLink(isExternal, branch)), _defineProperty(_ref, _services.serviceKeys.support, {
var releaseBranch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultReleaseBranch;
return _ref = {}, _defineProperty(_ref, _services.serviceKeys.bookmarks, getBookmarksLink(isExternal, releaseBranch)), _defineProperty(_ref, _services.serviceKeys.login, getLoginLink(releaseBranch)), _defineProperty(_ref, _services.serviceKeys.logout, getLogoutLink(releaseBranch)), _defineProperty(_ref, _services.serviceKeys.search, getSearchLink(isExternal, releaseBranch)), _defineProperty(_ref, _services.serviceKeys.support, {
to: __getExternalLinks().monthlyDonation,

@@ -135,0 +135,0 @@ isExternal: true

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

function formAPIURL() {
var branch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _releaseBranch.default.master;
var releaseBranch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _releaseBranch.default.master;
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

@@ -25,3 +25,3 @@ var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

return "".concat(_baseUrl.api[branch]).concat(path).concat(query ? '?' + query : '');
return "".concat(_baseUrl.api[releaseBranch]).concat(path).concat(query ? '?' + query : '');
}

@@ -28,0 +28,0 @@

{
"name": "@twreporter/universal-header",
"version": "2.0.3-beta-3",
"version": "2.0.3-beta-4",
"description": "Universal header of TWReporter sites",

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

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