diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a56a7ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules + diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index bceb569..c1e592a 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -36,7 +36,11 @@ Neos: fusion: autoInclude: Psmb.Newsletter: true - + Ui: + resources: + javascript: + 'Psmb.Newsletter:NewsletterView': + resource: resource://Psmb.Newsletter/Public/JavaScript/NewsletterView/Plugin.js #Psmb: # Newsletter: # globalSettings: diff --git a/Resources/Private/NewsletterView/.editorconfig b/Resources/Private/NewsletterView/.editorconfig new file mode 100644 index 0000000..189444b --- /dev/null +++ b/Resources/Private/NewsletterView/.editorconfig @@ -0,0 +1,14 @@ +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.{yml,yaml}] +indent_size = 2 + +[*.{md}] +indent_size = 2 +trim_trailing_whitespace = false diff --git a/Resources/Private/NewsletterView/.nvmrc b/Resources/Private/NewsletterView/.nvmrc new file mode 100644 index 0000000..798e389 --- /dev/null +++ b/Resources/Private/NewsletterView/.nvmrc @@ -0,0 +1 @@ +6.3.0 diff --git a/Resources/Private/NewsletterView/package.json b/Resources/Private/NewsletterView/package.json new file mode 100644 index 0000000..b686f3f --- /dev/null +++ b/Resources/Private/NewsletterView/package.json @@ -0,0 +1,15 @@ +{ + "description": "NewsletterView", + "license": "MIT", + "private": true, + "scripts": { + "build": "neos-react-scripts build", + "watch": "neos-react-scripts watch" + }, + "devDependencies": { + "@neos-project/neos-ui-extensibility": "@dev" + }, + "neos": { + "buildTargetDirectory": "../../Public/JavaScript/NewsletterView" + } +} diff --git a/Resources/Private/NewsletterView/src/NewsletterView.js b/Resources/Private/NewsletterView/src/NewsletterView.js new file mode 100644 index 0000000..28065f2 --- /dev/null +++ b/Resources/Private/NewsletterView/src/NewsletterView.js @@ -0,0 +1,101 @@ +import React, {PropTypes, Component} from 'react'; +import {SelectBox, Button, Dialog, TextInput} from '@neos-project/react-ui-components'; +import {connect} from 'react-redux'; +import {selectors} from '@neos-project/neos-ui-redux-store'; +import {neos} from '@neos-project/neos-ui-decorators'; +import {$get} from 'plow-js'; +import TestConfirmationDialog from './TestConfirmationDialog'; + +const fetchSubscriptions = nodeType => fetch(`/newsletter/getSubscriptions?nodeType=${nodeType}`, { + credentials: 'include' +}).then(response => response.json()); + +const sendNewsletter = (isTest, email) => { + const sendEndpointUrl = isTest ? '/newsletter/testSend' : '/newsletter/send'; + const csrfToken = document.getElementById('appContainer').dataset.csrfToken; + const data = new URLSearchParams(); + data.set('node', this.props.focusedNodeContextPath.replace(/user-.+\;/, 'live;')); + data.set('subscription', this.state.selectedSubscription); + data.set('__csrfToken', csrfToken); + if (isTest && email) { + data.set('email', email); + } + fetch(sendEndpointUrl, { + credentials: 'include', + method: 'POST', + body: data + }) + .then(response => response.json()); +}; + +@neos(globalRegistry => ({ + i18nRegistry: globalRegistry.get('i18n') +})) +@connect(state => ({ + focusedNodeContextPath: selectors.CR.Nodes.focusedNodePathSelector(state), + getNodeByContextPath: selectors.CR.Nodes.nodeByContextPath(state) +})) +export default class NewsletterView extends Component { + + static propTypes = { + focusedNodeContextPath: PropTypes.string, + getNodeByContextPath: PropTypes.func.isRequired + }; + + constructor(props) { + super(props); + this.state = { + subscriptions: [], + selectedSubscription: null, + confirmationDialogIsOpen: false, + isError: null, + isSent: null + }; + this.selectSubscription = this.selectSubscription.bind(this); + this.sendTestNewsletter = this.sendTestNewsletter.bind(this); + this.toggleTestConfirmationDialog = this.toggleTestConfirmationDialog.bind(this); + } + + componentDidMount() { + const node = this.props.getNodeByContextPath(this.props.focusedNodeContextPath); + const nodeType = $get('nodeType', node); + if (nodeType) { + fetchSubscriptions(nodeType).then(json => this.setState({subscriptions: json})); + } + } + + toggleTestConfirmationDialog(isOpen) { + this.setState({confirmationDialogIsOpen: isOpen}) + } + + selectSubscription(value) { + this.setState({selectedSubscription: value}); + } + + sendTestNewsletter(email) { + const isTest = true; + sendNewsletter(isTest, email).then(json => json.status === 'success' ? this.setState({isSent: true}) : this.setState({isError: true})); + this.toggleTestConfirmationDialog(false); + } + + render() { + return ( +
+ + + + + toggleTestConfirmationDialog(false)} + send={this.sendTestNewsletter} + /> +
+ ); + } +} diff --git a/Resources/Private/NewsletterView/src/TestConfirmationDialog.js b/Resources/Private/NewsletterView/src/TestConfirmationDialog.js new file mode 100644 index 0000000..5b7e539 --- /dev/null +++ b/Resources/Private/NewsletterView/src/TestConfirmationDialog.js @@ -0,0 +1,40 @@ +import React, {PropTypes, Component} from 'react'; +import {SelectBox, Button, Dialog, TextInput} from '@neos-project/react-ui-components'; + +export default class TestConfirmationDialog extends Component { + + static propTypes = { + isOpen: PropTypes.bool, + translate: PropTypes.func.isRequired, + close: PropTypes.func.isRequired, + send: PropTypes.func.isRequired + }; + + constructor(props) { + super(props); + this.state = { + email: '' + }; + } + + render() { + const {isOpen, translate, close, send} = this.props; + return ( + {translate('Neos.Neos:Main:cancel')}, + + ]} + > + {translate('Psmb.Newsletter:Main:js.testEmailLabel')} + this.setState({email})} + value={this.state.email} + /> + + ); + } +} diff --git a/Resources/Private/NewsletterView/src/index.js b/Resources/Private/NewsletterView/src/index.js new file mode 100644 index 0000000..5d7b08f --- /dev/null +++ b/Resources/Private/NewsletterView/src/index.js @@ -0,0 +1 @@ +require('./manifest'); diff --git a/Resources/Private/NewsletterView/src/manifest.js b/Resources/Private/NewsletterView/src/manifest.js new file mode 100644 index 0000000..e8287da --- /dev/null +++ b/Resources/Private/NewsletterView/src/manifest.js @@ -0,0 +1,10 @@ +import manifest from '@neos-project/neos-ui-extensibility'; +import NewsletterView from './NewsletterView'; + +manifest('Psmb.Newsletter:NewsletterView', {}, globalRegistry => { + const viewsRegistry = globalRegistry.get('inspector').get('views'); + + viewsRegistry.add('Psmb.Newsletter/Views/NewsletterView', { + component: NewsletterView + }); +}); diff --git a/Resources/Public/JavaScript/NewsletterView/Plugin.js b/Resources/Public/JavaScript/NewsletterView/Plugin.js new file mode 100644 index 0000000..747829e --- /dev/null +++ b/Resources/Public/JavaScript/NewsletterView/Plugin.js @@ -0,0 +1,593 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + __webpack_require__(1); + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _neosUiExtensibility = __webpack_require__(2); + + var _neosUiExtensibility2 = _interopRequireDefault(_neosUiExtensibility); + + var _NewsletterView = __webpack_require__(7); + + var _NewsletterView2 = _interopRequireDefault(_NewsletterView); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + (0, _neosUiExtensibility2.default)('Psmb.Newsletter:NewsletterView', {}, function (globalRegistry) { + var viewsRegistry = globalRegistry.get('inspector').get('views'); + + viewsRegistry.add('Psmb.Newsletter/Views/NewsletterView', { + component: _NewsletterView2.default + }); + }); + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.createConsumerApi = undefined; + + var _createConsumerApi = __webpack_require__(3); + + var _createConsumerApi2 = _interopRequireDefault(_createConsumerApi); + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = (0, _readFromConsumerApi2.default)('manifest'); + exports.createConsumerApi = _createConsumerApi2.default; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = createConsumerApi; + + var _package = __webpack_require__(4); + + var _manifest = __webpack_require__(5); + + var _manifest2 = _interopRequireDefault(_manifest); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var createReadOnlyValue = function createReadOnlyValue(value) { + return { + value: value, + writable: false, + enumerable: false, + configurable: true + }; + }; + + function createConsumerApi(manifests, exposureMap) { + var api = {}; + + Object.keys(exposureMap).forEach(function (key) { + Object.defineProperty(api, key, createReadOnlyValue(exposureMap[key])); + }); + + Object.defineProperty(api, '@manifest', createReadOnlyValue((0, _manifest2.default)(manifests))); + + Object.defineProperty(window, '@Neos:HostPluginAPI', createReadOnlyValue(api)); + Object.defineProperty(window['@Neos:HostPluginAPI'], 'VERSION', createReadOnlyValue(_package.version)); + } + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + module.exports = { + "name": "@neos-project/neos-ui-extensibility", + "version": "1.0.0-beta3", + "description": "Extensibility mechanisms for the Neos CMS UI", + "main": "./src/index.js", + "scripts": { + "prebuild": "check-dependencies && yarn clean", + "test": "yarn jest", + "test:watch": "yarn jest -- --watch", + "build": "exit 0", + "build:watch": "exit 0", + "clean": "rimraf ./lib ./dist", + "lint": "eslint src", + "jest": "PWD=$(pwd) NODE_ENV=test jest -w 1 --coverage" + }, + "dependencies": { + "@neos-project/build-essentials": "1.0.0-beta3", + "babel-core": "^6.13.2", + "babel-eslint": "^7.1.1", + "babel-loader": "^6.2.4", + "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-plugin-transform-object-rest-spread": "^6.20.1", + "babel-plugin-webpack-alias": "^2.1.1", + "babel-preset-es2015": "^6.13.2", + "babel-preset-react": "^6.3.13", + "babel-preset-stage-0": "^6.3.13", + "chalk": "^1.1.3", + "css-loader": "^0.26.0", + "file-loader": "^0.10.0", + "json-loader": "^0.5.4", + "postcss-loader": "^1.0.0", + "react-dev-utils": "^0.5.0", + "style-loader": "^0.13.1" + }, + "bin": { + "neos-react-scripts": "./bin/neos-react-scripts.js" + }, + "jest": { + "transformIgnorePatterns": [], + "setupFiles": [ + "./node_modules/@neos-project/build-essentials/src/setup-browser-env.js" + ], + "transform": { + "neos-ui-extensibility/src/.+\\.jsx?$": "./node_modules/.bin/babel-jest", + "node_modules/@neos-project/.+\\.jsx?$": "./node_modules/.bin/babel-jest" + } + } + }; + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + exports.default = function (manifests) { + return function manifest(identifier, options, bootstrap) { + manifests.push(_defineProperty({}, identifier, { + options: options, + bootstrap: bootstrap + })); + }; + }; + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = readFromConsumerApi; + function readFromConsumerApi(key) { + return function () { + if (window['@Neos:HostPluginAPI'] && window['@Neos:HostPluginAPI']['@' + key]) { + var _window$NeosHostPlu; + + return (_window$NeosHostPlu = window['@Neos:HostPluginAPI'])['@' + key].apply(_window$NeosHostPlu, arguments); + } + + throw new Error('You are trying to read from a consumer api that hasn\'t been initialized yet!'); + }; + } + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = undefined; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _dec, _dec2, _class, _class2, _temp; + + var _react = __webpack_require__(8); + + var _react2 = _interopRequireDefault(_react); + + var _reactUiComponents = __webpack_require__(9); + + var _reactRedux = __webpack_require__(10); + + var _neosUiReduxStore = __webpack_require__(11); + + var _neosUiDecorators = __webpack_require__(12); + + var _plowJs = __webpack_require__(13); + + var _TestConfirmationDialog = __webpack_require__(15); + + var _TestConfirmationDialog2 = _interopRequireDefault(_TestConfirmationDialog); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var fetchSubscriptions = function fetchSubscriptions(nodeType) { + return fetch('/newsletter/getSubscriptions?nodeType=' + nodeType, { + credentials: 'include' + }).then(function (response) { + return response.json(); + }); + }; + + var sendNewsletter = function sendNewsletter(isTest, email) { + var sendEndpointUrl = isTest ? '/newsletter/testSend' : '/newsletter/send'; + var csrfToken = document.getElementById('appContainer').dataset.csrfToken; + var data = new URLSearchParams(); + data.set('node', undefined.props.focusedNodeContextPath.replace(/user-.+\;/, 'live;')); + data.set('subscription', undefined.state.selectedSubscription); + data.set('__csrfToken', csrfToken); + if (isTest && email) { + data.set('email', email); + } + fetch(sendEndpointUrl, { + credentials: 'include', + method: 'POST', + body: data + }).then(function (response) { + return response.json(); + }); + }; + + var NewsletterView = (_dec = (0, _neosUiDecorators.neos)(function (globalRegistry) { + return { + i18nRegistry: globalRegistry.get('i18n') + }; + }), _dec2 = (0, _reactRedux.connect)(function (state) { + return { + focusedNodeContextPath: _neosUiReduxStore.selectors.CR.Nodes.focusedNodePathSelector(state), + getNodeByContextPath: _neosUiReduxStore.selectors.CR.Nodes.nodeByContextPath(state) + }; + }), _dec(_class = _dec2(_class = (_temp = _class2 = function (_Component) { + _inherits(NewsletterView, _Component); + + function NewsletterView(props) { + _classCallCheck(this, NewsletterView); + + var _this = _possibleConstructorReturn(this, (NewsletterView.__proto__ || Object.getPrototypeOf(NewsletterView)).call(this, props)); + + _this.state = { + subscriptions: [], + selectedSubscription: null, + confirmationDialogIsOpen: false, + isError: null, + isSent: null + }; + _this.selectSubscription = _this.selectSubscription.bind(_this); + _this.sendTestNewsletter = _this.sendTestNewsletter.bind(_this); + _this.toggleTestConfirmationDialog = _this.toggleTestConfirmationDialog.bind(_this); + return _this; + } + + _createClass(NewsletterView, [{ + key: 'componentDidMount', + value: function componentDidMount() { + var _this2 = this; + + var node = this.props.getNodeByContextPath(this.props.focusedNodeContextPath); + var nodeType = (0, _plowJs.$get)('nodeType', node); + if (nodeType) { + fetchSubscriptions(nodeType).then(function (json) { + return _this2.setState({ subscriptions: json }); + }); + } + } + }, { + key: 'toggleTestConfirmationDialog', + value: function toggleTestConfirmationDialog(isOpen) { + this.setState({ confirmationDialogIsOpen: isOpen }); + } + }, { + key: 'selectSubscription', + value: function selectSubscription(value) { + this.setState({ selectedSubscription: value }); + } + }, { + key: 'sendTestNewsletter', + value: function sendTestNewsletter(email) { + var _this3 = this; + + var isTest = true; + sendNewsletter(isTest, email).then(function (json) { + return json.status === 'success' ? _this3.setState({ isSent: true }) : _this3.setState({ isError: true }); + }); + this.toggleTestConfirmationDialog(false); + } + }, { + key: 'render', + value: function render() { + var _this4 = this; + + return _react2.default.createElement( + 'div', + null, + _react2.default.createElement(_reactUiComponents.SelectBox, { + value: this.state.selectedSubscription, + options: this.state.subscriptions, + onValueChange: this.selectSubscription + }), + _react2.default.createElement( + _reactUiComponents.Button, + { style: 'brand', onClick: function onClick() { + return _this4.toggleTestConfirmationDialog(true); + } }, + this.props.i18nRegistry.translate('Psmb.Newsletter:Main:js.send') + ), + _react2.default.createElement( + _reactUiComponents.Button, + { style: 'clean', onClick: function onClick() { + return _this4.toggleTestConfirmationDialog(true); + } }, + this.props.i18nRegistry.translate('Psmb.Newsletter:Main:js.test') + ), + _react2.default.createElement(_TestConfirmationDialog2.default, { + isOpen: this.state.confirmationDialogIsOpen, + translate: this.props.i18nRegistry.translate.bind(this.props.i18nRegistry), + close: function close() { + return toggleTestConfirmationDialog(false); + }, + send: this.sendTestNewsletter + }) + ); + } + }]); + + return NewsletterView; + }(_react.Component), _class2.propTypes = { + focusedNodeContextPath: _react.PropTypes.string, + getNodeByContextPath: _react.PropTypes.func.isRequired + }, _temp)) || _class) || _class); + exports.default = NewsletterView; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('vendor')().React; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('NeosProjectPackages')().ReactUiComponents; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('vendor')().reactRedux; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('NeosProjectPackages')().NeosUiReduxStore; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('NeosProjectPackages')().NeosUiDecorators; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _readFromConsumerApi = __webpack_require__(6); + + var _readFromConsumerApi2 = _interopRequireDefault(_readFromConsumerApi); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + module.exports = (0, _readFromConsumerApi2.default)('vendor')().plow; + +/***/ }), +/* 14 */, +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = undefined; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _class, _temp; + + var _react = __webpack_require__(8); + + var _react2 = _interopRequireDefault(_react); + + var _reactUiComponents = __webpack_require__(9); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var TestConfirmationDialog = (_temp = _class = function (_Component) { + _inherits(TestConfirmationDialog, _Component); + + function TestConfirmationDialog(props) { + _classCallCheck(this, TestConfirmationDialog); + + var _this = _possibleConstructorReturn(this, (TestConfirmationDialog.__proto__ || Object.getPrototypeOf(TestConfirmationDialog)).call(this, props)); + + _this.state = { + email: '' + }; + return _this; + } + + _createClass(TestConfirmationDialog, [{ + key: 'render', + value: function render() { + var _this2 = this; + + var _props = this.props, + isOpen = _props.isOpen, + translate = _props.translate, + close = _props.close, + send = _props.send; + + return _react2.default.createElement( + _reactUiComponents.Dialog, + { + isOpen: isOpen, + title: translate('Psmb.Newsletter:Main:js.testConfirmationTitle'), + onRequestClose: close, + actions: [_react2.default.createElement( + _reactUiComponents.Button, + { onClick: close, style: 'clean' }, + translate('Neos.Neos:Main:cancel') + ), _react2.default.createElement( + _reactUiComponents.Button, + { onClick: function onClick() { + return send(_this2.state.email); + }, style: 'brand' }, + translate('Psmb.Newsletter:Main:js.send') + )] + }, + translate('Psmb.Newsletter:Main:js.testEmailLabel'), + _react2.default.createElement(_reactUiComponents.TextInput, { + onChange: function onChange(email) { + return _this2.setState({ email: email }); + }, + value: this.state.email + }) + ); + } + }]); + + return TestConfirmationDialog; + }(_react.Component), _class.propTypes = { + isOpen: _react.PropTypes.bool, + translate: _react.PropTypes.func.isRequired, + close: _react.PropTypes.func.isRequired, + send: _react.PropTypes.func.isRequired + }, _temp); + exports.default = TestConfirmationDialog; + +/***/ }) +/******/ ]); +//# sourceMappingURL=Plugin.js.map \ No newline at end of file diff --git a/Resources/Public/JavaScript/NewsletterView/Plugin.js.map b/Resources/Public/JavaScript/NewsletterView/Plugin.js.map new file mode 100644 index 0000000..e93682e --- /dev/null +++ b/Resources/Public/JavaScript/NewsletterView/Plugin.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap 824c5c075dfb6053e1ab","webpack:///./src/index.js","webpack:///./src/manifest.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/createConsumerApi.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/package.json","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/manifest.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/readFromConsumerApi.js","webpack:///./src/NewsletterView.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/react/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/react-ui-components/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/react-redux/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-redux-store/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-decorators/index.js","webpack:////home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/plow-js/index.js","webpack:///./src/TestConfirmationDialog.js"],"names":["require","viewsRegistry","globalRegistry","get","add","component","createConsumerApi","createReadOnlyValue","value","writable","enumerable","configurable","manifests","exposureMap","api","Object","keys","forEach","defineProperty","key","window","manifest","identifier","options","bootstrap","push","readFromConsumerApi","Error","fetchSubscriptions","fetch","nodeType","credentials","then","response","json","sendNewsletter","isTest","email","sendEndpointUrl","csrfToken","document","getElementById","dataset","data","URLSearchParams","set","props","focusedNodeContextPath","replace","state","selectedSubscription","method","body","NewsletterView","i18nRegistry","CR","Nodes","focusedNodePathSelector","getNodeByContextPath","nodeByContextPath","subscriptions","confirmationDialogIsOpen","isError","isSent","selectSubscription","bind","sendTestNewsletter","toggleTestConfirmationDialog","node","setState","isOpen","status","translate","propTypes","string","func","isRequired","module","exports","React","ReactUiComponents","reactRedux","NeosUiReduxStore","NeosUiDecorators","plow","TestConfirmationDialog","close","send","bool"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;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IAD5B;;AAEL,oBACI;AAAA;AAAA;AACI,6BAAQjB,MADZ;AAEI,4BAAOE,UAAU,+CAAV,CAFX;AAGI,qCAAgBc,KAHpB;AAII,8BAAS,CACL;AAAA;AAAA,2BAAQ,SAASA,KAAjB,EAAwB,OAAM,OAA9B;AAAuCd,mCAAU,uBAAV;AAAvC,sBADK,EAEL;AAAA;AAAA,2BAAQ,SAAS;AAAA,wCAAMe,KAAK,OAAKtC,KAAL,CAAWZ,KAAhB,CAAN;AAAA,8BAAjB,EAA+C,OAAM,OAArD;AAA8DmC,mCAAU,8BAAV;AAA9D,sBAFK;AAJb;AASKA,2BAAU,wCAAV,CATL;AAUI;AACI,+BAAU;AAAA,gCAAS,OAAKH,QAAL,CAAc,EAAChC,YAAD,EAAd,CAAT;AAAA,sBADd;AAEI,4BAAO,KAAKY,KAAL,CAAWZ;AAFtB;AAVJ,cADJ;AAiBH;;;;6BAjCMoC,S,GAAY;AACfH,aAAQ,iBAAUkB,IADH;AAEfhB,gBAAW,iBAAUG,IAAV,CAAeC,UAFX;AAGfU,YAAO,iBAAUX,IAAV,CAAeC,UAHP;AAIfW,WAAM,iBAAUZ,IAAV,CAAeC;AAJN,E;mBAFFS,sB","file":"Plugin.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 824c5c075dfb6053e1ab","require('./manifest');\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import manifest from '@neos-project/neos-ui-extensibility';\nimport NewsletterView from './NewsletterView';\n\nmanifest('Psmb.Newsletter:NewsletterView', {}, globalRegistry => {\n const viewsRegistry = globalRegistry.get('inspector').get('views');\n\n viewsRegistry.add('Psmb.Newsletter/Views/NewsletterView', {\n component: NewsletterView\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./src/manifest.js","import createConsumerApi from './createConsumerApi';\nimport readFromConsumerApi from './readFromConsumerApi';\n\nexport default readFromConsumerApi('manifest');\n\nexport {\n createConsumerApi\n};\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/index.js","import {version} from '../package.json';\nimport createManifestFunction from './manifest';\n\nconst createReadOnlyValue = value => ({\n value,\n writable: false,\n enumerable: false,\n configurable: true\n});\n\nexport default function createConsumerApi(manifests, exposureMap) {\n const api = {};\n\n Object.keys(exposureMap).forEach(key => {\n Object.defineProperty(api, key, createReadOnlyValue(exposureMap[key]));\n });\n\n Object.defineProperty(api, '@manifest', createReadOnlyValue(\n createManifestFunction(manifests)\n ));\n\n Object.defineProperty(window, '@Neos:HostPluginAPI', createReadOnlyValue(api));\n Object.defineProperty(window['@Neos:HostPluginAPI'], 'VERSION', createReadOnlyValue(version));\n}\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/createConsumerApi.js","module.exports = {\n\t\"name\": \"@neos-project/neos-ui-extensibility\",\n\t\"version\": \"1.0.0-beta3\",\n\t\"description\": \"Extensibility mechanisms for the Neos CMS UI\",\n\t\"main\": \"./src/index.js\",\n\t\"scripts\": {\n\t\t\"prebuild\": \"check-dependencies && yarn clean\",\n\t\t\"test\": \"yarn jest\",\n\t\t\"test:watch\": \"yarn jest -- --watch\",\n\t\t\"build\": \"exit 0\",\n\t\t\"build:watch\": \"exit 0\",\n\t\t\"clean\": \"rimraf ./lib ./dist\",\n\t\t\"lint\": \"eslint src\",\n\t\t\"jest\": \"PWD=$(pwd) NODE_ENV=test jest -w 1 --coverage\"\n\t},\n\t\"dependencies\": {\n\t\t\"@neos-project/build-essentials\": \"1.0.0-beta3\",\n\t\t\"babel-core\": \"^6.13.2\",\n\t\t\"babel-eslint\": \"^7.1.1\",\n\t\t\"babel-loader\": \"^6.2.4\",\n\t\t\"babel-plugin-transform-decorators-legacy\": \"^1.3.4\",\n\t\t\"babel-plugin-transform-object-rest-spread\": \"^6.20.1\",\n\t\t\"babel-plugin-webpack-alias\": \"^2.1.1\",\n\t\t\"babel-preset-es2015\": \"^6.13.2\",\n\t\t\"babel-preset-react\": \"^6.3.13\",\n\t\t\"babel-preset-stage-0\": \"^6.3.13\",\n\t\t\"chalk\": \"^1.1.3\",\n\t\t\"css-loader\": \"^0.26.0\",\n\t\t\"file-loader\": \"^0.10.0\",\n\t\t\"json-loader\": \"^0.5.4\",\n\t\t\"postcss-loader\": \"^1.0.0\",\n\t\t\"react-dev-utils\": \"^0.5.0\",\n\t\t\"style-loader\": \"^0.13.1\"\n\t},\n\t\"bin\": {\n\t\t\"neos-react-scripts\": \"./bin/neos-react-scripts.js\"\n\t},\n\t\"jest\": {\n\t\t\"transformIgnorePatterns\": [],\n\t\t\"setupFiles\": [\n\t\t\t\"./node_modules/@neos-project/build-essentials/src/setup-browser-env.js\"\n\t\t],\n\t\t\"transform\": {\n\t\t\t\"neos-ui-extensibility/src/.+\\\\.jsx?$\": \"./node_modules/.bin/babel-jest\",\n\t\t\t\"node_modules/@neos-project/.+\\\\.jsx?$\": \"./node_modules/.bin/babel-jest\"\n\t\t}\n\t}\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/package.json\n// module id = 4\n// module chunks = 0","export default manifests => {\n return function manifest(identifier, options, bootstrap) {\n manifests.push({\n [identifier]: {\n options,\n bootstrap\n }\n });\n };\n};\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/manifest.js","export default function readFromConsumerApi(key) {\n return (...args) => {\n if (window['@Neos:HostPluginAPI'] && window['@Neos:HostPluginAPI'][`@${key}`]) {\n return window['@Neos:HostPluginAPI'][`@${key}`](...args);\n }\n\n throw new Error(`You are trying to read from a consumer api that hasn't been initialized yet!`);\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/readFromConsumerApi.js","import React, {PropTypes, Component} from 'react';\nimport {SelectBox, Button, Dialog, TextInput} from '@neos-project/react-ui-components';\nimport {connect} from 'react-redux';\nimport {selectors} from '@neos-project/neos-ui-redux-store';\nimport {neos} from '@neos-project/neos-ui-decorators';\nimport {$get} from 'plow-js';\nimport TestConfirmationDialog from './TestConfirmationDialog';\n\nconst fetchSubscriptions = nodeType => fetch(`/newsletter/getSubscriptions?nodeType=${nodeType}`, {\n credentials: 'include'\n}).then(response => response.json());\n\nconst sendNewsletter = (isTest, email) => {\n const sendEndpointUrl = isTest ? '/newsletter/testSend' : '/newsletter/send';\n const csrfToken = document.getElementById('appContainer').dataset.csrfToken;\n const data = new URLSearchParams();\n data.set('node', this.props.focusedNodeContextPath.replace(/user-.+\\;/, 'live;'));\n data.set('subscription', this.state.selectedSubscription);\n data.set('__csrfToken', csrfToken);\n if (isTest && email) {\n data.set('email', email);\n }\n fetch(sendEndpointUrl, {\n credentials: 'include',\n method: 'POST',\n body: data\n })\n .then(response => response.json());\n};\n\n@neos(globalRegistry => ({\n i18nRegistry: globalRegistry.get('i18n')\n}))\n@connect(state => ({\n focusedNodeContextPath: selectors.CR.Nodes.focusedNodePathSelector(state),\n getNodeByContextPath: selectors.CR.Nodes.nodeByContextPath(state)\n}))\nexport default class NewsletterView extends Component {\n\n static propTypes = {\n focusedNodeContextPath: PropTypes.string,\n getNodeByContextPath: PropTypes.func.isRequired\n };\n\n constructor(props) {\n super(props);\n this.state = {\n subscriptions: [],\n selectedSubscription: null,\n confirmationDialogIsOpen: false,\n isError: null,\n isSent: null\n };\n this.selectSubscription = this.selectSubscription.bind(this);\n this.sendTestNewsletter = this.sendTestNewsletter.bind(this);\n this.toggleTestConfirmationDialog = this.toggleTestConfirmationDialog.bind(this);\n }\n\n componentDidMount() {\n const node = this.props.getNodeByContextPath(this.props.focusedNodeContextPath);\n const nodeType = $get('nodeType', node);\n if (nodeType) {\n fetchSubscriptions(nodeType).then(json => this.setState({subscriptions: json}));\n }\n }\n\n toggleTestConfirmationDialog(isOpen) {\n this.setState({confirmationDialogIsOpen: isOpen})\n }\n\n selectSubscription(value) {\n this.setState({selectedSubscription: value});\n }\n\n sendTestNewsletter(email) {\n const isTest = true;\n sendNewsletter(isTest, email).then(json => json.status === 'success' ? this.setState({isSent: true}) : this.setState({isError: true}));\n this.toggleTestConfirmationDialog(false);\n }\n\n render() {\n return (\n
\n \n \n \n\n toggleTestConfirmationDialog(false)}\n send={this.sendTestNewsletter}\n />\n
\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/NewsletterView.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('vendor')().React;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/react/index.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('NeosProjectPackages')().ReactUiComponents;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/react-ui-components/index.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('vendor')().reactRedux;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/react-redux/index.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('NeosProjectPackages')().NeosUiReduxStore;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-redux-store/index.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('NeosProjectPackages')().NeosUiDecorators;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/neosProjectPackages/neos-ui-decorators/index.js","import readFromConsumerApi from '../../../readFromConsumerApi';\n\nmodule.exports = readFromConsumerApi('vendor')().plow;\n\n\n\n// WEBPACK FOOTER //\n// /home/dimaip/docker/sfi.ru/data/releases/current/Packages/Application/Neos.Neos.Ui/packages/neos-ui-extensibility/src/shims/vendor/plow-js/index.js","import React, {PropTypes, Component} from 'react';\nimport {SelectBox, Button, Dialog, TextInput} from '@neos-project/react-ui-components';\n\nexport default class TestConfirmationDialog extends Component {\n\n static propTypes = {\n isOpen: PropTypes.bool,\n translate: PropTypes.func.isRequired,\n close: PropTypes.func.isRequired,\n send: PropTypes.func.isRequired\n };\n\n constructor(props) {\n super(props);\n this.state = {\n email: ''\n };\n }\n\n render() {\n const {isOpen, translate, close, send} = this.props;\n return (\n {translate('Neos.Neos:Main:cancel')},\n \n ]}\n >\n {translate('Psmb.Newsletter:Main:js.testEmailLabel')}\n this.setState({email})}\n value={this.state.email}\n />\n \n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/TestConfirmationDialog.js"],"sourceRoot":""} \ No newline at end of file