@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
@@ -15,7 +15,7 @@ import { createStructuredSelector } from 'reselect';
15
15
  import { injectIntl, intlShape } from 'react-intl';
16
16
  import _ from 'lodash';
17
17
  import {makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse} from "../../MobilePush/Edit/selectors";
18
- import {makeSelectMetaEntities} from "../../Cap/selectors";
18
+ import {makeSelectMetaEntities, setInjectedTags} from "../../Cap/selectors";
19
19
  import {getMessageObject} from "../../../utils/messageUtils";
20
20
  import FormBuilder from '../../../components/FormBuilder';
21
21
  import * as globalActions from "../../Cap/actions";
@@ -200,29 +200,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
200
200
  const message = getMessageObject('error', (nextProps.Edit.editTemplateErrorMessage && nextProps.Edit.editTemplateErrorMessage !== '') ? nextProps.Edit.editTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
201
201
  this.props.globalActions.addMessageToQueue(message);
202
202
  }
203
- // if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && this.props.metaEntities.tags !== nextProps.metaEntities.tags) {
204
- // let injectedTags = _.cloneDeep(this.state.injectedTags);
205
- // injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
206
- // this.setState({injectedTags});
207
- // }
208
- if (nextProps.metaEntities && nextProps.metaEntities.tags && nextProps.metaEntities.tags.custom && !_.isEqual(this.props.metaEntities.tags, nextProps.metaEntities.tags)) {
209
- let injectedTags = _.cloneDeep(this.state.injectedTags);
210
- delete injectedTags["Registration custom fields"];
211
- delete injectedTags["Store custom fields"];
212
- delete injectedTags["Transaction custom fields"];
213
- injectedTags = _.merge({}, injectedTags, nextProps.metaEntities.tags.custom);
214
- console.log('new injected tags', nextProps.metaEntities.tags.custom);
215
- if (!_.has(nextProps.metaEntities.tags.custom, "Registration custom fields")) {
216
- delete injectedTags["Registration custom fields"];
217
- }
218
- if (!_.has(nextProps.metaEntities.tags.custom, "Store custom fields")) {
219
- delete injectedTags["Store custom fields"];
220
- }
221
- if (!_.has(nextProps.metaEntities.tags.custom, "Transaction custom fields")) {
222
- delete injectedTags["Transaction custom fields"];
223
- }
224
- this.setState({injectedTags});
225
- }
226
203
  }
227
204
 
228
205
  componentWillUnmount() {
@@ -752,6 +729,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
752
729
  console.log('startTemplateCreation', data);
753
730
  if (!data.edit) {
754
731
  this.setState({injectedTags: data.tags});
732
+ this.props.globalActions.setInjectedTags(data.tags);
755
733
  }
756
734
  };
757
735
 
@@ -1013,7 +991,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1013
991
  tabCount={2}
1014
992
  iosCtasData={this.state.iosCtasData}
1015
993
  tags={tags}
1016
- injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
994
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
1017
995
  onFormValidityChange={this.setFormValidity}
1018
996
  usingTabContainer
1019
997
  checkValidation={this.state.checkValidation}
@@ -1049,6 +1027,7 @@ Edit.propTypes = {
1049
1027
  templateData: PropTypes.object,
1050
1028
  getDefaultTags: PropTypes.string,
1051
1029
  supportedTags: PropTypes.array,
1030
+ injectedTags: PropTypes.object,
1052
1031
  };
1053
1032
 
1054
1033
  const mapStateToProps = createStructuredSelector({
@@ -1057,6 +1036,7 @@ const mapStateToProps = createStructuredSelector({
1057
1036
  templateDetails: makeSelectTemplateDetailsResponse(),
1058
1037
  metaEntities: makeSelectMetaEntities(),
1059
1038
  Templates: makeSelectTemplates(),
1039
+ injectedTags: setInjectedTags(),
1060
1040
  });
1061
1041
 
1062
1042
  function mapDispatchToProps(dispatch) {
@@ -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
 
@@ -333,10 +333,7 @@ export const response = {
333
333
  autosizeParams: {
334
334
  minRows: 3,
335
335
  },
336
- style: {
337
336
 
338
- paddingLeft: 0,
339
- },
340
337
  order: 1,
341
338
  customComponent: true,
342
339
  supportedEvents: [
@@ -664,10 +661,7 @@ export const response = {
664
661
  fluid: true,
665
662
  styling: "semantic",
666
663
  autosize: true,
667
- style: {
668
664
 
669
- paddingLeft: 0,
670
- },
671
665
  autosizeParams: {
672
666
  minRows: 3,
673
667
  },
@@ -1168,10 +1162,7 @@ export const response = {
1168
1162
  fluid: true,
1169
1163
  styling: "semantic",
1170
1164
  autosize: true,
1171
- style: {
1172
1165
 
1173
- paddingLeft: 0,
1174
- },
1175
1166
  autosizeParams: {
1176
1167
  minRows: 3,
1177
1168
  },
@@ -1546,10 +1537,7 @@ export const response = {
1546
1537
  fluid: true,
1547
1538
  styling: "semantic",
1548
1539
  autosize: true,
1549
- style: {
1550
1540
 
1551
- paddingLeft: 0,
1552
- },
1553
1541
  autosizeParams: {
1554
1542
  minRows: 3,
1555
1543
  },
@@ -38,7 +38,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
38
38
  this.props.onMobilepushModeChange( e.target.value );
39
39
  };
40
40
  render() {
41
- const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query} = this.props;
41
+ const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode} = this.props;
42
42
  const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
43
43
  return (
44
44
  <div className="mobilepush-wrapper">
@@ -62,7 +62,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
62
62
  query,
63
63
  }}
64
64
  params={{mode: mobilePushCreateMode}}
65
- isFullMode={false}
65
+ isFullMode={isFullMode}
66
66
  isGetFormData={isGetFormData}
67
67
  route={{ name: 'mobilepush' }}
68
68
  />
@@ -84,6 +84,7 @@ MobilepushWrapper.propTypes = {
84
84
  setIsLoadingContent: PropTypes.func,
85
85
  isGetFormData: PropTypes.bool,
86
86
  query: PropTypes.object,
87
+ isFullMode: PropTypes.bool,
87
88
  };
88
89
 
89
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