@capillarytech/creatives-library 7.10.32 → 7.10.34
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
CHANGED
|
@@ -420,8 +420,8 @@ class Creatives extends React.Component {
|
|
|
420
420
|
if (get(template, "value.versions.base")) {
|
|
421
421
|
const mobilpushTemplate = template.value;
|
|
422
422
|
templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
|
|
423
|
-
const
|
|
424
|
-
if(
|
|
423
|
+
const type = (get(this.props,"messageDetails.type") || '').toLowerCase();
|
|
424
|
+
if(type === LOYALTY){
|
|
425
425
|
templateData.licenseCode = get(mobilpushTemplate, 'definition.licenseCode');
|
|
426
426
|
}
|
|
427
427
|
const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
|
|
@@ -60,7 +60,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
60
60
|
this.getLinkTypeFields = getLinkTypeFields.bind(this);
|
|
61
61
|
}
|
|
62
62
|
componentWillMount() {
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
this.props.actions.getWeCrmAccounts("mobilepush");
|
|
65
65
|
if (!this.props.Templates.selectedWeChatAccount && this.props.location.query.type !== 'embedded') {
|
|
66
66
|
const type = this.props.location.query.type;
|
|
@@ -76,7 +76,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
76
76
|
version: "v2",
|
|
77
77
|
};
|
|
78
78
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
componentDidMount() {
|
|
@@ -106,10 +106,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
106
106
|
} else if (nextProps.isGetFormData && this.props.isGetFormData !== nextProps.isGetFormData && this.props.isFullMode && !this.props.Create.createTemplateInProgress) {
|
|
107
107
|
this.startValidation();
|
|
108
108
|
}
|
|
109
|
-
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
|
|
109
|
+
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
|
|
110
|
+
(!_.isEmpty(this.props.Edit.selectedWeChatAccount) ? this.props.Edit.selectedWeChatAccount : nextProps.Edit.selectedWeChatAccount));
|
|
110
111
|
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
111
|
-
|
|
112
|
-
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts);
|
|
112
|
+
|
|
113
|
+
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
113
114
|
}
|
|
114
115
|
if (!_.isEmpty(nextProps.Edit.selectedWeChatAccount) && !_.isEqual(this.props.Edit.selectedWeChatAccount, nextProps.Edit.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && this.props.location.query.module === "loyalty") {
|
|
115
116
|
const params = {
|
|
@@ -121,6 +122,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
121
122
|
}
|
|
122
123
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema)) {
|
|
123
124
|
this.setState({fullSchema: nextProps.metaEntities.layouts[0].definition, schema: (nextProps.location.query.module === 'loyalty') ? nextProps.metaEntities.layouts[0].definition.textSchema : {}}, () => {
|
|
125
|
+
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
124
126
|
const templateId = get(this, "props.params.id");
|
|
125
127
|
if (nextProps.location.query.module !== 'loyalty' && templateId && templateId !== 'temp') {
|
|
126
128
|
this.props.actions.getTemplateDetails(templateId);
|
|
@@ -143,27 +145,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
143
145
|
this.setTemplateOptions(nextProps.Edit.mobilepushTemplates);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
if (!_.isEmpty(nextProps.templateDetails) && _.isEmpty(this.state.editData) && !_.isEmpty(this.state.fullSchema) && selectedWeChatAccount && (this.props.location.query.type !== 'embedded' || this.props.isFullMode === false)) {
|
|
147
|
-
this.props = nextProps;
|
|
148
|
-
const mode = nextProps.templateDetails.definition ? nextProps.templateDetails.definition.mode : nextProps.templateDetails.mode;
|
|
149
|
-
const schema = mode === "text" ? this.state.fullSchema.textSchema : this.state.fullSchema.imageSchema;
|
|
150
|
-
const isAndroidSupported = get(this, "props.Templates.selectedWeChatAccount.configs.android") === '1';
|
|
151
|
-
const isIosSupported = get(this, "props.Templates.selectedWeChatAccount.configs.ios") === '1';
|
|
152
|
-
if (!isAndroidSupported) {
|
|
153
|
-
const androidField = get(schema, "containers[0].panes[0]");
|
|
154
|
-
androidField.isSupported = false;
|
|
155
|
-
this.setState({currentTab: 2});
|
|
156
|
-
set(schema, "containers[0].panes[0]", androidField);
|
|
157
|
-
}
|
|
158
|
-
if (!isIosSupported) {
|
|
159
|
-
const iosField = get(schema, "containers[0].panes[1]");
|
|
160
|
-
iosField.isSupported = false;
|
|
161
148
|
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
this.setEditState(nextProps.templateDetails, schema);
|
|
165
|
-
this.getTags();
|
|
166
|
-
}
|
|
149
|
+
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
167
150
|
if (nextProps.Edit.uploadedAssetData) {
|
|
168
151
|
const formData = _.cloneDeep(this.state.formData);
|
|
169
152
|
formData[this.state.currentTab - 1].image = nextProps.Edit.uploadedAssetData.metaInfo.public_url;
|
|
@@ -1783,10 +1766,34 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1783
1766
|
});
|
|
1784
1767
|
}
|
|
1785
1768
|
|
|
1769
|
+
handleEditSchemaOnPropsChange = (nextProps, selectedWeChatAccount) => {
|
|
1770
|
+
if (!_.isEmpty(nextProps.templateDetails) && _.isEmpty(this.state.editData) && !_.isEmpty(this.state.fullSchema) && selectedWeChatAccount && (this.props.location.query.type !== 'embedded' || this.props.isFullMode === false)) {
|
|
1771
|
+
this.props = nextProps;
|
|
1772
|
+
const mode = nextProps.templateDetails.definition ? nextProps.templateDetails.definition.mode : nextProps.templateDetails.mode;
|
|
1773
|
+
const schema = mode === "text" ? this.state.fullSchema.textSchema : this.state.fullSchema.imageSchema;
|
|
1774
|
+
const isAndroidSupported = get(this, "props.Templates.selectedWeChatAccount.configs.android") === '1';
|
|
1775
|
+
const isIosSupported = get(this, "props.Templates.selectedWeChatAccount.configs.ios") === '1';
|
|
1776
|
+
if (!isAndroidSupported) {
|
|
1777
|
+
const androidField = get(schema, "containers[0].panes[0]");
|
|
1778
|
+
androidField.isSupported = false;
|
|
1779
|
+
this.setState({currentTab: 2});
|
|
1780
|
+
set(schema, "containers[0].panes[0]", androidField);
|
|
1781
|
+
}
|
|
1782
|
+
if (!isIosSupported) {
|
|
1783
|
+
const iosField = get(schema, "containers[0].panes[1]");
|
|
1784
|
+
iosField.isSupported = false;
|
|
1785
|
+
|
|
1786
|
+
set(schema, "containers[0].panes[1]", iosField);
|
|
1787
|
+
}
|
|
1788
|
+
this.setEditState(nextProps.templateDetails, schema);
|
|
1789
|
+
this.getTags();
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1786
1793
|
render() {
|
|
1787
1794
|
const schema = this.state.schema;
|
|
1788
1795
|
const loadingContentEdit = this.state.loadingContentEdit || (this.props.location.query.module === 'dvs' && _.isEmpty(this.state.schema));
|
|
1789
|
-
const spinning = this.props.isLoadingMetaEntities || loadingContentEdit || this.props.Edit.fetchingDefaultTemplates || this.props.Edit.assetUploading || this.state.loading || (this.props.Edit && (("getTemplateDetailsInProgress" in this.props.Edit && this.props.Edit.getTemplateDetailsInProgress) || ("editTemplateInProgress" in this.props.Edit && this.props.Edit.editTemplateInProgress)));
|
|
1796
|
+
const spinning = get(this.props, "Edit.fetchingWeCrmAccounts") || this.props.isLoadingMetaEntities || loadingContentEdit || this.props.Edit.fetchingDefaultTemplates || this.props.Edit.assetUploading || this.state.loading || (this.props.Edit && (("getTemplateDetailsInProgress" in this.props.Edit && this.props.Edit.getTemplateDetailsInProgress) || ("editTemplateInProgress" in this.props.Edit && this.props.Edit.editTemplateInProgress)));
|
|
1790
1797
|
let tags = this.props.metaEntities && this.props.metaEntities.tags ? this.props.metaEntities.tags.standard : [];
|
|
1791
1798
|
if (this.props.supportedTags) {
|
|
1792
1799
|
tags = this.props.supportedTags;
|
|
@@ -1837,9 +1844,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1837
1844
|
<PrefixWrapper>
|
|
1838
1845
|
<CapIcons.backIcon onClick={this.handleClose} />
|
|
1839
1846
|
</PrefixWrapper>
|
|
1840
|
-
|
|
1847
|
+
}
|
|
1841
1848
|
|
|
1842
|
-
|
|
1849
|
+
/>}
|
|
1843
1850
|
content={<CapTable
|
|
1844
1851
|
rowSelection={{
|
|
1845
1852
|
type: 'radio',
|
|
@@ -1878,7 +1885,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1878
1885
|
<div>
|
|
1879
1886
|
{record.ctaTemplateDetails[1] ? record.ctaTemplateDetails[1].buttonText : ''}
|
|
1880
1887
|
</div>
|
|
1881
|
-
|
|
1888
|
+
),
|
|
1882
1889
|
},
|
|
1883
1890
|
]}
|
|
1884
1891
|
/>}
|