@capillarytech/creatives-library 7.6.13 → 7.7.0
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/app.js +0 -5
- package/index.html +2 -2
- package/index.js +3 -3
- package/package.json +2 -2
- package/services/api.js +0 -2
- package/v2Components/TemplatePreview/index.js +0 -1
- package/v2Containers/App/constants.js +0 -11
- package/v2Containers/Cap/index.js +29 -23
- package/v2Containers/CapFacebookPreview/index.js +3 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -16
- package/v2Containers/CreativesContainer/index.js +12 -122
- package/v2Containers/Email/index.js +3 -14
- package/v2Containers/EmailWrapper/index.js +3 -10
- package/v2Containers/Facebook/Advertisement/index.js +36 -72
- package/v2Containers/Facebook/Advertisement/index.scss +1 -1
- package/v2Containers/Facebook/Facebook.style.js +1 -1
- package/v2Containers/Facebook/constants.js +0 -4
- package/v2Containers/Facebook/index.js +122 -198
- package/v2Containers/Facebook/messages.js +4 -24
- package/v2Containers/Line/Container/index.js +4 -32
- package/v2Containers/MobilePush/Create/index.js +4 -25
- package/v2Containers/MobilePush/Edit/index.js +5 -27
- package/v2Containers/MobilePush/Edit/sagas.js +1 -1
- package/v2Containers/MobilePush/commonMethods.js +1 -19
- package/v2Containers/Sms/Create/index.js +2 -14
- package/v2Containers/Sms/Edit/index.js +2 -15
- package/v2Containers/Templates/index.js +27 -43
- package/v2Containers/Templates/reducer.js +1 -1
- package/v2Containers/TemplatesV2/index.js +6 -23
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Viber/index.js +3 -19
- package/v2Containers/WeChat/MapTemplates/index.js +3 -12
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -11
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +0 -41
- package/utils/gtmTrackers/index.js +0 -17
- package/v2Components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/v2Containers/Line/Create/_lineCreate.scss +0 -64
- package/v2Containers/Line/Create/actions.js +0 -94
- package/v2Containers/Line/Create/constants.js +0 -43
- package/v2Containers/Line/Create/index.js +0 -1132
- package/v2Containers/Line/Create/initialSchema.js +0 -378
- package/v2Containers/Line/Create/messages.js +0 -229
- package/v2Containers/Line/Create/reducer.js +0 -99
- package/v2Containers/Line/Create/sagas.js +0 -113
- package/v2Containers/Line/Create/selectors.js +0 -30
- package/v2Containers/Line/CreateWrapper/constants.js +0 -2
- package/v2Containers/Line/CreateWrapper/index.js +0 -117
- package/v2Containers/Line/CreateWrapper/messages.js +0 -55
- package/v2Containers/Line/Edit/_lineEdit.scss +0 -23
- package/v2Containers/Line/Edit/actions.js +0 -79
- package/v2Containers/Line/Edit/constants.js +0 -27
- package/v2Containers/Line/Edit/index.js +0 -1051
- package/v2Containers/Line/Edit/messages.js +0 -173
- package/v2Containers/Line/Edit/reducer.js +0 -83
- package/v2Containers/Line/Edit/sagas.js +0 -81
- package/v2Containers/Line/Edit/selectors.js +0 -29
- package/v2Containers/Line/Edit/tests/actions.test.js +0 -18
- package/v2Containers/Line/Edit/tests/index.test.js +0 -10
- package/v2Containers/Line/Edit/tests/reducer.test.js +0 -9
- package/v2Containers/Line/Edit/tests/sagas.test.js +0 -15
- package/v2Containers/Line/Edit/tests/selectors.test.js +0 -10
|
@@ -42,7 +42,7 @@ export default defineMessages({
|
|
|
42
42
|
},
|
|
43
43
|
fbAdsDescription: {
|
|
44
44
|
id: `${messagePrefix}.fbAdsDescription`,
|
|
45
|
-
defaultMessage: '
|
|
45
|
+
defaultMessage: 'You may create ads in Facebook Ad Manager under the below mentioned ad set. The performance of these ads will be reported here in Engage+.',
|
|
46
46
|
},
|
|
47
47
|
fbAdsDetailOne: {
|
|
48
48
|
id: `${messagePrefix}.fbAdsDetailOne`,
|
|
@@ -56,9 +56,9 @@ export default defineMessages({
|
|
|
56
56
|
id: `${messagePrefix}.fbAdsDetailThree`,
|
|
57
57
|
defaultMessage: 'You can create ads later in Facebook ad manager.',
|
|
58
58
|
},
|
|
59
|
-
|
|
60
|
-
id: `${messagePrefix}.
|
|
61
|
-
defaultMessage: '
|
|
59
|
+
fbConfirm: {
|
|
60
|
+
id: `${messagePrefix}.fbConfirm`,
|
|
61
|
+
defaultMessage: 'Confirm',
|
|
62
62
|
},
|
|
63
63
|
fbChange: {
|
|
64
64
|
id: `${messagePrefix}.fbChange`,
|
|
@@ -164,24 +164,4 @@ export default defineMessages({
|
|
|
164
164
|
id: `${messagePrefix}.fbMarketingObjectiveStoreTrafficDescription`,
|
|
165
165
|
defaultMessage: 'Drive visits to your physical stores by showing ads to people who are nearby.',
|
|
166
166
|
},
|
|
167
|
-
capFbAdManager: {
|
|
168
|
-
id: `${messagePrefix}.capFbAdManager`,
|
|
169
|
-
defaultMessage: 'Capillary Facebook ad manager',
|
|
170
|
-
},
|
|
171
|
-
fbAdManager: {
|
|
172
|
-
id: `${messagePrefix}.fbAdManager`,
|
|
173
|
-
defaultMessage: 'Facebook ad manager',
|
|
174
|
-
},
|
|
175
|
-
adManagerHeading: {
|
|
176
|
-
id: `${messagePrefix}.adManagerHeading`,
|
|
177
|
-
defaultMessage: "Where do you want to create your Facebook ad creative?",
|
|
178
|
-
},
|
|
179
|
-
capAdManagerHeading: {
|
|
180
|
-
id: `${messagePrefix}.capAdManagerHeading`,
|
|
181
|
-
defaultMessage: "You can create Facebook ads creative in Engage+ Facebook ad Manager.",
|
|
182
|
-
},
|
|
183
|
-
facebookDisableinfo: {
|
|
184
|
-
id: `${messagePrefix}.facebookDisableinfo`,
|
|
185
|
-
defaultMessage: 'Please integrate Facebook Ad page ID & username to enable this option.',
|
|
186
|
-
},
|
|
187
167
|
});
|
|
@@ -18,11 +18,11 @@ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
|
18
18
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
19
19
|
// GA
|
|
20
20
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
21
|
-
import {
|
|
21
|
+
import { TRACK_CREATE_LINE, TRACK_EDIT_LINE } from '../../App/constants';
|
|
22
22
|
|
|
23
23
|
import LineWrapper from './Wrapper';
|
|
24
24
|
import messages from './messages';
|
|
25
|
-
import { TEXT, IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, MAX_LINE_WRAPPER_LIMIT, MAX_LINE_WRAPPER_LIMIT_FULL_MODE, DEFAULT_VIDEO_URI
|
|
25
|
+
import { TEXT, IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, MAX_LINE_WRAPPER_LIMIT, MAX_LINE_WRAPPER_LIMIT_FULL_MODE, DEFAULT_VIDEO_URI } from './constants';
|
|
26
26
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
27
27
|
|
|
28
28
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
@@ -32,8 +32,6 @@ import {makeSelectCreateLine, makeSelectLine } from './selectors';
|
|
|
32
32
|
import * as compActions from './actions';
|
|
33
33
|
import * as templateActionsConfig from '../../Templates/actions';
|
|
34
34
|
import withCreatives from '../../../hoc/withCreatives';
|
|
35
|
-
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
36
|
-
import { LINE } from '../../CreativesContainer/constants';
|
|
37
35
|
|
|
38
36
|
const { stopTimer } = GA.timeTracker;
|
|
39
37
|
|
|
@@ -350,19 +348,6 @@ export const LineContainer = ({
|
|
|
350
348
|
}
|
|
351
349
|
}
|
|
352
350
|
|
|
353
|
-
const formatFSPayload = (lineWrapperContents) => {
|
|
354
|
-
const [ {
|
|
355
|
-
messageTitle,
|
|
356
|
-
messageContent: content,
|
|
357
|
-
type,
|
|
358
|
-
} = {}] = lineWrapperContents;
|
|
359
|
-
return {
|
|
360
|
-
name: messageTitle,
|
|
361
|
-
content,
|
|
362
|
-
imageAdded: [IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, TEMPLATE].includes(type),
|
|
363
|
-
videoAdded: type === VIDEO
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
351
|
const formatSubmitPayload = (lineWrapperContents) => {
|
|
367
352
|
const [ {
|
|
368
353
|
messageTitle,
|
|
@@ -576,17 +561,11 @@ export const LineContainer = ({
|
|
|
576
561
|
createCallback(errorMessage);
|
|
577
562
|
if (!errorMessage) {
|
|
578
563
|
// stop timer for create line
|
|
579
|
-
|
|
564
|
+
stopTimer(TRACK_CREATE_LINE, {
|
|
580
565
|
category: 'Creatives',
|
|
581
566
|
action: TRACK_CREATE_LINE,
|
|
582
567
|
label: getLineType(lineWrapperContents),
|
|
583
568
|
});
|
|
584
|
-
gtmPush('creativeDetails', Object.assign({
|
|
585
|
-
id: resp.templateId,
|
|
586
|
-
channel: LINE,
|
|
587
|
-
mode: CREATE,
|
|
588
|
-
timeTaken,
|
|
589
|
-
}, formatFSPayload(lineWrapperContents)));
|
|
590
569
|
onCreateComplete();
|
|
591
570
|
}
|
|
592
571
|
}
|
|
@@ -625,18 +604,11 @@ export const LineContainer = ({
|
|
|
625
604
|
editCallback(errorMessage);
|
|
626
605
|
if (!errorMessage) {
|
|
627
606
|
// stop timer for edit line
|
|
628
|
-
|
|
607
|
+
stopTimer(TRACK_EDIT_LINE, {
|
|
629
608
|
category: 'Creatives',
|
|
630
609
|
action: TRACK_EDIT_LINE,
|
|
631
610
|
label: getLineType(lineWrapperContents),
|
|
632
611
|
});
|
|
633
|
-
gtmPush('creativeDetails', Object.assign({
|
|
634
|
-
id: resp.templateId._id,
|
|
635
|
-
channel: LINE,
|
|
636
|
-
mode: EDIT,
|
|
637
|
-
timeTaken,
|
|
638
|
-
}, formatFSPayload(lineWrapperContents)));
|
|
639
|
-
|
|
640
612
|
onCreateComplete();
|
|
641
613
|
}
|
|
642
614
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import PropTypes
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { bindActionCreators } from 'redux';
|
|
@@ -22,15 +22,11 @@ import * as actions from './actions';
|
|
|
22
22
|
import withCreatives from '../../../hoc/withCreatives';
|
|
23
23
|
|
|
24
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
25
|
-
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
26
|
-
|
|
27
25
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
28
26
|
import messages from './messages';
|
|
29
27
|
import getEventsMap from '../eventsMap';
|
|
30
28
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
31
|
-
import {
|
|
32
|
-
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
33
|
-
import { getContent } from '../commonMethods';
|
|
29
|
+
import { TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
34
30
|
|
|
35
31
|
const PrefixWrapper = styled.div`
|
|
36
32
|
margin-right: 16px;
|
|
@@ -1405,33 +1401,16 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1405
1401
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, eventsMap, isSchemaChanged: true});
|
|
1406
1402
|
this.injectEvents(schema);
|
|
1407
1403
|
};
|
|
1408
|
-
|
|
1409
1404
|
saveFormData = (formData) => {
|
|
1410
1405
|
//this function gets called from form bulder only when the form data is valid
|
|
1411
1406
|
const obj = this.getTransformedData(formData);
|
|
1412
|
-
const content = getContent(obj);
|
|
1413
|
-
const {
|
|
1414
|
-
definition: {
|
|
1415
|
-
mode: definitionMode
|
|
1416
|
-
}
|
|
1417
|
-
} = obj || {};
|
|
1418
1407
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
1419
|
-
this.props.actions.createTemplate(obj, (
|
|
1420
|
-
|
|
1408
|
+
this.props.actions.createTemplate(obj, () => {
|
|
1409
|
+
GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1421
1410
|
category: 'Creatives',
|
|
1422
1411
|
action: TRACK_CREATE_MPUSH,
|
|
1423
1412
|
label,
|
|
1424
1413
|
});
|
|
1425
|
-
gtmPush('creativeDetails', {
|
|
1426
|
-
id: response.templateId,
|
|
1427
|
-
name: obj.name,
|
|
1428
|
-
channel: MOBILE_PUSH,
|
|
1429
|
-
timeTaken,
|
|
1430
|
-
content,
|
|
1431
|
-
mode: CREATE,
|
|
1432
|
-
imageAdded: definitionMode === 'image'
|
|
1433
|
-
});
|
|
1434
|
-
|
|
1435
1414
|
this.discardValues();
|
|
1436
1415
|
const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
|
|
1437
1416
|
CapNotification.success({message, key: 'createMpushSuccess'});
|
|
@@ -26,13 +26,11 @@ import messages from './messages';
|
|
|
26
26
|
import './_mobilePushCreate.scss';
|
|
27
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
-
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
30
29
|
|
|
31
30
|
import getEventsMap from '../eventsMap';
|
|
32
|
-
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields
|
|
31
|
+
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
33
32
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
34
|
-
import {
|
|
35
|
-
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
33
|
+
import { TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
36
34
|
|
|
37
35
|
const PrefixWrapper = styled.div`
|
|
38
36
|
margin-right: 16px;
|
|
@@ -273,34 +271,14 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
273
271
|
this.setState({modalContent: {...this.state.modalContent, show: false}});
|
|
274
272
|
}
|
|
275
273
|
};
|
|
276
|
-
onUpdateTemplateComplete = (
|
|
277
|
-
|
|
278
|
-
const content = getContent(obj);
|
|
279
|
-
const {
|
|
280
|
-
definition: {
|
|
281
|
-
mode: definitionMode
|
|
282
|
-
}
|
|
283
|
-
} = obj || {};
|
|
274
|
+
onUpdateTemplateComplete = () => {
|
|
275
|
+
|
|
284
276
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
285
|
-
|
|
277
|
+
GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
286
278
|
category: 'Creatives',
|
|
287
279
|
action: TRACK_EDIT_MPUSH,
|
|
288
280
|
label,
|
|
289
281
|
});
|
|
290
|
-
try {
|
|
291
|
-
gtmPush('creativeDetails', {
|
|
292
|
-
id: response.templateId,
|
|
293
|
-
name: obj.name,
|
|
294
|
-
channel: MOBILE_PUSH,
|
|
295
|
-
timeTaken,
|
|
296
|
-
content,
|
|
297
|
-
mode: EDIT,
|
|
298
|
-
imageAdded: definitionMode === 'image'
|
|
299
|
-
})
|
|
300
|
-
} catch(e) {
|
|
301
|
-
console.log(e);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
282
|
this.resetSchema();
|
|
305
283
|
this.setState({
|
|
306
284
|
formData: {},
|
|
@@ -15,7 +15,7 @@ export function* editTemplate(template) {
|
|
|
15
15
|
errorMsg = result.message;
|
|
16
16
|
}
|
|
17
17
|
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
18
|
-
yield call(template.callback
|
|
18
|
+
yield call(template.callback);
|
|
19
19
|
} catch (error) {
|
|
20
20
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
21
21
|
}
|
|
@@ -246,24 +246,6 @@ function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formDa
|
|
|
246
246
|
}
|
|
247
247
|
return inputFields;
|
|
248
248
|
}
|
|
249
|
-
|
|
250
|
-
function getContent(obj) {
|
|
251
|
-
const {
|
|
252
|
-
versions : {
|
|
253
|
-
base: {
|
|
254
|
-
ANDROID: {
|
|
255
|
-
title : androidTitle,
|
|
256
|
-
message : androidMessage
|
|
257
|
-
} = {},
|
|
258
|
-
IOS: {
|
|
259
|
-
title: iosTitle,
|
|
260
|
-
message: iosMessage
|
|
261
|
-
} = {}
|
|
262
|
-
} = {}
|
|
263
|
-
} = {}
|
|
264
|
-
} = obj;
|
|
265
|
-
return `${androidTitle} ${androidMessage} ${iosTitle} ${iosMessage}`;
|
|
266
|
-
}
|
|
267
249
|
export {
|
|
268
|
-
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields,
|
|
250
|
+
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields,
|
|
269
251
|
};
|
|
@@ -21,14 +21,13 @@ import messages from './messages';
|
|
|
21
21
|
import * as charCount from '../../../utils/smsCharCount';
|
|
22
22
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
|
-
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
25
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
26
25
|
import {SMS} from '../../CreativesContainer/constants';
|
|
27
26
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
28
27
|
import {showError} from '../commonMethods';
|
|
29
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
30
29
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
31
|
-
import {
|
|
30
|
+
import { TRACK_CREATE_SMS } from '../../App/constants';
|
|
32
31
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
33
32
|
constructor(props) {
|
|
34
33
|
super(props);
|
|
@@ -204,22 +203,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
204
203
|
this.setState({currentTab: data});
|
|
205
204
|
}
|
|
206
205
|
onCreateTemplateComplete = (editResponse) => {
|
|
207
|
-
|
|
206
|
+
GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
|
|
208
207
|
category: 'Creatives',
|
|
209
208
|
action: TRACK_CREATE_SMS,
|
|
210
209
|
});
|
|
211
|
-
const {
|
|
212
|
-
formData
|
|
213
|
-
} = this.state;
|
|
214
210
|
if (editResponse.templateId) {
|
|
215
|
-
gtmPush('creativeDetails', {
|
|
216
|
-
id: editResponse.templateId,
|
|
217
|
-
name: formData?.['template-name'],
|
|
218
|
-
channel: SMS,
|
|
219
|
-
timeTaken,
|
|
220
|
-
content: formData?.base?.['sms-editor'],
|
|
221
|
-
mode: CREATE
|
|
222
|
-
});
|
|
223
211
|
this.resetSchema();
|
|
224
212
|
this.setState({
|
|
225
213
|
formData: {},
|
|
@@ -21,14 +21,12 @@ import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
|
21
21
|
import '../Create/_smsCreate.scss';
|
|
22
22
|
import messages from './messages';
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
|
-
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
25
24
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
26
25
|
// import callNativeEvent from '../../../utils/callNativeEvent';
|
|
27
26
|
import {showError} from '../commonMethods';
|
|
28
27
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
-
import {
|
|
28
|
+
import { TRACK_EDIT_SMS } from '../../App/constants';
|
|
30
29
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
31
|
-
import { SMS } from '../../CreativesContainer/constants';
|
|
32
30
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
33
31
|
constructor(props) {
|
|
34
32
|
super(props);
|
|
@@ -222,22 +220,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
222
220
|
this.setState({currentTab: data});
|
|
223
221
|
}
|
|
224
222
|
onUpdateTemplateComplete = (editResponse) => {
|
|
225
|
-
|
|
223
|
+
GA.timeTracker.stopTimer(TRACK_EDIT_SMS, {
|
|
226
224
|
category: 'Creatives',
|
|
227
225
|
action: TRACK_EDIT_SMS,
|
|
228
226
|
});
|
|
229
|
-
const {
|
|
230
|
-
formData
|
|
231
|
-
} = this.state;
|
|
232
227
|
if (editResponse.templateId) {
|
|
233
|
-
gtmPush('creativeDetails', {
|
|
234
|
-
id: editResponse.templateId,
|
|
235
|
-
name: formData?.['template-name'],
|
|
236
|
-
channel: SMS,
|
|
237
|
-
timeTaken,
|
|
238
|
-
content: formData?.base?.['sms-editor'],
|
|
239
|
-
mode: EDIT
|
|
240
|
-
})
|
|
241
228
|
this.resetSchema();
|
|
242
229
|
this.setState({
|
|
243
230
|
formData: {},
|
|
@@ -62,8 +62,6 @@ import {
|
|
|
62
62
|
} from '../App/constants';
|
|
63
63
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK } from '../CreativesContainer/constants';
|
|
64
64
|
|
|
65
|
-
import {CREATIVE} from '../Facebook/constants';
|
|
66
|
-
|
|
67
65
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
68
66
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
69
67
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -323,7 +321,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
323
321
|
}
|
|
324
322
|
const fbSetting = get(nextProps.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
|
|
325
323
|
const { accountName = "",
|
|
326
|
-
|
|
324
|
+
orgUnitFacebookPageSettingsMap = {},
|
|
327
325
|
} = fbSetting[0] || {};
|
|
328
326
|
let pageAccessToken = false;
|
|
329
327
|
if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
|
|
@@ -456,7 +454,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
456
454
|
this.setState({previewTemplate: nextProps.Templates.templateDetails});
|
|
457
455
|
}
|
|
458
456
|
|
|
459
|
-
if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat'].indexOf(this.state.channel.toLowerCase()) > -1)) {
|
|
457
|
+
if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat', 'mobilepush'].indexOf(this.state.channel.toLowerCase()) > -1)) {
|
|
460
458
|
const paramsDefault = {
|
|
461
459
|
name: this.state.searchText,
|
|
462
460
|
sortBy: this.state.sortBy,
|
|
@@ -466,6 +464,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
466
464
|
paramsDefault.wecrmToken = nextProps.Templates.weCrmAccounts[0].configs.wecrm_token;
|
|
467
465
|
paramsDefault.originalId = nextProps.Templates.weCrmAccounts[0].sourceAccountIdentifier;
|
|
468
466
|
nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
|
|
467
|
+
} else if (this.state.channel.toLowerCase() === 'mobilepush') {
|
|
468
|
+
nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
|
|
469
|
+
paramsDefault.accountId = nextProps.Templates.weCrmAccounts[0].id;
|
|
469
470
|
}
|
|
470
471
|
this.setState({defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: nextProps.Templates.weCrmAccounts[0].name });
|
|
471
472
|
this.getAllTemplates({params: paramsDefault}, true);
|
|
@@ -510,7 +511,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
510
511
|
}
|
|
511
512
|
|
|
512
513
|
this.setState({activeMode: TEMPLATES_MODE});
|
|
513
|
-
|
|
514
|
+
|
|
514
515
|
this.getAllTemplates({params, resetPage: true});
|
|
515
516
|
});
|
|
516
517
|
}
|
|
@@ -1138,17 +1139,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1138
1139
|
const channel = this.state.channel.toLowerCase();
|
|
1139
1140
|
//const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
|
|
1140
1141
|
let routeParams = {};
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
|
|
1145
|
-
}
|
|
1146
|
-
if (isLibraryMode) {
|
|
1147
|
-
if (this.props.fbAdManager === CREATIVE) {
|
|
1148
|
-
this.props.createNew(fbAdManager);
|
|
1149
|
-
} else {
|
|
1150
|
-
this.props.createNew();
|
|
1151
|
-
}
|
|
1142
|
+
timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
|
|
1143
|
+
if (this.isEnabledInLibraryModule("callCreateFromProps")) {
|
|
1144
|
+
this.props.createNew();
|
|
1152
1145
|
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
1153
1146
|
routeParams = {
|
|
1154
1147
|
pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
|
|
@@ -1366,6 +1359,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1366
1359
|
};
|
|
1367
1360
|
|
|
1368
1361
|
handleEditClick(e, template, modeType, path, options) {
|
|
1362
|
+
timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
|
|
1369
1363
|
if (modeType && modeType !== undefined) {
|
|
1370
1364
|
this.setState({modeType});
|
|
1371
1365
|
}
|
|
@@ -1418,9 +1412,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1418
1412
|
}
|
|
1419
1413
|
}
|
|
1420
1414
|
if (this.isEnabledInLibraryModule("callSelectFromProps")) {
|
|
1421
|
-
this.props.onSelectTemplate(
|
|
1415
|
+
this.props.onSelectTemplate(id);
|
|
1422
1416
|
} else {
|
|
1423
|
-
timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
|
|
1424
1417
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
1425
1418
|
pathName = `/ebill/edit/${id}`;
|
|
1426
1419
|
}
|
|
@@ -1431,9 +1424,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1431
1424
|
}
|
|
1432
1425
|
}
|
|
1433
1426
|
|
|
1434
|
-
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
1427
|
handlePreviewClick(template, modeType) {
|
|
1438
1428
|
this.togglePreview();
|
|
1439
1429
|
const templateInfo = cloneDeep(template);
|
|
@@ -1811,10 +1801,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1811
1801
|
const isWechatChannel = channel === WECHAT;
|
|
1812
1802
|
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
1813
1803
|
const isLineChannel = channel === LINE;
|
|
1814
|
-
const isFacebookChannel = channel === FACEBOOK;
|
|
1815
1804
|
|
|
1816
1805
|
|
|
1817
|
-
if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts)
|
|
1806
|
+
if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts)) {
|
|
1818
1807
|
forEach(weCrmAccounts, (account) => {
|
|
1819
1808
|
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel || isLineChannel) {
|
|
1820
1809
|
if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
|
|
@@ -1954,33 +1943,28 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1954
1943
|
render() {
|
|
1955
1944
|
const isFullMode = this.isFullMode();
|
|
1956
1945
|
const { activeMode, channel, wechatFilter, lineFilter } = this.state;
|
|
1957
|
-
let
|
|
1946
|
+
let showForFacebook = true;
|
|
1958
1947
|
if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
pageAccessToken = true;
|
|
1970
|
-
}
|
|
1971
|
-
});
|
|
1972
|
-
if (!pageAccessToken) {
|
|
1973
|
-
showFbAds = true;
|
|
1948
|
+
if (isEmpty(this.props.Templates.campaignSettings)) {
|
|
1949
|
+
showForFacebook = false;
|
|
1950
|
+
}
|
|
1951
|
+
const fbSetting = get(this.props.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
|
|
1952
|
+
const { orgUnitFacebookPageSettingsMap = {} } = fbSetting[0] || {};
|
|
1953
|
+
let pageAccessToken = false;
|
|
1954
|
+
if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
|
|
1955
|
+
Object.values(orgUnitFacebookPageSettingsMap).forEach((obj) => {
|
|
1956
|
+
if (obj.pageAccessToken) {
|
|
1957
|
+
pageAccessToken = true;
|
|
1974
1958
|
}
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1959
|
+
});
|
|
1960
|
+
if (!pageAccessToken) {
|
|
1961
|
+
showForFacebook = false;
|
|
1977
1962
|
}
|
|
1978
1963
|
}
|
|
1979
1964
|
}
|
|
1980
|
-
|
|
1981
1965
|
const showForViber = (![VIBER_CHANNEL, FACEBOOK_CHANNEL].includes(channel.toLowerCase()) ||
|
|
1982
1966
|
(channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))) ||
|
|
1983
|
-
(channel.toLowerCase() === FACEBOOK_CHANNEL &&
|
|
1967
|
+
(channel.toLowerCase() === FACEBOOK_CHANNEL && showForFacebook)
|
|
1984
1968
|
);
|
|
1985
1969
|
|
|
1986
1970
|
|
|
@@ -9,7 +9,7 @@ import * as types from './constants';
|
|
|
9
9
|
|
|
10
10
|
const initialState = fromJS({
|
|
11
11
|
getAllTemplatesInProgress: false,
|
|
12
|
-
fetchingOrgLevelCampaignSettings:
|
|
12
|
+
fetchingOrgLevelCampaignSettings: true,
|
|
13
13
|
templates: [],
|
|
14
14
|
deleteResponse: {},
|
|
15
15
|
deleteTemplateInProgress: false,
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
12
|
import { bindActionCreators } from 'redux';
|
|
13
|
-
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get } from 'lodash';
|
|
15
15
|
import isEmpty from 'lodash/isEmpty';
|
|
16
16
|
import Helmet from 'react-helmet';
|
|
@@ -45,7 +45,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
45
45
|
channelsToDisable = [],
|
|
46
46
|
isFullMode,
|
|
47
47
|
onChannelChange,
|
|
48
|
-
showDisabledFBInfo,
|
|
49
48
|
} = props;
|
|
50
49
|
|
|
51
50
|
const defaultPanes = {
|
|
@@ -81,15 +80,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
81
80
|
if (channelsToDisable.includes(pane.key)) {
|
|
82
81
|
// eslint-disable-next-line no-param-reassign
|
|
83
82
|
pane.disabled = true;
|
|
84
|
-
if (pane.key === 'facebook' && showDisabledFBInfo) {
|
|
85
|
-
pane.tab = (<CapTooltip
|
|
86
|
-
title={
|
|
87
|
-
intl.formatMessage(messages.facebookDisableinfo)
|
|
88
|
-
}
|
|
89
|
-
>
|
|
90
|
-
{intl.formatMessage(messages.facebook)}
|
|
91
|
-
</CapTooltip>);
|
|
92
|
-
}
|
|
93
83
|
}
|
|
94
84
|
return pane;
|
|
95
85
|
});
|
|
@@ -158,16 +148,13 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
158
148
|
);
|
|
159
149
|
|
|
160
150
|
getFacebookComponent = () => {
|
|
161
|
-
const { messageDetails, cap, onFacebookSubmit,
|
|
151
|
+
const { messageDetails, cap, onFacebookSubmit, isFullMode } = this.props;
|
|
162
152
|
return (
|
|
163
153
|
<Facebook
|
|
164
154
|
{...this.props}
|
|
165
155
|
messageDetails={messageDetails}
|
|
166
156
|
cap={cap}
|
|
167
157
|
onFacebookSubmit={onFacebookSubmit}
|
|
168
|
-
messageStrategy={messageStrategy}
|
|
169
|
-
showDisabledFBInfo={showDisabledFBInfo}
|
|
170
|
-
orgUnitId={orgUnitId}
|
|
171
158
|
/>
|
|
172
159
|
);
|
|
173
160
|
}
|
|
@@ -191,21 +178,19 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
191
178
|
getTemplatesComponent(channel) {
|
|
192
179
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
193
180
|
let query = {};
|
|
194
|
-
|
|
195
|
-
if (!isFullMode) {
|
|
181
|
+
if (!this.props.isFullMode) {
|
|
196
182
|
query = {type: 'embedded', module: 'library'};
|
|
197
183
|
switch (channel) {
|
|
198
184
|
case 'line':
|
|
199
185
|
return this.getLineComponent();
|
|
200
186
|
case 'ftp':
|
|
201
187
|
return this.getFTPComponent();
|
|
188
|
+
case 'facebook':
|
|
189
|
+
return this.getFacebookComponent();
|
|
202
190
|
default:
|
|
203
191
|
break;
|
|
204
192
|
}
|
|
205
193
|
}
|
|
206
|
-
if (messageStrategy !== "X_ENGAGE" && channel === 'facebook' && !isFullMode) {
|
|
207
|
-
return this.getFacebookComponent();
|
|
208
|
-
}
|
|
209
194
|
const location = {pathname: `/${channel}`, search: '', query};
|
|
210
195
|
switch (channel) {
|
|
211
196
|
case 'call_task':
|
|
@@ -220,10 +205,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
220
205
|
router={this.props.router}
|
|
221
206
|
isFullMode={this.props.isFullMode}
|
|
222
207
|
createNew={this.props.createNew}
|
|
223
|
-
onSelectTemplate={this.props.onSelectTemplate}
|
|
208
|
+
onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
|
|
224
209
|
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
225
210
|
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
226
|
-
messageStrategy={this.props.messageStrategy}
|
|
227
211
|
/>);
|
|
228
212
|
}
|
|
229
213
|
}
|
|
@@ -303,7 +287,6 @@ TemplatesV2.propTypes = {
|
|
|
303
287
|
cap: PropTypes.object,
|
|
304
288
|
authData: PropTypes.object,
|
|
305
289
|
FTPMode: PropTypes.string,
|
|
306
|
-
messageStrategy: PropTypes.string,
|
|
307
290
|
};
|
|
308
291
|
|
|
309
292
|
TemplatesV2.defaultProps = {
|
|
@@ -66,8 +66,4 @@ export default defineMessages({
|
|
|
66
66
|
id: 'creatives.containersV2.TemplatesV2.line',
|
|
67
67
|
defaultMessage: 'Line',
|
|
68
68
|
},
|
|
69
|
-
facebookDisableinfo: {
|
|
70
|
-
id: `creatives.containersV2.TemplatesV2.facebookDisableinfo`,
|
|
71
|
-
defaultMessage: 'Please integrate Facebook Ad page ID & username to enable this option.',
|
|
72
|
-
},
|
|
73
69
|
});
|