@capillarytech/creatives-library 2.0.2 → 2.0.4
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.
|
@@ -15,7 +15,8 @@ import moment from "moment";
|
|
|
15
15
|
import _ from 'lodash';
|
|
16
16
|
import { bindActionCreators } from 'redux';
|
|
17
17
|
import { Row, Select, Spin, Dropdown, Col, Breadcrumb, Menu, Modal} from 'antd';
|
|
18
|
-
import {
|
|
18
|
+
import { CapPopover, CapSelect } from '@capillarytech/cap-react-ui-library';
|
|
19
|
+
import {CapButton, CapInput} from '@capillarytech/cap-ui-library';
|
|
19
20
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
20
21
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
21
22
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -1260,6 +1261,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1260
1261
|
value={this.state.searchText}
|
|
1261
1262
|
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
1262
1263
|
/>
|
|
1264
|
+
{this.props.isComponent ? <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1265
|
+
<CapButton type="secondary" onClick={() => this.props.isComponent ? this.handleBlankTemplateAction() : this.createTemplate()}>{this.state.channel.toUpperCase() === 'SMS' ? this.props.intl.formatMessage(messages.createSmsActionButton) : 'Create SMS'}</CapButton>
|
|
1266
|
+
</div>
|
|
1267
|
+
:
|
|
1263
1268
|
<div className="action-container">
|
|
1264
1269
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1265
1270
|
<div className="select-font">{this.props.intl.formatMessage(messages.sortBy)}</div>
|
|
@@ -1273,7 +1278,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1273
1278
|
</CapSelect>
|
|
1274
1279
|
</div>
|
|
1275
1280
|
}
|
|
1276
|
-
</div>
|
|
1281
|
+
</div>}
|
|
1277
1282
|
</div>
|
|
1278
1283
|
);
|
|
1279
1284
|
const accountOptions = [];
|
|
@@ -1316,7 +1321,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1316
1321
|
}
|
|
1317
1322
|
const pageHeader = (
|
|
1318
1323
|
<div>
|
|
1319
|
-
{(this.props.location.query.type !== 'embedded')
|
|
1324
|
+
{(this.props.location.query.type !== 'embedded') && `${pageHeaderText}`}
|
|
1325
|
+
{!this.props.isComponent && templateText}
|
|
1320
1326
|
{(this.isEnabledInLibraryModule("showAccountSelection") || (((this.state.channel.toUpperCase() === 'WECHAT' || this.state.channel.toUpperCase() === "MOBILEPUSH") && (this.props.location.query.type !== 'embedded') && !_.isEmpty(this.props.Templates.weCrmAccounts)))) &&
|
|
1321
1327
|
<CapSelect className="selectAccount" onSelect={this.onAccountSelect} value={this.props.Templates.selectedWeChatAccount ? this.props.Templates.selectedWeChatAccount.name : undefined} placeholder={this.props.intl.formatMessage(messages.selectAccount)}>
|
|
1322
1328
|
{accountOptions}
|
|
@@ -1464,7 +1470,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1464
1470
|
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
1465
1471
|
<Row>
|
|
1466
1472
|
<Col>
|
|
1467
|
-
{this.props.location.query.type !== "embedded" &&
|
|
1473
|
+
{(!this.props.isComponent || this.props.location.query.type !== "embedded") &&
|
|
1468
1474
|
<Breadcrumb>
|
|
1469
1475
|
<BreadcrumbItem>{this.props.intl.formatMessage(messages.campaigns)}</BreadcrumbItem>
|
|
1470
1476
|
<BreadcrumbItem>{this.props.intl.formatMessage(messages.creatives)}</BreadcrumbItem>
|
|
@@ -1475,7 +1481,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1475
1481
|
</Row>
|
|
1476
1482
|
<Row className="template-header-container">
|
|
1477
1483
|
<div className="template-header">{(this.props.location.query.type === 'embedded' && moduleName === 'dvs') ? pageHeaderDvs : pageHeader}</div>
|
|
1478
|
-
{actionButton}
|
|
1484
|
+
{!this.props.isComponent && actionButton}
|
|
1479
1485
|
</Row>
|
|
1480
1486
|
<Row>
|
|
1481
1487
|
<Helmet
|
|
@@ -1485,7 +1491,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1485
1491
|
]}
|
|
1486
1492
|
/>
|
|
1487
1493
|
{this.props.renderNewCardGrid && templateList && templateList.length > 0 &&
|
|
1488
|
-
this.props.renderNewCardGrid({templates: this.props.TemplatesList, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})
|
|
1494
|
+
this.props.renderNewCardGrid({templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})
|
|
1489
1495
|
}
|
|
1490
1496
|
{!this.props.renderNewCardGrid && ((templateList && templateList.length > 0) || isSearch) && <Pagination onPageChange={() => { console.log('getting all templates pagination'); this.getAllTemplates({getNextPage: true}); }} paginationSelector="pagination-container">
|
|
1491
1497
|
<CardGrid
|
|
@@ -1563,6 +1569,7 @@ Templates.propTypes = {
|
|
|
1563
1569
|
createNew: PropTypes.func,
|
|
1564
1570
|
onSelectTemplate: PropTypes.func,
|
|
1565
1571
|
lineActions: PropTypes.object,
|
|
1572
|
+
isComponent: PropTypes.bool,
|
|
1566
1573
|
};
|
|
1567
1574
|
|
|
1568
1575
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -39,7 +39,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
getTemplateDataForGrid = ({templates, handlers}) => {
|
|
42
|
+
getTemplateDataForGrid = ({templates, handlers, filterContent}) => {
|
|
43
43
|
const cardDataList = templates.map((template) => (
|
|
44
44
|
{
|
|
45
45
|
icon: <Message />,
|
|
@@ -48,7 +48,10 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
48
48
|
options: <View onClick={() => { this.props.isFullMode ? handlers.handlePreviewClick(template) : this.props.handlePeviewTemplate(template); }} />,
|
|
49
49
|
hoverOption: <CapButton onClick={(e) => handlers.handleEditClick(e, template._id)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.edit : messages.select)}</CapButton>,
|
|
50
50
|
}));
|
|
51
|
-
return <
|
|
51
|
+
return (<div>
|
|
52
|
+
{filterContent}
|
|
53
|
+
<CapCustomCardGrid cardDataList={cardDataList} />
|
|
54
|
+
</div>);
|
|
52
55
|
}
|
|
53
56
|
getTemplatesComponent(channel) {
|
|
54
57
|
const notFoundMessage = `No ${channel} templates found`;
|
|
@@ -61,8 +64,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
61
64
|
location={{pathname: channel, search: '', query}}
|
|
62
65
|
route={{name: channel}}
|
|
63
66
|
router={this.props.router}
|
|
64
|
-
isComponent
|
|
65
|
-
createNew={this.createNew}
|
|
67
|
+
isComponent={!this.props.isFullMode}
|
|
68
|
+
createNew={this.props.createNew}
|
|
66
69
|
onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
|
|
67
70
|
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
68
71
|
/>);
|
|
@@ -107,6 +110,7 @@ TemplatesV2.propTypes = {
|
|
|
107
110
|
isFullMode: PropTypes.bool,
|
|
108
111
|
handlePreview: PropTypes.func,
|
|
109
112
|
onSelectTemplate: PropTypes.func,
|
|
113
|
+
createNew: PropTypes.func,
|
|
110
114
|
channel: PropTypes.string,
|
|
111
115
|
Templates: PropTypes.object,
|
|
112
116
|
TemplatesList: PropTypes.arrayOf(PropTypes.object),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.4",
|
|
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.
|
|
16
|
+
"@capillarytech/cap-ui-library": "^1.0.32",
|
|
17
17
|
"antd": "^3.13.1",
|
|
18
18
|
"axios": "^0.16.2",
|
|
19
19
|
"babel-polyfill": "6.20.0",
|