@capillarytech/creatives-library 3.8.7 → 3.8.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/assets/lineImageTemplate.png +0 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/getSchema.js +4 -1
- package/translations/en.json +23 -1
- package/translations/zh.json +23 -1
- package/v2Components/FormBuilder/index.js +163 -31
- package/v2Components/FormBuilder/messages.js +16 -0
- package/v2Components/TemplatePreview/index.js +13 -4
- package/v2Containers/Assets/Gallery/index.js +40 -29
- package/v2Containers/CreativesContainer/SlideBoxContent.js +58 -3
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/EmailWrapper/index.js +3 -5
- package/v2Containers/Line/Create/_lineCreate.scss +40 -19
- package/v2Containers/Line/Create/actions.js +11 -8
- package/v2Containers/Line/Create/index.js +405 -215
- package/v2Containers/Line/Create/initialSchema.js +378 -0
- package/v2Containers/Line/Create/messages.js +42 -2
- package/v2Containers/Line/Create/sagas.js +10 -4
- package/v2Containers/Line/Create/selectors.js +1 -2
- package/v2Containers/Line/CreateWrapper/constants.js +2 -0
- package/v2Containers/Line/CreateWrapper/index.js +114 -0
- package/v2Containers/Line/CreateWrapper/messages.js +43 -0
- package/v2Containers/Templates/_templates.scss +20 -1
- package/v2Containers/Templates/index.js +59 -5
- package/v2Containers/TemplatesV2/index.js +5 -4
- package/v2Containers/TemplatesV2/messages.js +4 -0
|
@@ -50,7 +50,7 @@ import Pagination from '../../v2Components/Pagination';
|
|
|
50
50
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
51
51
|
import CreativesContainer from '../CreativesContainer';
|
|
52
52
|
import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
53
|
-
import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants'
|
|
53
|
+
import { CHANNEL_CREATE_TRACK_MAPPING, CHANNEL_EDIT_TRACK_MAPPING } from '../App/constants';
|
|
54
54
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
55
55
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
56
56
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
@@ -77,6 +77,11 @@ const WECHAT_FILTERS = {
|
|
|
77
77
|
MAPTEMPLATES: 'maptemplate',
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
const LINE_FILTERS = {
|
|
81
|
+
ALL: 'all',
|
|
82
|
+
TEXT: 'text',
|
|
83
|
+
IMAGE_VIDEO: 'image',
|
|
84
|
+
};
|
|
80
85
|
|
|
81
86
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
82
87
|
constructor(props) {
|
|
@@ -104,6 +109,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
104
109
|
routeParams: null,
|
|
105
110
|
activeMode: TEMPLATES_MODE,
|
|
106
111
|
wechatFilter: WECHAT_FILTERS.ALL,
|
|
112
|
+
lineFilter: LINE_FILTERS.ALL,
|
|
107
113
|
};
|
|
108
114
|
|
|
109
115
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
@@ -166,7 +172,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
componentDidMount() {
|
|
169
|
-
|
|
170
175
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
171
176
|
this.setLocale();
|
|
172
177
|
}
|
|
@@ -454,6 +459,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
454
459
|
};
|
|
455
460
|
} else {
|
|
456
461
|
creativesParams._id = pathname.split('/')[3];
|
|
462
|
+
creativesParams.modeType = pathname.split('/')[4];
|
|
457
463
|
}
|
|
458
464
|
creativesParams.type = this.state.channel.toUpperCase();
|
|
459
465
|
}
|
|
@@ -546,6 +552,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
546
552
|
return templates;
|
|
547
553
|
}
|
|
548
554
|
}
|
|
555
|
+
|
|
549
556
|
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
550
557
|
const currentChannel = channel.toUpperCase();
|
|
551
558
|
const {channel: stateChannel} = this.state;
|
|
@@ -554,6 +561,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
554
561
|
if (currentChannel === WECHAT) {
|
|
555
562
|
filteredTemplates = this.filterWechatTemplates(templates);
|
|
556
563
|
}
|
|
564
|
+
if (currentChannel === LINE) {
|
|
565
|
+
filteredTemplates = this.filterLineTemplates(templates);
|
|
566
|
+
}
|
|
557
567
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
558
568
|
const templateData =
|
|
559
569
|
{
|
|
@@ -607,6 +617,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
607
617
|
case WECHAT:
|
|
608
618
|
templateData.content = this.prepareWeChatPreviewData(template);
|
|
609
619
|
break;
|
|
620
|
+
case LINE: {
|
|
621
|
+
const {
|
|
622
|
+
content: {
|
|
623
|
+
messages: [{
|
|
624
|
+
text = '',
|
|
625
|
+
originalContentUrl = '',
|
|
626
|
+
}] = [{}],
|
|
627
|
+
} = {},
|
|
628
|
+
} = template.versions.base;
|
|
629
|
+
templateData.content = text;
|
|
630
|
+
templateData.url = originalContentUrl;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
610
633
|
default:
|
|
611
634
|
templateData.content = "";
|
|
612
635
|
}
|
|
@@ -656,6 +679,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
656
679
|
|
|
657
680
|
</div>);
|
|
658
681
|
}
|
|
682
|
+
filterLineTemplates = (templates) => {
|
|
683
|
+
const { lineFilter } = this.state;
|
|
684
|
+
if (LINE_FILTERS.ALL === lineFilter) {
|
|
685
|
+
return templates;
|
|
686
|
+
}
|
|
687
|
+
return templates.filter((template) => template.definition && template.definition.mode === lineFilter);
|
|
688
|
+
}
|
|
659
689
|
skipTemplateSelection = (e) => {
|
|
660
690
|
const type = this.props.location.query.type;
|
|
661
691
|
const module = (type === 'embedded') ? this.props.location.query.module : 'default';
|
|
@@ -1164,7 +1194,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1164
1194
|
pathName = `/ebill/edit/${id}`;
|
|
1165
1195
|
}
|
|
1166
1196
|
if (this.state.channel.toLowerCase() === 'line') {
|
|
1167
|
-
|
|
1197
|
+
const { messages } = template.versions.base.content;
|
|
1198
|
+
const type = messages && messages[0] && messages[0].type;
|
|
1199
|
+
pathName = `/line/edit/${id}/${type}`;
|
|
1168
1200
|
}
|
|
1169
1201
|
if (this.state.channel.toUpperCase() === WECHAT) {
|
|
1170
1202
|
if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
|
|
@@ -1631,10 +1663,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1631
1663
|
}
|
|
1632
1664
|
|
|
1633
1665
|
setWechatFilter = (e) => this.setState({wechatFilter: e.target.value});
|
|
1666
|
+
setLineFilter = (e) => this.setState({lineFilter: e.target.value});
|
|
1634
1667
|
|
|
1635
1668
|
render() {
|
|
1636
1669
|
const isFullMode = this.isFullMode();
|
|
1637
|
-
const { activeMode, channel, wechatFilter } = this.state;
|
|
1670
|
+
const { activeMode, channel, wechatFilter, lineFilter } = this.state;
|
|
1638
1671
|
if (activeMode === ACCOUNT_SELECTION_MODE) {
|
|
1639
1672
|
return this.renderAccountSelection();
|
|
1640
1673
|
}
|
|
@@ -1688,7 +1721,28 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1688
1721
|
</CapLabel></CapRadio.Button>
|
|
1689
1722
|
</CapRadio.CapRadioGroup>
|
|
1690
1723
|
}
|
|
1691
|
-
|
|
1724
|
+
{
|
|
1725
|
+
channel.toUpperCase() === LINE && <CapRadio.CapRadioGroup className="line-filters" defaultValue={lineFilter} onChange={this.setLineFilter}>
|
|
1726
|
+
{
|
|
1727
|
+
(() => {
|
|
1728
|
+
const { ALL, TEXT, IMAGE_VIDEO } = LINE_FILTERS;
|
|
1729
|
+
return (
|
|
1730
|
+
<>
|
|
1731
|
+
<CapRadio.Button value={ALL}><CapLabel type="label2">
|
|
1732
|
+
<FormattedMessage {...messages.all} />
|
|
1733
|
+
</CapLabel></CapRadio.Button>
|
|
1734
|
+
<CapRadio.Button value={TEXT}><CapLabel type="label2">
|
|
1735
|
+
<FormattedMessage {...messages.textTemplate} />
|
|
1736
|
+
</CapLabel></CapRadio.Button>
|
|
1737
|
+
<CapRadio.Button value={IMAGE_VIDEO}><CapLabel type="label2">
|
|
1738
|
+
<FormattedMessage {...messages.imageTemplate} />
|
|
1739
|
+
</CapLabel></CapRadio.Button>
|
|
1740
|
+
</>
|
|
1741
|
+
);
|
|
1742
|
+
})()
|
|
1743
|
+
}
|
|
1744
|
+
</CapRadio.CapRadioGroup>
|
|
1745
|
+
}
|
|
1692
1746
|
<div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
|
|
1693
1747
|
{isfilterContentVisisble && !isWechatEmbedded && <CapButton
|
|
1694
1748
|
className={`create-new-${channelLowerCase}`}
|
|
@@ -43,11 +43,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
43
43
|
} = props;
|
|
44
44
|
|
|
45
45
|
const defaultPanes = {
|
|
46
|
-
sms: {content:
|
|
47
|
-
email: {content:
|
|
48
|
-
weChat: {content:
|
|
46
|
+
sms: {content: <></>, tab: intl.formatMessage(messages.sms), key: 'sms'},
|
|
47
|
+
email: {content: <></>, tab: intl.formatMessage(messages.email), key: 'email'},
|
|
48
|
+
weChat: {content: <></>, tab: intl.formatMessage(messages.wechat), key: 'wechat'},
|
|
49
49
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
50
|
-
mPush: {content:
|
|
50
|
+
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
51
|
+
line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
|
|
51
52
|
};
|
|
52
53
|
let filteredPanes = Object.keys(defaultPanes)
|
|
53
54
|
.filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
|