@capillarytech/creatives-library 3.0.3 → 3.0.4
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/android-message-gui-2.svg +55 -0
- package/components/CallTaskPreview/_callTaskPreview.scss +17 -0
- package/components/CallTaskPreview/images/Footer.png +0 -0
- package/components/CallTaskPreview/images/Header.png +0 -0
- package/components/CallTaskPreview/index.js +37 -0
- package/components/CallTaskPreview/messages.js +13 -0
- package/components/CallTaskPreview/tests/index.test.js +15 -0
- package/components/CmsTemplatesComponent/index.js +33 -0
- package/components/CmsTemplatesComponent/messages.js +17 -0
- package/components/CmsTemplatesComponent/tests/index.test.js +10 -0
- package/components/EmailMobilePreview/index.js +129 -0
- package/components/EmailMobilePreview/index.scss +55 -0
- package/components/EmailPreviewV2/_emailPreviewV2.scss +69 -0
- package/components/EmailPreviewV2/index.js +132 -0
- package/components/EmailPreviewV2/messages.js +41 -0
- package/components/EmailPreviewV2/tests/index.test.js +10 -0
- package/components/MobilePushPreviewV2/index.js +120 -0
- package/components/MobilePushPreviewV2/messages.js +13 -0
- package/components/MobilePushPreviewV2/tests/index.test.js +10 -0
- package/components/NewCallTask/_newCallTask.scss +9 -0
- package/components/NewCallTask/index.js +152 -0
- package/components/NewCallTask/messages.js +29 -0
- package/components/NewCallTask/tests/index.test.js +10 -0
- package/components/SmsPreviewV2/_smsPreviewV2.scss +353 -0
- package/components/SmsPreviewV2/index.js +69 -0
- package/components/SmsPreviewV2/messages.js +13 -0
- package/components/SmsPreviewV2/tests/index.test.js +10 -0
- package/containers/Ebill/index.js +5 -4
- package/package.json +1 -1
- package/v2Components/FormBuilder/index.js +38 -35
- package/v2Components/NewCallTask/index.js +1 -1
- package/v2Components/NewCallTask/messages.js +1 -1
- package/v2Containers/Cap/index.js +1 -1
- package/v2Containers/Ebill/index.js +5 -5
- package/v2Containers/Email/index.js +3 -2
- package/v2Containers/Line/Create/index.js +6 -6
- package/v2Containers/Line/Edit/index.js +5 -5
- package/v2Containers/MobilePush/Create/index.js +36 -36
- package/v2Containers/MobilePush/Edit/index.js +6 -5
- package/v2Containers/MobilePush/initialSchema.js +3 -0
- package/v2Containers/Sms/Create/index.js +0 -2
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/WeChat/MapTemplates/index.js +5 -6
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* SmsPreviewV2
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
// import styled from 'styled-components';
|
|
9
|
+
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import messages from './messages';
|
|
12
|
+
import {CapColumn, CapRow, CapHeading} from '@capillarytech/cap-ui-library';
|
|
13
|
+
import androidPhoneImage from '../../assets/android-message-gui-2.svg';
|
|
14
|
+
|
|
15
|
+
class SmsPreviewV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
16
|
+
render() {
|
|
17
|
+
let content = [this.props.content];
|
|
18
|
+
const channel = this.props.channel;
|
|
19
|
+
let smsDetails = {};
|
|
20
|
+
if (this.props.content && this.props.charCounterEnabled) {
|
|
21
|
+
smsDetails = updateCharCount(this.props.content, this.props.unicodeEnabled);
|
|
22
|
+
content = [];
|
|
23
|
+
for (let i = 0, limit = 0; i < smsDetails.parts; i += 1, limit += smsDetails.chars_sms) {
|
|
24
|
+
content.push(smsDetails.char_list.slice(limit, smsDetails.chars_sms * (i + 1)));
|
|
25
|
+
}
|
|
26
|
+
if (document.getElementById("msg_count") && this.props.showCount) {
|
|
27
|
+
document.getElementById("msg_count").val = smsDetails.parts;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const type = this.props.location && this.props.location.query.type ? this.props.location.query.type : '';
|
|
31
|
+
return (
|
|
32
|
+
<CapRow>
|
|
33
|
+
{this.props.showCount && <CapColumn span={16}>
|
|
34
|
+
{channel && channel.toLowerCase() === 'sms' && <CapHeading type="h3">
|
|
35
|
+
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.chars_used}}/>
|
|
36
|
+
{smsDetails.unicode &&
|
|
37
|
+
<FormattedMessage {...messages.smsFormatType}/>
|
|
38
|
+
}
|
|
39
|
+
</CapHeading>}
|
|
40
|
+
</CapColumn>}
|
|
41
|
+
<CapColumn span={this.props.showCount ? 8 : 24}>
|
|
42
|
+
<div className={`preview-container ${type === 'embedded' ? 'embedded-preview' : ''}`}>
|
|
43
|
+
{ channel && channel.toLowerCase() === 'sms' &&
|
|
44
|
+
<div className="shell align-center" id="sms-preview">
|
|
45
|
+
<img className="preview-image sms" src={smsBody} alt="Preview is being generated"/>
|
|
46
|
+
<div className="msgContainer sms">
|
|
47
|
+
<img className="sms-icon" src={smsIcon} alt="Sms icon" />
|
|
48
|
+
<div className={"message-pop sms"}>
|
|
49
|
+
{content && content.length && content.map((msg, index) =>
|
|
50
|
+
<CapColumn key={`"message-pop-content-${index}`} className="message-pop-item align-left" style={{ background: '#3F51B5', color: '#ffffff'}}>
|
|
51
|
+
{msg}
|
|
52
|
+
</CapColumn>)
|
|
53
|
+
}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
}
|
|
58
|
+
</div>
|
|
59
|
+
</CapColumn>
|
|
60
|
+
</CapRow>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SmsPreviewV2.propTypes = {
|
|
66
|
+
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default SmsPreviewV2;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SmsPreviewV2 Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the SmsPreviewV2 component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
header: {
|
|
10
|
+
id: 'app.components.SmsPreviewV2.header',
|
|
11
|
+
defaultMessage: 'This is the SmsPreviewV2 component !',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -690,7 +690,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
690
690
|
onTagSelect = (data, currentTab) => {
|
|
691
691
|
console.log('parent data tag', data, currentTab);
|
|
692
692
|
const editorId = currentTab > 1 ? `ebill-editor${currentTab}` : 'ebill-editor';
|
|
693
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
693
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
694
694
|
document.getElementById(editorId).focus();
|
|
695
695
|
};
|
|
696
696
|
|
|
@@ -864,7 +864,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
864
864
|
|
|
865
865
|
};
|
|
866
866
|
|
|
867
|
-
insertAtCursor = (field, myValue) => {
|
|
867
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
868
868
|
//IE support
|
|
869
869
|
const myField = field;
|
|
870
870
|
if (document.selection) {
|
|
@@ -882,8 +882,9 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
882
882
|
} else {
|
|
883
883
|
myField.value += myValue;
|
|
884
884
|
}
|
|
885
|
-
const
|
|
886
|
-
myField.
|
|
885
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
886
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
887
|
+
this.setState({formData});
|
|
887
888
|
};
|
|
888
889
|
|
|
889
890
|
injectMessages(elem) {
|
package/package.json
CHANGED
|
@@ -1030,45 +1030,47 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1030
1030
|
response.valid = true;
|
|
1031
1031
|
response.missingTags = [];
|
|
1032
1032
|
response.unsupportedTags = [];
|
|
1033
|
-
|
|
1034
|
-
_.forEach(
|
|
1035
|
-
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1038
|
-
|
|
1033
|
+
if(tags && tags.length) {
|
|
1034
|
+
_.forEach(tags, (tag) => {
|
|
1035
|
+
_.forEach(tag.definition.supportedModules, (module) => {
|
|
1036
|
+
if (module.mandatory && (currentModule === module.context)) {
|
|
1037
|
+
if (content.indexOf(`{{${tag.definition.value}}}`) === -1) {
|
|
1038
|
+
response.valid = false;
|
|
1039
|
+
response.missingTags.push(tag.definition.value);
|
|
1040
|
+
}
|
|
1039
1041
|
}
|
|
1040
|
-
}
|
|
1042
|
+
});
|
|
1041
1043
|
});
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1044
|
+
const regex = /{{[(A-Z\w\(\)@!#$%^&*~.,/\\]+}}/g;
|
|
1045
|
+
let match = regex.exec(content);
|
|
1046
|
+
while (match !== null) {
|
|
1047
|
+
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1048
|
+
match = regex.exec(content);
|
|
1049
|
+
let ifSupported = false;
|
|
1050
|
+
_.forEach(tags, (tag) => {
|
|
1051
|
+
if (tag.definition.value === tagValue) {
|
|
1052
|
+
ifSupported = true;
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
const ifSkipped = this.skipTags(tagValue);
|
|
1056
|
+
if (ifSkipped) {
|
|
1051
1057
|
ifSupported = true;
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
if (isUnsubscribeSkipped) {
|
|
1059
|
-
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1060
|
-
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1061
|
-
response.missingTags.splice(missingTagIndex, 1);
|
|
1058
|
+
let isUnsubscribeSkipped = tagValue.indexOf("unsubscribe") != -1 ;
|
|
1059
|
+
if (isUnsubscribeSkipped) {
|
|
1060
|
+
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1061
|
+
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1062
|
+
response.missingTags.splice(missingTagIndex, 1);
|
|
1063
|
+
}
|
|
1062
1064
|
}
|
|
1063
1065
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1066
|
+
ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, injectedTags);
|
|
1067
|
+
if (!ifSupported) {
|
|
1068
|
+
response.unsupportedTags.push(tagValue);
|
|
1069
|
+
response.valid = false;
|
|
1070
|
+
}
|
|
1071
|
+
if (response.unsupportedTags.length == 0 && response.missingTags.length == 0 ) {
|
|
1072
|
+
response.valid = true;
|
|
1073
|
+
}
|
|
1072
1074
|
}
|
|
1073
1075
|
}
|
|
1074
1076
|
return response;
|
|
@@ -1088,6 +1090,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1088
1090
|
return formData;
|
|
1089
1091
|
}
|
|
1090
1092
|
|
|
1093
|
+
// eslint-disable-next-line consistent-return
|
|
1091
1094
|
initializeEditErrorData(formData, tabCount, isReturnErrorData) {
|
|
1092
1095
|
const errorData = {};
|
|
1093
1096
|
for (let idx = 0; idx < tabCount; idx += 1 ) {
|
|
@@ -2734,7 +2737,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2734
2737
|
{val.showPreview && <WithLabel key={`${val.id}-with-label`} {...rest} errorMessage={ifError && errorMessage} ifError={ifError}/>}
|
|
2735
2738
|
<form encType="multipart/form-data" id={val.id}>
|
|
2736
2739
|
<input key={val.id} style={{ display: 'none'}} id="fileName" type="file" onChange={(e) => this.uploadImages(e, {files: e.target.files}, val)} accept={val.supportedExtensions ? val.supportedExtensions : "image/*"} />
|
|
2737
|
-
<CapButton disabled={val.disabled ? val.disabled : false} type="secondary" onClick={(e) => this.openFileDialog(e, val.id)} style={{float: 'right'}}>
|
|
2740
|
+
<CapButton disabled={val.disabled ? val.disabled : false} type="secondary" onClick={(e) => this.openFileDialog(e, val.id)} style={{float: 'right', right: '-16px', top: '212px'}}>
|
|
2738
2741
|
{val.label}
|
|
2739
2742
|
</CapButton>
|
|
2740
2743
|
</form>
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { CapRow, CapColumn, CapInput, CapButton, CapSpin } from '@capillarytech/cap-ui-library';
|
|
10
10
|
import { injectIntl, intlShape } from 'react-intl';
|
|
11
|
-
import TagList from '../../
|
|
11
|
+
import TagList from '../../v2Containers/TagList';
|
|
12
12
|
import CallTaskPreview from '../CallTaskPreview';
|
|
13
13
|
import messages from './messages';
|
|
14
14
|
import './_newCallTask.scss';
|
|
@@ -7,7 +7,7 @@ import styled from 'styled-components';
|
|
|
7
7
|
import { createStructuredSelector } from 'reselect';
|
|
8
8
|
import _ from 'lodash';
|
|
9
9
|
import moment from 'moment';
|
|
10
|
-
import 'moment/locale/zh-cn';
|
|
10
|
+
// import 'moment/locale/zh-cn';
|
|
11
11
|
import { injectIntl } from 'react-intl';
|
|
12
12
|
import {CapNotification} from '@capillarytech/cap-ui-library';
|
|
13
13
|
import { makeSelectAuthenticated, makeSelectUser } from './selectors';
|
|
@@ -25,7 +25,6 @@ import makeSelectEbill from './selectors';
|
|
|
25
25
|
import messages from './messages';
|
|
26
26
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
27
27
|
import './_ebill.scss';
|
|
28
|
-
import callNativeEvent from '../../utils/callNativeEvent';
|
|
29
28
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
30
29
|
|
|
31
30
|
export class Ebill extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -691,7 +690,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
691
690
|
onTagSelect = (data, currentTab) => {
|
|
692
691
|
console.log('parent data tag', data, currentTab);
|
|
693
692
|
const editorId = currentTab > 1 ? `ebill-editor${currentTab}` : 'ebill-editor';
|
|
694
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
693
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
695
694
|
document.getElementById(editorId).focus();
|
|
696
695
|
};
|
|
697
696
|
|
|
@@ -865,7 +864,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
865
864
|
|
|
866
865
|
};
|
|
867
866
|
|
|
868
|
-
insertAtCursor = (field, myValue) => {
|
|
867
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
869
868
|
//IE support
|
|
870
869
|
const myField = field;
|
|
871
870
|
if (document.selection) {
|
|
@@ -883,8 +882,9 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
883
882
|
} else {
|
|
884
883
|
myField.value += myValue;
|
|
885
884
|
}
|
|
886
|
-
const
|
|
887
|
-
|
|
885
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
886
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
887
|
+
this.setState({formData});
|
|
888
888
|
};
|
|
889
889
|
|
|
890
890
|
injectMessages(elem) {
|
|
@@ -2429,6 +2429,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2429
2429
|
openFileDialog() {
|
|
2430
2430
|
document.getElementById("fileName").click();
|
|
2431
2431
|
}
|
|
2432
|
+
// eslint-disable-next-line react/sort-comp
|
|
2432
2433
|
getTemplateDataForGrid = ({templates, handlers, filterContent, isLoading, loadingTip}) => {
|
|
2433
2434
|
const currentChannel = 'gallery';
|
|
2434
2435
|
const cardDataList = templates.length ? _.map(templates, (template) => {
|
|
@@ -2555,14 +2556,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2555
2556
|
enablePagination
|
|
2556
2557
|
isLoading={}
|
|
2557
2558
|
/> */}
|
|
2558
|
-
{this.props.Email.assetList && this.props.Email.assetList.length
|
|
2559
|
+
{this.props.Email.assetList && this.props.Email.assetList.length ? this.getTemplateDataForGrid({
|
|
2559
2560
|
isLoading: this.props.Email.fetchingAllAssets,
|
|
2560
2561
|
loadingTip: <FormattedMessage {...messages.loadingImages}/>,
|
|
2561
2562
|
channel: this.state.channel,
|
|
2562
2563
|
templates: this.props.Email.assetList,
|
|
2563
2564
|
filterContent: this.getFilterContent(),
|
|
2564
2565
|
handlers: {onItemClick: this.handleOnItemClick}})
|
|
2565
|
-
|
|
2566
|
+
: ''}
|
|
2566
2567
|
|
|
2567
2568
|
</Pagination>
|
|
2568
2569
|
</div>
|
|
@@ -17,7 +17,6 @@ import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
|
17
17
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
18
18
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
19
|
import './_lineCreate.scss';
|
|
20
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
21
20
|
|
|
22
21
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
23
22
|
|
|
@@ -228,14 +227,14 @@ export class Line extends Component {
|
|
|
228
227
|
onTagSelect(data, currentTab) {
|
|
229
228
|
console.log('parent data tag', data, currentTab);
|
|
230
229
|
const editorId = 'message-editor';
|
|
231
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
230
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
232
231
|
document.getElementById(editorId).focus();
|
|
233
232
|
}
|
|
234
233
|
|
|
235
234
|
onTagSelectTitle(data, currentTab) {
|
|
236
235
|
console.log('parent data tag', data, currentTab);
|
|
237
236
|
const editorId = 'message-title';
|
|
238
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
237
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
239
238
|
document.getElementById(editorId).focus();
|
|
240
239
|
}
|
|
241
240
|
|
|
@@ -521,7 +520,7 @@ export class Line extends Component {
|
|
|
521
520
|
return section;
|
|
522
521
|
};
|
|
523
522
|
|
|
524
|
-
insertAtCursor = (field, myValue) => {
|
|
523
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
525
524
|
//IE support
|
|
526
525
|
const myField = field;
|
|
527
526
|
if (document.selection) {
|
|
@@ -539,8 +538,9 @@ export class Line extends Component {
|
|
|
539
538
|
} else {
|
|
540
539
|
myField.value += myValue;
|
|
541
540
|
}
|
|
542
|
-
const
|
|
543
|
-
|
|
541
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
542
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
543
|
+
this.setState({formData});
|
|
544
544
|
};
|
|
545
545
|
|
|
546
546
|
startTemplateCreation = (data) => {
|
|
@@ -24,7 +24,6 @@ import * as templatesActions from "../../Templates/actions";
|
|
|
24
24
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
25
25
|
import messages from './messages';
|
|
26
26
|
import './_lineEdit.scss';
|
|
27
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
28
27
|
|
|
29
28
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
30
29
|
|
|
@@ -256,7 +255,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
256
255
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
257
256
|
console.log('parent data tag', data, currentTab);
|
|
258
257
|
const editorId = srcComp.target;
|
|
259
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
258
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
260
259
|
document.getElementById(editorId).focus();
|
|
261
260
|
};
|
|
262
261
|
onModalCancel = () => {
|
|
@@ -687,7 +686,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
687
686
|
this.setState({showModal: false});
|
|
688
687
|
};
|
|
689
688
|
|
|
690
|
-
insertAtCursor = (field, myValue) => {
|
|
689
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
691
690
|
//IE support
|
|
692
691
|
const myField = field;
|
|
693
692
|
if (document.selection) {
|
|
@@ -705,8 +704,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
705
704
|
} else {
|
|
706
705
|
myField.value += myValue;
|
|
707
706
|
}
|
|
708
|
-
const
|
|
709
|
-
|
|
707
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
708
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
709
|
+
this.setState({formData});
|
|
710
710
|
};
|
|
711
711
|
|
|
712
712
|
selectCtaIos = (selectedConfig) => {
|
|
@@ -25,7 +25,6 @@ import * as actions from './actions';
|
|
|
25
25
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
26
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
27
27
|
import messages from './messages';
|
|
28
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
29
28
|
import getEventsMap from '../eventsMap';
|
|
30
29
|
|
|
31
30
|
const PrefixWrapper = styled.div`
|
|
@@ -201,7 +200,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
201
200
|
|
|
202
201
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
203
202
|
const editorId = srcComp.target;
|
|
204
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
203
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
205
204
|
document.getElementById(editorId).focus();
|
|
206
205
|
};
|
|
207
206
|
|
|
@@ -362,37 +361,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
362
361
|
}
|
|
363
362
|
return response;
|
|
364
363
|
};
|
|
365
|
-
showError = () => {
|
|
366
|
-
const {intl} = this.props;
|
|
367
|
-
const {errorData} = this.state;
|
|
368
|
-
const errorMessage = {key: 'validation-error', message: intl.formatMessage(messages.validationError)};
|
|
369
|
-
if (!isEmpty(this.state.formData) && !this.state.isFormValid) {
|
|
370
|
-
let tab = this.state.currentTab;
|
|
371
|
-
const isAndroidInvalid = Object.values(errorData[0]).includes(true);
|
|
372
|
-
const isIosInvalid = Object.values(errorData[1]).includes(true);
|
|
373
|
-
let isTagErrorExist = false;
|
|
374
|
-
if (isAndroidInvalid) {
|
|
375
|
-
tab = 1;
|
|
376
|
-
errorMessage.description = intl.formatMessage(messages.invalidAndroidMessage);
|
|
377
|
-
const invalidTags = errorData[0]['invalid-tags'];
|
|
378
|
-
if (!isEmpty(invalidTags)) {
|
|
379
|
-
isTagErrorExist = true;
|
|
380
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidAndroidMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
381
|
-
}
|
|
382
|
-
} else if (isIosInvalid) {
|
|
383
|
-
tab = 2;
|
|
384
|
-
errorMessage.description = intl.formatMessage(messages.invalidIosMessage);
|
|
385
|
-
const invalidTags = errorData[1]['invalid-tags'];
|
|
386
|
-
if (!isEmpty(invalidTags)) {
|
|
387
|
-
isTagErrorExist = true;
|
|
388
|
-
errorMessage.description = `${intl.formatMessage(messages.invalidIosMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
if (tab !== this.state.currentTab || isTagErrorExist) {
|
|
392
|
-
CapNotification.error(errorMessage);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
364
|
setFormValidity = (isFormValid, errorData) => {
|
|
397
365
|
const newState = {isFormValid, errorData};
|
|
398
366
|
this.setState(newState);
|
|
@@ -633,6 +601,37 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
633
601
|
this.setState({modalContent, showModal: true});
|
|
634
602
|
}
|
|
635
603
|
}
|
|
604
|
+
showError = () => {
|
|
605
|
+
const {intl} = this.props;
|
|
606
|
+
const {errorData} = this.state;
|
|
607
|
+
const errorMessage = {key: 'validation-error', message: intl.formatMessage(messages.validationError)};
|
|
608
|
+
if (!isEmpty(this.state.formData) && !this.state.isFormValid) {
|
|
609
|
+
let tab = this.state.currentTab;
|
|
610
|
+
const isAndroidInvalid = Object.values(errorData[0]).includes(true);
|
|
611
|
+
const isIosInvalid = Object.values(errorData[1]).includes(true);
|
|
612
|
+
let isTagErrorExist = false;
|
|
613
|
+
if (isAndroidInvalid) {
|
|
614
|
+
tab = 1;
|
|
615
|
+
errorMessage.description = intl.formatMessage(messages.invalidAndroidMessage);
|
|
616
|
+
const invalidTags = errorData[0]['invalid-tags'];
|
|
617
|
+
if (!isEmpty(invalidTags)) {
|
|
618
|
+
isTagErrorExist = true;
|
|
619
|
+
errorMessage.description = `${intl.formatMessage(messages.invalidAndroidMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
620
|
+
}
|
|
621
|
+
} else if (isIosInvalid) {
|
|
622
|
+
tab = 2;
|
|
623
|
+
errorMessage.description = intl.formatMessage(messages.invalidIosMessage);
|
|
624
|
+
const invalidTags = errorData[1]['invalid-tags'];
|
|
625
|
+
if (!isEmpty(invalidTags)) {
|
|
626
|
+
isTagErrorExist = true;
|
|
627
|
+
errorMessage.description = `${intl.formatMessage(messages.invalidIosMessage)} ${intl.formatMessage(messages.invalidTags)}: ${invalidTags.join(',')} `;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (tab !== this.state.currentTab || isTagErrorExist) {
|
|
631
|
+
CapNotification.error(errorMessage);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
636
635
|
stopValidation = () => {
|
|
637
636
|
this.setState({startValidation: false});
|
|
638
637
|
}
|
|
@@ -806,7 +805,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
806
805
|
});
|
|
807
806
|
return section;
|
|
808
807
|
};
|
|
809
|
-
insertAtCursor = (field, myValue) => {
|
|
808
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
810
809
|
//IE support
|
|
811
810
|
const myField = field;
|
|
812
811
|
if (document.selection) {
|
|
@@ -824,8 +823,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
824
823
|
} else {
|
|
825
824
|
myField.value += myValue;
|
|
826
825
|
}
|
|
827
|
-
const
|
|
828
|
-
|
|
826
|
+
const formData = cloneDeep(this.state.formData);
|
|
827
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
828
|
+
this.setState({formData});
|
|
829
829
|
};
|
|
830
830
|
|
|
831
831
|
startTemplateCreation = (data) => {
|
|
@@ -26,7 +26,6 @@ import * as templatesActions from "../../Templates/actions";
|
|
|
26
26
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
27
27
|
import messages from './messages';
|
|
28
28
|
import './_mobilePushCreate.scss';
|
|
29
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
30
29
|
import {makeSelectCreate} from "../Create/selectors";
|
|
31
30
|
|
|
32
31
|
import getEventsMap from '../eventsMap';
|
|
@@ -263,7 +262,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
263
262
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
264
263
|
console.log('parent data tag', data, currentTab);
|
|
265
264
|
const editorId = srcComp.target;
|
|
266
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
265
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
267
266
|
document.getElementById(editorId).focus();
|
|
268
267
|
};
|
|
269
268
|
onModalCancel = () => {
|
|
@@ -551,6 +550,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
551
550
|
}
|
|
552
551
|
return undefined;
|
|
553
552
|
};
|
|
553
|
+
// eslint-disable-next-line react/sort-comp
|
|
554
554
|
showError = () => {
|
|
555
555
|
const {intl} = this.props;
|
|
556
556
|
const {errorData} = this.state;
|
|
@@ -882,7 +882,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
882
882
|
this.setState({showModal: false});
|
|
883
883
|
};
|
|
884
884
|
|
|
885
|
-
insertAtCursor = (field, myValue) => {
|
|
885
|
+
insertAtCursor = (field, myValue, currentTab) => {
|
|
886
886
|
//IE support
|
|
887
887
|
const myField = field;
|
|
888
888
|
if (document.selection) {
|
|
@@ -900,8 +900,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
900
900
|
} else {
|
|
901
901
|
myField.value += myValue;
|
|
902
902
|
}
|
|
903
|
-
const
|
|
904
|
-
|
|
903
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
904
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
905
|
+
this.setState({formData});
|
|
905
906
|
};
|
|
906
907
|
|
|
907
908
|
selectCtaIos = (selectedConfig) => {
|
|
@@ -744,8 +744,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
744
744
|
const formData = _.cloneDeep(this.state.formData);
|
|
745
745
|
formData[currentTab - 1][field.id] = myField.value;
|
|
746
746
|
this.setState({formData});
|
|
747
|
-
// const event = new Event('input', { bubbles: true });
|
|
748
|
-
// callNativeEvent({field, value: myField.value, event});
|
|
749
747
|
}
|
|
750
748
|
|
|
751
749
|
startTemplateCreation(data) {
|
|
@@ -790,8 +790,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
790
790
|
const formData = _.cloneDeep(this.state.formData);
|
|
791
791
|
formData[currentTab - 1][field.id] = myField.value;
|
|
792
792
|
this.setState({formData});
|
|
793
|
-
// const event = new Event('input', { bubbles: true });
|
|
794
|
-
// callNativeEvent({field, value: myField.value, event});
|
|
795
793
|
}
|
|
796
794
|
|
|
797
795
|
handleFrameTasks = (e) => {
|
|
@@ -28,8 +28,6 @@ import * as templateActions from '../../Templates/actions';
|
|
|
28
28
|
// import PageHeader from '../../v2Components/PageHeader';
|
|
29
29
|
import './_mapTemplates.scss';
|
|
30
30
|
|
|
31
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
32
|
-
|
|
33
31
|
// const Option = Select.Option;
|
|
34
32
|
|
|
35
33
|
export class MapTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -427,7 +425,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
427
425
|
|
|
428
426
|
onTagSelect(data, currentTab, value) {
|
|
429
427
|
const editorId = (value.id).replace('tagList', 'template');
|
|
430
|
-
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}
|
|
428
|
+
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
431
429
|
document.getElementById(editorId).focus();
|
|
432
430
|
}
|
|
433
431
|
|
|
@@ -1020,7 +1018,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1020
1018
|
parent.postMessage(JSON.stringify(response), '*');
|
|
1021
1019
|
}
|
|
1022
1020
|
|
|
1023
|
-
insertAtCursor(field, myValue) {
|
|
1021
|
+
insertAtCursor(field, myValue, currentTab) {
|
|
1024
1022
|
//IE support
|
|
1025
1023
|
const myField = field;
|
|
1026
1024
|
if (document.selection) {
|
|
@@ -1038,8 +1036,9 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1038
1036
|
} else {
|
|
1039
1037
|
myField.value += myValue;
|
|
1040
1038
|
}
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1039
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1040
|
+
formData[currentTab - 1][field.id] = myField.value;
|
|
1041
|
+
this.setState({formData});
|
|
1043
1042
|
}
|
|
1044
1043
|
|
|
1045
1044
|
internalUrlChecked() {
|