@capillarytech/creatives-library 2.0.27 → 2.0.28

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.
@@ -45,13 +45,13 @@ class EmailPreviewV2 extends React.Component {
45
45
  constructor(props) {
46
46
  super(props);
47
47
  this.state = {
48
- currentDevice: devices.desktop,
48
+ currentDevice: props.device || devices.desktop,
49
49
  };
50
50
  }
51
51
  componentWillMount() {
52
52
  const {templateData, templateContent} = this.props;
53
- if (isEmpty(templateContent) && templateData._id) {
54
- this.props.templateActions.getTemplateDetails(templateData._id);
53
+ if (isEmpty(templateContent) && !isEmpty(templateData) && templateData._id) { // templateData: comes from templates list email preview
54
+ this.props.templateActions.getTemplateDetails(templateData._id); // templateContent: html data to be shown in iframe
55
55
  }
56
56
  }
57
57
  changePreviewDevice = (ev) => {
@@ -109,10 +109,11 @@ EmailPreviewV2.propTypes = {
109
109
  templateContent: PropTypes.string,
110
110
  templateData: PropTypes.object,
111
111
  templateActions: PropTypes.object,
112
+ device: PropTypes.string,
112
113
  };
113
114
 
114
- const mapStateToProps = createStructuredSelector({
115
- templateContent: selectTemplateContent(),
115
+ const mapStateToProps = (state, props) => createStructuredSelector({
116
+ templateContent: props.templateData ? selectTemplateContent() : () => props.templateContent, // when props has templateContent that means preview with content
116
117
  });
117
118
  function mapDispatchToProps(dispatch) {
118
119
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.27",
4
+ "version": "2.0.28",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",