@capillarytech/creatives-library 3.1.23 → 3.1.25
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/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -3
- package/v2Containers/CreativesContainer/index.js +13 -12
- package/v2Containers/TemplatesV2/index.js +1 -3
- package/v2Containers/WeChat/MapTemplates/index.js +13 -12
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +3 -4
- package/containers/Cap/messsages.js +0 -63
- package/v2Components/Header/index.js +0 -46
- package/v2Components/Header/tests/index.test.js +0 -10
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
// import { connect } from 'react-redux';
|
|
10
10
|
import { CapRow, CapColumn, CapButton } from '@capillarytech/cap-react-ui-library/';
|
|
11
|
-
import { CapHeading } from '@capillarytech/cap-ui-library/';
|
|
11
|
+
import { CapHeading, CapLabel } from '@capillarytech/cap-ui-library/';
|
|
12
12
|
import { FormattedMessage } from 'react-intl';
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
import './_wechatRichmediaTemplatePrev.scss';
|
|
@@ -35,14 +35,14 @@ class WechatRichmediaTemplatePreview extends React.PureComponent { // eslint-dis
|
|
|
35
35
|
previewMsg.push(
|
|
36
36
|
<div className="name-container-with-abstract">
|
|
37
37
|
<CapHeading type="h4">{contentData.title}</CapHeading>
|
|
38
|
-
<
|
|
38
|
+
<CapLabel type="label9">{contentData.digest}</CapLabel>
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
content.splice(1, 2).forEach((data) => {
|
|
43
43
|
previewMsg.push(
|
|
44
44
|
<div className="additional-richmedia-container">
|
|
45
|
-
<div><
|
|
45
|
+
<div><CapLabel type="label9" style={{width: '170px', top: '12px', position: 'relative'}}>{data.title}</CapLabel></div>
|
|
46
46
|
<img alt="default" width="34px" height="34px" src={data.image_url} />
|
|
47
47
|
</div>
|
|
48
48
|
);
|
|
@@ -137,13 +137,13 @@ class Creatives extends React.Component {
|
|
|
137
137
|
const {isFullMode} = this.props;
|
|
138
138
|
if (!isFullMode && templateData) { // for component mode
|
|
139
139
|
const {channel} = templateData;
|
|
140
|
-
let
|
|
140
|
+
let creativesTemplateData = {type: channel };
|
|
141
141
|
switch (channel) {
|
|
142
142
|
case constants.SMS: {
|
|
143
143
|
const formData = {
|
|
144
144
|
"sms-editor": templateData.messageBody,
|
|
145
145
|
};
|
|
146
|
-
|
|
146
|
+
creativesTemplateData = {
|
|
147
147
|
type: channel,
|
|
148
148
|
name: "Campaign message SMS content",
|
|
149
149
|
versions: {
|
|
@@ -163,7 +163,7 @@ class Creatives extends React.Component {
|
|
|
163
163
|
language: templateData.language,
|
|
164
164
|
drag_drop_id: templateData.drag_drop_id,
|
|
165
165
|
};
|
|
166
|
-
|
|
166
|
+
creativesTemplateData = {
|
|
167
167
|
base: formData,
|
|
168
168
|
edit: true,
|
|
169
169
|
type: channel,
|
|
@@ -171,7 +171,7 @@ class Creatives extends React.Component {
|
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
case constants.CALL_TASK: {
|
|
174
|
-
|
|
174
|
+
creativesTemplateData = {
|
|
175
175
|
subject: templateData.subject,
|
|
176
176
|
messageBody: templateData.messageBody,
|
|
177
177
|
description: templateData.description,
|
|
@@ -182,7 +182,7 @@ class Creatives extends React.Component {
|
|
|
182
182
|
}
|
|
183
183
|
case constants.MOBILE_PUSH: {
|
|
184
184
|
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type');
|
|
185
|
-
|
|
185
|
+
creativesTemplateData = {
|
|
186
186
|
type: channel,
|
|
187
187
|
name: templateData.messageSubject,
|
|
188
188
|
versions: {
|
|
@@ -197,16 +197,18 @@ class Creatives extends React.Component {
|
|
|
197
197
|
}
|
|
198
198
|
case constants.WECHAT: {
|
|
199
199
|
const messageBody = JSON.parse(templateData.messageBody);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
creativesTemplateData = {
|
|
201
|
+
...messageBody.data,
|
|
202
|
+
type: channel,
|
|
203
|
+
_id: messageBody.template_id,
|
|
204
|
+
isEditFromCampaigns: true,
|
|
205
|
+
};
|
|
204
206
|
break;
|
|
205
207
|
}
|
|
206
208
|
default:
|
|
207
209
|
break;
|
|
208
210
|
}
|
|
209
|
-
return
|
|
211
|
+
return creativesTemplateData;
|
|
210
212
|
}
|
|
211
213
|
return templateData || null;
|
|
212
214
|
}
|
|
@@ -242,7 +244,7 @@ class Creatives extends React.Component {
|
|
|
242
244
|
} );
|
|
243
245
|
androidContent.custom = custom;
|
|
244
246
|
templateData.androidContent = androidContent;
|
|
245
|
-
templateData.androidContent.type = get(mobilpushTemplate, 'definition.mode').toUpperCase();
|
|
247
|
+
templateData.androidContent.type = get(mobilpushTemplate, 'definition.mode', '').toUpperCase();
|
|
246
248
|
templateData.androidContent.deviceType = 'ANDROID';
|
|
247
249
|
}
|
|
248
250
|
const iosContent = get(mobilpushTemplate, 'versions.base.IOS');
|
|
@@ -288,7 +290,6 @@ class Creatives extends React.Component {
|
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
getFormData = (template) => {
|
|
291
|
-
console.log("Inside getFormData", template);
|
|
292
293
|
if (template.validity) {
|
|
293
294
|
this.setState(
|
|
294
295
|
{
|
|
@@ -102,7 +102,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
getTemplatesComponent(channel) {
|
|
105
|
-
console.log("getTemplatesComponent", channel);
|
|
106
105
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
107
106
|
let query = {};
|
|
108
107
|
if (!this.props.isFullMode) {
|
|
@@ -128,7 +127,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
128
127
|
/>);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
|
|
130
|
+
|
|
132
131
|
setChannelContent = (selectedChannel, argsPanes) => (
|
|
133
132
|
argsPanes.map((pane) => {
|
|
134
133
|
let content = null;
|
|
@@ -144,7 +143,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
144
143
|
);
|
|
145
144
|
|
|
146
145
|
channelChange = (selectedChannel) => {
|
|
147
|
-
console.log("channelChange", selectedChannel);
|
|
148
146
|
const panes = this.setChannelContent(selectedChannel, this.state.panes);
|
|
149
147
|
this.setState({panes, selectedChannel}, () => { if (!this.props.isFullMode) this.props.onChannelChange(selectedChannel); });
|
|
150
148
|
}
|
|
@@ -165,6 +165,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
componentWillReceiveProps(nextProps) {
|
|
168
|
+
const { location } = this.props;
|
|
168
169
|
if (nextProps.isGetFormData && !this.props.isFullMode && this.state.isEdit) {
|
|
169
170
|
this.props.getFormData(this.getFormData());
|
|
170
171
|
} else if (nextProps.isGetFormData && this.props.isGetFormData !== nextProps.isGetFormData && (this.props.isFullMode || !this.state.isEdit)) {
|
|
@@ -179,8 +180,8 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
179
180
|
layout: 'WECHAT',
|
|
180
181
|
type: 'TAG',
|
|
181
182
|
version: 'v2', //gets initial schema when v2 is specified
|
|
182
|
-
context:
|
|
183
|
-
embedded:
|
|
183
|
+
context: location.query.type === 'embedded' ? location.query.module : 'default',
|
|
184
|
+
embedded: location.query.type === 'embedded' ? location.query.type : 'full',
|
|
184
185
|
};
|
|
185
186
|
if (this.props.getDefaultTags) { // handling dynamic tags in library mode, but handling static and synamic tags in email and sms.
|
|
186
187
|
query.context = this.props.getDefaultTags;
|
|
@@ -196,7 +197,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
196
197
|
this.setTemplateOptions(nextProps.WeChat.weChatDefaultTemplate);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
if ((
|
|
200
|
+
if ((location.query.type === 'embedded' && (location.query.module === 'loyalty' || location.query.module === 'outbound')) && !isEmpty(nextProps.WeChat.templateDetails) && !isEqual(this.props.WeChat.templateDetails, this.state.editTemplateData) && this.isAccountChange === false) {
|
|
200
201
|
this.setState({editTemplateData: nextProps.WeChat.templateDetails}, () => {
|
|
201
202
|
if ( !isEmpty(this.state.baseSchema)) {
|
|
202
203
|
this.setEditData();
|
|
@@ -232,7 +233,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
232
233
|
}
|
|
233
234
|
//To do => Uncomment in loyalty mode
|
|
234
235
|
// if (nextProps.location.query.type === 'embedded') {
|
|
235
|
-
// if (
|
|
236
|
+
// if (location.query.module !== 'loyalty') {
|
|
236
237
|
// this.removeActionButtons();
|
|
237
238
|
// }
|
|
238
239
|
// }
|
|
@@ -258,19 +259,19 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
258
259
|
// const query = {
|
|
259
260
|
// layout: 'WECHAT',
|
|
260
261
|
// type: 'TAG',
|
|
261
|
-
// context:
|
|
262
|
+
// context: location.query.type === 'embedded' ? location.query.module : 'default',
|
|
262
263
|
// };
|
|
263
264
|
// this.props.globalActions.fetchSchemaForEntity(query);
|
|
264
|
-
if (
|
|
265
|
+
if (location.query.type === 'embedded') {
|
|
265
266
|
this.showNext();
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
if (!this.fetchedWeCrmAccount && !isEmpty(this.props.WeChat.weCrmAccounts) && (
|
|
269
|
+
if (!this.fetchedWeCrmAccount && !isEmpty(this.props.WeChat.weCrmAccounts) && (location.query.type === 'embedded' && location.query.module === 'loyalty')) {
|
|
269
270
|
this.injectEvents(this.state.schema);
|
|
270
271
|
this.setWechatAccountOptions(nextProps.WeChat.weCrmAccounts);
|
|
271
272
|
this.fetchedWeCrmAccount = true;
|
|
272
273
|
}
|
|
273
|
-
if (!isEmpty(nextProps.WeChat.selectedWeChatAccount) && !isEqual(this.props.WeChat.selectedWeChatAccount, nextProps.WeChat.selectedWeChatAccount) && (
|
|
274
|
+
if (!isEmpty(nextProps.WeChat.selectedWeChatAccount) && !isEqual(this.props.WeChat.selectedWeChatAccount, nextProps.WeChat.selectedWeChatAccount) && (location.query.type === 'embedded')) {
|
|
274
275
|
const params = {
|
|
275
276
|
name: '',
|
|
276
277
|
sortBy: 'Most Recent',
|
|
@@ -281,11 +282,11 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
281
282
|
this.props.actions.getDefaultWeChatTemplates('wechat', params);
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
if (isEmpty(nextProps.WeChat.selectedWeChatAccount) && (
|
|
285
|
+
if (isEmpty(nextProps.WeChat.selectedWeChatAccount) && (location.query.type === 'embedded')) {
|
|
285
286
|
let selectedAccount = {};
|
|
286
287
|
forEach(nextProps.WeChat.weCrmAccounts, (account) => {
|
|
287
288
|
if (account.configs && account.configs.is_wecrm_enabled) {
|
|
288
|
-
if (account.sourceAccountIdentifier ===
|
|
289
|
+
if (account.sourceAccountIdentifier === location.query.source_account_id) {
|
|
289
290
|
selectedAccount = account;
|
|
290
291
|
}
|
|
291
292
|
}
|
|
@@ -295,7 +296,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
// if (
|
|
299
|
+
// if (location.query.type.type === 'embedded' && location.query.module === 'loyalty' && this.state.formData['wechat-template'] !== '') {
|
|
299
300
|
// }
|
|
300
301
|
if (!nextProps.WeChat.fetchingDefaultTemplates && nextProps.location.query.module === 'outbound' && nextProps.params.id !== undefined) {
|
|
301
302
|
this.setState({ isLoading: false});
|
|
@@ -785,7 +786,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
785
786
|
//const {schema, baseSchema} = this.state;
|
|
786
787
|
const schema = cloneDeep(this.state.schema);
|
|
787
788
|
const baseSchema = cloneDeep(this.state.schema);
|
|
788
|
-
const baseSchemaTemplateOptionEmpty = (!isEmpty(baseSchema) && isEmpty(baseSchema
|
|
789
|
+
const baseSchemaTemplateOptionEmpty = (!isEmpty(baseSchema) && isEmpty(get(baseSchema, 'standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options', [])));
|
|
789
790
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
790
791
|
if (!isEmpty(baseSchema)) {
|
|
791
792
|
baseSchema.standalone.sections[0].childSections[1].childSections[0].childSections[0].inputFields[1].options = [];
|
|
@@ -9,7 +9,6 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { connect } from 'react-redux';
|
|
12
|
-
import Helmet from 'react-helmet';
|
|
13
12
|
import { bindActionCreators } from 'redux';
|
|
14
13
|
import { createStructuredSelector } from 'reselect';
|
|
15
14
|
import { injectIntl, intlShape } from 'react-intl';
|
|
@@ -18,7 +17,7 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
18
17
|
import forEach from 'lodash/forEach';
|
|
19
18
|
import isEqual from 'lodash/isEqual';
|
|
20
19
|
import get from 'lodash/get';
|
|
21
|
-
import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink, CapNotification } from '@capillarytech/cap-ui-library';
|
|
20
|
+
import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink, CapNotification, CapLabel } from '@capillarytech/cap-ui-library';
|
|
22
21
|
import makeSelectCreate, {makeSelectTemplates, getAssetDetails, getContentAssetDetails} from './selectors';
|
|
23
22
|
import * as actions from './actions';
|
|
24
23
|
import richmediaschema from './richmediaschema';
|
|
@@ -727,7 +726,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
727
726
|
{totalContentBlocks === 1 &&
|
|
728
727
|
<div className="custom-card">
|
|
729
728
|
<CapHeading type="h4" className="overflow-wrap-fields">{formData['title-value'] || "Title"}</CapHeading>
|
|
730
|
-
<
|
|
729
|
+
<CapLabel type="label9" className="overflow-wrap-fields">{formData['cover-abstract-value'] || "Cover abstract"}</CapLabel>
|
|
731
730
|
</div>
|
|
732
731
|
}
|
|
733
732
|
</div>
|
|
@@ -746,7 +745,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
746
745
|
>
|
|
747
746
|
<div className="richmedia-card-container">
|
|
748
747
|
<CapColumn span={18} className="overflow-wrap-fields title" >
|
|
749
|
-
<
|
|
748
|
+
<CapLabel type="label9">{formData['title-value'] || "Title"}</CapLabel>
|
|
750
749
|
</CapColumn>
|
|
751
750
|
<CapColumn span={6} className="image">
|
|
752
751
|
<img alt="" width="40px" height="40px" src={imageUrl} />
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
export default defineMessages({
|
|
3
|
-
"sms": {
|
|
4
|
-
id: 'reon.components.Cap.sms',
|
|
5
|
-
defaultMessage: 'SMS',
|
|
6
|
-
},
|
|
7
|
-
"wechat": {
|
|
8
|
-
id: 'reon.components.Cap.wechat',
|
|
9
|
-
defaultMessage: 'WeChat',
|
|
10
|
-
},
|
|
11
|
-
"gallery": {
|
|
12
|
-
id: 'reon.components.Cap.gallery',
|
|
13
|
-
defaultMessage: 'Gallery',
|
|
14
|
-
},
|
|
15
|
-
"creativesDashboard": {
|
|
16
|
-
id: 'reon.components.Cap.creativesDashboard',
|
|
17
|
-
defaultMessage: 'Creatives',
|
|
18
|
-
},
|
|
19
|
-
"creatives": {
|
|
20
|
-
id: 'reon.components.Cap.creatives',
|
|
21
|
-
defaultMessage: 'Creatives',
|
|
22
|
-
},
|
|
23
|
-
"campaigns": {
|
|
24
|
-
id: 'reon.components.Cap.campaigns',
|
|
25
|
-
defaultMessage: 'Campaigns',
|
|
26
|
-
},
|
|
27
|
-
"loyalty": {
|
|
28
|
-
id: 'reon.components.Cap.loyalty',
|
|
29
|
-
defaultMessage: 'Loyalty',
|
|
30
|
-
},
|
|
31
|
-
"member care": {
|
|
32
|
-
id: 'reon.components.Cap.memberCare',
|
|
33
|
-
defaultMessage: 'Member Care',
|
|
34
|
-
},
|
|
35
|
-
"workbench": {
|
|
36
|
-
id: 'reon.components.Cap.Workbench',
|
|
37
|
-
defaultMessage: 'WorkBench',
|
|
38
|
-
},
|
|
39
|
-
"store care": {
|
|
40
|
-
id: 'reon.components.Cap.storeCare',
|
|
41
|
-
defaultMessage: 'Store Care',
|
|
42
|
-
},
|
|
43
|
-
"store performance": {
|
|
44
|
-
id: 'reon.components.Cap.storePerformance',
|
|
45
|
-
defaultMessage: 'Store Performance',
|
|
46
|
-
},
|
|
47
|
-
"email": {
|
|
48
|
-
id: 'reon.components.Cap.email',
|
|
49
|
-
defaultMessage: 'Email',
|
|
50
|
-
},
|
|
51
|
-
"ebill": {
|
|
52
|
-
id: 'reon.components.Cap.ebill',
|
|
53
|
-
defaultMessage: 'Ebill',
|
|
54
|
-
},
|
|
55
|
-
"campaignsDashboard": {
|
|
56
|
-
id: 'reon.components.campaignsDashboard',
|
|
57
|
-
defaultMessage: 'Campaigns',
|
|
58
|
-
},
|
|
59
|
-
"campaignsHome": {
|
|
60
|
-
id: 'reon.components.campaignsHome',
|
|
61
|
-
defaultMessage: "Campaigns Home",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Header
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
// import styled from 'styled-components';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
|
|
13
|
-
import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import messages from './messages';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function Header(props) {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<CapRow className="template-form-header">
|
|
21
|
-
<CapColumn span={10}>
|
|
22
|
-
<CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
|
|
23
|
-
</CapColumn>
|
|
24
|
-
<CapColumn span={2} offset={8}>
|
|
25
|
-
<CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
|
|
26
|
-
</CapColumn>
|
|
27
|
-
<CapColumn span={2}>
|
|
28
|
-
<CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
|
|
29
|
-
</CapColumn>
|
|
30
|
-
<CapColumn span={2}>
|
|
31
|
-
<CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
|
|
32
|
-
</CapColumn>
|
|
33
|
-
</CapRow>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
Header.propTypes = {
|
|
39
|
-
templateNameHandler: PropTypes.func,
|
|
40
|
-
previewHandler: PropTypes.func,
|
|
41
|
-
cancelHandler: PropTypes.func,
|
|
42
|
-
saveHandler: PropTypes.func,
|
|
43
|
-
templateName: PropTypes.string,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default Header;
|