@capillarytech/creatives-library 3.12.10 → 3.12.21
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/package.json +1 -1
- package/v2Components/FormBuilder/index.js +3 -0
- package/v2Components/TemplatePreview/index.js +5 -2
- package/v2Containers/Email/index.js +30 -27
- package/v2Containers/Line/Create/constants.js +4 -0
- package/v2Containers/Line/Create/index.js +21 -9
- package/v2Containers/Line/Create/messages.js +4 -0
- package/v2Containers/TagList/index.js +8 -6
package/package.json
CHANGED
|
@@ -2385,6 +2385,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2385
2385
|
showTestAndPreviewIcon
|
|
2386
2386
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
2387
2387
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
2388
|
+
module={this.props.tagModule}
|
|
2388
2389
|
/>
|
|
2389
2390
|
</CapColumn>
|
|
2390
2391
|
);
|
|
@@ -2968,6 +2969,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2968
2969
|
showTestAndPreviewIcon
|
|
2969
2970
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
2970
2971
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
2972
|
+
module={this.props.tagModule}
|
|
2971
2973
|
>
|
|
2972
2974
|
</TemplatePreview>
|
|
2973
2975
|
</CapColumn>
|
|
@@ -3021,6 +3023,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3021
3023
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
3022
3024
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
3023
3025
|
templateDataRaw={this.props.templateData}
|
|
3026
|
+
module={this.props.location.query.module}
|
|
3024
3027
|
>
|
|
3025
3028
|
</TemplatePreview>
|
|
3026
3029
|
</CapColumn>
|
|
@@ -120,7 +120,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
120
120
|
|
|
121
121
|
render() {
|
|
122
122
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
123
|
-
const channel = this.props
|
|
123
|
+
const { channel, showTestAndPreviewIcon, module} = this.props;
|
|
124
124
|
let smsDetails = {};
|
|
125
125
|
// let smsText = '';
|
|
126
126
|
if (this.props.content && this.props.charCounterEnabled) {
|
|
@@ -148,6 +148,9 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
const disablePreviewAndTest = this.props.channel === 'MOBILEPUSH' ? !this.props.content.header : (this.props.channel === 'SMS' ? !this.props.content : false);
|
|
151
|
+
const showTestAndPreview = showTestAndPreviewIcon &&
|
|
152
|
+
channel !== WECHAT &&
|
|
153
|
+
['outbound', 'library'].includes(module);
|
|
151
154
|
return (
|
|
152
155
|
<CapRow>
|
|
153
156
|
{this.props.showCount && <CapColumn span={16}>
|
|
@@ -162,7 +165,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
162
165
|
</CapHeading>}
|
|
163
166
|
</CapColumn>}
|
|
164
167
|
<CapColumn span={this.props.showCount ? 8 : 24}>
|
|
165
|
-
{
|
|
168
|
+
{showTestAndPreview && (
|
|
166
169
|
<div className="test-and-preview-container">
|
|
167
170
|
<CapButton
|
|
168
171
|
style={{
|
|
@@ -32,6 +32,7 @@ import withCreatives from '../../hoc/withCreatives';
|
|
|
32
32
|
import { EMAIL } from '../CreativesContainer/constants';
|
|
33
33
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
34
34
|
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL } from '../App/constants';
|
|
35
|
+
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
35
36
|
|
|
36
37
|
const {CapCustomCardList} = CapCustomCard;
|
|
37
38
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -2563,6 +2564,27 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2563
2564
|
</div>
|
|
2564
2565
|
);
|
|
2565
2566
|
|
|
2567
|
+
showTestAndPreviewIcons = (action) => {
|
|
2568
|
+
const previewContent = this.state.formData[0][this.state.formData[0].selectedLanguages[0]]['template-content'];
|
|
2569
|
+
const previewSubject = this.state.formData['template-subject'];
|
|
2570
|
+
const testOrPreviewProps = {channel: EMAIL, content: previewContent, subject: previewSubject};
|
|
2571
|
+
const { onPreviewContentClicked, onTestContentClicked } = this.props;
|
|
2572
|
+
return (
|
|
2573
|
+
<CapButton
|
|
2574
|
+
style={{
|
|
2575
|
+
color: FONT_COLOR_05,
|
|
2576
|
+
display: 'inline-block',
|
|
2577
|
+
padding: '0 6px',
|
|
2578
|
+
}}
|
|
2579
|
+
type="flat"
|
|
2580
|
+
onClick={() => action === 'PREVIEW' ? onPreviewContentClicked(testOrPreviewProps) : onTestContentClicked(testOrPreviewProps)}
|
|
2581
|
+
>
|
|
2582
|
+
<CapIcon type={action === 'PREVIEW' ? "eye" : "lab"}/>
|
|
2583
|
+
{action === 'PREVIEW' ? <FormattedMessage {...messages.preview} /> : <FormattedMessage {...messages.testMessage} />}
|
|
2584
|
+
</CapButton>
|
|
2585
|
+
);
|
|
2586
|
+
};
|
|
2587
|
+
|
|
2566
2588
|
render() {
|
|
2567
2589
|
// const pageHeading = (this.state.isEdit) ? this.props.intl.formatMessage(messages.editHeading) : this.props.intl.formatMessage(messages.createHeading);
|
|
2568
2590
|
// const actionComponents = '';
|
|
@@ -2571,7 +2593,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2571
2593
|
const previewHeader = (<h3>{this.props.intl.formatMessage(messages.h3emailPreview)}</h3>);
|
|
2572
2594
|
const imagePreviewHeader = (<h3>{this.props.intl.formatMessage(messages.h3imageSelection)}</h3>);
|
|
2573
2595
|
const imagePreviewContent = this.getImagePreviewContent();
|
|
2574
|
-
const { selectedOfferDetails,
|
|
2596
|
+
const { selectedOfferDetails, getDefaultTags } = this.props;
|
|
2575
2597
|
if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
|
|
2576
2598
|
return (<div>Loading...</div>);
|
|
2577
2599
|
}
|
|
@@ -2579,35 +2601,16 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2579
2601
|
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'library' && !this.props.getDefaultTags) {
|
|
2580
2602
|
tags = this.props.supportedTags;
|
|
2581
2603
|
}
|
|
2582
|
-
const
|
|
2583
|
-
const previewSubject = this.state.formData['template-subject'];
|
|
2604
|
+
const showTestAndPreview = getDefaultTags === 'outbound';
|
|
2584
2605
|
return (
|
|
2585
2606
|
<div className="email-container">
|
|
2586
2607
|
<CapSpin spinning={isLoading}>
|
|
2587
|
-
|
|
2588
|
-
<
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
}}
|
|
2594
|
-
type="flat"
|
|
2595
|
-
onClick={() => this.props.onPreviewContentClicked({channel: EMAIL, content: previewContent, subject: previewSubject})}
|
|
2596
|
-
>
|
|
2597
|
-
<CapIcon type="eye"/><FormattedMessage {...messages.preview} />
|
|
2598
|
-
</CapButton>
|
|
2599
|
-
<CapButton
|
|
2600
|
-
style={{
|
|
2601
|
-
color: '#2466ea',
|
|
2602
|
-
display: 'inline-block',
|
|
2603
|
-
padding: '0 6px',
|
|
2604
|
-
}}
|
|
2605
|
-
type="flat"
|
|
2606
|
-
onClick={() => this.props.onTestContentClicked({channel: EMAIL, content: previewContent, subject: previewSubject})}
|
|
2607
|
-
>
|
|
2608
|
-
<CapIcon type="lab"/><FormattedMessage {...messages.testMessage} />
|
|
2609
|
-
</CapButton>
|
|
2610
|
-
</div>
|
|
2608
|
+
{ showTestAndPreview &&
|
|
2609
|
+
<div className="test-and-preview-container">
|
|
2610
|
+
{this.showTestAndPreviewIcons('PREVIEW')}
|
|
2611
|
+
{this.showTestAndPreviewIcons('TEST')}
|
|
2612
|
+
</div>
|
|
2613
|
+
}
|
|
2611
2614
|
<Row>
|
|
2612
2615
|
<Col>
|
|
2613
2616
|
{ !_.isEmpty(schema) && (this.state.formData[0] || this.state.formData["0"]) ?
|
|
@@ -19,6 +19,10 @@ export const CLEAR_CREATE_RESPONSE_REQUEST = 'app/v2Containers/Line/Create/CLEAR
|
|
|
19
19
|
export const CLEAR_CREATE_RESPONSE_SUCCESS = 'app/v2Containers/Line/Create/CLEAR_CREATE_RESPONSE_SUCCESS';
|
|
20
20
|
export const CLEAR_CREATE_RESPONSE_FAILURE = 'app/v2Containers/Line/Create/CLEAR_CREATE_RESPONSE_FAILURE';
|
|
21
21
|
|
|
22
|
+
export const LINE_IMG_HEIGHT = 400;
|
|
23
|
+
export const LINE_IMG_WIDTH = 300;
|
|
24
|
+
export const LINE_IMG_SIZE = 30000000;
|
|
25
|
+
|
|
22
26
|
|
|
23
27
|
// edit
|
|
24
28
|
|
|
@@ -6,7 +6,7 @@ import { bindActionCreators } from 'redux';
|
|
|
6
6
|
import { intlShape } from 'react-intl';
|
|
7
7
|
import { createStructuredSelector } from 'reselect';
|
|
8
8
|
import _ from 'lodash';
|
|
9
|
-
import { CapSpin, CapHeading, CapRow, CapColumn } from '@capillarytech/cap-ui-library';
|
|
9
|
+
import { CapSpin, CapHeading, CapRow, CapColumn, CapNotification } from '@capillarytech/cap-ui-library';
|
|
10
10
|
import messages from './messages';
|
|
11
11
|
import * as actions from './actions';
|
|
12
12
|
import Gallery from '../../Assets/Gallery';
|
|
@@ -18,6 +18,11 @@ import {getMessageObject} from '../../../utils/messageUtils';
|
|
|
18
18
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
19
|
import './_lineCreate.scss';
|
|
20
20
|
import withCreatives from '../../../hoc/withCreatives';
|
|
21
|
+
import {
|
|
22
|
+
LINE_IMG_HEIGHT,
|
|
23
|
+
LINE_IMG_WIDTH,
|
|
24
|
+
LINE_IMG_SIZE,
|
|
25
|
+
} from './constants';
|
|
21
26
|
|
|
22
27
|
export class Line extends Component {
|
|
23
28
|
constructor(props) {
|
|
@@ -867,15 +872,22 @@ export class Line extends Component {
|
|
|
867
872
|
|
|
868
873
|
uploadImage = (pearmData) => {
|
|
869
874
|
const data = pearmData;
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
+
const {
|
|
876
|
+
file: {
|
|
877
|
+
size,
|
|
878
|
+
},
|
|
879
|
+
fileParams: {
|
|
880
|
+
height,
|
|
881
|
+
width,
|
|
882
|
+
},
|
|
883
|
+
type,
|
|
884
|
+
} = pearmData;
|
|
885
|
+
if (type === "wrong file" || size > LINE_IMG_SIZE || height > LINE_IMG_HEIGHT || width > LINE_IMG_WIDTH) {
|
|
886
|
+
CapNotification.error({
|
|
887
|
+
message: this.props.intl.formatMessage(
|
|
888
|
+
messages.lineImageIncorrectSize
|
|
875
889
|
),
|
|
876
|
-
|
|
877
|
-
);
|
|
878
|
-
this.props.globalActions.addMessageToQueue(message);
|
|
890
|
+
});
|
|
879
891
|
} else {
|
|
880
892
|
data.fileParams.isGeneratePreview = true;
|
|
881
893
|
this.props.actions.uploadAsset(
|
|
@@ -222,4 +222,8 @@ export default defineMessages({
|
|
|
222
222
|
id: 'creatives.containers.Create.templateMessagePreviewPropsInductiveText',
|
|
223
223
|
defaultMessage: 'The relevant image that complements the message context.',
|
|
224
224
|
},
|
|
225
|
+
"lineImageIncorrectSize": {
|
|
226
|
+
id: 'creatives.containers.Create.lineImageIncorrectSize',
|
|
227
|
+
defaultMessage: 'Please upload the image with correct type, size and dimension',
|
|
228
|
+
},
|
|
225
229
|
});
|
|
@@ -156,18 +156,20 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
158
|
offerDetails.forEach((offer) => {
|
|
159
|
-
const { id, couponName } = offer;
|
|
159
|
+
const { id, couponName, description, couponSeriesId } = offer;
|
|
160
|
+
const couponId = id || couponSeriesId;
|
|
160
161
|
const couponSubTags = {};
|
|
161
162
|
couponTagsKeys.forEach((couponTagKey) => {
|
|
162
|
-
const couponSubTagsObj = withCouponId(allTags.coupon.subtags[couponTagKey],
|
|
163
|
+
const couponSubTagsObj = withCouponId(allTags.coupon.subtags[couponTagKey], couponId);
|
|
163
164
|
couponSubTags[couponTagKey] = couponSubTagsObj;
|
|
164
165
|
});
|
|
165
|
-
const
|
|
166
|
+
const couponNameFinal = couponName || description;
|
|
167
|
+
const key = couponNameFinal || couponId;
|
|
166
168
|
couponTags[key] = {
|
|
167
169
|
'tag-header': true,
|
|
168
|
-
'name':
|
|
169
|
-
'desc':
|
|
170
|
-
'couponSeriesId':
|
|
170
|
+
'name': couponNameFinal || couponId,
|
|
171
|
+
'desc': couponNameFinal || couponId,
|
|
172
|
+
'couponSeriesId': couponId,
|
|
171
173
|
'subtags': couponSubTags,
|
|
172
174
|
'resolved': true,
|
|
173
175
|
'couponTags': true,
|