From 7af190bba71856a6ef42c35ab3003965510b7f2b Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Thu, 27 Jul 2017 16:48:27 +1200 Subject: [PATCH] Clean up --- client/dist/js/bundle.js | 2 +- .../CampaignAdmin/CampaignAdminList.js | 26 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 0c637a54..57efe1d2 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN_CREATED:"SET_NEW_CAMPAIGN_CREATED"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN_CREATED,payload:{newItemCreated:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewCampaignCreated=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(L.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(S.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(R.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(D.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(S.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(L.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){return this.state.loading?h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign"),"from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),t=this.getItems();return t?(t.forEach(function(t){var n=t.BaseClass;e[n]||(e[n]={singular:t.Singular,plural:t.Plural,items:[]}),e[n].items.push(t)}),e):e}},{key:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,s.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(L.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(R.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(D.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(L.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),t=this.getItems();return t?(t.forEach(function(t){var n=t.BaseClass;e[n]||(e[n]={singular:t.Singular,plural:t.Plural,items:[]}),e[n].items.push(t)}),e):e}},{key:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,s.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t +

Loading...

); } else if (!this.getItems() || this.getItems().length === 0) { preview = ( -
+

Getting started

- Select Add to Campaign - from pages, files, and other content types + Select Add to Campaign from pages, files, and other content types

);