@capillarytech/creatives-library 2.0.65 → 2.0.68

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 (43) hide show
  1. package/components/Ckeditor/index.js +30 -3
  2. package/components/FormBuilder/index.js +53 -30
  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/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
  7. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +104 -0
  8. package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
  9. package/components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -0
  10. package/containers/Cap/actions.js +6 -0
  11. package/containers/Cap/constants.js +2 -0
  12. package/containers/Cap/reducer.js +4 -2
  13. package/containers/Cap/selectors.js +13 -0
  14. package/containers/CreativesContainer/SlideBoxContent.js +9 -2
  15. package/containers/Ebill/index.js +4 -21
  16. package/containers/Email/index.js +9 -24
  17. package/containers/Line/Create/index.js +5 -17
  18. package/containers/Line/Edit/index.js +5 -25
  19. package/containers/MobilePush/Create/index.js +5 -22
  20. package/containers/MobilePush/Create/selectors.js +1 -1
  21. package/containers/MobilePush/Edit/index.js +9 -30
  22. package/containers/MobilePush/Edit/selectors.js +2 -2
  23. package/containers/MobilePush/initialSchema.js +4 -4
  24. package/containers/MobilepushWrapper/index.js +9 -7
  25. package/containers/Sms/Create/index.js +17 -31
  26. package/containers/Sms/Edit/index.js +6 -20
  27. package/containers/Templates/index.js +60 -67
  28. package/containers/Templates/reducer.js +3 -3
  29. package/containers/WeChat/MapTemplates/index.js +6 -22
  30. package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +46 -2
  31. package/containers/WeChat/RichmediaTemplates/Create/actions.js +4 -3
  32. package/containers/WeChat/RichmediaTemplates/Create/constants.js +1 -0
  33. package/containers/WeChat/RichmediaTemplates/Create/index.js +525 -165
  34. package/containers/WeChat/RichmediaTemplates/Create/messages.js +125 -1
  35. package/containers/WeChat/RichmediaTemplates/Create/reducer.js +15 -4
  36. package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
  37. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +7 -3
  38. package/containers/WeChat/RichmediaTemplates/Create/selectors.js +5 -0
  39. package/containers/WeChat/RichmediaTemplates/Edit/index.js +24 -8
  40. package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +6 -1
  41. package/initialState.js +1 -0
  42. package/package.json +2 -2
  43. package/routes.js +22 -4
@@ -10,13 +10,13 @@ import React from 'react';
10
10
  import { connect } from 'react-redux';
11
11
  import { bindActionCreators } from 'redux';
12
12
  import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
13
- import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual, merge, has, findIndex} from 'lodash';
13
+ import {get, set, filter, isEmpty, map, forEach, uniqueId, cloneDeep, isEqual, findIndex} from 'lodash';
14
14
  import { createStructuredSelector } from 'reselect';
15
15
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
16
16
  import styled from 'styled-components';
17
17
  import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons} from '@capillarytech/cap-ui-library';
18
18
  import { makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta } from './selectors';
19
- import { makeSelectMetaEntities } from '../../Cap/selectors';
19
+ import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
20
20
  import * as globalActions from '../../../containers/Cap/actions';
21
21
  import FormBuilder from '../../../components/FormBuilder';
22
22
  import './_mobilePushCreate.scss';
@@ -146,25 +146,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
146
146
  this.showNext();
147
147
  }
148
148
  }
149
-
150
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
151
- let injectedTags = cloneDeep(this.state.injectedTags);
152
- delete injectedTags["Registration custom fields"];
153
- delete injectedTags["Store custom fields"];
154
- delete injectedTags["Transaction custom fields"];
155
- injectedTags = merge({}, injectedTags, nextProps.metaEntities.tags.custom);
156
-
157
- if (!has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
158
- delete injectedTags["Registration custom fields"];
159
- }
160
- if (!has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
161
- delete injectedTags["Store custom fields"];
162
- }
163
- if (!has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
164
- delete injectedTags["Transaction custom fields"];
165
- }
166
- this.setState({injectedTags});
167
- }
168
149
  };
169
150
  componentWillUnmount = () => {
170
151
  this.props.actions.resetStore();
@@ -1655,7 +1636,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1655
1636
  formData={cloneDeep(this.state.formData)}
1656
1637
  location={this.props.location}
1657
1638
  tags={tags}
1658
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
1639
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
1659
1640
  onFormValidityChange={this.setFormValidity}
1660
1641
  usingTabContainer
1661
1642
  checkValidation={this.state.checkValidation}
@@ -1752,6 +1733,7 @@ Create.propTypes = {
1752
1733
  supportedTags: PropTypes.array,
1753
1734
  getDefaultTags: PropTypes.string,
1754
1735
  iosCtasData: PropTypes.array,
1736
+ injectedTags: PropTypes.object,
1755
1737
  };
1756
1738
 
1757
1739
  const mapStateToProps = createStructuredSelector({
@@ -1760,6 +1742,7 @@ const mapStateToProps = createStructuredSelector({
1760
1742
  metaEntities: makeSelectMetaEntities(),
1761
1743
  Templates: makeSelectTemplates(),
1762
1744
  iosCtasData: makeSelectIosCta(),
1745
+ injectedTags: setInjectedTags(),
1763
1746
  });
1764
1747
 
1765
1748
  function mapDispatchToProps(dispatch) {
@@ -3,7 +3,7 @@ import { createSelector } from 'reselect';
3
3
  /**
4
4
  * Direct selector to the create state domain
5
5
  */
6
- const selectPushMessageCreateDomain = () => (state, props) => props.isFullMode === false ? state.get('mobileCreate') : state.get('create');
6
+ const selectPushMessageCreateDomain = () => (state) => state.get('mobileCreate');
7
7
  /**
8
8
  * Other specific selectors
9
9
  */
@@ -17,7 +17,7 @@ import _, {get, findIndex, set, forEach, cloneDeep} from 'lodash';
17
17
  import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons} from '@capillarytech/cap-ui-library';
18
18
  import styled from 'styled-components';
19
19
  import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse, makeSelectIosCta} from "./selectors";
20
- import {makeSelectMetaEntities} from "../../Cap/selectors";
20
+ import {makeSelectMetaEntities, setInjectedTags, isLoadingMetaEntities} from "../../Cap/selectors";
21
21
  import {getMessageObject} from "../../../utils/messageUtils";
22
22
  import FormBuilder from '../../../components/FormBuilder';
23
23
  import * as globalActions from "../../Cap/actions";
@@ -186,29 +186,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
186
186
  const message = getMessageObject('error', (nextProps.Edit.editTemplateErrorMessage && nextProps.Edit.editTemplateErrorMessage !== '') ? nextProps.Edit.editTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
187
187
  this.props.globalActions.addMessageToQueue(message);
188
188
  }
189
- // if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags !== nextProps.metaEntities.tags) {
190
- // let injectedTags = _.cloneDeep(this.state.injectedTags);
191
- // injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
192
- // this.setState({injectedTags});
193
- // }
194
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
195
- let injectedTags = _.cloneDeep(this.state.injectedTags);
196
- delete injectedTags["Registration custom fields"];
197
- delete injectedTags["Store custom fields"];
198
- delete injectedTags["Transaction custom fields"];
199
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
200
- console.log('new injected tags', nextProps.metaEntities.tags.custom);
201
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
202
- delete injectedTags["Registration custom fields"];
203
- }
204
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
205
- delete injectedTags["Store custom fields"];
206
- }
207
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
208
- delete injectedTags["Transaction custom fields"];
209
- }
210
- this.setState({injectedTags});
211
- }
212
189
  }
213
190
  componentWillUnmount() {
214
191
  this.props.actions.clearData();
@@ -1691,7 +1668,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1691
1668
  let tipText = this.props.Edit && ("getTemplateDetailsInProgress" in this.props.Edit && this.props.Edit.getTemplateDetailsInProgress) ? 'Getting template details...' : '';
1692
1669
  tipText = this.props.Edit && ("editTemplateInProgress" in this.props.Edit && this.props.Edit.editTemplateInProgress) ? 'Saving Template...' : '';
1693
1670
  const loadingContentEdit = this.state.loadingContentEdit || (this.props.location.query.module === 'dvs' && _.isEmpty(this.state.schema));
1694
- const spinning = loadingContentEdit || this.props.Edit.fetchingDefaultTemplates || this.props.Edit.assetUploading || this.state.loading || (this.props.Edit && (("getTemplateDetailsInProgress" in this.props.Edit && this.props.Edit.getTemplateDetailsInProgress) || ("editTemplateInProgress" in this.props.Edit && this.props.Edit.editTemplateInProgress)));
1671
+ const spinning = this.props.isLoadingMetaEntities || loadingContentEdit || this.props.Edit.fetchingDefaultTemplates || this.props.Edit.assetUploading || this.state.loading || (this.props.Edit && (("getTemplateDetailsInProgress" in this.props.Edit && this.props.Edit.getTemplateDetailsInProgress) || ("editTemplateInProgress" in this.props.Edit && this.props.Edit.editTemplateInProgress)));
1695
1672
  let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
1696
1673
  if (this.props.supportedTags) {
1697
1674
  tags = this.props.supportedTags;
@@ -1712,7 +1689,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1712
1689
  </Row>}
1713
1690
  <Row>
1714
1691
  <Col>
1715
- <FormBuilder
1692
+ {!this.props.isLoadingMetaEntities && <FormBuilder
1716
1693
  schema={schema}
1717
1694
  onSubmit={this.saveFormData}
1718
1695
  onChange={this.onFormDataChange}
@@ -1724,7 +1701,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1724
1701
  tabCount={2}
1725
1702
  iosCtasData={this.state.iosCtasData}
1726
1703
  tags={tags}
1727
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
1704
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
1728
1705
  onFormValidityChange={this.setFormValidity}
1729
1706
  usingTabContainer
1730
1707
  checkValidation={this.state.checkValidation}
@@ -1736,7 +1713,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1736
1713
  handleCancelModal={this.handleCancelModal}
1737
1714
  modal={this.state.modalContent}
1738
1715
  setModalContent={this.setModalContent}
1739
- />
1716
+ />}
1740
1717
  </Col>
1741
1718
  {this.props.iosCtasData && this.state.showIosCtaTable &&
1742
1719
  <CapSlideBox
@@ -1820,7 +1797,8 @@ Edit.propTypes = {
1820
1797
  templateData: PropTypes.object,
1821
1798
  isFullMode: PropTypes.bool,
1822
1799
  iosCtasData: PropTypes.array,
1823
-
1800
+ isLoadingMetaEntities: PropTypes.bool,
1801
+ injectedTags: PropTypes.object,
1824
1802
  };
1825
1803
 
1826
1804
  const mapStateToProps = createStructuredSelector({
@@ -1831,7 +1809,8 @@ const mapStateToProps = createStructuredSelector({
1831
1809
  metaEntities: makeSelectMetaEntities(),
1832
1810
  Templates: makeSelectTemplates(),
1833
1811
  iosCtasData: makeSelectIosCta(),
1834
-
1812
+ isLoadingMetaEntities: isLoadingMetaEntities(),
1813
+ injectedTags: setInjectedTags(),
1835
1814
  });
1836
1815
 
1837
1816
  function mapDispatchToProps(dispatch) {
@@ -3,7 +3,7 @@ import { createSelector } from 'reselect';
3
3
  /**
4
4
  * Direct selector to the create state domain
5
5
  */
6
- const selectMobilePushEditDomain = () => (state, props) => props.isFullMode === false ? state.get('mobileEdit') : state.get('edit'); // reducer injected as mobileEdit in library mode.
6
+ const selectMobilePushEditDomain = () => (state) => state.get('mobileEdit'); // reducer injected as mobileEdit in library mode.
7
7
 
8
8
 
9
9
  /**
@@ -23,7 +23,7 @@ const makeSelectEditResponse = () => createSelector(
23
23
  selectMobilePushEditDomain(), (dimensionState) => dimensionState.get('editResponse')
24
24
  );
25
25
  const makeSelectTemplateDetailsResponse = () => createSelector(
26
- selectMobilePushEditDomain(), (dimensionState) => dimensionState.get('templateDetails')
26
+ makeSelectEdit(), (dimensionState) => dimensionState.templateDetails
27
27
  );
28
28
  const makeSelectIosCta = () => createSelector(makeSelectEdit(), (create) => create.getIosCtasSucccess && create.iosCtasData );
29
29
 
@@ -1216,12 +1216,12 @@ export const response = {
1216
1216
  showPreview: true,
1217
1217
  previewProps: {
1218
1218
  label: "Cover Image",
1219
- inductiveText: "Maximum file size acceptable is 5 mb",
1219
+ inductiveText: "Maximum file size acceptable is 5 MB",
1220
1220
  // placeholder: "Max file size acceptable is 5mb",
1221
1221
  errorMessage: "Please upload Image",
1222
1222
 
1223
1223
  },
1224
- width: 20,
1224
+ width: 22,
1225
1225
  metaType: "text",
1226
1226
  datatype: "string",
1227
1227
  required: true,
@@ -1594,13 +1594,13 @@ export const response = {
1594
1594
  showPreview: true,
1595
1595
  previewProps: {
1596
1596
  label: "Cover Image",
1597
- inductiveText: "Maximum file size acceptable is 5 mb",
1597
+ inductiveText: "Maximum file size acceptable is 5 MB",
1598
1598
  // placeholder: "Max file size acceptable is 5mb",
1599
1599
  errorMessage: "Please upload Image",
1600
1600
 
1601
1601
  },
1602
1602
  type: "upload",
1603
- width: 20,
1603
+ width: 22,
1604
1604
  metaType: "text",
1605
1605
  datatype: "string",
1606
1606
  required: true,
@@ -18,6 +18,12 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
18
18
  constructor(props) {
19
19
  super(props);
20
20
  this.modes = [
21
+
22
+ {
23
+ title: <FormattedMessage {...messages.image}/>,
24
+ content: <WithImage height="248px" width={"248px"}/>,
25
+ value: 'image',
26
+ },
21
27
  {
22
28
  title: <FormattedMessage {...messages.text}/>,
23
29
  content: <WithNoImage height="124px" width={"248px"}/>,
@@ -26,18 +32,13 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
26
32
  // this.emailUploader.current.click();
27
33
  // },
28
34
  },
29
- {
30
- title: <FormattedMessage {...messages.image}/>,
31
- content: <WithImage height="248px" width={"248px"}/>,
32
- value: 'image',
33
- },
34
35
  ];
35
36
  }
36
37
  onChange = (e) => {
37
38
  this.props.onMobilepushModeChange( e.target.value );
38
39
  };
39
40
  render() {
40
- const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query} = this.props;
41
+ const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode} = this.props;
41
42
  const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
42
43
  return (
43
44
  <div className="mobilepush-wrapper">
@@ -61,7 +62,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
61
62
  query,
62
63
  }}
63
64
  params={{mode: mobilePushCreateMode}}
64
- isFullMode={false}
65
+ isFullMode={isFullMode}
65
66
  isGetFormData={isGetFormData}
66
67
  route={{ name: 'mobilepush' }}
67
68
  />
@@ -83,6 +84,7 @@ MobilepushWrapper.propTypes = {
83
84
  setIsLoadingContent: PropTypes.func,
84
85
  isGetFormData: PropTypes.bool,
85
86
  query: PropTypes.object,
87
+ isFullMode: PropTypes.bool,
86
88
  };
87
89
 
88
90
 
@@ -14,13 +14,14 @@ import { createStructuredSelector } from 'reselect';
14
14
  import _ from 'lodash';
15
15
  import { bindActionCreators } from 'redux';
16
16
  import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
17
- import { makeSelectMetaEntities, isLoadingMetaEntities } from '../../Cap/selectors';
17
+ import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
18
18
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
19
19
  import './_smsCreate.scss';
20
20
  import FormBuilder from '../../../components/FormBuilder';
21
21
  import * as actions from './actions';
22
22
  import messages from './messages';
23
23
  import * as charCount from '../../../utils/smsCharCount';
24
+ import {checkUnicode} from '../../../utils/smsCharCountV2';
24
25
  import * as globalActions from '../../../containers/Cap/actions';
25
26
  import {getMessageObject} from '../../../utils/messageUtils';
26
27
  import * as creativesContainerActions from '../../CreativesContainer/actions';
@@ -150,28 +151,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
150
151
  }
151
152
  }
152
153
  }
153
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags && this.props.metaEntities.tags.standard && (this.props.metaEntities.tags !== nextProps.metaEntities.tags)) {
154
- let injectedTags = _.cloneDeep(this.state.injectedTags);
155
- delete injectedTags["Registration custom fields"];
156
- delete injectedTags["Store custom fields"];
157
- delete injectedTags["Transaction custom fields"];
158
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
159
-
160
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
161
- delete injectedTags["Registration custom fields"];
162
- }
163
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
164
- delete injectedTags["Store custom fields"];
165
- }
166
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
167
- delete injectedTags["Transaction custom fields"];
168
- }
169
- this.setState({injectedTags, loadingStatus: this.state.loadingStatus + 1});
170
- }
171
- // if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.length > 0 && _.isEmpty(this.state.schema)) {
172
- //
173
- // this.injectEvents(nextProps.metaEntities.layouts[0].definition);
174
- // }
175
154
  }
176
155
 
177
156
  componentWillUnmount() {
@@ -757,9 +736,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
757
736
  }
758
737
 
759
738
  startTemplateCreation(data) {
739
+ console.log("reached here", data);
760
740
  if (data.edit) {
761
- // const ifUnicode = checkUnicode(data.content ? data.content : '');
762
-
741
+ console.log('in if startTemplateCreation', data.tags);
742
+ const ifUnicode = checkUnicode(data.content ? data.content : '');
743
+ console.log('smsDetails', ifUnicode, data.content);
763
744
  const content = data.content;
764
745
  const id = _.uniqueId();
765
746
  const tempData = {
@@ -775,8 +756,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
775
756
  this.setState({tabKey: ''});
776
757
  });
777
758
  } else {
759
+ console.log("in else startTemplateCreation: ", data.tags);
778
760
  this.setState({injectedTags: data.tags});
779
761
  }
762
+ this.props.globalActions.setInjectedTags(data.tags);
780
763
  }
781
764
 
782
765
  startLoading(ifEdit) {
@@ -932,9 +915,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
932
915
  return isLoading;
933
916
  }
934
917
  render() {
918
+ console.log("this.props sms create: ", this.props);
935
919
  const schema = this.state.schema;
936
920
  const spinning = this.isSmsLoading();
937
- let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
921
+ let tags = this.props.metaEntities && this.props.metaEntities.tags && this.props.metaEntities.tags.standard ? this.props.metaEntities.tags.standard : [];
922
+
938
923
  if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'library' && !this.props.getDefaultTags) {
939
924
  tags = this.props.supportedTags; // if get default tags is not present and supported tags is present use that inlbrary mode
940
925
  }
@@ -967,7 +952,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
967
952
  tabKey={this.state.tabKey}
968
953
  tags={tags}
969
954
  tagModule={this.props.getDefaultTags}
970
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
955
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
971
956
  onFormValidityChange={this.setFormValidity}
972
957
  usingTabContainer
973
958
  checkValidation={this.state.checkValidation}
@@ -994,11 +979,11 @@ Create.propTypes = {
994
979
  intl: intlShape.isRequired,
995
980
  supportedTags: PropTypes.array,
996
981
  getDefaultTags: PropTypes.string,
997
- isLoadingMetaEntities: PropTypes.bool,
998
- // creativesContainerActions: PropTypes.object,
999
- getFormSubscriptionData: PropTypes.func,
982
+ injectedTags: PropTypes.object,
983
+ setIsLoadingContent: PropTypes.bool,
1000
984
  isFullMode: PropTypes.bool,
1001
- setIsLoadingContent: PropTypes.func,
985
+ getFormSubscriptionData: PropTypes.func,
986
+ isLoadingMetaEntities: PropTypes.bool,
1002
987
  };
1003
988
 
1004
989
  const mapStateToProps = createStructuredSelector({
@@ -1006,6 +991,7 @@ const mapStateToProps = createStructuredSelector({
1006
991
  createResponse: makeSelectCreateResponse(),
1007
992
  metaEntities: makeSelectMetaEntities(),
1008
993
  isLoadingMetaEntities: isLoadingMetaEntities(),
994
+ injectedTags: setInjectedTags(),
1009
995
  });
1010
996
 
1011
997
  function mapDispatchToProps(dispatch) {
@@ -15,7 +15,7 @@ import { createStructuredSelector } from 'reselect';
15
15
  import _ from 'lodash';
16
16
  import { bindActionCreators } from 'redux';
17
17
  import { makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
18
- import { makeSelectMetaEntities, isLoadingMetaEntities } from '../../Cap/selectors';
18
+ import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../../Cap/selectors';
19
19
  import { UserIsAuthenticated } from '../../../utils/authWrapper';
20
20
  import FormBuilder from '../../../components/FormBuilder';
21
21
  import * as actions from './actions';
@@ -170,24 +170,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
170
170
  const message = getMessageObject('error', (nextProps.Edit.editTemplateErrorMessage && nextProps.Edit.editTemplateErrorMessage !== '') ? nextProps.Edit.editTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
171
171
  this.props.globalActions.addMessageToQueue(message);
172
172
  }
173
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags && this.props.metaEntities.tags.standard && (this.props.metaEntities.tags !== nextProps.metaEntities.tags)) {
174
- let injectedTags = _.cloneDeep(this.state.injectedTags);
175
- delete injectedTags["Registration custom fields"];
176
- delete injectedTags["Store custom fields"];
177
- delete injectedTags["Transaction custom fields"];
178
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
179
-
180
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
181
- delete injectedTags["Registration custom fields"];
182
- }
183
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
184
- delete injectedTags["Store custom fields"];
185
- }
186
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
187
- delete injectedTags["Transaction custom fields"];
188
- }
189
- this.setState({injectedTags});
190
- }
191
173
  }
192
174
 
193
175
  componentWillUnmount() {
@@ -425,6 +407,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
425
407
  } else {
426
408
  this.setState({injectedTags: data.tags});
427
409
  }
410
+ this.props.globalActions.setInjectedTags(data.tags);
428
411
  }
429
412
 
430
413
  startLoading(ifEdit) {
@@ -972,7 +955,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
972
955
  modal={this.state.modalContent}
973
956
  tags={tags}
974
957
  tagModule={this.props.getDefaultTags}
975
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
958
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
976
959
  onFormValidityChange={this.setFormValidity}
977
960
  usingTabContainer
978
961
  checkValidation={this.state.checkValidation}
@@ -1005,6 +988,8 @@ Edit.propTypes = {
1005
988
  isFullMode: PropTypes.bool,
1006
989
  getFormSubscriptionData: PropTypes.func,
1007
990
  setIsLoadingContent: PropTypes.func,
991
+ // route: PropTypes.object,
992
+ injectedTags: PropTypes.object,
1008
993
  };
1009
994
 
1010
995
  const mapStateToProps = createStructuredSelector({
@@ -1012,6 +997,7 @@ const mapStateToProps = createStructuredSelector({
1012
997
  editResponse: makeSelectEditResponse(),
1013
998
  templateDetails: makeSelectTemplateDetailsResponse(),
1014
999
  metaEntities: makeSelectMetaEntities(),
1000
+ injectedTags: setInjectedTags(),
1015
1001
  isLoadingMetaEntities: isLoadingMetaEntities(),
1016
1002
  });
1017
1003