@capillarytech/creatives-library 3.1.6 → 3.1.8
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/Line/Create/messages.js +1 -1
- package/package.json +1 -1
- package/services/api.js +1 -8
- package/translations/en.json +420 -1
- package/translations/zh.json +419 -0
- package/v2Components/CapTagList/index.js +1 -1
- package/v2Components/CapTagList/messages.js +1 -1
- package/v2Components/EmailPreviewV2/messages.js +4 -4
- package/v2Components/FormBuilder/messages.js +1 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +43 -0
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +54 -47
- package/v2Components/TopBar/messages.js +1 -1
- package/v2Containers/CreativesContainer/messages.js +3 -3
- package/v2Containers/Line/Create/messages.js +1 -1
- package/v2Containers/MobilePush/Create/messages.js +1 -1
- package/v2Containers/MobilePush/Edit/messages.js +1 -1
- package/v2Containers/MobilepushWrapper/messages.js +1 -1
- package/v2Containers/Templates/index.js +7 -12
- package/v2Containers/Templates/messages.js +2 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -4
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import {
|
|
10
|
+
// import { connect } from 'react-redux';
|
|
11
|
+
import { CapRow, CapColumn, CapButton } from '@capillarytech/cap-react-ui-library/';
|
|
12
|
+
import { CapHeading } from '@capillarytech/cap-ui-library/';
|
|
11
13
|
import { FormattedMessage } from 'react-intl';
|
|
12
14
|
import _ from 'lodash';
|
|
13
15
|
import './_wechatRichmediaTemplatePrev.scss';
|
|
@@ -16,39 +18,41 @@ const wechatBody = require('./../assets/images/WECHAT_5x.png');
|
|
|
16
18
|
|
|
17
19
|
class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
18
20
|
preparePreviewData = (mediaList) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
{Object.keys(mediaList).length === 1 ?
|
|
30
|
-
<CapRow style={{ height: 32 }}>
|
|
31
|
-
{contentData.digest ? contentData.digest : ""}
|
|
32
|
-
</CapRow>
|
|
33
|
-
:
|
|
34
|
-
""
|
|
35
|
-
}
|
|
21
|
+
const previewMsg = [];
|
|
22
|
+
const content = JSON.parse(JSON.stringify(mediaList));
|
|
23
|
+
const mediaListLength = content.length;
|
|
24
|
+
const contentData = content[0];
|
|
25
|
+
previewMsg.push(
|
|
26
|
+
<div className="image-container">
|
|
27
|
+
<img alt="default" width="100%" height="102px" src={contentData.image_url} />
|
|
28
|
+
{mediaListLength !== 1 && (
|
|
29
|
+
<div className="name-container">
|
|
30
|
+
<CapHeading type="h4" style={{color: "white"}}>{contentData.title}</CapHeading>
|
|
36
31
|
</div>
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
if (mediaListLength === 1) {
|
|
36
|
+
previewMsg.push(
|
|
37
|
+
<div className="name-container-with-abstract">
|
|
38
|
+
<CapHeading type="h4">{contentData.title}</CapHeading>
|
|
39
|
+
<CapHeading type="label7">{contentData.digest}</CapHeading>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
content.splice(1, 2).forEach((data) => {
|
|
44
|
+
previewMsg.push(
|
|
45
|
+
<div className="additional-richmedia-container">
|
|
46
|
+
<div><CapHeading type="label7" style={{width: '170px', top: '12px', position: 'relative'}}>{data.title}</CapHeading></div>
|
|
47
|
+
<img alt="default" width="34px" height="34px" src={data.image_url} />
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
50
|
});
|
|
51
|
-
return
|
|
51
|
+
return (
|
|
52
|
+
<div className="richmedia-template">
|
|
53
|
+
{previewMsg}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
52
56
|
}
|
|
53
57
|
prepareCardLayoutPreviewData = (mediaList) => {
|
|
54
58
|
const returnObj = [];
|
|
@@ -90,27 +94,29 @@ class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-dis
|
|
|
90
94
|
}
|
|
91
95
|
render() {
|
|
92
96
|
return (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<div className=
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
<div className={this.props.type === 'embedded' ? "
|
|
99
|
-
{this.
|
|
97
|
+
<div>
|
|
98
|
+
{this.props.contentForSlideBox ?
|
|
99
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
100
|
+
<div className="shell align-center" id="sms-preview">
|
|
101
|
+
<img className="preview-image" src={wechatBody} alt="Preview is being generated"/>
|
|
102
|
+
<div className={this.props.type === 'embedded' ? "wechatMsgContainerOutbound" : "wechatMsgContainer"}>
|
|
103
|
+
<div className={this.props.type === 'embedded' ? "overflow-handle-preview-outbound" : "overflow-handle-preview"}>
|
|
104
|
+
{this.preparePreviewData(this.props.content)}
|
|
105
|
+
</div>
|
|
100
106
|
</div>
|
|
101
107
|
</div>
|
|
108
|
+
{this.props.showEdit ? <CapButton onClick={(e) => this.goToEdit(e, this.props.path)} className="preview-buttons" type="primary">{this.props.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} /> }</CapButton> : ""}
|
|
102
109
|
</div>
|
|
103
|
-
{this.props.showEdit ? <CapButton onClick={(e) => this.goToEdit(e, this.props.path)} className="preview-buttons" type="primary">{this.props.type === 'embedded' ? <FormattedMessage {...messages.select} /> : <FormattedMessage {...messages.edit} /> }</CapButton> : ""}
|
|
104
|
-
</div>
|
|
105
110
|
:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
<div className={`preview-container ${this.props.type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
112
|
+
<div className="shell align-center" id="sms-preview">
|
|
113
|
+
<div className="wechatMsgContainerCardLayout">
|
|
114
|
+
<div>{this.prepareCardLayoutPreviewData(this.props.content)}
|
|
115
|
+
</div>
|
|
110
116
|
</div>
|
|
111
117
|
</div>
|
|
112
|
-
</div>
|
|
113
|
-
|
|
118
|
+
</div>}
|
|
119
|
+
</div>
|
|
114
120
|
);
|
|
115
121
|
}
|
|
116
122
|
}
|
|
@@ -127,3 +133,4 @@ WechatRichmediaTemplatePreview.propTypes = {
|
|
|
127
133
|
};
|
|
128
134
|
|
|
129
135
|
export default WechatRichmediaTemplatePreview;
|
|
136
|
+
// export default connect(null, null)(WechatRichmediaTemplatePreview);
|
|
@@ -259,7 +259,7 @@ export default defineMessages({
|
|
|
259
259
|
defaultMessage: `Edit message content`,
|
|
260
260
|
},
|
|
261
261
|
"createMessageContent": {
|
|
262
|
-
id: `${scope}.
|
|
262
|
+
id: `${scope}.createMessageContent`,
|
|
263
263
|
defaultMessage: `New {channel} message`,
|
|
264
264
|
},
|
|
265
265
|
"creativeTemplatesDesc": {
|
|
@@ -283,11 +283,11 @@ export default defineMessages({
|
|
|
283
283
|
defaultMessage: `Discard`,
|
|
284
284
|
},
|
|
285
285
|
"creativesTemplatesEdit": {
|
|
286
|
-
id: `${scope}.
|
|
286
|
+
id: `${scope}.creativesTemplatesEdit`,
|
|
287
287
|
defaultMessage: `Edit`,
|
|
288
288
|
},
|
|
289
289
|
"creativesTemplatesEditName": {
|
|
290
|
-
id: `${scope}.
|
|
290
|
+
id: `${scope}.creativesTemplatesEditName`,
|
|
291
291
|
defaultMessage: `Edit name`,
|
|
292
292
|
},
|
|
293
293
|
"wechatAccountNotConfigured": {
|
|
@@ -167,7 +167,7 @@ export default defineMessages({
|
|
|
167
167
|
defaultMessage: 'Please upload an image to proceed',
|
|
168
168
|
},
|
|
169
169
|
"Maximum characters length exceeds": {
|
|
170
|
-
id: 'creatives.containersV2.Line.Create.
|
|
170
|
+
id: 'creatives.containersV2.Line.Create.maximumCharacterLengthExceeds',
|
|
171
171
|
defaultMessage: 'Maximum characters length exceeds',
|
|
172
172
|
},
|
|
173
173
|
"alertMessage": {
|
|
@@ -231,7 +231,7 @@ export default defineMessages({
|
|
|
231
231
|
defaultMessage: 'Mobile Push',
|
|
232
232
|
},
|
|
233
233
|
"selectActionButton": {
|
|
234
|
-
id: 'creatives.containersV2.MobilePush.Create.
|
|
234
|
+
id: 'creatives.containersV2.MobilePush.Create.selectActionButton',
|
|
235
235
|
defaultMessage: 'Select action buttons',
|
|
236
236
|
},
|
|
237
237
|
"uploadImageSizeErrorTitle": {
|
|
@@ -247,7 +247,7 @@ export default defineMessages({
|
|
|
247
247
|
defaultMessage: 'IOS template is not configured, save without IOS template',
|
|
248
248
|
},
|
|
249
249
|
"selectActionButton": {
|
|
250
|
-
id: 'creatives.containersV2.MobilePush.Edit.
|
|
250
|
+
id: 'creatives.containersV2.MobilePush.Edit.selectActionButton',
|
|
251
251
|
defaultMessage: 'Select action buttons',
|
|
252
252
|
},
|
|
253
253
|
"validationError": {
|
|
@@ -23,7 +23,7 @@ export default defineMessages({
|
|
|
23
23
|
defaultMessage: 'Which type of content you want to create?',
|
|
24
24
|
},
|
|
25
25
|
creativeName: {
|
|
26
|
-
id: 'creatives.containersV2.MobilepushWrapper.
|
|
26
|
+
id: 'creatives.containersV2.MobilepushWrapper.creativeName',
|
|
27
27
|
defaultMessage: 'Creative name',
|
|
28
28
|
},
|
|
29
29
|
});
|
|
@@ -387,7 +387,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
387
387
|
|
|
388
388
|
onAccountSelect(e) {
|
|
389
389
|
const value = e.target.value;
|
|
390
|
-
console.log("onAccountSelect", e, value);
|
|
391
390
|
this.setState({selectedAccount: value}, () => {
|
|
392
391
|
const params = {
|
|
393
392
|
name: this.state.searchText,
|
|
@@ -532,18 +531,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
532
531
|
};
|
|
533
532
|
filterWechatTemplates = (templates) => {
|
|
534
533
|
const { wechatFilter } = this.state;
|
|
535
|
-
switch(wechatFilter) {
|
|
534
|
+
switch (wechatFilter) {
|
|
536
535
|
case WECHAT_FILTERS.RICHMEDIA:
|
|
537
|
-
return templates.filter(
|
|
538
|
-
return template.definition && template.definition.msgcontent.toUpperCase() === "RICH_MEDIA_WECHAT";
|
|
539
|
-
});
|
|
536
|
+
return templates.filter((template) => template.definition && template.definition.msgcontent.toUpperCase() === "RICH_MEDIA_WECHAT");
|
|
540
537
|
case WECHAT_FILTERS.MAPTEMPLATES:
|
|
541
|
-
return templates.filter(
|
|
542
|
-
return !template.definition;
|
|
543
|
-
});
|
|
538
|
+
return templates.filter((template) => !template.definition);
|
|
544
539
|
default:
|
|
545
540
|
return templates;
|
|
546
|
-
}
|
|
541
|
+
}
|
|
547
542
|
}
|
|
548
543
|
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
549
544
|
const currentChannel = channel.toUpperCase();
|
|
@@ -1585,7 +1580,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1585
1580
|
<CapRadioCard
|
|
1586
1581
|
className="select-account"
|
|
1587
1582
|
onChange={this.onAccountSelect}
|
|
1588
|
-
value={this.props.Templates.selectedWeChatAccount ? this.props.Templates.selectedWeChatAccount.name : undefined}
|
|
1589
1583
|
panes={accountOptions}
|
|
1590
1584
|
cardHeight="48px"
|
|
1591
1585
|
cardWidth="276px"
|
|
@@ -1611,7 +1605,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1611
1605
|
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
1612
1606
|
return (<CapHeader
|
|
1613
1607
|
title={<CapHeading type="h4">{isMobilePushChannel ? this.props.intl.formatMessage(messages.mobilepushAccount) : this.props.intl.formatMessage(messages.wechatAccount)}</CapHeading>}
|
|
1614
|
-
|
|
1608
|
+
description={<><CapHeading type="h3">{selectedAccount} {weCrmAccounts.length > 1 && <CapLink onClick={this.setAccountSelectionMode} style={{display: 'inline-block', position: 'relative', top: '3px'}} fontWeight="regular" fontSize="14px" title="change"/>} </CapHeading></>}
|
|
1615
1609
|
size="regular"
|
|
1616
1610
|
/>);
|
|
1617
1611
|
}
|
|
@@ -1649,6 +1643,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1649
1643
|
//TODO -> uncomment the following line
|
|
1650
1644
|
// const isfilterContentVisisble = !isEmpty(this.props.TemplatesList) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError);
|
|
1651
1645
|
const isfilterContentVisisble = true;
|
|
1646
|
+
const isWechatEmbedded = !this.props.isFullMode && channel.toUpperCase() === WECHAT;
|
|
1652
1647
|
const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH].includes(this.state.channel.toUpperCase())) && <div className="action-container">
|
|
1653
1648
|
{isfilterContentVisisble && <CapInput.Search
|
|
1654
1649
|
className="search-text"
|
|
@@ -1673,7 +1668,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1673
1668
|
</CapRadio.CapRadioGroup>
|
|
1674
1669
|
}
|
|
1675
1670
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1676
|
-
{isfilterContentVisisble && <CapButton
|
|
1671
|
+
{isfilterContentVisisble && !isWechatEmbedded && <CapButton
|
|
1677
1672
|
type={"primary"}
|
|
1678
1673
|
disabled={this.isCreateDisabled()}
|
|
1679
1674
|
style={{marginLeft: '8px'}}
|
|
@@ -255,7 +255,7 @@ export default defineMessages({
|
|
|
255
255
|
defaultMessage: `Edit message content`,
|
|
256
256
|
},
|
|
257
257
|
"createMessageContent": {
|
|
258
|
-
id: `${scope}.
|
|
258
|
+
id: `${scope}.createMessageContent`,
|
|
259
259
|
defaultMessage: `New message`,
|
|
260
260
|
},
|
|
261
261
|
"creativeTemplatesDesc": {
|
|
@@ -267,7 +267,7 @@ export default defineMessages({
|
|
|
267
267
|
defaultMessage: `Done`,
|
|
268
268
|
},
|
|
269
269
|
"creativesTemplatesEdit": {
|
|
270
|
-
id: `${scope}.
|
|
270
|
+
id: `${scope}.creativesTemplatesEdit`,
|
|
271
271
|
defaultMessage: `Edit`,
|
|
272
272
|
},
|
|
273
273
|
"continue": {
|
|
@@ -18,8 +18,6 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
18
18
|
import forEach from 'lodash/forEach';
|
|
19
19
|
import isEqual from 'lodash/isEqual';
|
|
20
20
|
import get from 'lodash/get';
|
|
21
|
-
|
|
22
|
-
import { Menu } from 'antd';
|
|
23
21
|
import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink } from '@capillarytech/cap-ui-library';
|
|
24
22
|
import makeSelectCreate, {makeSelectTemplates, getAssetDetails, getContentAssetDetails} from './selectors';
|
|
25
23
|
import * as actions from './actions';
|
|
@@ -925,11 +923,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
925
923
|
/>
|
|
926
924
|
<div className="wechat-container">
|
|
927
925
|
<CapRow className="wechat-form-container">
|
|
928
|
-
<CapColumn span={
|
|
926
|
+
<CapColumn span={9}>
|
|
929
927
|
{cardLayout}
|
|
930
928
|
{!this.state.isIframe && contentMenu}
|
|
931
929
|
</CapColumn>
|
|
932
|
-
<CapColumn span={
|
|
930
|
+
<CapColumn span={15}>
|
|
933
931
|
{ !isIframe && <CapInput
|
|
934
932
|
label="Name of the template"
|
|
935
933
|
value={this.state.templateName}
|