@capillarytech/creatives-library 2.0.10 → 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,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;
@@ -146,6 +146,8 @@ class Creatives extends React.Component {
146
146
  getFormData={this.getFormData}
147
147
  onCreateNew={this.onCreateNew}
148
148
  isGetFormData={isGetFormData}
149
+ toggleShowSlideBox={this.toggleShowSlideBox}
150
+ showSlideBox={showSlideBox}
149
151
  />
150
152
  }
151
153
  footer={
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.10",
4
+ "version": "2.0.11",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",