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

@wildberries/notifications

Package Overview
Dependencies
Maintainers
4
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wildberries/notifications - npm Package Compare versions

Comparing version 0.0.10-beta.3 to 0.0.10-beta.5

dist/redux-module/action-creator.d.ts

17

dist/components/container.d.ts
import { Component } from 'react';
import { Dispatch } from 'redux';
import { NotificationType } from '../types/types';
import { NotificationType, BaseAction, ActionsConfigType, ConfirmModalActionType } from '../types/types';
import { IMakeExternalActionParams } from './_types';
declare type PropsType = {
dispatch: Dispatch;
modalStack: Array<NotificationType>;
isConfirmModalOpened: boolean;
confirmModalParams: any;
confirmModalParams: ConfirmModalActionType;
closeConfirmModal: BaseAction;
dispatch: Dispatch;
};
export declare class WrappedContainer extends Component<PropsType> {
notificationModalRef: any;
closeModal: (id: string) => void;
closeModal: (id: string) => {
type: string;
payload: string;
};
makeExternalAction: ({ id, additionalActionType, additionalPayload, }: IMakeExternalActionParams) => void;
confirmModal: () => {
type: string;
payload: any;
};
getModalConfrmPropsConfig: () => ActionsConfigType;
render(): JSX.Element;

@@ -16,0 +25,0 @@ }

@@ -26,8 +26,9 @@ var __extends = (this && this.__extends) || (function () {

import React, { Component, createRef } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import classnames from 'classnames/bind';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import { Modal } from '@wildberries/ui-kit';
import { Modal, Text } from '@wildberries/ui-kit';
import { getConfirmModalParams, getIsConfirmModalOpened, getModalStackSelector, } from '../redux-module/selectors';
import { removeModalAction } from '../redux-module/actions';
import { removeModalAction, closeConfirmModalAction, } from '../redux-module/actions';
import { TIME_TO_ENTER_MODAL, TIME_TO_EXIT_MODAL, TIME_TO_HOLD_MODAL, } from '../constants';

@@ -42,6 +43,3 @@ import styles from '../styles/index.module.css';

_this.notificationModalRef = createRef();
_this.closeModal = function (id) {
var dispatch = _this.props.dispatch;
dispatch(removeModalAction(id));
};
_this.closeModal = function (id) { return _this.props.dispatch(removeModalAction(id)); };
_this.makeExternalAction = function (_a) {

@@ -56,2 +54,25 @@ var id = _a.id, additionalActionType = _a.additionalActionType, additionalPayload = _a.additionalPayload;

};
_this.confirmModal = function () {
return _this.props.confirmModalParams.confirmAction(_this.props.confirmModalParams.confirmActionParams);
};
_this.getModalConfrmPropsConfig = function () { return ({
actionButton: {
onClick: _this.confirmModal,
type: 'button',
withLoader: true,
isLoading: false,
size: 'big',
title: _this.props.confirmModalParams.confirmButtonProps.text,
variant: 'main',
},
cancelButton: {
onClick: _this.props.closeConfirmModal,
type: 'button',
withLoader: true,
isLoading: false,
size: 'big',
title: _this.props.confirmModalParams.cancelButtonProps.text,
variant: 'interface',
},
}); };
return _this;

@@ -61,29 +82,6 @@ }

var _this = this;
var modalStack = this.props.modalStack;
// eslint-disable-next-line
console.log('this.props.isConfirmModalOpened', this.props.isConfirmModalOpened);
var _a = this.props, modalStack = _a.modalStack, _b = _a.confirmModalParams, confirmModalText = _b.text, title = _b.title;
return (React.createElement(React.Fragment, null,
React.createElement(Modal, { actionsConfig: {
actionButton: {
// eslint-disable-next-line
onClick: function () { return console.log('onClick actionButton'); },
type: 'button',
withLoader: true,
isLoading: false,
size: 'big',
title: 'actionButton',
},
cancelButton: {
// eslint-disable-next-line
onClick: function () { return console.log('onClick cancelButton'); },
type: 'button',
withLoader: true,
isLoading: false,
size: 'big',
title: 'cancelButton',
},
}, isShowCloseIcon: true, isOpened: this.props.isConfirmModalOpened, isTransparent: true, onClose: function () {
// eslint-disable-next-line
return console.log('onClose');
}, title: "test", titleSize: "h1" }),
React.createElement(Modal, { actionsConfig: this.getModalConfrmPropsConfig(), isShowCloseIcon: true, isOpened: this.props.isConfirmModalOpened, isTransparent: true, onClose: this.props.closeConfirmModal, title: title, titleSize: "h1" },
React.createElement(Text, { text: confirmModalText, size: "h4", color: "black" })),
React.createElement(TransitionGroup, { className: cn('notificationModalsTransitionGroup') }, modalStack.map(function (_a) {

@@ -110,2 +108,8 @@ var status = _a.status, text = _a.text, id = _a.id, additionalActionType = _a.additionalActionType, additionalPayload = _a.additionalPayload;

}); };
export var Notifications = connect(mapStateToProps)(WrappedContainer);
var mapDispatchToProps = function (dispatch) {
return bindActionCreators({
closeConfirmModal: closeConfirmModalAction,
dispatch: dispatch,
}, dispatch);
};
export var Notifications = connect(mapStateToProps, mapDispatchToProps)(WrappedContainer);

@@ -9,1 +9,2 @@ export declare const TIME_TO_ENTER_MODAL = 500;

};
export declare const noop: () => void;

@@ -9,1 +9,2 @@ export var TIME_TO_ENTER_MODAL = 500;

};
export var noop = function () { };

@@ -6,1 +6,2 @@ export { setModalAction, removeModalAction, openConfirmModalAction, closeConfirmModalAction, } from './redux-module/actions';

export { NotificationsModal } from './components/notification-modal';
export { ConfirmModalActionType } from './types/types';

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

import { NotificationType, Action, BaseAction } from '../types/types';
import { NotificationType, Action, BaseAction, ConfirmModalActionType } from '../types/types';
export declare const SET_MODAL = "@notifications/SET_MODAL";

@@ -6,5 +6,9 @@ export declare const setModalAction: Action<Omit<NotificationType, 'id'>>;

export declare const removeModalAction: Action<string>;
export declare const OPEN_CONFIRM_MODAL = "@notifications/OPEN_CONFIRM_MODAL";
export declare const openConfirmModalAction: Action<any>;
export declare const SET_CONFIRM_MODAL = "@notifications/OPEN_CONFIRM_MODAL";
export declare const openConfirmModalAction: Action<ConfirmModalActionType>;
export declare const CLOSE_CONFIRM_MODAL = "@notifications/CLOSE_CONFIRM_MODAL";
export declare const closeConfirmModalAction: BaseAction;
export declare const CONFIRM_MODAL_LOADING_START = "@notifications/CONFIRM_MODAL_LOADING_START";
export declare const confirmModalLoadingStart: BaseAction;
export declare const CONFIRM_MODAL_LOADING_STOP = "@notifications/CONFIRM_MODAL_LOADING_STOP";
export declare const confirmModalLoadingStop: BaseAction;

@@ -23,5 +23,5 @@ var __assign = (this && this.__assign) || function () {

}); };
export var OPEN_CONFIRM_MODAL = '@notifications/OPEN_CONFIRM_MODAL';
export var SET_CONFIRM_MODAL = '@notifications/OPEN_CONFIRM_MODAL';
export var openConfirmModalAction = function (payload) { return ({
type: OPEN_CONFIRM_MODAL,
type: SET_CONFIRM_MODAL,
payload: payload,

@@ -33,1 +33,9 @@ }); };

}); };
export var CONFIRM_MODAL_LOADING_START = '@notifications/CONFIRM_MODAL_LOADING_START';
export var confirmModalLoadingStart = function () { return ({
type: CONFIRM_MODAL_LOADING_START,
}); };
export var CONFIRM_MODAL_LOADING_STOP = '@notifications/CONFIRM_MODAL_LOADING_STOP';
export var confirmModalLoadingStop = function () { return ({
type: CONFIRM_MODAL_LOADING_STOP,
}); };

@@ -6,3 +6,9 @@ import { INotificationsStorage } from '../types/types';

isModalOpened: boolean;
modalParams: import("../types/types").ConfirmModalActionType;
isConfirmModalLoading: boolean;
} | {
isModalOpened: boolean;
modalParams: any;
modals: import("../types/types").NotificationType[];
isConfirmModalLoading: boolean;
};

@@ -19,7 +19,19 @@ var __assign = (this && this.__assign) || function () {

};
import { SET_MODAL, REMOVE_MODAL, OPEN_CONFIRM_MODAL, CLOSE_CONFIRM_MODAL, } from './actions';
import { SET_MODAL, REMOVE_MODAL, SET_CONFIRM_MODAL, CLOSE_CONFIRM_MODAL, CONFIRM_MODAL_LOADING_START, CONFIRM_MODAL_LOADING_STOP, } from './actions';
export var initialState = {
modals: [],
isModalOpened: false,
modalParams: {},
modalParams: {
confirmAction: function () { return ({ type: 'DEFAULT_ACTION_TYPE', payload: {} }); },
confirmActionParams: null,
confirmButtonProps: {
text: '',
},
cancelButtonProps: {
text: '',
},
title: '',
text: '',
},
isConfirmModalLoading: false,
};

@@ -34,6 +46,10 @@ export var notificationsModuleReducer = function (state, _a) {

return __assign(__assign({}, state), { modals: state.modals.filter(function (modal) { return modal.id !== payload; }) });
case OPEN_CONFIRM_MODAL:
return __assign(__assign({}, state), { isModalOpened: true });
case SET_CONFIRM_MODAL:
return __assign(__assign({}, state), { isModalOpened: true, modalParams: payload });
case CLOSE_CONFIRM_MODAL:
return __assign(__assign({}, state), { isModalOpened: false });
case CONFIRM_MODAL_LOADING_START:
return __assign(__assign({}, state), { isConfirmModalLoading: true });
case CONFIRM_MODAL_LOADING_STOP:
return __assign(__assign({}, state), { isConfirmModalLoading: false });
default:

@@ -40,0 +56,0 @@ return state;

import { INotificationsStoragePart, INotificationsStorage } from '../types/types';
export declare const getModalStackSelector: import("reselect").OutputSelector<INotificationsStoragePart, import("../types/types").NotificationType[], (res: INotificationsStorage) => import("../types/types").NotificationType[]>;
export declare const getIsConfirmModalOpened: import("reselect").OutputSelector<INotificationsStoragePart, boolean, (res: INotificationsStorage) => boolean>;
export declare const getConfirmModalParams: import("reselect").OutputSelector<INotificationsStoragePart, any, (res: INotificationsStorage) => any>;
export declare const getConfirmModalParams: import("reselect").OutputSelector<INotificationsStoragePart, import("../types/types").ConfirmModalActionType, (res: INotificationsStorage) => import("../types/types").ConfirmModalActionType>;
import { MouseEvent } from 'react';
import { ButtonVariant, ButtonType, ButtonSize } from '@wildberries/ui-kit/lib/button/types';
import { notificationIconStatus } from '../constants';

@@ -24,3 +25,4 @@ import { NOTIFICATIONS_REDUCER_NAME } from '../redux-module/constants';

isModalOpened: boolean;
modalParams: any;
modalParams: ConfirmModalActionType;
isConfirmModalLoading: boolean;
}

@@ -37,1 +39,29 @@ export interface INotificationsStoragePart {

};
export declare type BaseButtonType = {
title: string;
type?: ButtonType;
variant?: ButtonVariant;
size?: ButtonSize;
isLoading?: boolean;
withLoader?: boolean;
};
export declare type ActionButtonType = BaseButtonType & {
onClick: () => void;
};
export declare type ActionsConfigType = {
actionButton?: ActionButtonType;
cancelButton?: ActionButtonType;
};
export declare type ConfirmModalActionType = {
title: string;
text: string;
confirmAction: Action<any>;
confirmActionParams: any;
confirmButtonProps: {
text: string;
};
cancelButtonProps: {
text: string;
action?: Action<any> | BaseAction;
};
};
{
"name": "@wildberries/notifications",
"version": "0.0.10-beta.3",
"version": "0.0.10-beta.5",
"description": "notifications module",

@@ -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