@capillarytech/creatives-library 7.6.5 → 7.6.6
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/v2Containers/CreativesContainer/SlideBoxContent.js +2 -0
- package/v2Containers/CreativesContainer/index.js +48 -22
- package/v2Containers/Facebook/Advertisement/index.js +12 -4
- package/v2Containers/Facebook/index.js +3 -3
- package/v2Containers/Templates/index.js +5 -2
- package/v2Containers/TemplatesV2/index.js +1 -1
package/package.json
CHANGED
|
@@ -563,6 +563,7 @@ function SlideBoxContent(props) {
|
|
|
563
563
|
getFormSubscriptionData={getFormData}
|
|
564
564
|
messageStrategy={messageStrategy}
|
|
565
565
|
fbAdManger={fbAdManger}
|
|
566
|
+
onSelectTemplate={onSelectTemplate}
|
|
566
567
|
/>
|
|
567
568
|
)
|
|
568
569
|
}
|
|
@@ -579,6 +580,7 @@ function SlideBoxContent(props) {
|
|
|
579
580
|
id: templateData._id,
|
|
580
581
|
}}
|
|
581
582
|
getFormSubscriptionData={getFormData}
|
|
583
|
+
fbAdManger={fbAdManger}
|
|
582
584
|
/>
|
|
583
585
|
)
|
|
584
586
|
}
|
|
@@ -73,8 +73,12 @@ class Creatives extends React.Component {
|
|
|
73
73
|
this.setState({templateNameExists: false});
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
onSelectTemplate = (template) => {
|
|
77
|
-
|
|
76
|
+
onSelectTemplate = (template, fbAdManger) => {
|
|
77
|
+
if (fbAdManger) {
|
|
78
|
+
this.setState({ slidBoxContent: 'editTemplate', templateData: template, fbAdManger});
|
|
79
|
+
} else {
|
|
80
|
+
this.setState({ slidBoxContent: 'editTemplate', templateData: template });
|
|
81
|
+
}
|
|
78
82
|
};
|
|
79
83
|
onPreviewTemplate = (template) => {
|
|
80
84
|
const templateData = template;
|
|
@@ -276,25 +280,6 @@ class Creatives extends React.Component {
|
|
|
276
280
|
};
|
|
277
281
|
break;
|
|
278
282
|
}
|
|
279
|
-
case constants.FACEBOOK: {
|
|
280
|
-
return {
|
|
281
|
-
fbContentType: "CREATIVE",
|
|
282
|
-
creativeType: "IMAGE",
|
|
283
|
-
facebookCreativeList: [{
|
|
284
|
-
subType: "IMAGE",
|
|
285
|
-
displayLink: "www.google.com",
|
|
286
|
-
callToAction: "callToAction",
|
|
287
|
-
primaryText: "primaryText",
|
|
288
|
-
linkDescription: "linkDescription",
|
|
289
|
-
linkHeadLine: "linkHeadLine",
|
|
290
|
-
websiteLink: "websiteLink",
|
|
291
|
-
imageLink: "www.kuch_bhi_link.com",
|
|
292
|
-
pageId: "1234",
|
|
293
|
-
}],
|
|
294
|
-
channel: "FACEBOOK",
|
|
295
|
-
accountId: "1310132286042455",
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
283
|
default:
|
|
299
284
|
break;
|
|
300
285
|
}
|
|
@@ -398,7 +383,48 @@ class Creatives extends React.Component {
|
|
|
398
383
|
};
|
|
399
384
|
}
|
|
400
385
|
break;
|
|
401
|
-
case constants.FACEBOOK:
|
|
386
|
+
case constants.FACEBOOK: {
|
|
387
|
+
if (template.value) {
|
|
388
|
+
const FacebookAd = template.value.versions.base.content.FacebookAd;
|
|
389
|
+
const type = FacebookAd[0].type;
|
|
390
|
+
const {accountId, orgUnitFacebookPageSettingsMap = {}} = this.props.Templates.selectedFacebookAccount;
|
|
391
|
+
const facebookCreativeList = [];
|
|
392
|
+
const fBContent = Object.values(FacebookAd);
|
|
393
|
+
fBContent.forEach((obj) => {
|
|
394
|
+
const data = cloneDeep(obj);
|
|
395
|
+
const {subType, linkDesc, imgSrc, webSiteLink} = obj;
|
|
396
|
+
delete data.type;
|
|
397
|
+
delete data.linkDesc;
|
|
398
|
+
delete data.webSiteLink;
|
|
399
|
+
data.linkDescription = linkDesc;
|
|
400
|
+
data.websiteLink = webSiteLink;
|
|
401
|
+
|
|
402
|
+
switch (subType) {
|
|
403
|
+
case "IMAGE":
|
|
404
|
+
data.imageLink = imgSrc;
|
|
405
|
+
delete data.imgSrc;
|
|
406
|
+
break;
|
|
407
|
+
case "VIDEO":
|
|
408
|
+
data.imageLink = "www.kuch_bhi_link.com";
|
|
409
|
+
data.videoId = "123";
|
|
410
|
+
break;
|
|
411
|
+
case "CAROUSEL":
|
|
412
|
+
break;
|
|
413
|
+
default:
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
facebookCreativeList.push(data);
|
|
417
|
+
});
|
|
418
|
+
templateData = {
|
|
419
|
+
fbContentType: "CREATIVE",
|
|
420
|
+
creativeType: type,
|
|
421
|
+
facebookCreativeList,
|
|
422
|
+
channel: "FACEBOOK",
|
|
423
|
+
accountId,
|
|
424
|
+
selectedMarketingObjective: template.value.selectedMarketingObjective,
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
402
428
|
break;
|
|
403
429
|
default:
|
|
404
430
|
break;
|
|
@@ -3,6 +3,8 @@ import React, { useState, useEffect, useCallback} from "react";
|
|
|
3
3
|
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
|
|
4
4
|
import { isUrl } from '../../Line/Container/Wrapper/utils';
|
|
5
5
|
import get from 'lodash/get';
|
|
6
|
+
import isEmpty from 'lodash/isEmpty';
|
|
7
|
+
|
|
6
8
|
import {
|
|
7
9
|
CapInput,
|
|
8
10
|
CapRadioCard,
|
|
@@ -86,6 +88,7 @@ export const Advertisement = (props) => {
|
|
|
86
88
|
params,
|
|
87
89
|
getFormSubscriptionData,
|
|
88
90
|
facebookTemplateData,
|
|
91
|
+
selectedMarketingObjective,
|
|
89
92
|
} = props;
|
|
90
93
|
const {
|
|
91
94
|
formatMessage,
|
|
@@ -349,8 +352,7 @@ export const Advertisement = (props) => {
|
|
|
349
352
|
}
|
|
350
353
|
messageData.push(data);
|
|
351
354
|
});
|
|
352
|
-
|
|
353
|
-
return {
|
|
355
|
+
let finalResponse = {
|
|
354
356
|
versions: {
|
|
355
357
|
base: {
|
|
356
358
|
content: {
|
|
@@ -362,12 +364,17 @@ export const Advertisement = (props) => {
|
|
|
362
364
|
type: "FACEBOOK",
|
|
363
365
|
name: messageTitle,
|
|
364
366
|
};
|
|
367
|
+
if (!isFullMode) {
|
|
368
|
+
finalResponse = {...finalResponse, selectedMarketingObjective};
|
|
369
|
+
}
|
|
370
|
+
return finalResponse;
|
|
365
371
|
}, [carouselData,
|
|
366
372
|
pageId,
|
|
367
373
|
messageTitle,
|
|
368
374
|
primaryText,
|
|
369
375
|
callToAction,
|
|
370
|
-
displayLink
|
|
376
|
+
displayLink,
|
|
377
|
+
selectedMarketingObjective]);
|
|
371
378
|
|
|
372
379
|
const onCreateFacebookAd = useCallback( () => {
|
|
373
380
|
actions.createTemplate(
|
|
@@ -829,7 +836,7 @@ export const Advertisement = (props) => {
|
|
|
829
836
|
const options = getPageAccessOrgs() || [];
|
|
830
837
|
const { data = {} } = fbADData.orgOuData || {};
|
|
831
838
|
const selectedPageName = Object.keys(data).find((key) => data[key] === pageId);
|
|
832
|
-
return ( (step === 'modeSelection') ?
|
|
839
|
+
return ( (step === 'modeSelection' && isEmpty(templateData)) ?
|
|
833
840
|
( <CapSpin spinning={adSpinLoader} className="add-facebook-ad-section">
|
|
834
841
|
<div style={{ position: 'fixed', top: '25px', zIndex: 1}}>
|
|
835
842
|
<CapHeader
|
|
@@ -974,6 +981,7 @@ Advertisement.propTypes = {
|
|
|
974
981
|
facebookTemplateData: PropTypes.object,
|
|
975
982
|
templateData: PropTypes.object,
|
|
976
983
|
params: PropTypes.object,
|
|
984
|
+
selectedMarketingObjective: PropTypes.any,
|
|
977
985
|
|
|
978
986
|
};
|
|
979
987
|
|
|
@@ -371,7 +371,7 @@ const Facebook = (props) => {
|
|
|
371
371
|
<CapCustomCard
|
|
372
372
|
type="Facebook"
|
|
373
373
|
FBDynamicComponent={() => (
|
|
374
|
-
|
|
374
|
+
<CapIcon
|
|
375
375
|
size="l"
|
|
376
376
|
type="scenery"
|
|
377
377
|
className="facebook-dynamic-content"
|
|
@@ -382,7 +382,7 @@ const Facebook = (props) => {
|
|
|
382
382
|
<CapColumn span={16}>
|
|
383
383
|
<ul className="parameter-list">
|
|
384
384
|
{adSetParameters.map((parameter, index) => (
|
|
385
|
-
|
|
385
|
+
<li key={parameter} className="parameter-list-item">
|
|
386
386
|
<CapLabel type="label2" className="parameter-index">
|
|
387
387
|
{index + 1}
|
|
388
388
|
</CapLabel>
|
|
@@ -417,6 +417,7 @@ const Facebook = (props) => {
|
|
|
417
417
|
facebookTemplateData={facebookTemplateData}
|
|
418
418
|
messageStrategy={messageStrategy}
|
|
419
419
|
getFormSubscriptionData={getFormSubscriptionData}
|
|
420
|
+
selectedMarketingObjective={selectedMarketingObjective}
|
|
420
421
|
/>
|
|
421
422
|
</div>
|
|
422
423
|
);
|
|
@@ -442,7 +443,6 @@ Facebook.propTypes = {
|
|
|
442
443
|
|
|
443
444
|
Facebook.defaultProps = {
|
|
444
445
|
marketingObjectiveList: [""],
|
|
445
|
-
|
|
446
446
|
};
|
|
447
447
|
|
|
448
448
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1143,7 +1143,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1143
1143
|
if (this.isEnabledInLibraryModule("callCreateFromProps")) {
|
|
1144
1144
|
if (this.props.fbAdManger === "CREATIVE") {
|
|
1145
1145
|
this.props.createNew(this.props.fbAdManger);
|
|
1146
|
-
} else{
|
|
1146
|
+
} else {
|
|
1147
1147
|
this.props.createNew();
|
|
1148
1148
|
}
|
|
1149
1149
|
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
@@ -1416,7 +1416,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
if (this.isEnabledInLibraryModule("callSelectFromProps")) {
|
|
1419
|
-
this.props.onSelectTemplate(id);
|
|
1419
|
+
this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManger);
|
|
1420
1420
|
} else {
|
|
1421
1421
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
1422
1422
|
pathName = `/ebill/edit/${id}`;
|
|
@@ -1428,6 +1428,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
1430
|
|
|
1431
|
+
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
1432
|
+
|
|
1433
|
+
|
|
1431
1434
|
handlePreviewClick(template, modeType) {
|
|
1432
1435
|
this.togglePreview();
|
|
1433
1436
|
const templateInfo = cloneDeep(template);
|
|
@@ -208,7 +208,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
208
208
|
router={this.props.router}
|
|
209
209
|
isFullMode={this.props.isFullMode}
|
|
210
210
|
createNew={this.props.createNew}
|
|
211
|
-
onSelectTemplate={
|
|
211
|
+
onSelectTemplate={this.props.onSelectTemplate}
|
|
212
212
|
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
213
213
|
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
214
214
|
messageStrategy={this.props.messageStrategy}
|