@capillarytech/creatives-library 2.0.13 → 2.0.15
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.
- package/containers/Ebill/index.js +2 -1
- package/containers/Line/Create/index.js +2 -1
- package/containers/Line/Edit/index.js +54 -52
- package/containers/MobilePush/Create/index.js +81 -79
- package/containers/MobilePush/Edit/index.js +79 -77
- package/containers/Sms/Create/index.js +9 -8
- package/containers/Sms/Edit/index.js +2 -483
- package/containers/Templates/index.js +49 -59
- package/containers/TemplatesV2/index.js +10 -2
- package/containers/WeChat/index.js +5 -5
- package/package.json +2 -2
- package/utils/callNativeEvent.js +15 -0
|
@@ -370,18 +370,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
setLocale = () => {
|
|
374
|
-
const user = localStorage.getItem('user');
|
|
375
|
-
let locale = 'en';
|
|
376
|
-
if (user) {
|
|
377
|
-
locale = JSON.parse(user).lang;
|
|
378
|
-
}
|
|
379
|
-
locale = this.getMappedLocale(locale);
|
|
380
|
-
//locale = 'zh';
|
|
381
|
-
console.log('Setting final locale as', locale);
|
|
382
|
-
moment.locale(locale);
|
|
383
|
-
};
|
|
384
|
-
|
|
385
373
|
getMappedLocale = (locale) => {
|
|
386
374
|
const map = {
|
|
387
375
|
'en': 'en',
|
|
@@ -435,7 +423,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
435
423
|
});
|
|
436
424
|
}
|
|
437
425
|
};
|
|
438
|
-
|
|
426
|
+
onPaginationChange = () => { this.getAllTemplates({getNextPage: true}); }
|
|
427
|
+
setLocale = () => {
|
|
428
|
+
const user = localStorage.getItem('user');
|
|
429
|
+
let locale = 'en';
|
|
430
|
+
if (user) {
|
|
431
|
+
locale = JSON.parse(user).lang;
|
|
432
|
+
}
|
|
433
|
+
locale = this.getMappedLocale(locale);
|
|
434
|
+
//locale = 'zh';
|
|
435
|
+
console.log('Setting final locale as', locale);
|
|
436
|
+
moment.locale(locale);
|
|
437
|
+
};
|
|
439
438
|
getCurrentWindow(e) {
|
|
440
439
|
console.log('in sms templates', e);
|
|
441
440
|
const response = {
|
|
@@ -731,7 +730,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
731
730
|
});
|
|
732
731
|
} else {
|
|
733
732
|
this.props.router.push({
|
|
734
|
-
pathname:
|
|
733
|
+
pathname: `/templates/${this.state.channel.toLowerCase()}/create`,
|
|
735
734
|
query: type === 'embedded' ? {type: 'embedded', module} : {module},
|
|
736
735
|
});
|
|
737
736
|
}
|
|
@@ -1207,7 +1206,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1207
1206
|
/>
|
|
1208
1207
|
);
|
|
1209
1208
|
}
|
|
1210
|
-
|
|
1211
1209
|
render() {
|
|
1212
1210
|
console.log('templates props', this.props);
|
|
1213
1211
|
let pageHeaderText = '';
|
|
@@ -1227,30 +1225,30 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1227
1225
|
pageHeaderText = this.props.intl.formatMessage(messages.lineHeader);
|
|
1228
1226
|
}
|
|
1229
1227
|
}
|
|
1230
|
-
const options = [
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
];
|
|
1240
|
-
const typeOptions = [
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
];
|
|
1228
|
+
// const options = [
|
|
1229
|
+
// {
|
|
1230
|
+
// value: "Most Recent",
|
|
1231
|
+
// label: this.props.intl.formatMessage(messages.mostRecentOption),
|
|
1232
|
+
// },
|
|
1233
|
+
// {
|
|
1234
|
+
// value: "Alphabetically",
|
|
1235
|
+
// label: this.props.intl.formatMessage(messages.alphabeticallyOption),
|
|
1236
|
+
// },
|
|
1237
|
+
// ];
|
|
1238
|
+
// const typeOptions = [
|
|
1239
|
+
// {
|
|
1240
|
+
// value: "All",
|
|
1241
|
+
// label: "All",
|
|
1242
|
+
// },
|
|
1243
|
+
// {
|
|
1244
|
+
// label: "Text",
|
|
1245
|
+
// value: 'Text',
|
|
1246
|
+
// },
|
|
1247
|
+
// {
|
|
1248
|
+
// label: "Image",
|
|
1249
|
+
// value: "Image",
|
|
1250
|
+
// },
|
|
1251
|
+
// ];
|
|
1254
1252
|
const filterContent = (
|
|
1255
1253
|
<div className="action-container">
|
|
1256
1254
|
<CapInput
|
|
@@ -1261,24 +1259,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1261
1259
|
value={this.state.searchText}
|
|
1262
1260
|
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
1263
1261
|
/>
|
|
1264
|
-
|
|
1265
|
-
<CapButton
|
|
1262
|
+
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1263
|
+
<CapButton
|
|
1264
|
+
type={this.props.isComponent ? "secondary" : "primary"}
|
|
1265
|
+
onClick={(ev) => this.props.isComponent ? this.handleBlankTemplateAction() : this.createTemplate(ev)} >
|
|
1266
|
+
{ this.props.intl.formatMessage(messages.createNewActionButton) }
|
|
1267
|
+
</CapButton>
|
|
1266
1268
|
</div>
|
|
1267
|
-
|
|
1268
|
-
<div className="action-container">
|
|
1269
|
-
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1270
|
-
<div className="select-font">{this.props.intl.formatMessage(messages.sortBy)}</div>
|
|
1271
|
-
<CapSelect key={"select-account"} style={{width: '120px', marginLeft: '16px', minWidth: 'initial'}} defaultValue="Most Recent" onChange={this.handleSortBy} options={options}>
|
|
1272
|
-
</CapSelect>
|
|
1273
|
-
</div>
|
|
1274
|
-
{ (this.state.channel.toLowerCase() === 'mobilepush' || this.state.channel.toLowerCase() === 'line') &&
|
|
1275
|
-
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center', marginLeft: '16px'}}>
|
|
1276
|
-
<div className="select-font">Type</div>
|
|
1277
|
-
<CapSelect key={"select-type"} style={{width: '120px', marginLeft: '16px', minWidth: 'initial'}} defaultValue="All" onChange={this.handleType} options={typeOptions}>
|
|
1278
|
-
</CapSelect>
|
|
1279
|
-
</div>
|
|
1280
|
-
}
|
|
1281
|
-
</div>}
|
|
1269
|
+
|
|
1282
1270
|
</div>
|
|
1283
1271
|
);
|
|
1284
1272
|
const accountOptions = [];
|
|
@@ -1481,7 +1469,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1481
1469
|
</Row>
|
|
1482
1470
|
<Row className="template-header-container">
|
|
1483
1471
|
<div className="template-header">{(this.props.location.query.type === 'embedded' && moduleName === 'dvs') ? pageHeaderDvs : pageHeader}</div>
|
|
1484
|
-
{!this.props.isComponent && actionButton}
|
|
1485
1472
|
</Row>
|
|
1486
1473
|
<Row>
|
|
1487
1474
|
<Helmet
|
|
@@ -1491,9 +1478,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1491
1478
|
]}
|
|
1492
1479
|
/>
|
|
1493
1480
|
{this.props.renderNewCardGrid && templateList && templateList.length > 0 &&
|
|
1494
|
-
|
|
1481
|
+
<Pagination onPageChange={this.onPaginationChange} paginationSelector="pagination-container">
|
|
1482
|
+
{this.props.renderNewCardGrid({templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
1483
|
+
</Pagination>
|
|
1495
1484
|
}
|
|
1496
|
-
{!this.props.renderNewCardGrid && ((templateList && templateList.length > 0) || isSearch) &&
|
|
1485
|
+
{!this.props.renderNewCardGrid && ((templateList && templateList.length > 0) || isSearch) &&
|
|
1486
|
+
<Pagination onPageChange={this.onPaginationChange} paginationSelector="pagination-container">
|
|
1497
1487
|
<CardGrid
|
|
1498
1488
|
className={this.state.channel.toLowerCase() === "mobilepush" ? "mobilepush-templates" : ""}
|
|
1499
1489
|
listItem={templateList}
|
|
@@ -44,7 +44,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
44
44
|
}));
|
|
45
45
|
return (<div>
|
|
46
46
|
{filterContent}
|
|
47
|
-
<
|
|
47
|
+
<div className="pagination-container">
|
|
48
|
+
<CapCustomCardList cardList={cardDataList} type="SMS" />
|
|
49
|
+
</div>
|
|
48
50
|
</div>);
|
|
49
51
|
}
|
|
50
52
|
getTemplatesComponent(channel) {
|
|
@@ -83,7 +85,13 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
83
85
|
render() {
|
|
84
86
|
return (
|
|
85
87
|
<div>
|
|
86
|
-
<CapTab
|
|
88
|
+
<CapTab
|
|
89
|
+
panes={this.state.panes}
|
|
90
|
+
onChange={this.channelChange}
|
|
91
|
+
activeKey={this.state.selectedChannel}
|
|
92
|
+
defaultActiveKey={this.state.selectedChannel}/>
|
|
93
|
+
|
|
94
|
+
|
|
87
95
|
</div>
|
|
88
96
|
|
|
89
97
|
);
|
|
@@ -27,6 +27,7 @@ import {getMessageObject} from '../../utils/messageUtils';
|
|
|
27
27
|
// import SlideBox from '../../components/SlideBox';
|
|
28
28
|
// import PageHeader from '../../components/PageHeader';
|
|
29
29
|
import './_wechat.scss';
|
|
30
|
+
import callNativeEvent from '../../utils/callNativeEvent';
|
|
30
31
|
|
|
31
32
|
// const Option = Select.Option;
|
|
32
33
|
|
|
@@ -483,7 +484,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
483
484
|
this.setState({isEdit: true});
|
|
484
485
|
}
|
|
485
486
|
if (this.state.isEdit && _.isEmpty(this.state.editTemplateData) && !_.isEmpty(nextProps.WeChat.weChatTemplates)) {
|
|
486
|
-
const templateIndex = _.findIndex(nextProps.WeChat.weChatTemplates, {
|
|
487
|
+
const templateIndex = _.findIndex(nextProps.WeChat.weChatTemplates, {_id: nextProps.params.id});
|
|
487
488
|
this.setState({editTemplateData: nextProps.WeChat.weChatTemplates[templateIndex]}, () => {
|
|
488
489
|
if (_.isEmpty(this.state.baseSchema)) {
|
|
489
490
|
this.setState({ baseSchema: _.cloneDeep(this.state.schema)}, () => {
|
|
@@ -694,8 +695,8 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
694
695
|
console.log('posting final result', this.state.formData, this.state.editTemplateData);
|
|
695
696
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
696
697
|
const data = {
|
|
697
|
-
|
|
698
|
-
|
|
698
|
+
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
699
|
+
Title: this.state.editTemplateData.versions.base.Title,
|
|
699
700
|
Tag: [],
|
|
700
701
|
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
701
702
|
TopColor: "#000000",
|
|
@@ -1287,7 +1288,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1287
1288
|
myField.value += myValue;
|
|
1288
1289
|
}
|
|
1289
1290
|
const event = new Event('input', { bubbles: true });
|
|
1290
|
-
myField.
|
|
1291
|
+
callNativeEvent({field, value: myField.value, event});
|
|
1291
1292
|
}
|
|
1292
1293
|
|
|
1293
1294
|
internalUrlChecked() {
|
|
@@ -1561,7 +1562,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1561
1562
|
<Helmet
|
|
1562
1563
|
title="WeChat"
|
|
1563
1564
|
/>
|
|
1564
|
-
{/* <CapSelect options={options} /> */}
|
|
1565
1565
|
<Row className="wechat-container">
|
|
1566
1566
|
<Col>
|
|
1567
1567
|
<FormBuilder
|
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.15",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"sanitize.css": "4.1.0",
|
|
62
62
|
"semantic-ui-react": "0.68.3",
|
|
63
63
|
"source-map-loader": "^0.2.4",
|
|
64
|
-
"styled-components": "
|
|
64
|
+
"styled-components": "2",
|
|
65
65
|
"warning": "3.0.0",
|
|
66
66
|
"whatwg-fetch": "2.0.1"
|
|
67
67
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//https://github.com/facebook/react/issues/11488#issuecomment-470623779
|
|
2
|
+
export default function callNativeEvent({field, value, ev}) {
|
|
3
|
+
const event = ev;
|
|
4
|
+
const input = field;
|
|
5
|
+
const lastValue = input.value;
|
|
6
|
+
input.value = value;
|
|
7
|
+
// hack React15
|
|
8
|
+
event.simulated = true;
|
|
9
|
+
// hack React16 内部定义了descriptor拦截value,此处重置状态
|
|
10
|
+
const tracker = input._valueTracker;
|
|
11
|
+
if (tracker) {
|
|
12
|
+
tracker.setValue(lastValue);
|
|
13
|
+
}
|
|
14
|
+
input.dispatchEvent(event);
|
|
15
|
+
}
|