@capillarytech/creatives-library 2.0.10 → 2.0.12

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,16 @@ 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 { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree } from '@capillarytech/cap-ui-library';
12
+ import { CapSelect } from '@capillarytech/cap-react-ui-library';
13
+
12
14
  import _ from 'lodash';
13
15
  // import { CapInput } from '@capillarytech/cap-react-ui-library/basic/input';
14
16
  import { injectIntl, intlShape } from 'react-intl';
15
- import { CapButton, CapPopover, CapSelect, CapInput } from '@capillarytech/cap-react-ui-library';
16
17
  import messages from './messages';
17
18
 
19
+ const {Search} = CapInput;
20
+ const {CapTreeNode} = CapTree;
18
21
  class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
19
22
 
20
23
  constructor(props) {
@@ -184,7 +187,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
184
187
  onVisibleChange={this.togglePopoverVisibility}
185
188
  content={<div>
186
189
  <CapSpin tip="Getting tags..." spinning={this.props.loading}>
187
- <CapInputSearch style={{ marginBottom: 8, width: '250px'}} placeholder="Search" onChange={this.onChange} />
190
+ <Search style={{ marginBottom: 8, width: '250px'}} placeholder="Search" onChange={this.onChange} />
188
191
  {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
192
  </CapSelect> : ''}
190
193
  <CapTree
@@ -201,7 +204,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
201
204
  </div>}
202
205
  trigger="click"
203
206
  placement="bottomRight">
204
- <CapButton icon="plus-circle-o" type="secondary">{this.props.label !== '' ? this.props.label : ''}</CapButton>
207
+ <CapButton isAddBtn type="flat">{this.props.label !== '' ? this.props.label : ''}</CapButton>
205
208
  </CapPopover>
206
209
  <CapModal
207
210
  visible={this.state.showModal}
@@ -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.12",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -13,7 +13,7 @@
13
13
  "license": "LicenseRef-LICENSE",
14
14
  "dependencies": {
15
15
  "@capillarytech/cap-react-ui-library": "latest",
16
- "@capillarytech/cap-ui-library": "^1.0.44",
16
+ "@capillarytech/cap-ui-library": "^1.0.47",
17
17
  "antd": "^3.13.1",
18
18
  "axios": "^0.16.2",
19
19
  "babel-polyfill": "6.20.0",