@capillarytech/creatives-library 2.0.71 → 2.0.72
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/components/EmailMobilePreview/index.scss +0 -1
- package/components/EmailPreviewV2/_emailPreviewV2.scss +4 -1
- package/components/EmailPreviewV2/index.js +1 -1
- package/config/app.js +1 -0
- package/package.json +2 -2
- package/v2Containers/MobilePush/Edit/index.js +5 -0
- package/v2Containers/Templates/index.js +52 -9
- package/v2Containers/Templates/messages.js +5 -0
|
@@ -6,10 +6,13 @@ $classPrefix: email-preview-v2;
|
|
|
6
6
|
overflow-y: auto;
|
|
7
7
|
// font-family: 'proxima-nova';
|
|
8
8
|
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
#email-iframe {
|
|
11
|
+
width: -webkit-fill-available;
|
|
12
|
+
}
|
|
9
13
|
#emailPreivew-content-wrapper{
|
|
10
14
|
width: 100%;
|
|
11
15
|
height: 90%;
|
|
12
|
-
overflow: auto;
|
|
13
16
|
// display: table;
|
|
14
17
|
|
|
15
18
|
#emailPreivew-content {
|
|
@@ -88,7 +88,7 @@ class EmailPreviewV2 extends React.Component {
|
|
|
88
88
|
{currentDevice === devices.mobile ?
|
|
89
89
|
<img src={mobileBody} alt="capillary" width="85%" /> : ''}
|
|
90
90
|
<div className={messageContainerName}>
|
|
91
|
-
<iframe srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
|
|
91
|
+
<iframe id="email-iframe" srcDoc={templateContent} {...deviceAspectRatio[currentDevice]} >
|
|
92
92
|
<p><FormattedMessage {...messages.noIframeSupport}/></p>
|
|
93
93
|
</iframe>
|
|
94
94
|
</div>
|
package/config/app.js
CHANGED
|
@@ -8,6 +8,7 @@ const config = {
|
|
|
8
8
|
login_url: 'auth/login',
|
|
9
9
|
//dashboard_url: '/sms',
|
|
10
10
|
dashboard_url: '/v2',
|
|
11
|
+
accountConfig: (strs, accountId) => `org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
11
12
|
},
|
|
12
13
|
development: {
|
|
13
14
|
api_endpoint: 'https://nightly.capillary.in/arya/api/v1/creatives',
|
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.72",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@capillarytech/cap-ui-library": "^1.0.
|
|
15
|
+
"@capillarytech/cap-ui-library": "^1.0.144",
|
|
16
16
|
"antd": "3.19.6",
|
|
17
17
|
"axios": "^0.16.2",
|
|
18
18
|
"babel-polyfill": "6.20.0",
|
|
@@ -604,6 +604,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
604
604
|
}
|
|
605
605
|
if (androidData) {
|
|
606
606
|
if (androidData.cta) {
|
|
607
|
+
android['add-pri-cta'] = true;
|
|
607
608
|
android['cta-deeplink'] = androidData.cta.type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
608
609
|
if ( androidData.cta.type === "DEEP_LINK") {
|
|
609
610
|
android['cta-deeplink-select'] = androidData ? androidData.cta.actionLink : '';
|
|
@@ -623,6 +624,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
623
624
|
android.image = androidData.expandableDetails.image;
|
|
624
625
|
}
|
|
625
626
|
if (androidData.expandableDetails && androidData.expandableDetails.ctas && androidData.expandableDetails.ctas.length) {
|
|
627
|
+
android['add-sec-cta'] = true;
|
|
626
628
|
android['cta-deeplink-secondary-cta-0'] = androidData.expandableDetails.ctas[0].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
627
629
|
if ( androidData.expandableDetails.ctas[0].type === "DEEP_LINK") {
|
|
628
630
|
android['cta-deeplink-secondary-cta-0-select'] = androidData.expandableDetails.ctas[0].actionLink;
|
|
@@ -640,6 +642,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
640
642
|
}
|
|
641
643
|
}
|
|
642
644
|
if (androidData.expandableDetails && androidData.expandableDetails.ctas && androidData.expandableDetails.ctas.length > 1) {
|
|
645
|
+
android['add-sec-cta-2'] = true;
|
|
643
646
|
android['cta-deeplink-secondary-cta-1'] = androidData.expandableDetails.ctas[1].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
644
647
|
if (androidData.expandableDetails.ctas[1].type === "DEEP_LINK") {
|
|
645
648
|
android['cta-deeplink-secondary-cta-1-select'] = androidData.expandableDetails.ctas[1].actionLink;
|
|
@@ -667,6 +670,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
667
670
|
}
|
|
668
671
|
if (iosData) {
|
|
669
672
|
if (iosData.cta) {
|
|
673
|
+
ios['add-pri-cta-ios'] = true;
|
|
670
674
|
ios['cta-deeplink2'] = iosData.cta.type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
671
675
|
if (iosData.cta.type === "DEEP_LINK") {
|
|
672
676
|
ios['cta-deeplink2-select'] = iosData ? iosData.cta.actionLink : '';
|
|
@@ -689,6 +693,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
689
693
|
ios.image = iosData.expandableDetails.image;
|
|
690
694
|
}
|
|
691
695
|
if (iosData.expandableDetails && iosData.expandableDetails.ctas && iosData.expandableDetails.ctas.length) {
|
|
696
|
+
iosData['add-sec-cta-ios'] = true;
|
|
692
697
|
if (iosData.expandableDetails.ctas[0].type) {
|
|
693
698
|
ios['cta-deeplink-secondary-cta-1'] = iosData.expandableDetails.ctas[0].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
694
699
|
}
|
|
@@ -8,13 +8,14 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
+
import styled from 'styled-components';
|
|
11
12
|
import {injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
12
13
|
import { createStructuredSelector } from 'reselect';
|
|
13
14
|
import moment from "moment";
|
|
14
15
|
import _ from 'lodash';
|
|
15
16
|
import { bindActionCreators } from 'redux';
|
|
16
17
|
import { Modal} from 'antd';
|
|
17
|
-
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox} from '@capillarytech/cap-ui-library';
|
|
18
|
+
import {CapMenu, CapDropdown, CapButton, CapInput, CapIcon, CapSelect, CapPopover, CapSpin, CapCustomCard, CapRow, CapSlideBox, CapLink, CapHeading} from '@capillarytech/cap-ui-library';
|
|
18
19
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
19
20
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
20
21
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -33,6 +34,7 @@ import * as ebillActions from '../Ebill/actions';
|
|
|
33
34
|
import * as emailActions from '../Email/actions';
|
|
34
35
|
import * as lineActions from '../Line/Create/actions';
|
|
35
36
|
import CardGrid from '../../components/CardGrid';
|
|
37
|
+
import config from '../../config/app';
|
|
36
38
|
import './_templates.scss';
|
|
37
39
|
import * as globalActions from '../Cap/actions';
|
|
38
40
|
import { makeSelectAuthenticated } from '../Cap/selectors';
|
|
@@ -44,7 +46,15 @@ import CreativesContainer from '../CreativesContainer';
|
|
|
44
46
|
import WechatRichmediaTemplatePreview from '../../components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
45
47
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE } from '../CreativesContainer/constants';
|
|
46
48
|
const {CapCustomCardList} = CapCustomCard;
|
|
47
|
-
|
|
49
|
+
const InlineDiv = styled.div`
|
|
50
|
+
display: inline;
|
|
51
|
+
.ant-anchor.fixed{
|
|
52
|
+
display: inline;
|
|
53
|
+
.ant-anchor-link{
|
|
54
|
+
display: inline;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
48
58
|
export class Templates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
49
59
|
constructor(props) {
|
|
50
60
|
super(props);
|
|
@@ -141,7 +151,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
141
151
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
142
152
|
}
|
|
143
153
|
if (this.state.channel.toLowerCase() === "mobilepush" && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
144
|
-
|
|
154
|
+
const account = this.props.Templates.selectedWeChatAccount;
|
|
155
|
+
queryParams.accountId = account.id;
|
|
156
|
+
const isAndroidSupported = _.get(account, "configs.android") === '1';
|
|
157
|
+
const isIosSupported = _.get(account, "configs.ios") === '1';
|
|
158
|
+
if (!(isAndroidSupported || isIosSupported)) {
|
|
159
|
+
this.props.actions.resetAccount();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
145
162
|
}
|
|
146
163
|
queryParams.page = this.state.page;
|
|
147
164
|
queryParams.perPage = this.state.perPageLimit;
|
|
@@ -360,8 +377,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
360
377
|
params.originalId = this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})].sourceAccountIdentifier;
|
|
361
378
|
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|
|
362
379
|
this.props.actions.setWeChatAccount(this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})]);
|
|
363
|
-
|
|
380
|
+
const account = this.props.Templates.weCrmAccounts[_.findIndex(this.props.Templates.weCrmAccounts, { name: value})];
|
|
381
|
+
params.accountId = account.id;
|
|
382
|
+
const isAndroidSupported = _.get(account, "configs.android") === '1';
|
|
383
|
+
const isIosSupported = _.get(account, "configs.ios") === '1';
|
|
384
|
+
if (!(isAndroidSupported || isIosSupported)) {
|
|
385
|
+
this.setState({selectedAccountError: true});
|
|
386
|
+
this.props.actions.resetTemplate();
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
364
389
|
}
|
|
390
|
+
|
|
365
391
|
console.log("getAllTemplates params: ", params);
|
|
366
392
|
this.getAllTemplates({params, resetPage: true});
|
|
367
393
|
});
|
|
@@ -501,15 +527,27 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
501
527
|
}
|
|
502
528
|
return templateData;
|
|
503
529
|
}) : [];
|
|
530
|
+
const accountId = _.get(this.props, 'Templates.selectedWeChatAccount.uuid');
|
|
504
531
|
return (<div>
|
|
505
532
|
{filterContent}
|
|
506
533
|
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
507
534
|
{!_.isEmpty(templates) && <div className="pagination-container">
|
|
508
535
|
<CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
|
|
509
536
|
</div>}
|
|
510
|
-
{(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
511
|
-
|
|
537
|
+
{(this.state.selectedAccount === '' && _.isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&
|
|
538
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
539
|
+
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noAccountMessage)}</CapHeading>
|
|
512
540
|
</div>}
|
|
541
|
+
{ !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === "mobilepush" && this.state.selectedAccountError &&
|
|
542
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
543
|
+
<CapHeading type="h6" >
|
|
544
|
+
{this.props.intl.formatMessage(messages.accountConfigError)}
|
|
545
|
+
<InlineDiv>
|
|
546
|
+
<CapLink title="here" style={{display: 'inline'}} onClick={() => { window.open(config.production.accountConfig`${accountId}`); }}/>
|
|
547
|
+
</InlineDiv>
|
|
548
|
+
</CapHeading>
|
|
549
|
+
</div>
|
|
550
|
+
}
|
|
513
551
|
</CapSpin>
|
|
514
552
|
|
|
515
553
|
</div>);
|
|
@@ -1282,9 +1320,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1282
1320
|
isFullMode = () => this.props.location.query.type !== "embedded" || this.props.isFullMode
|
|
1283
1321
|
isCreateDisabled = () => {
|
|
1284
1322
|
let isDisabled = this.isLoading();
|
|
1285
|
-
|
|
1323
|
+
const channel = this.state.channel.toUpperCase();
|
|
1324
|
+
if (channel === MOBILE_PUSH || channel === WECHAT) {
|
|
1286
1325
|
isDisabled = isDisabled || _.isEmpty(this.props.Templates.selectedWeChatAccount);
|
|
1287
1326
|
}
|
|
1327
|
+
if (channel === MOBILE_PUSH) {
|
|
1328
|
+
isDisabled = isDisabled || this.state.selectedAccountError;
|
|
1329
|
+
}
|
|
1288
1330
|
return isDisabled;
|
|
1289
1331
|
}
|
|
1290
1332
|
|
|
@@ -1569,8 +1611,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1569
1611
|
>
|
|
1570
1612
|
</CardGrid>
|
|
1571
1613
|
</Pagination>} */}
|
|
1572
|
-
{(((this.state.selectedAccount !== '' && !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === 'wechat') || this.state.channel.toLowerCase() !== 'wechat') && _.isEmpty(this.props.TemplatesList)) && !this.props.Templates.getAllTemplatesInProgress &&
|
|
1573
|
-
<
|
|
1614
|
+
{(((this.state.selectedAccount !== '' && !_.isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === 'wechat') || this.state.channel.toLowerCase() !== 'wechat') && _.isEmpty(this.props.TemplatesList)) && !this.props.Templates.getAllTemplatesInProgress &&
|
|
1615
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
1616
|
+
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesMessage)}</CapHeading>
|
|
1574
1617
|
</div>}
|
|
1575
1618
|
</CapRow>
|
|
1576
1619
|
<CapRow>
|
|
@@ -270,4 +270,9 @@ export default defineMessages({
|
|
|
270
270
|
id: `${scope}.wechatAccountNotConfigured`,
|
|
271
271
|
defaultMessage: 'Selected wechat account is not configured to create wechat templates',
|
|
272
272
|
},
|
|
273
|
+
"accountConfigError": {
|
|
274
|
+
id: `${scope}.accountConfigError`,
|
|
275
|
+
defaultMessage: 'This account is not configured properly. You can configure it ',
|
|
276
|
+
},
|
|
277
|
+
|
|
273
278
|
});
|