@capillarytech/creatives-library 2.0.9 → 2.0.11

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.
@@ -8,13 +8,13 @@ import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
10
  // import styled from 'styled-components';
11
- import { CapTree, CapSpin, CapModal, CapTreeNode, CapInputSearch } from '@capillarytech/cap-ui-library';
11
+ import { CapTree, CapSpin, CapModal, CapTreeNode, CapButton, CapPopover, CapSelect, CapInput } from '@capillarytech/cap-ui-library';
12
12
  import _ from 'lodash';
13
13
  // import { CapInput } from '@capillarytech/cap-react-ui-library/basic/input';
14
14
  import { injectIntl, intlShape } from 'react-intl';
15
- import { CapButton, CapPopover, CapSelect, CapInput } from '@capillarytech/cap-react-ui-library';
16
15
  import messages from './messages';
17
16
 
17
+ const {Search} = CapInput;
18
18
  class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
19
19
 
20
20
  constructor(props) {
@@ -184,7 +184,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
184
184
  onVisibleChange={this.togglePopoverVisibility}
185
185
  content={<div>
186
186
  <CapSpin tip="Getting tags..." spinning={this.props.loading}>
187
- <CapInputSearch style={{ marginBottom: 8, width: '250px'}} placeholder="Search" onChange={this.onChange} />
187
+ <Search style={{ marginBottom: 8, width: '250px'}} placeholder="Search" onChange={this.onChange} />
188
188
  {this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
189
189
  </CapSelect> : ''}
190
190
  <CapTree
@@ -6,7 +6,7 @@ import _ from 'lodash';
6
6
  import * as types from './constants';
7
7
  import initialState from '../../initialState';
8
8
 
9
- function capReducer(state = fromJS(initialState), action) {
9
+ function capReducer(state = fromJS(initialState.cap), action) {
10
10
  switch (action.type) {
11
11
  case types.LOGIN_REQUEST:
12
12
  return state.set('login_progress', true);
@@ -95,11 +95,12 @@ function capReducer(state = fromJS(initialState), action) {
95
95
  layouts: [],
96
96
  tags: [],
97
97
  });
98
- case types.HIDE_TAGS:
98
+ case types.HIDE_TAGS: {
99
99
  const metaEntities = {tags: {}, layouts: state.get('metaEntities').layouts};
100
100
  metaEntities.tags.standard = _.filter(state.get('metaEntities').tags.standard, (tag) => action.tagList.indexOf(tag.definition.value) === -1);
101
101
  metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
102
102
  return state.setIn(['metaEntities'], metaEntities);
103
+ }
103
104
  default:
104
105
  return state;
105
106
  }
@@ -6,6 +6,7 @@ import TemplatePreview from '../../components/TemplatePreview';
6
6
  import SmsCreate from '../Sms/Create';
7
7
  import SmsEdit from '../Sms/Edit';
8
8
  import Email from '../Email';
9
+ import EmailPreview from '../../components/EmailPreview';
9
10
  import * as constants from './constants';
10
11
  const CreativesWrapper = styled.div`
11
12
  .ant-popover,
@@ -25,6 +26,8 @@ function SlideBoxContent(props) {
25
26
  getFormData,
26
27
  messageDetails,
27
28
  onCreateNew,
29
+ toggleShowSlideBox,
30
+ showSlideBox,
28
31
  } = props;
29
32
  const query = { type: 'embedded', module: 'library' };
30
33
  const creativesLocationProps = {
@@ -36,12 +39,16 @@ function SlideBoxContent(props) {
36
39
  let isEditSms = false;
37
40
  let isEditEmailWithId = false;
38
41
  let isEmailEditWithContent = false;
42
+ let isPreview = false;
43
+ let isEmailPreview = false;
39
44
  if (templateData) {
40
45
  const channel = templateData.type;
41
46
  isEditSms = slidBoxContent === 'editTemplate' && channel === constants.SMS;
42
47
  isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
43
48
  isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
44
49
  isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
50
+ isPreview = slidBoxContent === 'preview' && channel !== constants.EMAIL;
51
+ isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
45
52
  }
46
53
 
47
54
  return (
@@ -55,13 +62,25 @@ function SlideBoxContent(props) {
55
62
  createNew={onCreateNew}
56
63
  />
57
64
  )}
58
- {slidBoxContent === 'preview' && (
65
+ {isPreview && (
59
66
  <TemplatePreview
60
67
  content={templateData.versions.base['sms-editor']}
61
68
  channel={templateData.type.toLowerCase()}
62
69
  charCounterEnabled
63
70
  />
64
71
  )}
72
+ {isEmailPreview && (
73
+ <EmailPreview
74
+ content={templateData.base.html_content}
75
+ device={this.state.device}
76
+ header={templateData.base.subject}
77
+ location={this.props.location}
78
+ show={showSlideBox}
79
+ handleClose={toggleShowSlideBox}
80
+ changePreviewDevice={this.changePreviewDevice}
81
+ />
82
+ )
83
+ }
65
84
  {isEditSms && (
66
85
  <SmsEdit
67
86
  location={creativesLocationProps}
@@ -125,5 +144,7 @@ SlideBoxContent.propTypes = {
125
144
  getFormData: PropTypes.func,
126
145
  messageDetails: PropTypes.object,
127
146
  onCreateNew: PropTypes.func,
147
+ toggleShowSlideBox: PropTypes.func,
148
+ showSlideBox: PropTypes.bool,
128
149
  };
129
150
  export default SlideBoxContent;
@@ -123,8 +123,7 @@ class Creatives extends React.Component {
123
123
  this.setState({ isGetFormData: true });
124
124
  };
125
125
  render() {
126
- const {slidBoxContent, isGetFormData, showSlideBox} = this.state;
127
- const { templateData } = this.state;
126
+ const {slidBoxContent, isGetFormData, showSlideBox, templateData} = this.state;
128
127
  return (
129
128
  <div className={classnames(`${classPrefix}`)}>
130
129
  <CapSlideBox
@@ -147,6 +146,8 @@ class Creatives extends React.Component {
147
146
  getFormData={this.getFormData}
148
147
  onCreateNew={this.onCreateNew}
149
148
  isGetFormData={isGetFormData}
149
+ toggleShowSlideBox={this.toggleShowSlideBox}
150
+ showSlideBox={showSlideBox}
150
151
  />
151
152
  }
152
153
  footer={
@@ -2523,14 +2523,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2523
2523
  }
2524
2524
  if (containerInputFieldCol.id === 'add-language-button' && !ifLangSupported) {
2525
2525
  const newContainerInputFieldCol = containerInputFieldCol;
2526
- newContainerInputFieldCol.colStyle.display = "none";
2526
+ if (newContainerInputFieldCol.colStyle.display !== "none") {
2527
+ newContainerInputFieldCol.colStyle.display = "none";
2528
+ }
2527
2529
  hideLang = true;
2528
2530
  } else if (containerInputFieldCol.id === 'add-language-button') {
2529
2531
  hideLang = true;
2530
2532
  }
2531
2533
  if (containerInputFieldCol.id === "mark-final-version-label") {
2532
2534
  const newContainerInputFieldCol = containerInputFieldCol;
2533
- newContainerInputFieldCol.colStyle.display = "none";
2535
+ if (newContainerInputFieldCol.colStyle.display !== "none") {
2536
+ newContainerInputFieldCol.colStyle.display = "none";
2537
+ }
2534
2538
  }
2535
2539
  // if (containerInputFieldCol.id === "tab-options-popover") {
2536
2540
  // const newContainerInputFieldCol = containerInputFieldCol;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.9",
4
+ "version": "2.0.11",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",