@capillarytech/creatives-library 2.0.81 → 2.0.82
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/FormBuilder/index.js +4 -4
- package/containers/WeChat/actions.js +0 -6
- package/containers/WeChat/index.js +13 -31
- package/package.json +1 -1
- package/v2Containers/Email/index.js +9 -9
- package/v2Containers/MobilePush/Create/index.js +25 -2
- package/v2Containers/MobilePush/Edit/index.js +31 -6
- package/v2Containers/MobilePush/initialSchema.js +2 -0
- package/components/FormBuilder/test +0 -1845
- package/containers/CallTask/_callTask.scss +0 -5
- package/containers/CallTask/actions.js +0 -15
- package/containers/CallTask/constants.js +0 -7
- package/containers/CallTask/index.js +0 -141
- package/containers/CallTask/messages.js +0 -21
- package/containers/CallTask/reducer.js +0 -23
- package/containers/CallTask/sagas.js +0 -11
- package/containers/CallTask/selectors.js +0 -25
- package/containers/CallTask/tests/actions.test.js +0 -18
- package/containers/CallTask/tests/index.test.js +0 -10
- package/containers/CallTask/tests/reducer.test.js +0 -9
- package/containers/CallTask/tests/sagas.test.js +0 -15
- package/containers/CallTask/tests/selectors.test.js +0 -10
- package/containers/ChannelTemplates/actions.js +0 -20
- package/containers/ChannelTemplates/constants.js +0 -8
- package/containers/ChannelTemplates/index.js +0 -48
- package/containers/ChannelTemplates/messages.js +0 -13
- package/containers/ChannelTemplates/reducer.js +0 -34
- package/containers/ChannelTemplates/sagas.js +0 -32
- package/containers/ChannelTemplates/selectors.js +0 -25
- package/containers/ChannelTemplates/tests/actions.test.js +0 -18
- package/containers/ChannelTemplates/tests/index.test.js +0 -10
- package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
- package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
- package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
- package/containers/CreativesContainer/SlideBoxContent.js +0 -248
- package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
- package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
- package/containers/CreativesContainer/actions.js +0 -27
- package/containers/CreativesContainer/constants.js +0 -13
- package/containers/CreativesContainer/index.js +0 -418
- package/containers/CreativesContainer/index.scss +0 -27
- package/containers/CreativesContainer/messages.js +0 -17
- package/containers/CreativesContainer/reducer.js +0 -29
- package/containers/CreativesContainer/sagas.js +0 -11
- package/containers/CreativesContainer/selectors.js +0 -30
- package/containers/CreativesContainer/tests/actions.test.js +0 -18
- package/containers/CreativesContainer/tests/index.test.js +0 -10
- package/containers/CreativesContainer/tests/reducer.test.js +0 -9
- package/containers/CreativesContainer/tests/sagas.test.js +0 -15
- package/containers/CreativesContainer/tests/selectors.test.js +0 -10
- package/containers/EmailWrapper/actions.js +0 -15
- package/containers/EmailWrapper/constants.js +0 -7
- package/containers/EmailWrapper/index.js +0 -238
- package/containers/EmailWrapper/messages.js +0 -57
- package/containers/EmailWrapper/reducer.js +0 -23
- package/containers/EmailWrapper/sagas.js +0 -11
- package/containers/EmailWrapper/selectors.js +0 -25
- package/containers/EmailWrapper/tests/actions.test.js +0 -18
- package/containers/EmailWrapper/tests/index.test.js +0 -10
- package/containers/EmailWrapper/tests/reducer.test.js +0 -9
- package/containers/EmailWrapper/tests/sagas.test.js +0 -15
- package/containers/EmailWrapper/tests/selectors.test.js +0 -10
- package/containers/MobilePush/commonMethods.js +0 -249
- package/containers/MobilePush/eventsMap.js +0 -127
- package/containers/MobilePush/initialSchema.js +0 -1739
- package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
- package/containers/MobilepushWrapper/index.js +0 -97
- package/containers/MobilepushWrapper/messages.js +0 -25
- package/containers/MobilepushWrapper/tests/index.test.js +0 -10
- package/containers/TemplatesV2/_templatesV2.scss +0 -5
- package/containers/TemplatesV2/actions.js +0 -16
- package/containers/TemplatesV2/constants.js +0 -10
- package/containers/TemplatesV2/index.js +0 -207
- package/containers/TemplatesV2/messages.js +0 -29
- package/containers/TemplatesV2/selectors.js +0 -25
- package/containers/TemplatesV2/tests/actions.test.js +0 -18
- package/containers/TemplatesV2/tests/index.test.js +0 -10
- package/containers/TemplatesV2/tests/reducer.test.js +0 -9
- package/containers/TemplatesV2/tests/sagas.test.js +0 -15
- package/containers/TemplatesV2/tests/selectors.test.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
|
@@ -1803,7 +1803,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1803
1803
|
}
|
|
1804
1804
|
|
|
1805
1805
|
if (!((event === 'onSelect' && data === 'New Version') || event === 'onContentChange')) {
|
|
1806
|
-
this.props.onChange(formData, this.state.tabCount, currentTab);
|
|
1806
|
+
this.props.onChange(formData, this.state.tabCount, currentTab, val);
|
|
1807
1807
|
}
|
|
1808
1808
|
}
|
|
1809
1809
|
|
|
@@ -1845,7 +1845,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1845
1845
|
if (!event) {
|
|
1846
1846
|
return;
|
|
1847
1847
|
}
|
|
1848
|
-
|
|
1849
1848
|
const tab = this.state.tabCount;
|
|
1850
1849
|
// const parent = this._reactInternalInstance._currentElement._owner._instance;
|
|
1851
1850
|
if (event === 'onTabChange') {
|
|
@@ -1855,7 +1854,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1855
1854
|
if (this.props.isNewVersionFlow) {
|
|
1856
1855
|
const formData = _.cloneDeep(this.state.formData);
|
|
1857
1856
|
let activeTabIndex = '1';
|
|
1858
|
-
const elems = document.
|
|
1857
|
+
const elems = document.querySelectorAll(`.cap-tabs-${val.id} .ant-tabs-tab`);
|
|
1859
1858
|
|
|
1860
1859
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1861
1860
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
@@ -1875,7 +1874,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1875
1874
|
});
|
|
1876
1875
|
} else {
|
|
1877
1876
|
let activeTabIndex = '1';
|
|
1878
|
-
const elems = document.
|
|
1877
|
+
const elems = document.querySelectorAll(`.cap-tabs-${val.id} .ant-tabs-tab`);
|
|
1879
1878
|
|
|
1880
1879
|
for (let i = 0; i < elems.length; i += 1) {
|
|
1881
1880
|
if (elems.item(i).classList.contains("ant-tabs-tab-active")) {
|
|
@@ -3168,6 +3167,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3168
3167
|
}
|
|
3169
3168
|
return (
|
|
3170
3169
|
<Tabs
|
|
3170
|
+
className={`cap-tabs-${container.id}`}
|
|
3171
3171
|
activeKey={activeTabKey && activeTabKey !== '' ? `${activeTabKey}` : '1'}
|
|
3172
3172
|
defaultActiveKey={activeTabKey && activeTabKey !== '' ? `${activeTabKey}` : '1'}
|
|
3173
3173
|
onChange={(data, e) => { this.callChildEvent(data, container, 'onTabChange', e); }}
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import PropTypes from '
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
7
|
+
import React, { PropTypes } from 'react';
|
|
10
8
|
import { connect } from 'react-redux';
|
|
11
9
|
import { bindActionCreators } from 'redux';
|
|
12
10
|
import Helmet from 'react-helmet';
|
|
13
11
|
import { injectIntl, intlShape } from 'react-intl';
|
|
14
12
|
import { createStructuredSelector } from 'reselect';
|
|
13
|
+
// import { CapButton, CapSelect } from '@capillarytech/cap-react-ui-library';
|
|
15
14
|
import { Row, Col, Spin } from 'antd';
|
|
16
15
|
import _ from 'lodash';
|
|
17
16
|
import { makeSelectTemplates } from '../Templates/selectors';
|
|
@@ -22,12 +21,10 @@ import * as actions from './actions';
|
|
|
22
21
|
import FormBuilder from '../../components/FormBuilder';
|
|
23
22
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
24
23
|
import * as globalActions from '../../containers/Cap/actions';
|
|
25
|
-
import * as templateActions from '../../containers/Templates/actions';
|
|
26
24
|
import {getMessageObject} from '../../utils/messageUtils';
|
|
27
25
|
// import SlideBox from '../../components/SlideBox';
|
|
28
26
|
// import PageHeader from '../../components/PageHeader';
|
|
29
27
|
import './_wechat.scss';
|
|
30
|
-
import callNativeEvent from '../../utils/callNativeEvent';
|
|
31
28
|
|
|
32
29
|
// const Option = Select.Option;
|
|
33
30
|
|
|
@@ -404,7 +401,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
404
401
|
sortBy: 'Most Recent',
|
|
405
402
|
wecrmId: this.props.Templates.selectedWeChatAccount.configs.wecrm_app_id,
|
|
406
403
|
wecrmToken: this.props.Templates.selectedWeChatAccount.configs.wecrm_token,
|
|
407
|
-
originalId: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
|
|
408
404
|
};
|
|
409
405
|
this.props.actions.getDefaultWeChatTemplates('wechat', params);
|
|
410
406
|
} else {
|
|
@@ -437,7 +433,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
437
433
|
}
|
|
438
434
|
|
|
439
435
|
componentWillReceiveProps(nextProps) {
|
|
440
|
-
if (nextProps.isGetFormData) {
|
|
436
|
+
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
|
|
441
437
|
this.getFormData();
|
|
442
438
|
}
|
|
443
439
|
console.log('MetaEntity nextprops ', nextProps.metaEntities);
|
|
@@ -485,7 +481,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
485
481
|
this.setState({isEdit: true});
|
|
486
482
|
}
|
|
487
483
|
if (this.state.isEdit && _.isEmpty(this.state.editTemplateData) && !_.isEmpty(nextProps.WeChat.weChatTemplates)) {
|
|
488
|
-
const templateIndex = _.findIndex(nextProps.WeChat.weChatTemplates, {_id: nextProps.params.id});
|
|
484
|
+
const templateIndex = _.findIndex(nextProps.WeChat.weChatTemplates, {"_id": nextProps.params.id});
|
|
489
485
|
this.setState({editTemplateData: nextProps.WeChat.weChatTemplates[templateIndex]}, () => {
|
|
490
486
|
if (_.isEmpty(this.state.baseSchema)) {
|
|
491
487
|
this.setState({ baseSchema: _.cloneDeep(this.state.schema)}, () => {
|
|
@@ -545,7 +541,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
545
541
|
sortBy: 'Most Recent',
|
|
546
542
|
wecrmId: nextProps.WeChat.selectedWeChatAccount.configs.wecrm_app_id,
|
|
547
543
|
wecrmToken: nextProps.WeChat.selectedWeChatAccount.configs.wecrm_token,
|
|
548
|
-
originalId: nextProps.WeChat.selectedWeChatAccount.sourceAccountIdentifier,
|
|
549
544
|
};
|
|
550
545
|
this.props.actions.getDefaultWeChatTemplates('wechat', params);
|
|
551
546
|
}
|
|
@@ -602,11 +597,11 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
602
597
|
componentWillUnmount() {
|
|
603
598
|
console.log('removed listener create');
|
|
604
599
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
605
|
-
this.props.templateActions.resetTemplate();
|
|
606
600
|
this.resetState();
|
|
607
601
|
}
|
|
608
602
|
|
|
609
603
|
onFormDataChange(formData) {
|
|
604
|
+
console.log('Form Data Change ', formData);
|
|
610
605
|
let selectedWechatTemplateIndex = -1;
|
|
611
606
|
let selectedTemplate = {};
|
|
612
607
|
let selectedTemplateData = {};
|
|
@@ -645,7 +640,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
645
640
|
selectedWechatTemplateIndex = _.findIndex(this.props.WeChat.weChatDefaultTemplate, {template_id: formData['wechat-template']});
|
|
646
641
|
selectedTemplate = this.props.WeChat.weChatDefaultTemplate[selectedWechatTemplateIndex];
|
|
647
642
|
}
|
|
648
|
-
|
|
649
643
|
if (!_.isEqual(formData['wechat-template'], this.state.formData['wechat-template'])) {
|
|
650
644
|
this.updateSchema = true;
|
|
651
645
|
}
|
|
@@ -698,8 +692,8 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
698
692
|
console.log('posting final result', this.state.formData, this.state.editTemplateData);
|
|
699
693
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.WeChat.selectedWeChatAccount);
|
|
700
694
|
const data = {
|
|
701
|
-
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
702
|
-
Title: this.state.editTemplateData.versions.base.Title,
|
|
695
|
+
"template_id": this.state.editTemplateData.versions.base.template_id,
|
|
696
|
+
"Title": this.state.editTemplateData.versions.base.Title,
|
|
703
697
|
Tag: [],
|
|
704
698
|
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
705
699
|
TopColor: "#000000",
|
|
@@ -710,7 +704,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
710
704
|
content: this.state.editTemplateData.versions.base.content,
|
|
711
705
|
isInternalUrl: this.state.formData['is-internal-url'],
|
|
712
706
|
creative_template_id: this.state.editTemplateData._id,
|
|
713
|
-
touser: "{{wechat_open_id}}",
|
|
714
707
|
};
|
|
715
708
|
_.forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
716
709
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
@@ -1153,15 +1146,10 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1153
1146
|
|
|
1154
1147
|
setTemplateOptions(weChatData) {
|
|
1155
1148
|
console.log('Set Templates ', weChatData);
|
|
1156
|
-
|
|
1157
|
-
const schema = _.cloneDeep(this.state.schema);
|
|
1158
|
-
const baseSchema = _.cloneDeep(this.state.baseSchema);
|
|
1149
|
+
const {schema, baseSchema} = this.state;
|
|
1150
|
+
// const schema = _.cloneDeep(this.state.schema);
|
|
1151
|
+
// const baseSchema = _.cloneDeep(this.state.baseSchema);
|
|
1159
1152
|
const baseSchemaTemplateOptionEmpty = (!_.isEmpty(baseSchema) && _.isEmpty(baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options));
|
|
1160
|
-
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
1161
|
-
if (!_.isEmpty(baseSchema)) {
|
|
1162
|
-
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
1163
|
-
|
|
1164
|
-
}
|
|
1165
1153
|
_.forEach(weChatData, (template) => {
|
|
1166
1154
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options.push({
|
|
1167
1155
|
key: (template.versions) ? template.versions.base.template_id : template.template_id,
|
|
@@ -1296,7 +1284,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1296
1284
|
myField.value += myValue;
|
|
1297
1285
|
}
|
|
1298
1286
|
const event = new Event('input', { bubbles: true });
|
|
1299
|
-
|
|
1287
|
+
myField.dispatchEvent(event);
|
|
1300
1288
|
}
|
|
1301
1289
|
|
|
1302
1290
|
internalUrlChecked() {
|
|
@@ -1558,10 +1546,6 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1558
1546
|
// value: 'Test3',
|
|
1559
1547
|
// },
|
|
1560
1548
|
// ];
|
|
1561
|
-
let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
|
|
1562
|
-
if (this.props.supportedTags) {
|
|
1563
|
-
tags = this.props.supportedTags;
|
|
1564
|
-
}
|
|
1565
1549
|
return (
|
|
1566
1550
|
<Spin
|
|
1567
1551
|
tip={this.props.intl.formatMessage(messages.gettingTemplateData)}
|
|
@@ -1570,6 +1554,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1570
1554
|
<Helmet
|
|
1571
1555
|
title="WeChat"
|
|
1572
1556
|
/>
|
|
1557
|
+
{/* <CapSelect options={options} /> */}
|
|
1573
1558
|
<Row className="wechat-container">
|
|
1574
1559
|
<Col>
|
|
1575
1560
|
<FormBuilder
|
|
@@ -1583,7 +1568,7 @@ export class WeChat extends React.Component { // eslint-disable-line react/prefe
|
|
|
1583
1568
|
formData={_.cloneDeep(this.state.formData)}
|
|
1584
1569
|
onFormValidityChange={this.setFormValidity}
|
|
1585
1570
|
location= {this.props.location}
|
|
1586
|
-
tags={tags}
|
|
1571
|
+
tags={this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : []}
|
|
1587
1572
|
tagModule={this.props.getDefaultTags}
|
|
1588
1573
|
injectedTags={this.state.injectedTags ? this.state.injectedTags : {}}
|
|
1589
1574
|
isEdit={this.state.isEdit}
|
|
@@ -1614,8 +1599,6 @@ WeChat.propTypes = {
|
|
|
1614
1599
|
isGetFormData: PropTypes.bool,
|
|
1615
1600
|
getLibraryFormData: PropTypes.func,
|
|
1616
1601
|
getDefaultTags: PropTypes.string,
|
|
1617
|
-
templateData: PropTypes.object,
|
|
1618
|
-
templateActions: PropTypes.object,
|
|
1619
1602
|
};
|
|
1620
1603
|
|
|
1621
1604
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1628,7 +1611,6 @@ function mapDispatchToProps(dispatch) {
|
|
|
1628
1611
|
return {
|
|
1629
1612
|
actions: bindActionCreators(actions, dispatch),
|
|
1630
1613
|
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1631
|
-
templateActions: bindActionCreators(templateActions, dispatch),
|
|
1632
1614
|
};
|
|
1633
1615
|
}
|
|
1634
1616
|
|
package/package.json
CHANGED
|
@@ -604,15 +604,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
604
604
|
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
|
|
605
605
|
const win = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`).contentWindow;
|
|
606
606
|
win.postMessage(msgString, '*');
|
|
607
|
+
} else if (data === "unsubscribe") {
|
|
608
|
+
const anchor = `<a href='{{${data}}}'>${data}</a>`;
|
|
609
|
+
this.state.editorInstanse.insertHtml(`${anchor}`);
|
|
607
610
|
} else {
|
|
608
|
-
|
|
609
|
-
const anchor = `<a href='{{${data}}}'>${data}</a>`;
|
|
610
|
-
this.state.editorInstanse.insertHtml(`${anchor}`);
|
|
611
|
-
} else {
|
|
612
|
-
this.state.editorInstanse.insertHtml(`{{${data}}}`);
|
|
613
|
-
}
|
|
614
|
-
//this.resetCkEditorInstance(currentTab, formData, true, data);
|
|
611
|
+
this.state.editorInstanse.insertHtml(`{{${data}}}`);
|
|
615
612
|
}
|
|
613
|
+
//this.resetCkEditorInstance(currentTab, formData, true, data);
|
|
616
614
|
}
|
|
617
615
|
|
|
618
616
|
onImageSelect = () => {
|
|
@@ -866,7 +864,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
866
864
|
|
|
867
865
|
|
|
868
866
|
this.setState({ formData, schema, tabKey, currentTab, tabCount: editData.versions.history.length, loadingStatus: this.state.loadingStatus + 1 }, () => {
|
|
869
|
-
this.props.
|
|
867
|
+
if (this.props.isFullMode) {
|
|
868
|
+
this.props.showTemplateName({formData, onFormDataChange: this.onFormDataChange});
|
|
869
|
+
}
|
|
870
870
|
_.forEach((editData.versions.base.selectedLanguages), (language) => {
|
|
871
871
|
// if (formData[this.state.currentTab - 1].tabKey === formData[this.state.currentTab - 1][language].tabKey) {
|
|
872
872
|
// formData[this.state.currentTab - 1].activeTab = language;
|
|
@@ -1214,7 +1214,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1214
1214
|
const baseData = {};
|
|
1215
1215
|
const baseLanguage = props.currentOrgDetails.basic_details.base_language;
|
|
1216
1216
|
this.supportedLanguages = this.getSupportedLanguages(props);
|
|
1217
|
-
const languageObject = this.supportedLanguages[_.findIndex(this.supportedLanguages, {iso_code: baseLanguage})];
|
|
1217
|
+
const languageObject = this.supportedLanguages[_.findIndex(this.supportedLanguages, {iso_code: baseLanguage})] || {iso_code: 'en', lang_id: 1, language: "English"};
|
|
1218
1218
|
baseData.activeTab = baseLanguage;
|
|
1219
1219
|
baseData[languageObject.iso_code] = {};
|
|
1220
1220
|
baseData[languageObject.iso_code].is_drag_drop = false;
|
|
@@ -151,7 +151,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
151
151
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
onFormDataChange = (formData, tabCount) => {
|
|
154
|
+
onFormDataChange = (formData, tabCount, currentTab, inputField) => {
|
|
155
155
|
const newFormData = cloneDeep(formData);
|
|
156
156
|
const {templateCta} = this.state;
|
|
157
157
|
if (!isEmpty(templateCta)) {
|
|
@@ -187,6 +187,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
187
187
|
if (this.props.isFullMode && this.props.defaultData && isEmpty(formData['template-name'])) {
|
|
188
188
|
newFormData['template-name'] = get(this.props, "defaultData['template-name']");
|
|
189
189
|
}
|
|
190
|
+
if (inputField && inputField.id === "add-sec-cta") {
|
|
191
|
+
if (!newFormData[0]["add-sec-cta"]) {
|
|
192
|
+
newFormData[0]["add-sec-cta-2"] = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
190
195
|
this.setState({formData: newFormData, tabCount, isSchemaChanged: !this.state.isSchemaChanged}, () => {
|
|
191
196
|
if (this.props.isFullMode) {
|
|
192
197
|
this.props.showTemplateName({formData: this.state.formData, onFormDataChange: this.onFormDataChange});
|
|
@@ -1169,6 +1174,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1169
1174
|
addSecondoryCta = (flag, formData, schemaField) => {
|
|
1170
1175
|
const id = schemaField.id;
|
|
1171
1176
|
const schema = cloneDeep(this.state.schema);
|
|
1177
|
+
const formDataCopy = cloneDeep(formData);
|
|
1172
1178
|
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
1173
1179
|
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1174
1180
|
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
@@ -1270,7 +1276,24 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1270
1276
|
}
|
|
1271
1277
|
});
|
|
1272
1278
|
});
|
|
1273
|
-
|
|
1279
|
+
if (id === "add-sec-cta") {
|
|
1280
|
+
//The following block of code enables and disables add secondary button based on the primary button
|
|
1281
|
+
const indexOfSecondary = findIndex(inputFields, {identifier: 'add-sec-cta-2'});
|
|
1282
|
+
inputFields[indexOfSecondary].cols[0].disabled = !formData[this.state.currentTab - 1][id];
|
|
1283
|
+
//Calling the following function to unset the data set under secondary button
|
|
1284
|
+
if (!formData[this.state.currentTab - 1][id]) {
|
|
1285
|
+
formDataCopy[this.state.currentTab - 1]['add-sec-cta-2'] = false;
|
|
1286
|
+
}
|
|
1287
|
+
//Calling set state here to update the state and schema before manually triggering secondarycta update
|
|
1288
|
+
this.setState(
|
|
1289
|
+
{schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true},
|
|
1290
|
+
() => {
|
|
1291
|
+
this.injectEvents(schema);
|
|
1292
|
+
this.addSecondoryCta(true, formDataCopy, inputFields[indexOfSecondary].cols[0]);
|
|
1293
|
+
});
|
|
1294
|
+
} else {
|
|
1295
|
+
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true}, () => { this.injectEvents(schema); });
|
|
1296
|
+
}
|
|
1274
1297
|
};
|
|
1275
1298
|
copyIphoneContent = () => {
|
|
1276
1299
|
const formData = cloneDeep(this.state.formData);
|
|
@@ -189,7 +189,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
|
-
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
192
|
+
onFormDataChange = (formData, tabCount, currentTab, inputField) => {
|
|
193
193
|
console.log('Form data changed is ', formData, tabCount, currentTab);
|
|
194
194
|
const newFormData = _.cloneDeep(formData);
|
|
195
195
|
const {templateCta} = this.state;
|
|
@@ -218,6 +218,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
218
218
|
if (this.props.isFullMode && this.props.defaultData && _.isEmpty(formData['template-name'])) {
|
|
219
219
|
newFormData['template-name'] = _.get(this.props, "defaultData['template-name']");
|
|
220
220
|
}
|
|
221
|
+
if (inputField && inputField.id === "add-sec-cta") {
|
|
222
|
+
if (!newFormData[0]["add-sec-cta"]) {
|
|
223
|
+
newFormData[0]["add-sec-cta-2"] = false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
221
226
|
this.setState({formData: newFormData, tabCount}, () => {
|
|
222
227
|
this.props.showTemplateName({formData: this.state.formData, onFormDataChange: this.onFormDataChange});
|
|
223
228
|
});
|
|
@@ -1604,6 +1609,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1604
1609
|
addSecondoryCta = (flag, formData, field, inputSchema, currentTab) => {
|
|
1605
1610
|
const id = field.id;
|
|
1606
1611
|
const tabIndex = currentTab || this.state.currentTab;
|
|
1612
|
+
const formDataCopy = cloneDeep(formData);
|
|
1607
1613
|
const schema = inputSchema ? _.cloneDeep(inputSchema) : _.cloneDeep(this.state.schema);
|
|
1608
1614
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.Edit.selectedWeChatAccount);
|
|
1609
1615
|
const ck = selectedWeChatAccount.configs ? !!selectedWeChatAccount.configs.deeplink : false;
|
|
@@ -1619,13 +1625,32 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1619
1625
|
const deleteCount = indexOfNextField - fieldIndex;
|
|
1620
1626
|
newInputFields = [...inputFields.slice(0, fieldIndex + 1), ...inputFields.slice(fieldIndex + deleteCount, inputFields.length)];
|
|
1621
1627
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1628
|
+
if (id === "add-sec-cta") {
|
|
1629
|
+
//The following block of code enables and disables add secondary button based on the primary button
|
|
1630
|
+
const indexOfSecondary = findIndex(newInputFields, {identifier: 'add-sec-cta-2'});
|
|
1631
|
+
newInputFields[indexOfSecondary].cols[0].disabled = !formData[this.state.currentTab - 1][id];
|
|
1632
|
+
//Calling the following function to unset the data set under secondary button
|
|
1633
|
+
if (!formData[this.state.currentTab - 1][id]) {
|
|
1634
|
+
formDataCopy[this.state.currentTab - 1]['add-sec-cta-2'] = false;
|
|
1635
|
+
}
|
|
1636
|
+
set(schema, `containers[0].panes[${tabIndex - 1}].sections[0].childSections[0].childSections[0].inputFields`, newInputFields);
|
|
1637
|
+
//Calling set state here to update the state and schema before manually triggering secondarycta update
|
|
1638
|
+
this.setState(
|
|
1639
|
+
{schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true},
|
|
1640
|
+
() => {
|
|
1641
|
+
this.injectEvents(schema);
|
|
1642
|
+
this.addSecondoryCta(true, formDataCopy, newInputFields[indexOfSecondary].cols[0]);
|
|
1643
|
+
});
|
|
1644
|
+
} else {
|
|
1645
|
+
set(schema, `containers[0].panes[${tabIndex - 1}].sections[0].childSections[0].childSections[0].inputFields`, newInputFields);
|
|
1646
|
+
if (inputSchema) {
|
|
1647
|
+
return schema;
|
|
1648
|
+
}
|
|
1649
|
+
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1650
|
+
this.injectEvents(schema);
|
|
1624
1651
|
return schema;
|
|
1625
1652
|
}
|
|
1626
|
-
|
|
1627
|
-
this.injectEvents(schema);
|
|
1628
|
-
return schema;
|
|
1653
|
+
return true;
|
|
1629
1654
|
};
|
|
1630
1655
|
|
|
1631
1656
|
addSecondoryCtaIos = (flag, formData, schemaField) => {
|
|
@@ -441,6 +441,7 @@ export const response = {
|
|
|
441
441
|
id: "add-sec-cta-2",
|
|
442
442
|
metaType: "label",
|
|
443
443
|
dynamicTab: false,
|
|
444
|
+
disabled: true,
|
|
444
445
|
label: "Add secondary button to notification",
|
|
445
446
|
styling: "semantic",
|
|
446
447
|
type: "checkbox",
|
|
@@ -1323,6 +1324,7 @@ export const response = {
|
|
|
1323
1324
|
id: "add-sec-cta-2",
|
|
1324
1325
|
metaType: "label",
|
|
1325
1326
|
dynamicTab: false,
|
|
1327
|
+
disabled: true,
|
|
1326
1328
|
label: "Add secondary button to notification",
|
|
1327
1329
|
styling: "semantic",
|
|
1328
1330
|
type: "checkbox",
|