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

@bufferapp/notifications

Package Overview
Dependencies
Maintainers
17
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufferapp/notifications - npm Package Compare versions

Comparing version 1.9.4-beta-01 to 1.9.4-beta-02

50

lib/components/Notifications/index.js

@@ -1,8 +0,24 @@

import React from 'react';
import PropTypes from 'prop-types';
import { calculateStyles } from '@bufferapp/components/lib/utils';
import { transitionAnimationTime, transitionAnimationType } from '@bufferapp/components/style/animation';
import { Notification } from '@bufferapp/components';
'use strict';
const Notifications = ({ notifications, onNotificationClose }) => React.createElement(
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _utils = require('@bufferapp/components/lib/utils');
var _animation = require('@bufferapp/components/style/animation');
var _components = require('@bufferapp/components');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const Notifications = ({ notifications, onNotificationClose }) => _react2.default.createElement(
'div',

@@ -17,3 +33,3 @@ {

},
React.createElement(
_react2.default.createElement(
'div',

@@ -29,10 +45,10 @@ {

},
notifications.map(notification => React.createElement(
notifications.map(notification => _react2.default.createElement(
'div',
{
style: calculateStyles({
style: (0, _utils.calculateStyles)({
default: {
marginBottom: '1rem',
maxHeight: '100vh',
transition: `all ${transitionAnimationTime} ${transitionAnimationType}`
transition: `all ${_animation.transitionAnimationTime} ${_animation.transitionAnimationType}`
},

@@ -48,4 +64,4 @@ hidden: {

},
React.createElement(
Notification,
_react2.default.createElement(
_components.Notification,
{

@@ -62,9 +78,9 @@ type: notification.type,

Notifications.propTypes = {
notifications: PropTypes.arrayOf(PropTypes.shape({
type: Notification.propTypes.type,
message: PropTypes.string
notifications: _propTypes2.default.arrayOf(_propTypes2.default.shape({
type: _components.Notification.propTypes.type,
message: _propTypes2.default.string
})).isRequired,
onNotificationClose: PropTypes.func.isRequired
onNotificationClose: _propTypes2.default.func.isRequired
};
export default Notifications;
exports.default = Notifications;

@@ -1,7 +0,19 @@

import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { checkA11y } from 'storybook-addon-a11y';
import Notifications from './index';
'use strict';
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _react3 = require('@storybook/react');
var _addonActions = require('@storybook/addon-actions');
var _storybookAddonA11y = require('storybook-addon-a11y');
var _index = require('./index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const notifications = [{

@@ -17,8 +29,8 @@ type: 'success',

storiesOf('Notifications', module).addDecorator(checkA11y).add('default', () => React.createElement(Notifications, {
(0, _react3.storiesOf)('Notifications', module).addDecorator(_storybookAddonA11y.checkA11y).add('default', () => _react2.default.createElement(_index2.default, {
notifications: notifications,
onNotificationClose: action('on-notification-close')
})).add('1 notification', () => React.createElement(Notifications, {
onNotificationClose: (0, _addonActions.action)('on-notification-close')
})).add('1 notification', () => _react2.default.createElement(_index2.default, {
notifications: notifications.slice(0, 1),
onNotificationClose: action('on-notification-close')
onNotificationClose: (0, _addonActions.action)('on-notification-close')
}));

@@ -1,12 +0,25 @@

import React from 'react';
import { storiesOf } from '@storybook/react';
import { checkA11y } from 'storybook-addon-a11y';
import { Provider } from 'react-redux';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import Notifications, { reducer, actions, middleware } from '../../index';
'use strict';
const store = createStore(combineReducers({
notifications: reducer
}), {}, applyMiddleware(middleware));
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _react3 = require('@storybook/react');
var _storybookAddonA11y = require('storybook-addon-a11y');
var _reactRedux = require('react-redux');
var _redux = require('redux');
var _index = require('../../index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const store = (0, _redux.createStore)((0, _redux.combineReducers)({
notifications: _index.reducer
}), {}, (0, _redux.applyMiddleware)(_index.middleware));
const notificationPool = [{

@@ -26,13 +39,13 @@ notificationType: 'success',

storiesOf('Notifications - Test Harness', module).addDecorator(checkA11y).addDecorator(getStory => React.createElement(
Provider,
(0, _react3.storiesOf)('Notifications - Test Harness', module).addDecorator(_storybookAddonA11y.checkA11y).addDecorator(getStory => _react2.default.createElement(
_reactRedux.Provider,
{ store: store },
React.createElement(
_react2.default.createElement(
'div',
null,
getStory(),
React.createElement(
_react2.default.createElement(
'button',
{
onClick: () => store.dispatch(actions.createNotification(notificationPool[Math.floor(Math.random() * notificationPool.length)]))
onClick: () => store.dispatch(_index.actions.createNotification(notificationPool[Math.floor(Math.random() * notificationPool.length)]))
},

@@ -42,2 +55,2 @@ 'Create Notification'

)
)).add('default', () => React.createElement(Notifications, null));
)).add('default', () => _react2.default.createElement(_index2.default, null));

@@ -1,15 +0,43 @@

import { connect } from 'react-redux';
import { actions } from './reducer';
import Notifications from './components/Notifications';
'use strict';
export default connect(state => ({
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.middleware = exports.actionTypes = exports.actions = exports.reducer = undefined;
var _reducer2 = require('./reducer');
Object.defineProperty(exports, 'actions', {
enumerable: true,
get: function () {
return _reducer2.actions;
}
});
Object.defineProperty(exports, 'actionTypes', {
enumerable: true,
get: function () {
return _reducer2.actionTypes;
}
});
var _reactRedux = require('react-redux');
var _reducer3 = _interopRequireDefault(_reducer2);
var _Notifications = require('./components/Notifications');
var _Notifications2 = _interopRequireDefault(_Notifications);
var _middleware2 = require('./middleware');
var _middleware3 = _interopRequireDefault(_middleware2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _reactRedux.connect)(state => ({
notifications: state.notifications
}), dispatch => ({
onNotificationClose: notification => dispatch(actions.deleteNotification({ notification }))
}))(Notifications);
import _reducer from './reducer';
export { _reducer as reducer };
export { actions, actionTypes } from './reducer';
import _middleware from './middleware';
export { _middleware as middleware };
onNotificationClose: notification => dispatch(_reducer2.actions.deleteNotification({ notification }))
}))(_Notifications2.default);
exports.reducer = _reducer3.default;
exports.middleware = _middleware3.default;

@@ -0,16 +1,23 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _animation = require('@bufferapp/components/style/animation');
var _reducer = require('./reducer');
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import { transitionTimeMilliseconds } from '@bufferapp/components/style/animation';
import { actionTypes, actions } from './reducer';
export default (({ dispatch }) => next => action => {
exports.default = ({ dispatch }) => next => action => {
// eslint-disable-line no-unused-vars
next(action);
switch (action.type) {
case actionTypes.DELETE_NOTIFICATION:
setTimeout(() => dispatch(actions.deleteNotificationComplete({
case _reducer.actionTypes.DELETE_NOTIFICATION:
setTimeout(() => dispatch(_reducer.actions.deleteNotificationComplete({
notification: action.notification
})), transitionTimeMilliseconds);
})), _animation.transitionTimeMilliseconds);
break;
case actionTypes.CREATE_NOTIFICATION:
case _reducer.actionTypes.CREATE_NOTIFICATION:
{

@@ -20,3 +27,3 @@ const { type } = action,

setTimeout(() => {
dispatch(actions.createNotificationComplete({
dispatch(_reducer.actions.createNotificationComplete({
notification

@@ -26,3 +33,3 @@ }));

setTimeout(() => {
dispatch(actions.deleteNotification({
dispatch(_reducer.actions.deleteNotification({
notification

@@ -36,2 +43,2 @@ }));

}
});
};

@@ -0,9 +1,23 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.actions = exports.actionTypes = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _uuid = require('uuid');
var _uuid2 = _interopRequireDefault(_uuid);
var _keywrapper = require('@bufferapp/keywrapper');
var _keywrapper2 = _interopRequireDefault(_keywrapper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import uuid from 'uuid';
import keyWrapper from '@bufferapp/keywrapper';
export const actionTypes = keyWrapper('NOTIFICATIONS', {
const actionTypes = exports.actionTypes = (0, _keywrapper2.default)('NOTIFICATIONS', {
CREATE_NOTIFICATION: 0,

@@ -39,3 +53,3 @@ CREATE_NOTIFICATION_COMPLETE: 0,

export default ((state = initialState, action) => {
exports.default = (state = initialState, action) => {
switch (action.type) {

@@ -53,5 +67,5 @@ case actionTypes.CREATE_NOTIFICATION:

}
});
};
export const actions = {
const actions = exports.actions = {
createNotification: ({ notificationType = 'success', message }) => ({

@@ -61,3 +75,3 @@ type: actionTypes.CREATE_NOTIFICATION,

message,
key: uuid()
key: (0, _uuid2.default)()
}),

@@ -64,0 +78,0 @@ createNotificationComplete: ({ notification }) => ({

{
"name": "@bufferapp/notifications",
"version": "1.9.4-beta-01",
"version": "1.9.4-beta-02",
"description": "Display application notifications",

@@ -62,4 +62,3 @@ "main": "lib/index.js",

},
"browsers": "> 3%",
"modules": false
"browsers": "> 3%"
}

@@ -73,20 +72,3 @@ ],

"transform-object-rest-spread"
],
"env": {
"test": {
"presets": [
[
"env",
{
"modules": "commonjs"
}
]
],
"plugins": [
"transform-class-properties",
"transform-export-extensions",
"transform-object-rest-spread"
]
}
}
]
},

@@ -93,0 +75,0 @@ "eslintConfig": {

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