@capillarytech/creatives-library 2.0.66 → 2.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/components/Ckeditor/index.js +30 -3
  2. package/components/FormBuilder/index.js +50 -27
  3. package/components/FormBuilder/test +1845 -0
  4. package/components/Header/index.js +7 -4
  5. package/components/Header/messages.js +12 -0
  6. package/components/Sidebar/index.js +0 -27
  7. package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
  8. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +104 -0
  9. package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
  10. package/components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
  11. package/containers/Cap/actions.js +6 -0
  12. package/containers/Cap/constants.js +2 -0
  13. package/containers/Cap/index.js +1 -22
  14. package/containers/Cap/reducer.js +4 -2
  15. package/containers/Cap/selectors.js +13 -0
  16. package/containers/CreativesContainer/SlideBoxContent.js +2 -1
  17. package/containers/Ebill/index.js +4 -21
  18. package/containers/Email/index.js +9 -24
  19. package/containers/Line/Create/index.js +5 -17
  20. package/containers/Line/Edit/index.js +5 -25
  21. package/containers/MobilePush/Create/index.js +5 -22
  22. package/containers/MobilePush/Create/selectors.js +1 -1
  23. package/containers/MobilePush/Edit/index.js +9 -30
  24. package/containers/MobilePush/Edit/selectors.js +2 -2
  25. package/containers/MobilePush/initialSchema.js +0 -12
  26. package/containers/MobilepushWrapper/index.js +3 -2
  27. package/containers/Sms/Create/index.js +17 -31
  28. package/containers/Sms/Edit/index.js +6 -20
  29. package/containers/Templates/index.js +60 -67
  30. package/containers/Templates/reducer.js +3 -3
  31. package/containers/WeChat/MapTemplates/index.js +6 -22
  32. package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +46 -2
  33. package/containers/WeChat/RichmediaTemplates/Create/actions.js +4 -3
  34. package/containers/WeChat/RichmediaTemplates/Create/constants.js +1 -0
  35. package/containers/WeChat/RichmediaTemplates/Create/index.js +525 -165
  36. package/containers/WeChat/RichmediaTemplates/Create/messages.js +125 -1
  37. package/containers/WeChat/RichmediaTemplates/Create/reducer.js +15 -4
  38. package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
  39. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +7 -3
  40. package/containers/WeChat/RichmediaTemplates/Create/selectors.js +5 -0
  41. package/containers/WeChat/RichmediaTemplates/Edit/index.js +24 -8
  42. package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +6 -1
  43. package/initialState.js +1 -0
  44. package/package.json +2 -2
  45. package/routes.js +22 -4
@@ -6,24 +6,27 @@
6
6
 
7
7
  import React, { PropTypes } from 'react';
8
8
  // import styled from 'styled-components';
9
+ import { FormattedMessage } from 'react-intl';
9
10
 
10
11
  import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
12
+ import messages from './messages';
13
+
11
14
 
12
15
  function Header(props) {
13
16
  return (
14
17
  <div>
15
18
  <CapRow className="template-form-header">
16
19
  <CapColumn span={10}>
17
- <CapInput id="template-name" errorMessage="Template name cannot be empty" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
20
+ <CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
18
21
  </CapColumn>
19
22
  <CapColumn span={2} offset={8}>
20
- <CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> Preview </CapButton>
23
+ <CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
21
24
  </CapColumn>
22
25
  <CapColumn span={2}>
23
- <CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> Cancel </CapButton>
26
+ <CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
24
27
  </CapColumn>
25
28
  <CapColumn span={2}>
26
- <CapButton id="save-button" type="primary" onClick={props.saveHandler}> Save </CapButton>
29
+ <CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
27
30
  </CapColumn>
28
31
  </CapRow>
29
32
  </div>
@@ -10,4 +10,16 @@ export default defineMessages({
10
10
  id: 'app.components.Header.header',
11
11
  defaultMessage: 'This is the Header component !',
12
12
  },
13
+ preview: {
14
+ id: 'app.components.Header.preview',
15
+ defaultMessage: 'Preview',
16
+ },
17
+ cancel: {
18
+ id: 'app.components.Header.cancel',
19
+ defaultMessage: 'Cancel',
20
+ },
21
+ save: {
22
+ id: 'app.components.Header.save',
23
+ defaultMessage: 'Save',
24
+ },
13
25
  });
@@ -2,15 +2,12 @@ import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  // import styled from 'styled-components';
4
4
  import { Accordion, Icon, Input, Button } from 'semantic-ui-react';
5
- import { Select } from 'antd';
6
5
  import { FormattedMessage } from 'react-intl';
7
6
  import _ from 'lodash';
8
7
  import { Link } from 'react-router';
9
8
  import messages from './messages';
10
9
  import './_sidebar.scss';
11
10
 
12
- const Option = Select.Option;
13
-
14
11
  class Sidebar extends React.Component { // eslint-disable-line react/prefer-stateless-function
15
12
  constructor(props) {
16
13
  super(props);
@@ -28,7 +25,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
28
25
  this.toggleSideNav = this.toggleSideNav.bind(this);
29
26
  this.getLinkElement = this.getLinkElement.bind(this);
30
27
  this.selectActiveLinkFromUrl = this.selectActiveLinkFromUrl.bind(this);
31
- this.onProductChange = this.onProductChange.bind(this);
32
28
  }
33
29
 
34
30
  componentWillMount() {
@@ -40,12 +36,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
40
36
  this.setState({ menuItems: nextProp.menuData });
41
37
  }
42
38
 
43
- onProductChange(value) {
44
- const selectedProductIndex = _.findIndex(this.props.productMenuData, {value: value.toLowerCase()});
45
- window.location = this.props.productMenuData[selectedProductIndex].url;
46
- // console.log('On Product selected ', value, selectedProductIndex);
47
- }
48
-
49
39
  getAccordian(content, keyValue) {
50
40
  return (<Accordion key={keyValue}>{content}</Accordion>);
51
41
  }
@@ -184,14 +174,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
184
174
  const toggle = visible ? 'hide' : '';
185
175
 
186
176
  // const types = [{ text: 'Creatives', value: 'Creatives' }];
187
- const productOptions = [];
188
- if (this.props.productMenuData.length > 1) {
189
- _.forEach(this.props.productMenuData, (product) => {
190
- productOptions.push(
191
- <Option key={product.text} value={product.text}>{product.text}</Option>
192
- );
193
- });
194
- }
195
177
  return (
196
178
  <div className="sidebar-container">
197
179
  <div className={`sidebar sidebar-width ${collapse}`}>
@@ -200,14 +182,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
200
182
  <a href="" onClick={this.toggleSideNav}><i className="material-icons control-arrow">arrow_back</i></a>
201
183
  </div>
202
184
 
203
- { this.props.productMenuData.length > 1 ?
204
- <Select className="icon product-select-menu" defaultValue={'CAMPAIGNS'} onChange={this.onProductChange}>
205
- {productOptions}
206
- </Select>
207
- :
208
- <div className="module-menu-header">{this.props.productMenuData[0].text}</div>
209
- }
210
-
211
185
  <div className="menu-header">
212
186
  <span className="menu-title"><FormattedMessage {...messages.menuTitle} /> </span>
213
187
  {this.props.actionComponents}
@@ -228,7 +202,6 @@ class Sidebar extends React.Component { // eslint-disable-line react/prefer-stat
228
202
 
229
203
  Sidebar.propTypes = {
230
204
  menuData: PropTypes.array.isRequired,
231
- productMenuData: PropTypes.array.isRequired,
232
205
  actionComponents: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
233
206
  };
234
207
 
@@ -0,0 +1,42 @@
1
+ .wechatMsgContainer{
2
+ position: absolute;
3
+ left: 30%;
4
+ top: 20%;
5
+ background: white;
6
+ width: 40%;
7
+ text-align: left;
8
+ }
9
+ .wechatMsgContainerOutbound{
10
+ position: absolute;
11
+ left: 35%;
12
+ top: 20%;
13
+ background: white;
14
+ width: 30%;
15
+ text-align: left;
16
+ }
17
+ .wechatMsgContainerCardLayout {
18
+ position: absolute;
19
+ left: 20%;
20
+ top: 20%;
21
+ background: white;
22
+ width: 60%;
23
+ text-align: left;
24
+ }
25
+ .overflow-handle-preview {
26
+ height: 430px;
27
+ overflow-y: auto;
28
+ }
29
+ .overflow-handle-preview-outbound {
30
+ height: 330px;
31
+ overflow-y: auto;
32
+ }
33
+ .preview-overflow-wrap-fields {
34
+ text-overflow: ellipsis;
35
+ overflow: hidden;
36
+ overflow-wrap: break-word;
37
+ display: -webkit-box !important;
38
+ -webkit-box-orient: vertical;
39
+ -webkit-line-clamp: 2;
40
+ text-align: left;
41
+ width: 200px;
42
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ *
3
+ * WechatRichmediaTemplatePreview
4
+ *
5
+ */
6
+
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
9
+ import { CapRow, CapColumn, CapButton } from '@capillarytech/cap-ui-library/';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import _ from 'lodash';
12
+ import SlideBox from '../../SlideBox';
13
+ import './_wechatRichmediaTemplatePrev.scss';
14
+ import messages from './messages';
15
+ const wechatBody = require('./../assets/images/WECHAT_5x.png');
16
+
17
+ class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
18
+ preparePreviewData = (mediaList) => {
19
+ const returnObj = [];
20
+ _.forEach(mediaList, (contentData, contentIndex) => {
21
+ const id = parseInt(contentIndex, 10);
22
+ if (id === 0) {
23
+ returnObj.push(
24
+ <div style={{ width: "100%", height: 116, position: "relative" }}>
25
+ <CapRow>
26
+ <img alt="default" width="100%" height="110px" src={contentData.image_url} />
27
+ <div className="preview-overflow-wrap-fields" style={{ position: "absolute", bottom: "5%", left: "5%" }}>{contentData.title ? contentData.title : ""}</div>
28
+ </CapRow>
29
+ {Object.keys(mediaList).length === 1 ?
30
+ <CapRow style={{ height: 32, left: "5%" }}>
31
+ {contentData.digest ? contentData.digest : ""}
32
+ </CapRow>
33
+ :
34
+ ""
35
+ }
36
+ </div>
37
+ );
38
+ } else {
39
+ returnObj.push(
40
+ <CapRow style={{ "width": "100%", "height": 64, "border-bottom": "0.5px solid lightgrey" }}>
41
+ <CapColumn className="preview-overflow-wrap-fields" style={{ padding: "5% 0% 0% 5%", float: "left" }}>
42
+ {contentData.title}
43
+ </CapColumn>
44
+ <CapColumn style={{ float: "right" }}>
45
+ <img alt="default" width="60px" height="60px" src={contentData.image_url} style={{ "padding-right": "10%", "float": "left" }}/>
46
+ </CapColumn>
47
+ </CapRow>
48
+ );
49
+ }
50
+ });
51
+ return returnObj;
52
+ }
53
+ goToEdit(e, path) {
54
+ this.props.onEditClick(e, this.props.templateId, this.props.modeType, path);
55
+ }
56
+ render() {
57
+ return (
58
+ this.props.showSlidebox ?
59
+ <SlideBox
60
+ show={this.props.show}
61
+ handleClose={this.props.closeSlideBox}
62
+ header={this.props.templateName}
63
+ width={50}
64
+ content={
65
+ <div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
66
+ <div className="shell align-center" id="sms-preview">
67
+ <img className="preview-image" src={wechatBody} alt="Preview is being generated"/>
68
+ <div className={this.props.type === 'embedded' ? "wechatMsgContainerOutbound" : "wechatMsgContainer"}>
69
+ <div className={this.props.type === 'embedded' ? "overflow-handle-preview-outbound" : "overflow-handle-preview"}>{this.preparePreviewData(this.props.content)}
70
+ </div>
71
+ </div>
72
+ </div>
73
+ {this.props.showEdit ? <CapButton onClick={(e) => this.goToEdit(e, this.props.path)} className="preview-buttons" type="primary">{this.props.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} /> }</CapButton> : ""}
74
+ </div>
75
+ }
76
+ />
77
+ :
78
+ <div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
79
+ <div className="shell align-center" id="sms-preview">
80
+ <div className="wechatMsgContainerCardLayout">
81
+ <div>{this.preparePreviewData(this.props.content)}
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ );
87
+ }
88
+ }
89
+
90
+ WechatRichmediaTemplatePreview.propTypes = {
91
+ showSlidebox: PropTypes.bool,
92
+ show: PropTypes.bool,
93
+ closeSlideBox: PropTypes.function,
94
+ templateName: PropTypes.string,
95
+ type: PropTypes.string,
96
+ content: PropTypes.array,
97
+ onEditClick: PropTypes.func,
98
+ showEdit: PropTypes.bool,
99
+ path: PropTypes.string,
100
+ templateId: PropTypes.string,
101
+ modeType: PropTypes.string,
102
+ };
103
+
104
+ export default WechatRichmediaTemplatePreview;
@@ -0,0 +1,21 @@
1
+ /*
2
+ * WechatRichmediaTemplatePreview Messages
3
+ *
4
+ * This contains all the text for the WechatRichmediaTemplatePreview component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'app.components.WechatRichmediaTemplatePreview.header',
11
+ defaultMessage: 'This is the WechatRichmediaTemplatePreview component !',
12
+ },
13
+ select: {
14
+ id: 'app.components.WechatRichmediaTemplatePreview.select',
15
+ defaultMessage: 'Select',
16
+ },
17
+ edit: {
18
+ id: 'app.components.WechatRichmediaTemplatePreview.edit',
19
+ defaultMessage: 'Edit',
20
+ },
21
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import WechatRichmediaTemplatePreview from '../index';
5
+
6
+ describe('<WechatRichmediaTemplatePreview />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -56,3 +56,9 @@ export function clearMetaEntities() {
56
56
  type: types.CLEAR_META_ENTITIES,
57
57
  };
58
58
  }
59
+ export function setInjectedTags(injectedTags) {
60
+ return {
61
+ type: types.SET_INJECTED_TAGS, injectedTags,
62
+ };
63
+ }
64
+
@@ -20,3 +20,5 @@ export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST'
20
20
  export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
21
21
  export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
22
22
  export const HIDE_TAGS = 'cap/HIDE_TAGS';
23
+
24
+ export const SET_INJECTED_TAGS = 'cap/SET_INJECTED_TAGS';
@@ -101,7 +101,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
101
101
  }
102
102
 
103
103
  if (nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
104
- if (nextProps.Global.orgID !== undefined && !isEqual(nextProps.Global.orgID, this.props.Global.orgID)) {
104
+ if (nextProps.Global.orgID !== undefined && !_.isEqual(nextProps.Global.orgID, this.props.Global.orgID)) {
105
105
  const userGtmData = this.getUserGtmData(nextProps);
106
106
  gtm.push(userGtmData);
107
107
  }
@@ -273,26 +273,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
273
273
  ],
274
274
  },
275
275
  ];
276
-
277
- const productMenuData = [
278
- // {
279
- // text: this.props.intl.formatMessage(messages.creatives),
280
- // value: 'Creatives',
281
- // url: '/creatives/ui/',
282
- // },
283
- ];
284
- if (this.props.Global.currentOrgDetails) {
285
- _.forEach(this.props.Global.currentOrgDetails.module_details, (module) => {
286
- if (module.display_order > 0) {
287
- productMenuData.push({
288
- text: (messages[module.name]) ? this.props.intl.formatMessage(messages[module.name]) : module.name,
289
- value: module.name.toLowerCase(),
290
- url: module.url,
291
- });
292
- }
293
- });
294
- }
295
-
296
276
  return (
297
277
  <CapWrapper>
298
278
  <Helmet
@@ -317,7 +297,6 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
317
297
  {loggedIn && type !== 'embedded' && this.props.location.pathname.indexOf('v2') === -1 ? <div id="cap-sidebar" className={'sidebar'}>
318
298
  <Sidebar
319
299
  menuData={menuData}
320
- productMenuData={productMenuData}
321
300
  actionComponents={actionComponents}
322
301
  router={this.props.router}
323
302
  />
@@ -95,12 +95,14 @@ function capReducer(state = fromJS(initialState.cap), action) {
95
95
  layouts: [],
96
96
  tags: [],
97
97
  });
98
- case types.HIDE_TAGS: {
98
+ // eslint-disable-next-line no-case-declarations
99
+ case types.HIDE_TAGS:
99
100
  const metaEntities = {tags: {}, layouts: state.get('metaEntities').layouts};
100
101
  metaEntities.tags.standard = _.filter(state.get('metaEntities').tags.standard, (tag) => action.tagList.indexOf(tag.definition.value) === -1);
101
102
  metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
102
103
  return state.setIn(['metaEntities'], metaEntities);
103
- }
104
+ case types.SET_INJECTED_TAGS:
105
+ return state.set('injectedTags', action.injectedTags);
104
106
  default:
105
107
  return state;
106
108
  }
@@ -1,5 +1,6 @@
1
1
  // makeSelectLocationState expects a plain JS object for the routing state
2
2
  import { createSelector } from 'reselect';
3
+ import _ from 'lodash';
3
4
  const selectCapDomain = (state) => state.get('cap');
4
5
 
5
6
  const makeSelectAuthenticated = () => createSelector(
@@ -21,6 +22,17 @@ const isLoadingMetaEntities = () => createSelector(
21
22
  selectCapDomain,
22
23
  (globalState) => globalState.get('fetchingSchema')
23
24
  );
25
+ const setInjectedTags = () => createSelector(
26
+ selectCapDomain,
27
+ (globalState) => {
28
+ let injectedTags = globalState.get('injectedTags') || {};
29
+ const metaEntities = globalState.get('metaEntities') || {};
30
+ const customTags = metaEntities.tags && metaEntities.tags.custom ? metaEntities.tags.custom : {};
31
+ console.log("selector cap: ", injectedTags, customTags, metaEntities);
32
+ return (injectedTags = _.merge({}, injectedTags, customTags));
33
+ }
34
+ );
35
+
24
36
  const makeSelectLocationState = () => {
25
37
  let prevRoutingState;
26
38
  let prevRoutingStateJS;
@@ -69,4 +81,5 @@ export {
69
81
  selectCurrentOrgDetails,
70
82
  isLoadingMetaEntities,
71
83
  makeSelectFetchingSchema,
84
+ setInjectedTags,
72
85
  };
@@ -193,7 +193,8 @@ function SlideBoxContent(props) {
193
193
  pathname: `/mobilepush/edit/`,
194
194
  query,
195
195
  }}
196
- isFullMode={false}
196
+ params={{id: templateData._id}}
197
+ isFullMode={isFullMode}
197
198
  isGetFormData={isGetFormData}
198
199
  route={{ name: 'mobilepush' }}
199
200
  templateData={templateData}
@@ -16,7 +16,7 @@ import _ from 'lodash';
16
16
  import { createStructuredSelector } from 'reselect';
17
17
  import * as actions from './actions';
18
18
  import FormBuilder from '../../components/FormBuilder';
19
- import { makeSelectMetaEntities, makeSelectAuthenticated } from '../Cap/selectors';
19
+ import { makeSelectMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
20
20
  import * as globalActions from '../../containers/Cap/actions';
21
21
  import { UserIsAuthenticated } from '../../utils/authWrapper';
22
22
  import { makeSelectTemplates } from '../Templates/selectors';
@@ -629,25 +629,6 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
629
629
  this.props.globalActions.addMessageToQueue(message);
630
630
  }
631
631
 
632
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
633
- let injectedTags = _.cloneDeep(this.state.injectedTags);
634
- delete injectedTags["Registration custom fields"];
635
- delete injectedTags["Store custom fields"];
636
- delete injectedTags["Transaction custom fields"];
637
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
638
- console.log('new injected tags', nextProps.metaEntities.tags.custom);
639
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
640
- delete injectedTags["Registration custom fields"];
641
- }
642
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
643
- delete injectedTags["Store custom fields"];
644
- }
645
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
646
- delete injectedTags["Transaction custom fields"];
647
- }
648
- this.setState({injectedTags});
649
- }
650
-
651
632
  console.log('Form Data After ', nextProps.Ebill.cmsData, this.props.Ebill.cmsData);
652
633
  if (nextProps.Ebill.cmsData !== '' && !_.isEqual(nextProps.Ebill.cmsData, this.props.Ebill.cmsData)) {
653
634
  const formData = _.cloneDeep(this.state.formData);
@@ -1209,7 +1190,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
1209
1190
  location={this.props.location}
1210
1191
  tabKey={this.state.tabKey}
1211
1192
  tags={this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : []}
1212
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
1193
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
1213
1194
  onFormValidityChange={this.setFormValidity}
1214
1195
  handleCancelModal={this.handleCancelModal}
1215
1196
  usingTabContainer
@@ -1259,6 +1240,7 @@ Ebill.propTypes = {
1259
1240
  intl: intlShape.isRequired,
1260
1241
  metaEntities: PropTypes.object,
1261
1242
  // Global: PropTypes.object,
1243
+ injectedTags: PropTypes.object,
1262
1244
  };
1263
1245
 
1264
1246
  const mapStateToProps = createStructuredSelector({
@@ -1266,6 +1248,7 @@ const mapStateToProps = createStructuredSelector({
1266
1248
  Templates: makeSelectTemplates(),
1267
1249
  metaEntities: makeSelectMetaEntities(),
1268
1250
  Global: makeSelectAuthenticated(),
1251
+ injectedTags: setInjectedTags(),
1269
1252
  });
1270
1253
 
1271
1254
  function mapDispatchToProps(dispatch) {
@@ -16,7 +16,7 @@ import { createStructuredSelector } from 'reselect';
16
16
  import _ from 'lodash';
17
17
  import moment from "moment";
18
18
  import FormBuilder from '../../components/FormBuilder';
19
- import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities } from '../Cap/selectors';
19
+ import { makeSelectMetaEntities, selectCurrentOrgDetails, isLoadingMetaEntities, makeSelectAuthenticated, setInjectedTags } from '../Cap/selectors';
20
20
  import * as actions from './actions';
21
21
  import * as templatesActions from '../Templates/actions';
22
22
  import * as globalActions from '../../containers/Cap/actions';
@@ -234,7 +234,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
234
234
  if (this.props.getDefaultTags) {
235
235
  query.context = this.props.getDefaultTags;
236
236
  }
237
- this.props.globalActions.fetchSchemaForEntity(query);
237
+ if (_.isEmpty(this.props.metaEntities.tags)) {
238
+ this.props.globalActions.fetchSchemaForEntity(query);
239
+ }
238
240
  }
239
241
  setTimeout(() => {
240
242
  this.showSubject();
@@ -436,27 +438,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
436
438
  });
437
439
  }
438
440
 
439
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags && this.props.metaEntities.tags.standard && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
440
- let injectedTags = _.cloneDeep(this.state.injectedTags);
441
- if (!_.isEmpty(injectedTags)) {
442
- delete injectedTags["Registration custom fields"];
443
- delete injectedTags["Store custom fields"];
444
- delete injectedTags["Transaction custom fields"];
445
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
446
-
447
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
448
- delete injectedTags["Registration custom fields"];
449
- }
450
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
451
- delete injectedTags["Store custom fields"];
452
- }
453
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
454
- delete injectedTags["Transaction custom fields"];
455
- }
456
- this.setState({injectedTags});
457
- }
458
- }
459
-
460
441
  if ( !_.isEqual(nextProps.Email.uploadAssetSuccess, this.props.Email.uploadAssetSuccess) && nextProps.Email.uploadAssetSuccess) {
461
442
  const isDragDrop = this.state.formData[`${this.state.currentTab - 1}`][this.state.formData[`${this.state.currentTab - 1}`].activeTab].is_drag_drop;
462
443
  const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
@@ -2113,6 +2094,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2113
2094
  } else {
2114
2095
  this.setState({injectedTags: data.tags});
2115
2096
  }
2097
+ this.props.globalActions.setInjectedTags(data.tags);
2116
2098
  }
2117
2099
 
2118
2100
  startLoading = (ifEdit) => {
@@ -2579,7 +2561,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2579
2561
  tabKey={this.state.tabKey}
2580
2562
  tags={tags}
2581
2563
  tagModule={this.props.getDefaultTags}
2582
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
2564
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
2583
2565
  onFormValidityChange={this.setFormValidity}
2584
2566
  handleCancelModal={this.handleCancelModal}
2585
2567
  usingTabContainer
@@ -2653,6 +2635,7 @@ Email.propTypes = {
2653
2635
  // creativesContainerActions: PropTypes.object,
2654
2636
  isFullMode: PropTypes.bool,
2655
2637
  setIsLoadingContent: PropTypes.func,
2638
+ injectedTags: PropTypes.object,
2656
2639
  };
2657
2640
 
2658
2641
  const mapStateToProps = (state, props) => createStructuredSelector({
@@ -2661,6 +2644,8 @@ const mapStateToProps = (state, props) => createStructuredSelector({
2661
2644
  metaEntities: makeSelectMetaEntities(),
2662
2645
  currentOrgDetails: props.cap ? () => props.cap.currentOrgDetails : selectCurrentOrgDetails(),
2663
2646
  isLoadingMetaEntities: isLoadingMetaEntities(),
2647
+ Global: makeSelectAuthenticated(),
2648
+ injectedTags: setInjectedTags(),
2664
2649
  });
2665
2650
 
2666
2651
  function mapDispatchToProps(dispatch) {
@@ -13,7 +13,7 @@ import { UserIsAuthenticated } from '../../../utils/authWrapper';
13
13
  import * as globalActions from '../../../containers/Cap/actions';
14
14
  //import { makeSelectCreate, makeSelectCreateResponse, makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
15
15
  import {makeSelectCreateLine} from './selectors';
16
- import { makeSelectMetaEntities } from '../../Cap/selectors';
16
+ import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
17
17
  import {getMessageObject} from '../../../utils/messageUtils';
18
18
  import { makeSelectTemplates } from '../../Templates/selectors';
19
19
  import './_lineCreate.scss';
@@ -218,21 +218,6 @@ export class Line extends Component {
218
218
  console.log("ooo", this.state.formData);
219
219
  this.props.actions.clearAsset();
220
220
  }
221
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags !== nextProps.metaEntities.tags) {
222
- let injectedTags = _.cloneDeep(this.state.injectedTags);
223
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
224
- console.log('new injected tags', nextProps.metaEntities.tags.custom);
225
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
226
- delete injectedTags["Registration custom fields"];
227
- }
228
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
229
- delete injectedTags["Store custom fields"];
230
- }
231
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
232
- delete injectedTags["Transaction custom fields"];
233
- }
234
- this.setState({injectedTags});
235
- }
236
221
  }
237
222
 
238
223
  componentWillUnmount() {
@@ -579,6 +564,7 @@ export class Line extends Component {
579
564
  obj['0'].image = content;
580
565
  }
581
566
  this.setState({formData: obj, loading: false, injectedTags: data.tags});
567
+ this.props.globalActions.setInjectedTags(data.tags);
582
568
  };
583
569
 
584
570
  startLoading = (ifEdit) => {
@@ -781,7 +767,7 @@ export class Line extends Component {
781
767
  formData={_.cloneDeep(this.state.formData)}
782
768
  location={this.props.location}
783
769
  tags={tags}
784
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
770
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
785
771
  onFormValidityChange={this.setFormValidity}
786
772
  usingTabContainer
787
773
  checkValidation={this.state.checkValidation}
@@ -816,12 +802,14 @@ Line.propTypes = {
816
802
  Line: PropTypes.object,
817
803
  supportedTags: PropTypes.any,
818
804
  getDefaultTags: PropTypes.string,
805
+ injectedTags: PropTypes.object,
819
806
  };
820
807
 
821
808
  const mapStateToProps = createStructuredSelector({
822
809
  Line: makeSelectCreateLine(),
823
810
  Templates: makeSelectTemplates(),
824
811
  metaEntities: makeSelectMetaEntities(),
812
+ injectedTags: setInjectedTags(),
825
813
  });
826
814
 
827
815
  function mapDispatchToProps(dispatch) {