@capillarytech/creatives-library 3.10.0 → 3.11.0

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.
Files changed (66) hide show
  1. package/assets/lineImageTemplate.png +0 -0
  2. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +7 -7
  3. package/components/TemplatePreview/_templatePreview.scss +287 -20
  4. package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
  5. package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
  6. package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
  7. package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
  8. package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
  9. package/components/TemplatePreview/index.js +203 -31
  10. package/components/TemplatePreview/messages.js +21 -0
  11. package/containers/Assets/Gallery/index.js +53 -59
  12. package/containers/Cap/index.js +1 -0
  13. package/index.js +6 -0
  14. package/package.json +1 -1
  15. package/routes.js +5 -0
  16. package/services/getSchema.js +4 -1
  17. package/translations/en.json +40 -4
  18. package/translations/zh.json +39 -3
  19. package/v2Components/FormBuilder/index.js +188 -37
  20. package/v2Components/FormBuilder/messages.js +16 -0
  21. package/v2Components/MobilePushPreviewV2/index.js +44 -36
  22. package/v2Components/MobilePushPreviewV2/messages.js +0 -8
  23. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +64 -0
  24. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +100 -18
  25. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +12 -0
  26. package/v2Components/TemplatePreview/_templatePreview.scss +24 -4
  27. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
  28. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
  29. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
  30. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -0
  31. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
  32. package/v2Components/TemplatePreview/index.js +162 -23
  33. package/v2Components/TemplatePreview/messages.js +8 -0
  34. package/v2Containers/Assets/Gallery/index.js +54 -48
  35. package/v2Containers/CreativesContainer/SlideBoxContent.js +87 -4
  36. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -1
  37. package/v2Containers/CreativesContainer/index.js +58 -2
  38. package/v2Containers/CreativesContainer/messages.js +2 -2
  39. package/v2Containers/Email/_email.scss +7 -1
  40. package/v2Containers/Email/index.js +40 -14
  41. package/v2Containers/Email/messages.js +4 -0
  42. package/v2Containers/Email/reducer.js +1 -0
  43. package/v2Containers/EmailWrapper/index.js +7 -5
  44. package/v2Containers/Line/Create/_lineCreate.scss +40 -19
  45. package/v2Containers/Line/Create/actions.js +13 -9
  46. package/v2Containers/Line/Create/index.js +498 -237
  47. package/v2Containers/Line/Create/initialSchema.js +378 -0
  48. package/v2Containers/Line/Create/messages.js +42 -2
  49. package/v2Containers/Line/Create/sagas.js +10 -4
  50. package/v2Containers/Line/Create/selectors.js +3 -9
  51. package/v2Containers/Line/CreateWrapper/constants.js +2 -0
  52. package/v2Containers/Line/CreateWrapper/index.js +117 -0
  53. package/v2Containers/Line/CreateWrapper/messages.js +55 -0
  54. package/v2Containers/MobilePush/Create/index.js +5 -0
  55. package/v2Containers/MobilePush/Edit/index.js +5 -0
  56. package/v2Containers/MobilepushWrapper/index.js +4 -1
  57. package/v2Containers/Sms/Create/index.js +2 -1
  58. package/v2Containers/Sms/Edit/index.js +2 -0
  59. package/v2Containers/Templates/_templates.scss +24 -1
  60. package/v2Containers/Templates/actions.js +7 -0
  61. package/v2Containers/Templates/constants.js +2 -0
  62. package/v2Containers/Templates/index.js +118 -15
  63. package/v2Containers/Templates/messages.js +8 -0
  64. package/v2Containers/Templates/reducer.js +2 -0
  65. package/v2Containers/TemplatesV2/index.js +5 -4
  66. package/v2Containers/TemplatesV2/messages.js +4 -0
@@ -1714,6 +1714,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1714
1714
  startValidation={this.state.startValidation}
1715
1715
  stopValidation={this.stopValidation}
1716
1716
  selectedOfferDetails={this.props.selectedOfferDetails}
1717
+ onPreviewContentClicked={this.props.onPreviewContentClicked}
1718
+ onTestContentClicked={this.props.onTestContentClicked}
1719
+ templateData={this.props.templateData}
1717
1720
  />
1718
1721
  </CapColumn>
1719
1722
  {this.props.iosCtasData && this.state.showIosCtaTable &&
@@ -1803,6 +1806,8 @@ Create.propTypes = {
1803
1806
  isGetFormData: PropTypes.bool,
1804
1807
  onValidationFail: PropTypes.func,
1805
1808
  getFormLibraryData: PropTypes.func,
1809
+ onPreviewContentClicked: PropTypes.func,
1810
+ onTestContentClicked: PropTypes.func,
1806
1811
  };
1807
1812
 
1808
1813
  const mapStateToProps = createStructuredSelector({
@@ -1801,6 +1801,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1801
1801
  startValidation={this.state.startValidation}
1802
1802
  stopValidation={this.stopValidation}
1803
1803
  selectedOfferDetails={this.props.selectedOfferDetails}
1804
+ onPreviewContentClicked={this.props.onPreviewContentClicked}
1805
+ onTestContentClicked={this.props.onTestContentClicked}
1806
+ templateData={this.props.templateData}
1804
1807
  />}
1805
1808
  </CapColumn>
1806
1809
  {this.props.iosCtasData && this.state.showIosCtaTable &&
@@ -1893,6 +1896,8 @@ Edit.propTypes = {
1893
1896
  isGetFormData: PropTypes.bool,
1894
1897
  Create: PropTypes.object,
1895
1898
  onValidationFail: PropTypes.bool,
1899
+ onPreviewContentClicked: PropTypes.func,
1900
+ onTestContentClicked: PropTypes.func,
1896
1901
  };
1897
1902
 
1898
1903
  const mapStateToProps = createStructuredSelector({
@@ -69,7 +69,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
69
69
  }
70
70
  }
71
71
  render() {
72
- const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail} = this.props;
72
+ const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
73
73
  const {templateName} = this.state;
74
74
  const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
75
75
  return (
@@ -112,6 +112,9 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
112
112
  route={{ name: 'mobilepush' }}
113
113
  getDefaultTags={type}
114
114
  onValidationFail={onValidationFail}
115
+ onPreviewContentClicked={onPreviewContentClicked}
116
+ onTestContentClicked={onTestContentClicked}
117
+ templateData={templateData}
115
118
  />
116
119
 
117
120
 
@@ -928,7 +928,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
928
928
  this.setState({startValidation: true}, this.showError);
929
929
  }
930
930
  render() {
931
- console.log("this.props sms create: ", this.props);
932
931
  const schema = this.state.schema;
933
932
  const spinning = this.isSmsLoading();
934
933
  let tags = this.props.metaEntities && this.props.metaEntities.tags && this.props.metaEntities.tags.standard ? this.props.metaEntities.tags.standard : [];
@@ -976,6 +975,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
976
975
  startValidation={this.state.startValidation}
977
976
  stopValidation={this.stopValidation}
978
977
  selectedOfferDetails={this.props.selectedOfferDetails}
978
+ onTestContentClicked={this.props.onTestContentClicked}
979
+ onPreviewContentClicked={this.props.onPreviewContentClicked}
979
980
  />
980
981
  </CapColumn>
981
982
  </CapRow>
@@ -972,6 +972,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
972
972
  startValidation={this.state.startValidation}
973
973
  stopValidation={this.stopValidation}
974
974
  selectedOfferDetails={this.props.selectedOfferDetails}
975
+ onPreviewContentClicked={this.props.onPreviewContentClicked}
976
+ onTestContentClicked={this.props.onTestContentClicked}
975
977
  />
976
978
  </CapColumn>
977
979
  </CapRow>
@@ -18,6 +18,28 @@
18
18
  }
19
19
  }
20
20
 
21
+ .creatives-templates-list {
22
+ .pagination-container {
23
+ .LINE {
24
+ .ant-card-body {
25
+ background-color: $CAP_G09;
26
+ height: 320px;
27
+ }
28
+
29
+ &.no-image .ant-card-meta {
30
+ height: 276px;
31
+ background: $CAP_WHITE;
32
+ padding: $CAP_SPACE_16 $CAP_SPACE_12;
33
+
34
+ .ant-card-meta-description {
35
+ height: 250px;
36
+ word-wrap: break-word;
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+
21
43
  .card-title {
22
44
  line-height: 24px;
23
45
  font-size: 14px;
@@ -361,7 +383,8 @@
361
383
  overflow: hidden;
362
384
  }
363
385
 
364
- .wechat-filters {
386
+ .wechat-filters,
387
+ .line-filters {
365
388
  width: 100%;
366
389
  padding-left: 12px;
367
390
  .ant-radio-button-wrapper {
@@ -52,6 +52,13 @@
52
52
  };
53
53
  }
54
54
 
55
+ export function setLineAccount(lineAccount) {
56
+ return {
57
+ type: types.SET_LINE_ACCOUNT,
58
+ lineAccount,
59
+ };
60
+ }
61
+
55
62
  export function handleHtmlUpload(selectedTemplate) {
56
63
  return {
57
64
  type: types.SET_SELECTED_LAYOUT,
@@ -43,3 +43,5 @@ export const RESET_TEMPLATE = "app/v2Containers/Templates/RESET_TEMPLATE";
43
43
  export const RESET_TEMPLATE_DATA = "app/v2Containers/Templates/RESET_TEMPLATE_DATA";
44
44
  export const RESET_UPLOAD_DATA = "app/v2Containers/Templates/RESET_UPLOAD_DATA";
45
45
  export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPLATE_STORE_DATA";
46
+
47
+ export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
@@ -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);
@@ -154,6 +160,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
154
160
  break;
155
161
  case LINE:
156
162
  channel = "Line";
163
+ if (!this.props.isFullMode) {
164
+ activeMode = ACCOUNT_SELECTION_MODE;
165
+ this.props.actions.getWeCrmAccounts(channel);
166
+ }
157
167
  break;
158
168
  default:
159
169
  channel = '';
@@ -166,7 +176,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
166
176
  }
167
177
 
168
178
  componentDidMount() {
169
-
170
179
  if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
171
180
  this.setLocale();
172
181
  }
@@ -234,6 +243,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
234
243
  channel = 'Ebill';
235
244
  } else if (nextProps.route.name.toLowerCase() === 'line') {
236
245
  channel = 'Line';
246
+ if (!this.props.isFullMode) {
247
+ this.setState({defaultAccount: true});
248
+ nextProps.actions.getWeCrmAccounts(channel);
249
+ }
237
250
  }
238
251
  this.setState({ channel }, () => {
239
252
  if (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill' || (this.state.channel.toLowerCase() === 'wechat' && !isEmpty(nextProps.Templates.selectedWeChatAccount))) {
@@ -416,6 +429,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
416
429
  } else {
417
430
  this.setState({selectedAccountError: false});
418
431
  }
432
+ } else if (this.state.channel.toLowerCase() === 'line') {
433
+ this.props.actions.setLineAccount(this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount));
419
434
  }
420
435
  this.setState({activeMode: TEMPLATES_MODE});
421
436
  console.log("getAllTemplates params: ", params);
@@ -454,6 +469,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
454
469
  };
455
470
  } else {
456
471
  creativesParams._id = pathname.split('/')[3];
472
+ creativesParams.modeType = pathname.split('/')[4];
473
+ creativesParams.account = pathname.split('/')[5];
457
474
  }
458
475
  creativesParams.type = this.state.channel.toUpperCase();
459
476
  }
@@ -546,6 +563,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
546
563
  return templates;
547
564
  }
548
565
  }
566
+
549
567
  getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
550
568
  const currentChannel = channel.toUpperCase();
551
569
  const {channel: stateChannel} = this.state;
@@ -554,6 +572,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
554
572
  if (currentChannel === WECHAT) {
555
573
  filteredTemplates = this.filterWechatTemplates(templates);
556
574
  }
575
+ if (currentChannel === LINE) {
576
+ filteredTemplates = this.filterLineTemplates(templates);
577
+ }
557
578
  const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
558
579
  const templateData =
559
580
  {
@@ -567,7 +588,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
567
588
  onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }}
568
589
  />,
569
590
  ],
570
- hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.creativesTemplatesEdit : messages.selectButton)}</CapButton>,
591
+ hoverOption: <CapButton className={this.props.isFullMode ? `edit-${channelLowerCase}` : `select-${channelLowerCase}`} onClick={(e) => handlers.handleEditClick(e, template, undefined, undefined, {account: this.state.selectedAccount})}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.creativesTemplatesEdit : messages.selectButton)}</CapButton>,
571
592
  };
572
593
  if (this.props.isFullMode) {
573
594
  templateData.extra.push(<CapDropdown
@@ -607,6 +628,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
607
628
  case WECHAT:
608
629
  templateData.content = this.prepareWeChatPreviewData(template);
609
630
  break;
631
+ case LINE: {
632
+ const {
633
+ content: {
634
+ messages: [{
635
+ text = '',
636
+ originalContentUrl = '',
637
+ }] = [{}],
638
+ } = {},
639
+ } = template.versions.base;
640
+ templateData.content = text;
641
+ templateData.url = originalContentUrl;
642
+ break;
643
+ }
610
644
  default:
611
645
  templateData.content = "";
612
646
  }
@@ -623,7 +657,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
623
657
  <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : "pagination-container"}>
624
658
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} style={{marginLeft: '16px'}}/>
625
659
  </div>)
626
- : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
660
+ : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
627
661
  }
628
662
 
629
663
  {(this.state.selectedAccount === '' && isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
@@ -645,7 +679,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
645
679
  isEmpty(filteredTemplates) &&
646
680
  isEmpty(this.state.searchText) &&
647
681
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
648
- <CapIllustration {...this.getChannelTypeIllustrationInfo(currentChannel)} />
682
+ <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
649
683
  </div>
650
684
  )
651
685
  }
@@ -656,6 +690,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
656
690
 
657
691
  </div>);
658
692
  }
693
+ filterLineTemplates = (templates) => {
694
+ const { lineFilter } = this.state;
695
+ if (LINE_FILTERS.ALL === lineFilter) {
696
+ return templates;
697
+ }
698
+ return templates.filter((template) => template.definition && template.definition.mode === lineFilter);
699
+ }
659
700
  skipTemplateSelection = (e) => {
660
701
  const type = this.props.location.query.type;
661
702
  const module = (type === 'embedded') ? this.props.location.query.module : 'default';
@@ -930,7 +971,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
930
971
  break;
931
972
  }
932
973
  };
933
-
974
+
934
975
  createTemplate(ev) {
935
976
  const type = this.props.location.query.type;
936
977
  const module = this.props.location.query.module ? this.props.location.query.module : 'default';
@@ -1089,7 +1130,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1089
1130
  } else if (this.state.channel.toLowerCase() === "email") {
1090
1131
  this.props.emailActions.duplicateTemplate(template._id, "EMAIL");
1091
1132
  } else if (this.state.channel.toLowerCase() === "line") {
1092
- this.props.lineActions.createTemplate(duplicateObj);
1133
+ this.props.lineActions.createTemplate(duplicateObj, (response) => {
1134
+ if (response && response.templateId) {
1135
+ const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
1136
+ CapNotification.success({key: 'duplicateSucess', message});
1137
+ this.getAllTemplates({params, resetPage: true});
1138
+ this.props.lineActions.clearCreateResponse();
1139
+ }
1140
+ });
1093
1141
  }
1094
1142
  }
1095
1143
 
@@ -1131,7 +1179,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1131
1179
  }
1132
1180
  };
1133
1181
 
1134
- handleEditClick(e, template, modeType, path) {
1182
+ handleEditClick(e, template, modeType, path, options) {
1135
1183
  timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
1136
1184
  if (modeType && modeType !== undefined) {
1137
1185
  this.setState({modeType});
@@ -1164,7 +1212,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1164
1212
  pathName = `/ebill/edit/${id}`;
1165
1213
  }
1166
1214
  if (this.state.channel.toLowerCase() === 'line') {
1167
- pathName = `/line/edit/${modeType}/${id}`;
1215
+ const { messages } = template.versions.base.content;
1216
+ const type = messages && messages[0] && messages[0].type;
1217
+ pathName = `/line/edit/${id}/${type}`;
1218
+ if (options && options.account) {
1219
+ pathName += `/${options.account}`;
1220
+ }
1168
1221
  }
1169
1222
  if (this.state.channel.toUpperCase() === WECHAT) {
1170
1223
  if (get(template, 'definition.msgcontent', '') === "RICH_MEDIA_WECHAT") {
@@ -1545,10 +1598,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1545
1598
  const { weCrmAccounts = [], fetchingWeCrmAccounts = false } = templates;
1546
1599
  const isWechatChannel = channel === WECHAT;
1547
1600
  const isMobilePushChannel = channel === MOBILE_PUSH;
1601
+ const isLineChannel = channel === LINE;
1548
1602
 
1549
- if ((isWechatChannel || isMobilePushChannel) && !isEmpty(weCrmAccounts)) {
1603
+ if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts)) {
1550
1604
  forEach(weCrmAccounts, (account) => {
1551
- if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel) {
1605
+ if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel || isLineChannel) {
1552
1606
  if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
1553
1607
  if (query.source_account_id && account.sourceAccountIdentifier === query.source_account_id) {
1554
1608
  accountOptions.push(
@@ -1581,11 +1635,37 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1581
1635
  }
1582
1636
  });
1583
1637
  }
1638
+ const {
1639
+ intl: {
1640
+ formatMessage,
1641
+ },
1642
+ } = this.props;
1643
+ let accountHeader = formatMessage(messages.mobilepushAccount);
1644
+ let noAccountHeader = messages.noAccountsPresent;
1645
+ switch (channel) {
1646
+ case MOBILE_PUSH: {
1647
+ accountHeader = formatMessage(messages.mobilepushAccount);
1648
+ noAccountHeader = messages.noAccountsPresent;
1649
+ break;
1650
+ }
1651
+ case WECHAT: {
1652
+ accountHeader = formatMessage(messages.wechatAccount);
1653
+ noAccountHeader = messages.noAccountsPresentWeChat;
1654
+ break;
1655
+ }
1656
+ case LINE: {
1657
+ accountHeader = formatMessage(messages.lineAccount);
1658
+ noAccountHeader = messages.noAccountsPresentLine;
1659
+ break;
1660
+ }
1661
+ default:
1662
+ break;
1663
+ }
1584
1664
  return (<CapSpin spinning={fetchingWeCrmAccounts}>
1585
- {isEmpty(weCrmAccounts) && !fetchingWeCrmAccounts ? <FormattedMessage {...(channel === WECHAT ? messages.noAccountsPresentWeChat : messages.noAccountsPresent)} /> :
1665
+ {isEmpty(weCrmAccounts) && !fetchingWeCrmAccounts ? <FormattedMessage {...noAccountHeader} /> :
1586
1666
  <div style={{ overflowX: "auto", paddingBottom: CAP_SPACE_16 }}>
1587
1667
  <CapHeader
1588
- title={isMobilePushChannel ? this.props.intl.formatMessage(messages.mobilepushAccount) : this.props.intl.formatMessage(messages.wechatAccount)}
1668
+ title={accountHeader}
1589
1669
  description={this.props.intl.formatMessage(messages.chooseAccount)}
1590
1670
  size="regular"
1591
1671
  className="select-account-header"
@@ -1631,10 +1711,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1631
1711
  }
1632
1712
 
1633
1713
  setWechatFilter = (e) => this.setState({wechatFilter: e.target.value});
1714
+ setLineFilter = (e) => this.setState({lineFilter: e.target.value});
1634
1715
 
1635
1716
  render() {
1636
1717
  const isFullMode = this.isFullMode();
1637
- const { activeMode, channel, wechatFilter } = this.state;
1718
+ const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1638
1719
  if (activeMode === ACCOUNT_SELECTION_MODE) {
1639
1720
  return this.renderAccountSelection();
1640
1721
  }
@@ -1688,7 +1769,28 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1688
1769
  </CapLabel></CapRadio.Button>
1689
1770
  </CapRadio.CapRadioGroup>
1690
1771
  }
1691
-
1772
+ {
1773
+ channel.toUpperCase() === LINE && <CapRadio.CapRadioGroup className="line-filters" defaultValue={lineFilter} onChange={this.setLineFilter}>
1774
+ {
1775
+ (() => {
1776
+ const { ALL, TEXT, IMAGE_VIDEO } = LINE_FILTERS;
1777
+ return (
1778
+ <>
1779
+ <CapRadio.Button value={ALL}><CapLabel type="label2">
1780
+ <FormattedMessage {...messages.all} />
1781
+ </CapLabel></CapRadio.Button>
1782
+ <CapRadio.Button value={TEXT}><CapLabel type="label2">
1783
+ <FormattedMessage {...messages.textTemplate} />
1784
+ </CapLabel></CapRadio.Button>
1785
+ <CapRadio.Button value={IMAGE_VIDEO}><CapLabel type="label2">
1786
+ <FormattedMessage {...messages.imageTemplate} />
1787
+ </CapLabel></CapRadio.Button>
1788
+ </>
1789
+ );
1790
+ })()
1791
+ }
1792
+ </CapRadio.CapRadioGroup>
1793
+ }
1692
1794
  <div style={{display: "flex", justifyContent: "space-between", alignItems: 'center'}}>
1693
1795
  {isfilterContentVisisble && !isWechatEmbedded && <CapButton
1694
1796
  className={`create-new-${channelLowerCase}`}
@@ -1744,6 +1846,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1744
1846
  channel={route.name.toUpperCase()}
1745
1847
  handleCloseCreatives={this.onCreateComplete}
1746
1848
  selectedWeChatAccount={get(this.props, 'Templates.selectedWeChatAccount', {})}
1849
+ selectedAccount={this.state.selectedAccount}
1747
1850
  />
1748
1851
  }
1749
1852
  </CapRow>
@@ -126,6 +126,10 @@ export default defineMessages({
126
126
  id: `${scope}.noAccountsPresentWeChat`,
127
127
  defaultMessage: "Wechat accounts are not setup for your brand",
128
128
  },
129
+ "noAccountsPresentLine": {
130
+ id: `${scope}.noAccountsPresentLine`,
131
+ defaultMessage: "Line accounts are not setup for your brand",
132
+ },
129
133
  "noTemplatesMessage": {
130
134
  id: `${scope}.noTemplatesMessage`,
131
135
  defaultMessage: "No templates available",
@@ -326,6 +330,10 @@ export default defineMessages({
326
330
  id: `${scope}.mobilepushAccount`,
327
331
  defaultMessage: 'Mobilepush account',
328
332
  },
333
+ "lineAccount": {
334
+ id: `${scope}.lineAccount`,
335
+ defaultMessage: 'Line account',
336
+ },
329
337
  "all": {
330
338
  id: `${scope}.all`,
331
339
  defaultMessage: 'All',
@@ -71,6 +71,8 @@ function templatesReducer(state = initialState, action) {
71
71
  case types.SET_WECHAT_ACCOUNT:
72
72
  return state
73
73
  .set('selectedWeChatAccount', fromJS(action.weChatAccount));
74
+ case types.SET_LINE_ACCOUNT:
75
+ return state.set('selectedLineAccount', fromJS(action.lineAccount));
74
76
  case types.RESET_ACCOUNT:
75
77
  return state
76
78
  .remove('selectedWeChatAccount')
@@ -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: <div></div>, tab: intl.formatMessage(messages.sms), key: 'sms'},
47
- email: {content: <div></div>, tab: intl.formatMessage(messages.email), key: 'email'},
48
- weChat: {content: <div></div>, tab: intl.formatMessage(messages.wechat), key: 'wechat'},
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: <div></div>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
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) => {
@@ -54,4 +54,8 @@ export default defineMessages({
54
54
  id: 'creatives.containersV2.TemplatesV2.wechat',
55
55
  defaultMessage: 'Wechat',
56
56
  },
57
+ line: {
58
+ id: 'creatives.containersV2.TemplatesV2.line',
59
+ defaultMessage: 'Line',
60
+ },
57
61
  });