From c0976fa15e43888ebf2eb3c71183296a59dfb1f7 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Tue, 18 Sep 2018 15:23:02 +1200 Subject: [PATCH] All proptypes replaced with external lib --- client/dist/js/bundle.js | 2 +- .../src/components/IntroScreen/IntroScreen.js | 3 +- .../containers/CampaignAdmin/CampaignAdmin.js | 5 +-- .../CampaignAdmin/CampaignAdminItem.js | 7 +++-- .../CampaignAdmin/CampaignAdminList.js | 31 ++++++++++--------- package.json | 3 +- yarn.lock | 13 ++++++-- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index ee3da11a..76c222f1 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 i=n[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,t),i.l=!0,i.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="./client/src/bundles/bundle.js")}({"./client/src/boot/applyConditionals.js":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(a),r=function(){i.default.transform("add-to-campaign",function(e){e.form.alterSchema("*.AddToCampaign",function(e){if(!e.getFieldByName("AddNewSelect"))return e.getState();var t=e.getValue("AddNewSelect");return e.setFieldClass("NewTitle","show",t).setFieldClass("NewTitle","hide",!t).getState()})})};t.default=r},"./client/src/boot/index.js":function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var i=n(6),r=n(14),o=a(r),s=n(2),l=a(s),c=n(19),u=a(c),p=n("./client/src/containers/CampaignAdmin/CampaignAdmin.js"),d=a(p),m=n("./client/src/state/campaign/CampaignReducer.js"),f=a(m),h=n("./client/src/boot/applyConditionals.js"),g=a(h);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");u.default.add({path:e.url,component:(0,i.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",f.default),(0,g.default)()})},"./client/src/bundles/bundle.js":function(e,t,n){"use strict";n("./client/src/boot/index.js")},"./client/src/components/IntroScreen/IntroScreen.js":function(e,t,n){"use strict";function a(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 r(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){var r=a.form.campaignEditForm.schemaUrl+"/"+t.params.id,o=e.form.formSchemas[r],s=o&&o.name,l=s&&(0,h.formValueSelector)(o.name,v.default);n=l&&l(e,"Name")}return{previewState:i.activeState,config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n,showMessage:e.campaign.showMessage}}function c(e){return{breadcrumbsActions:(0,g.bindActionCreators)(w,e),campaignActions:(0,g.bindActionCreators)(A,e),recordActions:(0,g.bindActionCreators)(P,e),onResize:function(t){e(q.enableOrDisableSplitMode(t))}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var u=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,i=n();if(!i)throw new Error("Promise was not returned for submitting");return i.then(function(e){var n=a.hasErrors(e);if("action_save"===t&&!n){var i=a.props.sectionConfig.url,r=e.record.id;a.props.campaignActions.setNewItem(r),a.props.router.push(i+"/set/"+r+"/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:"handleRemoveCampaignItem",value:function(e,t){var n=this,a=O.default._t("CampaignAdmin.REMOVE_ITEM_MESSAGE","Are you sure you want to remove this item?\n\nBy removing this item all linked items will be removed unless used elsewhere.");return window.confirm(a)?(this.setState({loading:!0}),this.removeCampaignItem(e,t).then(this.fetchCampaignsList.bind(this)).then(function(){return n.setState({loading:!1})}).then(function(){n.props.campaignActions.selectChangeSetItem(null),window.document.body.click()})):null}},{key:"handleToggleMessage",value:function(){this.props.campaignActions.setShowMessage(!this.props.showMessage)}},{key:"handleHideMessage",value:function(){this.props.campaignActions.setShowMessage(!1)}},{key:"removeCampaignItem",value:function(e,t){return this.props.campaignActions.removeCampaignItem(this.removeCampaignItemApi,e,t)}},{key:"fetchCampaignsList",value:function(){var e=this.props.sectionConfig.readCampaignsEndpoint,t=e.url;return this.props.recordActions.fetchRecords(this.props.sectionConfig.treeClass,e.method,t)}},{key:"hasErrors",value:function(e){if(e.errors&&e.errors.length)return!0;var t=e.state;if(!t)return!1;if(t.messages&&t.messages.find(function(e){return"good"!==e.type}))return!0;var n=t.fields&&t.fields.find(function(e){return e.message&&"good"!==e.message.type});return Boolean(n)}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var i=Object.assign({},t,{onClick:function(e){e.preventDefault(),n.props.router.push(a)}});return m.default.createElement(e,u({key:t.id},i))}return m.default.createElement(e,u({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var i=Object.assign({},t,{onClick:function(e){e.preventDefault(),n.props.router.push(a)}});return m.default.createElement(e,u({key:t.name},i))}return m.default.createElement(e,u({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var i=Object.assign({},t,{data:Object.assign({},t.data,{onDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},onEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return m.default.createElement(e,u({key:i.name},i))}return m.default.createElement(e,u({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(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 m.default.createElement("div",{className:"fill-height"},m.default.createElement(x.default,{showBackButton:!0,onBackButtonClick:this.handleBackButtonClick},m.default.createElement(k.default,{multiline:!0})),m.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},m.default.createElement(L.default,{onAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return m.default.createElement("div",{className:"fill-height"},m.default.createElement(x.default,{showBackButton:!0,onBackButtonClick:this.handleBackButtonClick},m.default.createElement(k.default,{multiline:!0})),m.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},m.default.createElement(L.default,{onSubmit:this.handleCreateCampaignSubmit,onAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:O.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",onClick:this.addCampaign},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return m.default.createElement("div",{className:"fill-height","aria-expanded":"true"},m.default.createElement(x.default,null,m.default.createElement(k.default,{multiline:!0})),m.default.createElement(F.default,{show:this.props.showMessage,onClose:this.handleHideMessage}),m.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},m.default.createElement("div",{className:"toolbar toolbar--content"},m.default.createElement("div",{className:"btn-toolbar fill-width"},m.default.createElement("div",{className:"btn-toolbar__left-panel flexbox-area-grow"},m.default.createElement(M.default,t)),m.default.createElement("div",{className:"btn-toolbar__left-panel"},m.default.createElement("a",{role:"button","aria-label":O.default._t("CampaignAdmin.HELP_SHOW","Show help"),tabIndex:0,onClick:this.handleToggleMessage,className:"btn btn-secondary font-icon-white-question btn--icon-xl btn--no-text"})))),m.default.createElement(L.default,n)))}},{key:"renderItemListView",value:function(){var e=this,t={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,onBackButtonClick:this.handleBackButtonClick,onRemoveCampaignItem:this.handleRemoveCampaignItem,loading:this.state.loading,previewState:this.props.previewState};return m.default.createElement(H.default,{style:{position:"relative"},className:"flexbox-area-grow fill-height",onResize:function(t){var n=t.width;return e.props.onResize(n)}},m.default.createElement(D.default,t))}},{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}}]),t}(d.Component);Q.propTypes={breadcrumbsActions:d.PropTypes.object.isRequired,campaignId:d.PropTypes.string,sectionConfig:d.PropTypes.shape({publishEndpoint:d.PropTypes.shape({url:d.PropTypes.string,method:d.PropTypes.string}),form:d.PropTypes.shape({EditForm:d.PropTypes.shape({schemaUrl:d.PropTypes.string}),campaignEditForm:d.PropTypes.shape({schemaUrl:d.PropTypes.string}),campaignCreateForm:d.PropTypes.shape({schemaUrl:d.PropTypes.string})})}),securityId:d.PropTypes.string.isRequired,view:d.PropTypes.string,params:d.PropTypes.shape({view:d.PropTypes.string,id:d.PropTypes.number}),showMessage:d.PropTypes.bool,previewState:d.PropTypes.oneOf(["edit","preview","split"]),onResize:m.default.PropTypes.func.isRequired},Q.defaultProps={sectionConfig:{},params:{},view:"show",breadcrumbs:[]},t.Component=Q,t.default=(0,b.withRouter)((0,f.connect)(l,c)(Q))},"./client/src/containers/CampaignAdmin/CampaignAdminItem.js":function(e,t,n){"use strict";function a(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 r(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(p.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,f.default)(t)));var a=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"];a=c.default.createElement("div",{className:i.join(" ")},c.default.createElement("span",{id:"campaign-tooltip-"+this.props.item.ID},c.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),c.default.createElement("span",{className:"font-icon-link"})),c.default.createElement(d.UncontrolledTooltip,{placement:"left",target:"campaign-tooltip-"+this.props.item.ID},n.join(", ")))}return a}},{key:"render",value:function(){var e=null,t={},n=this.props.item;if("open"===this.props.campaign.State)switch(n.ChangeType){case"created":t.className="badge badge-warning list-group-item__status",t.Title=p.default._t("CampaignAdmin.DRAFT","Draft");break;case"modified":t.className="badge badge-warning list-group-item__status",t.Title=p.default._t("CampaignAdmin.MODIFIED","Modified");break;case"deleted":t.className="badge badge-error list-group-item__status",t.Title=p.default._t("CampaignAdmin.REMOVED","Removed");break;case"none":default:t.className="badge badge-success list-group-item__status",t.Title=p.default._t("CampaignAdmin.NO_CHANGES","No changes")}var a=this.renderLinks();return n.Thumbnail&&(e=c.default.createElement("span",{className:"list-group-item__thumbnail"},c.default.createElement("img",{alt:n.Title,src:n.Thumbnail}))),c.default.createElement("div",{className:"fill-width"},e,c.default.createElement("div",{className:"list-group-item__details"},c.default.createElement("h4",{className:"list-group-item__heading",title:n.Title},n.Title),a,t.className&&t.Title&&c.default.createElement("span",{className:t.className},t.Title)))}}]),t}(l.Component);h.propTypes={campaign:c.default.PropTypes.object.isRequired,item:c.default.PropTypes.object.isRequired,isLinked:c.default.PropTypes.bool},t.default=h},"./client/src/containers/CampaignAdmin/CampaignAdminList.js":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 i(e){return e&&e.__esModule?e:{default:e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0});n=i?a[i].items[0]:null}return n}},{key:"getMoreActions",value:function(){var e=this.getSelectedItem();if(!e)return null;var t=e._links&&e._links.referenced_by,n=t&&t.length||0,a=L.default._t("CampaignAdmin.UNREMOVEABLE_INFO","Required by {number} item(s), and cannot be removed directly.");return["explicitly"===e.Added?f.default.createElement(x.DropdownItem,{key:"remove_action",className:"btn btn-secondary action",onClick:this.handleRemoveItem},L.default._t("CampaignAdmin.REMOVE","Remove")):f.default.createElement(x.DropdownItem,{tag:"p",key:"unremoveable_info",className:"alert alert-info campaign-admin__unremoveable-item"},f.default.createElement("span",{className:"font-icon-link"}),L.default.inject(a,{number:n}))]}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{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(r(t.items))}),e}},{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:"isRecordLoaded",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"handleRemoveItem",value:function(){"function"==typeof this.props.onRemoveCampaignItem&&this.props.onRemoveCampaignItem(this.props.campaignId,this.getSelectedItem().ID)}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"handlePublish",value:function(e){e.preventDefault();var t=L.default._t("CampaignAdmin.PUBLISH_CAMPAIGN_CONFIRM","Are you sure you want to publish this campaign?");window.confirm(t)&&this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}},{key:"renderButtonToolbar",value:function(){var e=this.props,t=e.ViewModeComponent,n=e.FormActionComponent,a=this.getItems(),i=!a||0===a.length,r=null;return i?r={title:L.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}:"open"===this.props.record.State&&(r={title:L.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,onClick:this.handlePublish,icon:"rocket"}),r?f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(n,r),!i&&f.default.createElement(t,{id:"view-mode-toggle-in-edit-nb",area:"edit"})):null}},{key:"renderPreview",value:function(e,t){var n=["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"],a=this.props,i=a.PreviewComponent,r=a.previewState,o=this.state.loading;switch(r){case"preview":n.push("preview-only");break;case"edit":return null}if(n=(0,U.default)(n),o)return f.default.createElement("div",{className:n},f.default.createElement("p",null,L.default._t("CampaignAdmin.LOADING","Loading...")));if(!this.getItems()||0===this.getItems().length){var s=L.default._t("CampaignAdmin.SELECTFROMSECTIONS",'Select "Add to Campaign" from pages, files, and other admin sections with content types');return f.default.createElement("div",{className:n},f.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),f.default.createElement("p",{className:"campaign-admin__empty-info"},s))}return f.default.createElement(i,{itemLinks:e,itemId:t,onBack:this.handleCloseItem,moreActions:this.getMoreActions(),className:n})}},{key:"renderCampaignAdminListDetail",value:function(e){var t=this.props,n=t.previewState,a=t.onBackButtonClick,i=t.newItem,r=(0,U.default)("panel","panel--padded","panel--scrollable","flexbox-area-grow"),o=i?f.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},L.default._t("CampaignAdmin.NEWCAMPAIGNSUCCESS","Nice one! You have successfully created a campaign.")):null;if("preview"===n)return null;var s=(0,U.default)("fill-height","campaign-admin__campaign-items",{"fill-height":"edit"===n,"campaign-admin__campaign-items-edit":"edit"===n});return f.default.createElement("div",{className:s,"aria-expanded":"true"},f.default.createElement(N.default,{showBackButton:!0,onBackButtonClick:a},f.default.createElement(j.default,{multiline:!0})),o,f.default.createElement("div",{className:r},e),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar()))}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",i=this.props.campaignId,r=this.props.record,o=this.groupItemsForSet(),s=[],l=this.getSelectedItem(),c=l&&l._links&&l._links.references||[],u=l&&l._links&&l._links.referenced_by||[];Object.keys(o).forEach(function(a){var l=o[a],p=l.items.length,d=[],m="\n "+(0===p?"":p)+"\n "+(1===p?l.singular:l.plural)+"\n ",h="Set_"+i+"_Group_"+a;l.items.forEach(function(a,i){t||(t=a.ID);var o=t===a.ID;o&&a._links&&(n=a._links);var s=(0,U.default)({"list-group-item--inactive":"none"===a.ChangeType||"published"===r.State,active:o}),l=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});l=l||u.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(T.default,{key:a.ID||i,className:s,onClick:e.handleItemSelected,onClickArg:a.ID},f.default.createElement(R.default,{item:a,campaign:e.props.record,selected:o,isLinked:l})))});var g=(0,U.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});s.push(f.default.createElement("div",{className:g,key:h},f.default.createElement(S.default,{groupid:h,title:m},d.length>0?d:f.default.createElement("p",{className:"list-group-item"},l.noItemsText))))});var p=f.default.createElement(I.default,null,s),d=this.props.loading&&[f.default.createElement("div",{key:"overlay",className:"cms-content-loading-overlay ui-widget-overlay-light"}),f.default.createElement("div",{key:"spinner",className:"cms-content-loading-spinner"})];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},d,this.renderCampaignAdminListDetail(p,n),this.renderPreview(n,t))}}]),t}(m.Component);F.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool,changeSetItemId:f.default.PropTypes.number}),publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,onBackButtonClick:f.default.PropTypes.func,onRemoveCampaignItem:f.default.PropTypes.func,breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,PreviewComponent:f.default.PropTypes.oneOfType([m.PropTypes.node,m.PropTypes.func]),ViewModeComponent:f.default.PropTypes.oneOfType([m.PropTypes.node,m.PropTypes.func]),FormActionComponent:m.PropTypes.oneOfType([m.PropTypes.node,m.PropTypes.func]),previewState:f.default.PropTypes.oneOf(["edit","preview","split"])},F.defaultProps={},t.Component=F,t.default=(0,h.compose)((0,g.connect)(c,u),(0,G.inject)(["FormAction","ViewModeToggle","Preview"],function(e,t,n){return{FormActionComponent:e,ViewModeComponent:t,PreviewComponent:n}},function(){return"CampaignAdmin.CampaignAdmin.List"}))(F)},"./client/src/state/campaign/CampaignActionTypes.js":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:"SET_NEW_CAMPAIGN",REMOVE_CAMPAIGN_ITEM_REQUEST:"REMOVE_CAMPAIGN_ITEM_REQUEST",REMOVE_CAMPAIGN_ITEM_SUCCESS:"REMOVE_CAMPAIGN_ITEM_SUCCESS",REMOVE_CAMPAIGN_ITEM_FAILURE:"REMOVE_CAMPAIGN_ITEM_FAILURE",SET_SHOW_MESSAGE:"SET_SHOW_MESSAGE"}},"./client/src/state/campaign/CampaignActions.js":function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.localStorage).setItem("campaign.showMessage",e),{type:p.default.SET_SHOW_MESSAGE,payload:{show:e}}}function r(e){return{type:p.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function o(e,t){return function(n){n({type:p.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function s(e,t,n){return function(a){a({type:p.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:p.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:m.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:p.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function l(e){return{type:p.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}function c(e,t,n){return function(a){return a({type:p.default.REMOVE_CAMPAIGN_ITEM_REQUEST,payload:{campaignId:t,itemId:n}}),e({id:t,itemId:n}).then(function(){a({type:p.default.REMOVE_CAMPAIGN_ITEM_SUCCESS,payload:{campaignId:t,itemId:n}})}).catch(function(e){a({type:p.default.REMOVE_CAMPAIGN_ITEM_FAILURE,payload:{error:e}})})}}Object.defineProperty(t,"__esModule",{value:!0}),t.setShowMessage=i,t.selectChangeSetItem=r,t.showCampaignView=o,t.publishCampaign=s,t.setNewItem=l,t.removeCampaignItem=c;var u=n("./client/src/state/campaign/CampaignActionTypes.js"),p=a(u),d=n(20),m=a(d)},"./client/src/state/campaign/CampaignReducer.js":function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,t=arguments[1];switch(t.type){case c.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case c.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case c.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case c.default.PUBLISH_CAMPAIGN_SUCCESS:case c.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case c.default.SET_NEW_CAMPAIGN:return(0,s.default)(r({},e,{newItem:t.payload.newItem}));case c.default.SET_SHOW_MESSAGE:return(0,s.default)(r({},e,{showMessage:t.payload.show}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}function s(e){return function(n){return t.createElement(p,l({component:e},n))}}var l=Object.assign||function(e){for(var t=1;t0){var r=a.form.campaignEditForm.schemaUrl+"/"+t.params.id,o=e.form.formSchemas[r],s=o&&o.name,l=s&&(0,b.formValueSelector)(o.name,E.default);n=l&&l(e,"Name")}return{previewState:i.activeState,config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n,showMessage:e.campaign.showMessage}}function c(e){return{breadcrumbsActions:(0,v.bindActionCreators)(k,e),campaignActions:(0,v.bindActionCreators)(w,e),recordActions:(0,v.bindActionCreators)(M,e),onResize:function(t){e(Q.enableOrDisableSplitMode(t))}}}Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;var u=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,i=n();if(!i)throw new Error("Promise was not returned for submitting");return i.then(function(e){var n=a.hasErrors(e);if("action_save"===t&&!n){var i=a.props.sectionConfig.url,r=e.record.id;a.props.campaignActions.setNewItem(r),a.props.router.push(i+"/set/"+r+"/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:"handleRemoveCampaignItem",value:function(e,t){var n=this,a=x.default._t("CampaignAdmin.REMOVE_ITEM_MESSAGE","Are you sure you want to remove this item?\n\nBy removing this item all linked items will be removed unless used elsewhere.");return window.confirm(a)?(this.setState({loading:!0}),this.removeCampaignItem(e,t).then(this.fetchCampaignsList.bind(this)).then(function(){return n.setState({loading:!1})}).then(function(){n.props.campaignActions.selectChangeSetItem(null),window.document.body.click()})):null}},{key:"handleToggleMessage",value:function(){this.props.campaignActions.setShowMessage(!this.props.showMessage)}},{key:"handleHideMessage",value:function(){this.props.campaignActions.setShowMessage(!1)}},{key:"removeCampaignItem",value:function(e,t){return this.props.campaignActions.removeCampaignItem(this.removeCampaignItemApi,e,t)}},{key:"fetchCampaignsList",value:function(){var e=this.props.sectionConfig.readCampaignsEndpoint,t=e.url;return this.props.recordActions.fetchRecords(this.props.sectionConfig.treeClass,e.method,t)}},{key:"hasErrors",value:function(e){if(e.errors&&e.errors.length)return!0;var t=e.state;if(!t)return!1;if(t.messages&&t.messages.find(function(e){return"good"!==e.type}))return!0;var n=t.fields&&t.fields.find(function(e){return e.message&&"good"!==e.message.type});return Boolean(n)}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var i=Object.assign({},t,{onClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,u({key:t.id},i))}return f.default.createElement(e,u({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var i=Object.assign({},t,{onClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,u({key:t.name},i))}return f.default.createElement(e,u({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var i=Object.assign({},t,{data:Object.assign({},t.data,{onDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},onEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,u({key:i.name},i))}return f.default.createElement(e,u({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(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(L.default,{showBackButton:!0,onBackButtonClick: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,{onAction: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(L.default,{showBackButton:!0,onBackButtonClick: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,{onSubmit:this.handleCreateCampaignSubmit,onAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:x.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",onClick:this.addCampaign},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(L.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement(H.default,{show:this.props.showMessage,onClose:this.handleHideMessage}),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 fill-width"},f.default.createElement("div",{className:"btn-toolbar__left-panel flexbox-area-grow"},f.default.createElement(O.default,t)),f.default.createElement("div",{className:"btn-toolbar__left-panel"},f.default.createElement("a",{role:"button","aria-label":x.default._t("CampaignAdmin.HELP_SHOW","Show help"),tabIndex:0,onClick:this.handleToggleMessage,className:"btn btn-secondary font-icon-white-question btn--icon-xl btn--no-text"})))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e=this,t={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,onBackButtonClick:this.handleBackButtonClick,onRemoveCampaignItem:this.handleRemoveCampaignItem,loading:this.state.loading,previewState:this.props.previewState};return f.default.createElement(q.default,{style:{position:"relative"},className:"flexbox-area-grow fill-height",onResize:function(t){var n=t.width;return e.props.onResize(n)}},f.default.createElement(F.default,t))}},{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}}]),t}(p.Component);Y.propTypes={breadcrumbsActions:h.default.object.isRequired,campaignId:h.default.string,sectionConfig:h.default.shape({publishEndpoint:h.default.shape({url:h.default.string,method:h.default.string}),form:h.default.shape({EditForm:h.default.shape({schemaUrl:h.default.string}),campaignEditForm:h.default.shape({schemaUrl:h.default.string}),campaignCreateForm:h.default.shape({schemaUrl:h.default.string})})}),securityId:h.default.string.isRequired,view:h.default.string,params:h.default.shape({view:h.default.string,id:h.default.number}),showMessage:h.default.bool,previewState:h.default.oneOf(["edit","preview","split"]),onResize:h.default.func.isRequired},Y.defaultProps={sectionConfig:{},params:{},view:"show",breadcrumbs:[]},t.Component=Y,t.default=(0,_.withRouter)((0,g.connect)(l,c)(Y))},"./client/src/containers/CampaignAdmin/CampaignAdminItem.js":function(e,t,n){"use strict";function a(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 r(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(d.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,m.default)(t)));var a=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"];a=c.default.createElement("div",{className:i.join(" ")},c.default.createElement("span",{id:"campaign-tooltip-"+this.props.item.ID},c.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),c.default.createElement("span",{className:"font-icon-link"})),c.default.createElement(p.UncontrolledTooltip,{placement:"left",target:"campaign-tooltip-"+this.props.item.ID},n.join(", ")))}return a}},{key:"render",value:function(){var e=null,t={},n=this.props.item;if("open"===this.props.campaign.State)switch(n.ChangeType){case"created":t.className="badge badge-warning list-group-item__status",t.Title=d.default._t("CampaignAdmin.DRAFT","Draft");break;case"modified":t.className="badge badge-warning list-group-item__status",t.Title=d.default._t("CampaignAdmin.MODIFIED","Modified");break;case"deleted":t.className="badge badge-error list-group-item__status",t.Title=d.default._t("CampaignAdmin.REMOVED","Removed");break;case"none":default:t.className="badge badge-success list-group-item__status",t.Title=d.default._t("CampaignAdmin.NO_CHANGES","No changes")}var a=this.renderLinks();return n.Thumbnail&&(e=c.default.createElement("span",{className:"list-group-item__thumbnail"},c.default.createElement("img",{alt:n.Title,src:n.Thumbnail}))),c.default.createElement("div",{className:"fill-width"},e,c.default.createElement("div",{className:"list-group-item__details"},c.default.createElement("h4",{className:"list-group-item__heading",title:n.Title},n.Title),a,t.className&&t.Title&&c.default.createElement("span",{className:t.className},t.Title)))}}]),t}(l.Component);b.propTypes={campaign:g.default.object.isRequired,item:g.default.object.isRequired,isLinked:g.default.bool},t.default=b},"./client/src/containers/CampaignAdmin/CampaignAdminList.js":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 i(e){return e&&e.__esModule?e:{default:e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0});n=i?a[i].items[0]:null}return n}},{key:"getMoreActions",value:function(){var e=this.getSelectedItem();if(!e)return null;var t=e._links&&e._links.referenced_by,n=t&&t.length||0,a=D.default._t("CampaignAdmin.UNREMOVEABLE_INFO","Required by {number} item(s), and cannot be removed directly.");return["explicitly"===e.Added?m.default.createElement(L.DropdownItem,{key:"remove_action",className:"btn btn-secondary action",onClick:this.handleRemoveItem},D.default._t("CampaignAdmin.REMOVE","Remove")):m.default.createElement(L.DropdownItem,{tag:"p",key:"unremoveable_info",className:"alert alert-info campaign-admin__unremoveable-item"},m.default.createElement("span",{className:"font-icon-link"}),D.default.inject(a,{number:n}))]}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=d({},t),e[t.baseClass].items=[].concat(r(t.items))}),e}},{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:"isRecordLoaded",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"handleRemoveItem",value:function(){"function"==typeof this.props.onRemoveCampaignItem&&this.props.onRemoveCampaignItem(this.props.campaignId,this.getSelectedItem().ID)}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"handlePublish",value:function(e){e.preventDefault();var t=D.default._t("CampaignAdmin.PUBLISH_CAMPAIGN_CONFIRM","Are you sure you want to publish this campaign?");window.confirm(t)&&this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}},{key:"renderButtonToolbar",value:function(){var e=this.props,t=e.ViewModeComponent,n=e.FormActionComponent,a=this.getItems(),i=!a||0===a.length,r=null;return i?r={title:D.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}:"open"===this.props.record.State&&(r={title:D.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,onClick:this.handlePublish,icon:"rocket"}),r?m.default.createElement("div",{className:"btn-toolbar"},m.default.createElement(n,r),!i&&m.default.createElement(t,{id:"view-mode-toggle-in-edit-nb",area:"edit"})):null}},{key:"renderPreview",value:function(e,t){var n=["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"],a=this.props,i=a.PreviewComponent,r=a.previewState,o=this.state.loading;switch(r){case"preview":n.push("preview-only");break;case"edit":return null}if(n=(0,V.default)(n),o)return m.default.createElement("div",{className:n},m.default.createElement("p",null,D.default._t("CampaignAdmin.LOADING","Loading...")));if(!this.getItems()||0===this.getItems().length){var s=D.default._t("CampaignAdmin.SELECTFROMSECTIONS",'Select "Add to Campaign" from pages, files, and other admin sections with content types');return m.default.createElement("div",{className:n},m.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),m.default.createElement("p",{className:"campaign-admin__empty-info"},s))}return m.default.createElement(i,{itemLinks:e,itemId:t,onBack:this.handleCloseItem,moreActions:this.getMoreActions(),className:n})}},{key:"renderCampaignAdminListDetail",value:function(e){var t=this.props,n=t.previewState,a=t.onBackButtonClick,i=t.newItem,r=(0,V.default)("panel","panel--padded","panel--scrollable","flexbox-area-grow"),o=i?m.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},D.default._t("CampaignAdmin.NEWCAMPAIGNSUCCESS","Nice one! You have successfully created a campaign.")):null;if("preview"===n)return null;var s=(0,V.default)("fill-height","campaign-admin__campaign-items",{"fill-height":"edit"===n,"campaign-admin__campaign-items-edit":"edit"===n});return m.default.createElement("div",{className:s,"aria-expanded":"true"},m.default.createElement(R.default,{showBackButton:!0,onBackButtonClick:a},m.default.createElement(B.default,{multiline:!0})),o,m.default.createElement("div",{className:r},e),m.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar()))}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",i=this.props.campaignId,r=this.props.record,o=this.groupItemsForSet(),s=[],l=this.getSelectedItem(),c=l&&l._links&&l._links.references||[],u=l&&l._links&&l._links.referenced_by||[];Object.keys(o).forEach(function(a){var l=o[a],d=l.items.length,p=[],f="\n "+(0===d?"":d)+"\n "+(1===d?l.singular:l.plural)+"\n ",h="Set_"+i+"_Group_"+a;l.items.forEach(function(a,i){t||(t=a.ID);var o=t===a.ID;o&&a._links&&(n=a._links);var s=(0,V.default)({"list-group-item--inactive":"none"===a.ChangeType||"published"===r.State,active:o}),l=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});l=l||u.find(function(e){return e.ChangeSetItemID===a.ID}),p.push(m.default.createElement(P.default,{key:a.ID||i,className:s,onClick:e.handleItemSelected,onClickArg:a.ID},m.default.createElement(j.default,{item:a,campaign:e.props.record,selected:o,isLinked:l})))});var g=(0,V.default)("list-group-wrapper",{"list-group-wrapper--empty":0===p.length});s.push(m.default.createElement("div",{className:g,key:h},m.default.createElement(N.default,{groupid:h,title:f},p.length>0?p:m.default.createElement("p",{className:"list-group-item"},l.noItemsText))))});var d=m.default.createElement(S.default,null,s),p=this.props.loading&&[m.default.createElement("div",{key:"overlay",className:"cms-content-loading-overlay ui-widget-overlay-light"}),m.default.createElement("div",{key:"spinner",className:"cms-content-loading-spinner"})];return m.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},p,this.renderCampaignAdminListDetail(d,n),this.renderPreview(n,t))}}]),t}(f.Component);H.propTypes={campaign:g.default.shape({isPublishing:g.default.bool,changeSetItemId:g.default.number}),publishApi:g.default.func.isRequired,record:g.default.object.isRequired,sectionConfig:g.default.object.isRequired,onBackButtonClick:g.default.func,onRemoveCampaignItem:g.default.func,breadcrumbsActions:g.default.object.isRequired,campaignActions:g.default.object.isRequired,recordActions:g.default.object.isRequired,PreviewComponent:g.default.oneOfType([g.default.node,g.default.func]),ViewModeComponent:g.default.oneOfType([g.default.node,g.default.func]),FormActionComponent:g.default.oneOfType([g.default.node,g.default.func]),previewState:g.default.oneOf(["edit","preview","split"])},H.defaultProps={},t.Component=H,t.default=(0,b.compose)((0,v.connect)(c,u),(0,U.inject)(["FormAction","ViewModeToggle","Preview"],function(e,t,n){return{FormActionComponent:e,ViewModeComponent:t,PreviewComponent:n}},function(){return"CampaignAdmin.CampaignAdmin.List"}))(H)},"./client/src/state/campaign/CampaignActionTypes.js":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:"SET_NEW_CAMPAIGN",REMOVE_CAMPAIGN_ITEM_REQUEST:"REMOVE_CAMPAIGN_ITEM_REQUEST",REMOVE_CAMPAIGN_ITEM_SUCCESS:"REMOVE_CAMPAIGN_ITEM_SUCCESS",REMOVE_CAMPAIGN_ITEM_FAILURE:"REMOVE_CAMPAIGN_ITEM_FAILURE",SET_SHOW_MESSAGE:"SET_SHOW_MESSAGE"}},"./client/src/state/campaign/CampaignActions.js":function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.localStorage).setItem("campaign.showMessage",e),{type:d.default.SET_SHOW_MESSAGE,payload:{show:e}}}function r(e){return{type:d.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function o(e,t){return function(n){n({type:d.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function s(e,t,n){return function(a){a({type:d.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:d.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:f.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:d.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function l(e){return{type:d.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}function c(e,t,n){return function(a){return a({type:d.default.REMOVE_CAMPAIGN_ITEM_REQUEST,payload:{campaignId:t,itemId:n}}),e({id:t,itemId:n}).then(function(){a({type:d.default.REMOVE_CAMPAIGN_ITEM_SUCCESS,payload:{campaignId:t,itemId:n}})}).catch(function(e){a({type:d.default.REMOVE_CAMPAIGN_ITEM_FAILURE,payload:{error:e}})})}}Object.defineProperty(t,"__esModule",{value:!0}),t.setShowMessage=i,t.selectChangeSetItem=r,t.showCampaignView=o,t.publishCampaign=s,t.setNewItem=l,t.removeCampaignItem=c;var u=n("./client/src/state/campaign/CampaignActionTypes.js"),d=a(u),p=n(21),f=a(p)},"./client/src/state/campaign/CampaignReducer.js":function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments[1];switch(t.type){case c.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case c.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case c.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case c.default.PUBLISH_CAMPAIGN_SUCCESS:case c.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case c.default.SET_NEW_CAMPAIGN:return(0,s.default)(r({},e,{newItem:t.payload.newItem}));case c.default.SET_SHOW_MESSAGE:return(0,s.default)(r({},e,{showMessage:t.payload.show}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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)}function s(e){return function(n){return t.createElement(d,l({component:e},n))}}var l=Object.assign||function(e){for(var t=1;t