@capillarytech/creatives-library 7.6.1 → 7.6.3
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/config/app.js +2 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/reducers.js +2 -1
- package/routes.js +5 -0
- package/services/api.js +30 -1
- package/utils/common.js +13 -1
- package/v2Components/CapVideoUpload/index.js +14 -6
- package/v2Components/TemplatePreview/index.js +23 -2
- package/v2Containers/App/constants.js +21 -0
- package/v2Containers/Cap/messages.js +30 -0
- package/v2Containers/CapFacebookPreview/actions.js +3 -15
- package/v2Containers/CapFacebookPreview/constants.js +3 -11
- package/v2Containers/CapFacebookPreview/index.js +6 -6
- package/v2Containers/CapFacebookPreview/reducer.js +3 -9
- package/v2Containers/CapFacebookPreview/sagas.js +6 -65
- package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -1
- package/v2Containers/CreativesContainer/index.js +19 -8
- package/v2Containers/Facebook/Advertisement/index.js +38 -15
- package/v2Containers/Facebook/Advertisement/index.scss +9 -0
- package/v2Containers/Facebook/Advertisement/messages.js +2 -2
- package/v2Containers/Facebook/actions.js +63 -0
- package/v2Containers/Facebook/constants.js +25 -1
- package/v2Containers/Facebook/index.js +135 -107
- package/v2Containers/Facebook/reducer.js +98 -1
- package/v2Containers/Facebook/sagas.js +147 -0
- package/v2Containers/Facebook/selectors.js +10 -0
- package/v2Containers/Line/Container/Video/index.js +38 -41
- package/v2Containers/Templates/_templates.scss +26 -0
- package/v2Containers/Templates/actions.js +14 -1
- package/v2Containers/Templates/constants.js +8 -0
- package/v2Containers/Templates/index.js +138 -10
- package/v2Containers/Templates/messages.js +8 -4
- package/v2Containers/Templates/reducer.js +22 -0
- package/v2Containers/Templates/sagas.js +26 -1
- package/v2Containers/TemplatesV2/index.js +13 -13
- package/v2Containers/Viber/index.js +2 -1
package/config/app.js
CHANGED
|
@@ -5,6 +5,7 @@ const config = {
|
|
|
5
5
|
production: {
|
|
6
6
|
api_endpoint: '/arya/api/v1/creatives',
|
|
7
7
|
campaigns_api_endpoint: '/iris/v2/campaigns',
|
|
8
|
+
campaigns_api_org_endpoint: '/iris/v2/org/campaign',
|
|
8
9
|
auth_endpoint: '/arya/api/v1/auth',
|
|
9
10
|
arya_endpoint: '/arya/api/v1',
|
|
10
11
|
login_url: '/auth/login',
|
|
@@ -17,6 +18,7 @@ const config = {
|
|
|
17
18
|
development: {
|
|
18
19
|
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
19
20
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
21
|
+
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
20
22
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
21
23
|
arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
|
|
22
24
|
subscription_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/org-settings/subscription',
|
package/index.js
CHANGED
|
@@ -75,6 +75,10 @@ import viberSaga from './v2Containers/Viber/sagas';
|
|
|
75
75
|
|
|
76
76
|
import TemplatesV2 from './v2Containers/TemplatesV2/index';
|
|
77
77
|
|
|
78
|
+
import FacebookPreview from './v2Containers/CapFacebookPreview';
|
|
79
|
+
import FacebookPreviewReducer from './v2Containers/CapFacebookPreview/reducer';
|
|
80
|
+
import FacebookPreviewSaga from './v2Containers/CapFacebookPreview/sagas';
|
|
81
|
+
|
|
78
82
|
import CreativesContainer from './v2Containers/CreativesContainer';
|
|
79
83
|
import CreativesContainerReducer from './v2Containers/CreativesContainer/reducer';
|
|
80
84
|
import { updateCharCount } from './utils/smsCharCountV2';
|
|
@@ -101,6 +105,7 @@ const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
|
101
105
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
102
106
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
103
107
|
const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
108
|
+
const FacebookPreviewContainer = { FacebookPreview, FacebookPreviewReducer, FacebookPreviewSaga };
|
|
104
109
|
|
|
105
110
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
106
111
|
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
@@ -145,4 +150,5 @@ export { CapContainer,
|
|
|
145
150
|
GalleryContainer,
|
|
146
151
|
FTPContainer,
|
|
147
152
|
ViberContainer,
|
|
153
|
+
FacebookPreviewContainer,
|
|
148
154
|
};
|
package/package.json
CHANGED
package/reducers.js
CHANGED
|
@@ -9,7 +9,7 @@ import { LOCATION_CHANGE } from 'react-router-redux';
|
|
|
9
9
|
|
|
10
10
|
import languageProviderReducer from 'v2Containers/LanguageProvider/reducer';
|
|
11
11
|
import beeEditorReducer from 'v2Containers/BeeEditor/reducer';
|
|
12
|
-
|
|
12
|
+
import CapFacebookPreviewReducer from 'v2Containers/CapFacebookPreview/reducer';
|
|
13
13
|
|
|
14
14
|
import capReducer from 'containers/Cap/reducer';
|
|
15
15
|
import appReducer from 'containers/App/reducer';
|
|
@@ -64,6 +64,7 @@ export default function createReducer(asyncReducers) {
|
|
|
64
64
|
email: emailReducer,
|
|
65
65
|
ebill: ebillReducer,
|
|
66
66
|
beeEditor: beeEditorReducer,
|
|
67
|
+
facebookPreview: CapFacebookPreviewReducer,
|
|
67
68
|
FTP: ftpReducer,
|
|
68
69
|
...asyncReducers,
|
|
69
70
|
});
|
package/routes.js
CHANGED
|
@@ -637,6 +637,8 @@ export default function createRoutes(store) {
|
|
|
637
637
|
import('v2Containers/Line/Container/reducer'),
|
|
638
638
|
import('v2Containers/Viber/sagas'),
|
|
639
639
|
import('v2Containers/Viber/reducer'),
|
|
640
|
+
import('v2Containers/CapFacebookPreview/sagas'),
|
|
641
|
+
import('v2Containers/CapFacebookPreview/reducer'),
|
|
640
642
|
]);
|
|
641
643
|
|
|
642
644
|
const renderRoute = loadModule(cb);
|
|
@@ -658,6 +660,7 @@ export default function createRoutes(store) {
|
|
|
658
660
|
facebookSagas, facebookReducer,
|
|
659
661
|
lineCreateSagas, lineCreateReducer,
|
|
660
662
|
viberSagas, viberReducer,
|
|
663
|
+
capFacebookPreviewSagas, capFacebookPreviewReducer,
|
|
661
664
|
]) => {
|
|
662
665
|
injectReducer('templates', reducer.default);
|
|
663
666
|
injectReducer('cap', capReducer.default);
|
|
@@ -675,6 +678,7 @@ export default function createRoutes(store) {
|
|
|
675
678
|
injectReducer('facebook', facebookReducer.default);
|
|
676
679
|
injectReducer('lineCreate', lineCreateReducer.default);
|
|
677
680
|
injectReducer('viber', viberReducer.default);
|
|
681
|
+
injectReducer('facebookPreview', capFacebookPreviewReducer.default);
|
|
678
682
|
injectSagas(gallerySagas.default);
|
|
679
683
|
injectSagas(sagas.default);
|
|
680
684
|
injectSagas(capSagas.default);
|
|
@@ -691,6 +695,7 @@ export default function createRoutes(store) {
|
|
|
691
695
|
injectSagas(facebookSagas.default);
|
|
692
696
|
injectSagas(lineCreateSagas.default);
|
|
693
697
|
injectSagas(viberSagas.default);
|
|
698
|
+
injectSagas(capFacebookPreviewSagas.default);
|
|
694
699
|
renderRoute(component);
|
|
695
700
|
});
|
|
696
701
|
importModules.catch(errorLoading);
|
package/services/api.js
CHANGED
|
@@ -11,12 +11,15 @@ import { GA } from '@capillarytech/cap-ui-utils';
|
|
|
11
11
|
let API_ENDPOINT = config.development.api_endpoint;
|
|
12
12
|
let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
|
|
13
13
|
let CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_endpoint;
|
|
14
|
+
let CAMPAIGNS_API_ORG_ENDPOINT = config.development.campaigns_api_org_endpoint;
|
|
15
|
+
|
|
14
16
|
let API_AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
15
17
|
let ARYA_ENDPOINT = config.development.arya_endpoint;
|
|
16
18
|
let SUBSCRIPTION_API_ENDPOINT = config.development.subscription_api_endpoint;
|
|
17
19
|
if (process.env.NODE_ENV === 'production') {
|
|
18
20
|
API_ENDPOINT = config.production.api_endpoint;
|
|
19
21
|
CAMPAIGNS_API_ENDPOINT = config.production.campaigns_api_endpoint;
|
|
22
|
+
CAMPAIGNS_API_ORG_ENDPOINT = config.production.campaigns_api_org_endpoint;
|
|
20
23
|
API_AUTH_ENDPOINT = config.production.auth_endpoint;
|
|
21
24
|
ARYA_ENDPOINT = config.production.arya_endpoint;
|
|
22
25
|
SUBSCRIPTION_API_ENDPOINT = config.production.subscription_api_endpoint;
|
|
@@ -203,6 +206,7 @@ export const createWeChatTemplate = ({template}) => {
|
|
|
203
206
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|
|
204
207
|
return request(url, getAPICallObject('POST', template));
|
|
205
208
|
};
|
|
209
|
+
|
|
206
210
|
export const createMobilePushTemplate = ({template}) => {
|
|
207
211
|
console.log('in api.js', template);
|
|
208
212
|
const url = `${API_ENDPOINT}/templates/MOBILEPUSH`;
|
|
@@ -245,7 +249,6 @@ export const getTemplateDetails = ({id, channel}) => {
|
|
|
245
249
|
};
|
|
246
250
|
|
|
247
251
|
export const getAllTemplates = ({channel, queryParams}) => {
|
|
248
|
-
console.log('in api.js', channel, queryParams);
|
|
249
252
|
const url = `${API_ENDPOINT}/templates/${channel}?query=${encodeURIComponent(JSON.stringify(queryParams))}`;
|
|
250
253
|
return request(url, getAPICallObject('GET'));
|
|
251
254
|
};
|
|
@@ -370,6 +373,11 @@ export const createViberTemplate = ({template}) => {
|
|
|
370
373
|
return request(url, getAPICallObject('POST', template));
|
|
371
374
|
};
|
|
372
375
|
|
|
376
|
+
export const createFacebookADTemplate = ({template}) => {
|
|
377
|
+
const url = `${API_ENDPOINT}/templates/FACEBOOK`;
|
|
378
|
+
return request(url, getAPICallObject('POST', template));
|
|
379
|
+
};
|
|
380
|
+
|
|
373
381
|
export const getLocizMessage = async (locale) => {
|
|
374
382
|
const appName = 'creatives_v2';
|
|
375
383
|
const url = `${ARYA_ENDPOINT}/translations/${appName}/${locale}`;
|
|
@@ -403,3 +411,24 @@ export const createCustomRow = (data) => {
|
|
|
403
411
|
const url = `${API_ENDPOINT}/cms/saveRows`;
|
|
404
412
|
return request(url, getAPICallObject('POST', data));
|
|
405
413
|
};
|
|
414
|
+
|
|
415
|
+
export const getFacebookPreview = ({previewData}) => {
|
|
416
|
+
const url = `${API_ENDPOINT}/facebook/getPreview`;
|
|
417
|
+
return request(url, getAPICallObject('POST', previewData));
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
export const getOrgOUs = ({ orgID }) => {
|
|
422
|
+
const url = `${ARYA_ENDPOINT}/org/${orgID}/oulist`;
|
|
423
|
+
return request(url, getAPICallObject('GET'));
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export const getOrgLevelCampaignSettings = () => {
|
|
427
|
+
const url = `${CAMPAIGNS_API_ORG_ENDPOINT}/settings`;
|
|
428
|
+
return request(url, getAPICallObject('GET', null, false, true));
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
export const getFacebookVideoId = ({videoUrl, accessToken, actId, pageAccessToken, pageId}) => {
|
|
432
|
+
const url = `${API_ENDPOINT}/facebook/getFacebookVideoId`;
|
|
433
|
+
return request(url, getAPICallObject('POST', {videoUrl, accessToken, actId, pageAccessToken, pageId}));
|
|
434
|
+
};
|
package/utils/common.js
CHANGED
|
@@ -49,7 +49,7 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
|
|
|
49
49
|
name: tag.label[userLocale] || tag.label.en,
|
|
50
50
|
value: tag.value,
|
|
51
51
|
};
|
|
52
|
-
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
52
|
+
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
53
53
|
// to check it this tag header is already available in mainTags object,
|
|
54
54
|
//If yes, it will concat the subtag
|
|
55
55
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
@@ -215,3 +215,15 @@ function getSubTags(subtagsParam) {
|
|
|
215
215
|
});
|
|
216
216
|
return result;
|
|
217
217
|
}
|
|
218
|
+
|
|
219
|
+
export const bytes2Size = (bytes, decimals = 2) => {
|
|
220
|
+
if (bytes === 0) return '0 Bytes';
|
|
221
|
+
|
|
222
|
+
const k = 1024;
|
|
223
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
224
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
225
|
+
|
|
226
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
227
|
+
|
|
228
|
+
return `${Math.ceil((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
229
|
+
};
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
CapError,
|
|
18
18
|
CapUploader,
|
|
19
19
|
CapSpin,
|
|
20
|
+
CapNotification,
|
|
20
21
|
} from '@capillarytech/cap-ui-library';
|
|
21
22
|
import {bytes2Size} from '../../utils/common';
|
|
22
23
|
import './index.scss';
|
|
@@ -48,6 +49,7 @@ function CapVideoUpload(props) {
|
|
|
48
49
|
previewUrl,
|
|
49
50
|
videoHeight,
|
|
50
51
|
videoWidth,
|
|
52
|
+
videoId,
|
|
51
53
|
} = uploadedAssetList;
|
|
52
54
|
|
|
53
55
|
const [isTemplateDrawerRequired, updateTemplateDrawerRequirement] = useState(false);
|
|
@@ -82,11 +84,14 @@ function CapVideoUpload(props) {
|
|
|
82
84
|
const metaVideoSrc = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.secure_file_path`, '');
|
|
83
85
|
const previewImgUrl = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.video_file_path_preview`, '');
|
|
84
86
|
const metaVideoName = get(videoData, `uploadedAssetDataVideo_${index}.metaInfo.name`, '');
|
|
87
|
+
const metaVideoId = get(videoData, `uploadedAssetDataVideo_${index}.videoIdResponse.fbVideo.id`, '');
|
|
88
|
+
|
|
85
89
|
if (metaVideoSrc && videoSrc === "") {
|
|
86
90
|
onVideoUploadUpdateAssestList(index, {
|
|
87
91
|
previewUrl: previewImgUrl,
|
|
88
92
|
videoSrc: metaVideoSrc,
|
|
89
93
|
videoName: metaVideoName,
|
|
94
|
+
videoId: metaVideoId,
|
|
90
95
|
},
|
|
91
96
|
);
|
|
92
97
|
}
|
|
@@ -100,6 +105,7 @@ function CapVideoUpload(props) {
|
|
|
100
105
|
}
|
|
101
106
|
}, [videoData[`assetUploadingVideo_${index}`]]);
|
|
102
107
|
|
|
108
|
+
|
|
103
109
|
useEffect(() => {
|
|
104
110
|
if (!isEmpty(uploadedAssetList)) {
|
|
105
111
|
const {
|
|
@@ -184,12 +190,13 @@ function CapVideoUpload(props) {
|
|
|
184
190
|
onVideoUploadUpdateAssestList(
|
|
185
191
|
index,
|
|
186
192
|
{
|
|
187
|
-
previewUrl,
|
|
188
|
-
videoName,
|
|
189
|
-
videoHeight,
|
|
190
|
-
videoWidth,
|
|
191
|
-
videoSrc,
|
|
192
|
-
videoDuration,
|
|
193
|
+
previewUrl: "",
|
|
194
|
+
videoName: "",
|
|
195
|
+
videoHeight: "",
|
|
196
|
+
videoWidth: "",
|
|
197
|
+
videoSrc: "",
|
|
198
|
+
videoDuration: "",
|
|
199
|
+
videoId: "",
|
|
193
200
|
}
|
|
194
201
|
);
|
|
195
202
|
};
|
|
@@ -204,6 +211,7 @@ function CapVideoUpload(props) {
|
|
|
204
211
|
index,
|
|
205
212
|
{
|
|
206
213
|
videoSrc,
|
|
214
|
+
videoId,
|
|
207
215
|
videoName,
|
|
208
216
|
videoHeight: metaVideoHeight,
|
|
209
217
|
videoWidth: metaVideoWidth,
|
|
@@ -16,7 +16,7 @@ import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
|
16
16
|
import messages from './messages';
|
|
17
17
|
import { WECHAT } from '../../v2Containers/CreativesContainer/constants';
|
|
18
18
|
import Carousel from '../Carousel';
|
|
19
|
-
import { VIBER } from '../../v2Containers/App/constants';
|
|
19
|
+
import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
|
|
20
20
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
21
21
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
22
22
|
const lineMobileAndroid = require('../../assets/line.png');
|
|
@@ -30,6 +30,7 @@ const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
|
|
|
30
30
|
|
|
31
31
|
import { CAP_COLOR_03, CAP_WHITE, FONT_COLOR_01, CAP_G08, CAP_G06, CAP_G15, CAP_PURPLE01, CAP_G16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
32
32
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
33
|
+
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
33
34
|
|
|
34
35
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
35
36
|
onPreviewContentClicked = (channel) => {
|
|
@@ -260,7 +261,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
260
261
|
|
|
261
262
|
return (
|
|
262
263
|
<CapRow>
|
|
263
|
-
{this.props.showCount && <CapColumn span={16}>
|
|
264
|
+
{this.props.showCount && (channel && channel.toLowerCase() !== FACEBOOK) && <CapColumn span={16}>
|
|
264
265
|
{channel && channel.toLowerCase() === 'sms' && <CapHeading type="h3">
|
|
265
266
|
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.chars_used}}/>
|
|
266
267
|
{smsDetails.unicode &&
|
|
@@ -637,6 +638,22 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
637
638
|
</div>
|
|
638
639
|
) : ''
|
|
639
640
|
}
|
|
641
|
+
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
642
|
+
<div style={{position: 'absolute', left: '80%'}} id="facebook-preview">
|
|
643
|
+
<CapFacebookPreview
|
|
644
|
+
disablePreviewButton={false}
|
|
645
|
+
selectedAd={content.selectedAd}
|
|
646
|
+
previewData={content.previewData}
|
|
647
|
+
primaryText={content.primaryText}
|
|
648
|
+
callToAction={content.callToAction}
|
|
649
|
+
displayLink={content.displayLink}
|
|
650
|
+
orgUnitFacebookPageSettingsMap={{pageAccessToken: content.pageAccessToken,
|
|
651
|
+
pageId: content.pageId}}
|
|
652
|
+
accountId={content.accountId}
|
|
653
|
+
accessToken={content.accessToken}
|
|
654
|
+
/>
|
|
655
|
+
</div>
|
|
656
|
+
)}
|
|
640
657
|
</div>
|
|
641
658
|
|
|
642
659
|
</CapColumn>
|
|
@@ -660,6 +677,10 @@ TemplatePreview.propTypes = {
|
|
|
660
677
|
onPreviewContentClicked: PropTypes.func,
|
|
661
678
|
onTestContentClicked: PropTypes.func,
|
|
662
679
|
showTestAndPreviewIcon: PropTypes.bool,
|
|
680
|
+
fbContent: PropTypes.oneOfType([
|
|
681
|
+
PropTypes.object,
|
|
682
|
+
PropTypes.any,
|
|
683
|
+
]),
|
|
663
684
|
};
|
|
664
685
|
|
|
665
686
|
export default (injectIntl(TemplatePreview));
|
|
@@ -25,6 +25,8 @@ export const EDIT = 'edit';
|
|
|
25
25
|
export const PREVIEW = 'preview';
|
|
26
26
|
|
|
27
27
|
export const VIBER = 'viber';
|
|
28
|
+
export const FACEBOOK = 'facebook';
|
|
29
|
+
|
|
28
30
|
export const TRACK_EDIT_SMS = 'editSms';
|
|
29
31
|
export const TRACK_EDIT_EMAIL = 'editEmail';
|
|
30
32
|
export const TRACK_EDIT_MPUSH = 'editMpush';
|
|
@@ -54,3 +56,22 @@ export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
|
54
56
|
export const NO_COMMUNICATION = 'NO_COMMUNICATION';
|
|
55
57
|
export const FTP = 'FTP';
|
|
56
58
|
export const CREATIVES_UI_VIEW = 'CREATIVES_UI_VIEW';
|
|
59
|
+
|
|
60
|
+
export const APPLY_NOW = <FormattedMessage {...globalMessages.applyNow} />;
|
|
61
|
+
export const NO_CALL_TO_ACTION = <FormattedMessage {...globalMessages.noCallToAction} />;
|
|
62
|
+
export const LEARN_MORE = <FormattedMessage {...globalMessages.learnMore} />;
|
|
63
|
+
export const SHOP_NOW = <FormattedMessage {...globalMessages.shopNow} />;
|
|
64
|
+
export const SIGN_UP = <FormattedMessage {...globalMessages.signUp} />;
|
|
65
|
+
export const SUBSCRIBE = <FormattedMessage {...globalMessages.subscribe} />;
|
|
66
|
+
export const WATCH_MORE = <FormattedMessage {...globalMessages.watchMore} />;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export const FB_AD_CALL_TO_ACTION = {
|
|
70
|
+
NO_CALL_TO_ACTION,
|
|
71
|
+
APPLY_NOW,
|
|
72
|
+
LEARN_MORE,
|
|
73
|
+
SHOP_NOW,
|
|
74
|
+
SIGN_UP,
|
|
75
|
+
SUBSCRIBE,
|
|
76
|
+
WATCH_MORE,
|
|
77
|
+
};
|
|
@@ -113,4 +113,34 @@ export default defineMessages({
|
|
|
113
113
|
id: `creatives.containersV2.newOrgName`,
|
|
114
114
|
defaultMessage: '{newOrgName}',
|
|
115
115
|
},
|
|
116
|
+
"applyNow": {
|
|
117
|
+
id: `creatives.containersV2.applyNow`,
|
|
118
|
+
defaultMessage: 'Apply now',
|
|
119
|
+
},
|
|
120
|
+
"noCallToAction": {
|
|
121
|
+
id: `creatives.containersV2.noCallToAction`,
|
|
122
|
+
defaultMessage: 'No call to action',
|
|
123
|
+
},
|
|
124
|
+
"learnMore": {
|
|
125
|
+
id: `creatives.containersV2.learnMore`,
|
|
126
|
+
defaultMessage: 'Learn More',
|
|
127
|
+
},
|
|
128
|
+
"shopNow": {
|
|
129
|
+
id: `creatives.containersV2.shopNow`,
|
|
130
|
+
defaultMessage: 'Shop Now',
|
|
131
|
+
},
|
|
132
|
+
"signUp": {
|
|
133
|
+
id: `creatives.containersV2.signUp`,
|
|
134
|
+
defaultMessage: 'Sign Up',
|
|
135
|
+
},
|
|
136
|
+
"subscribe": {
|
|
137
|
+
id: `creatives.containersV2.subscribe`,
|
|
138
|
+
defaultMessage: 'Subscribe',
|
|
139
|
+
},
|
|
140
|
+
"watchMore": {
|
|
141
|
+
id: `creatives.containersV2.watchMore`,
|
|
142
|
+
defaultMessage: 'Watch More',
|
|
143
|
+
},
|
|
144
|
+
|
|
116
145
|
});
|
|
146
|
+
|
|
@@ -5,24 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
GENERATE_VIDEO_PREVIEW_REQUEST,
|
|
10
|
-
GENERATE_CAROUSEL_PREVIEW_REQUEST,
|
|
8
|
+
GENERATE_PREVIEW_REQUEST,
|
|
11
9
|
CLEAR_PREVIEW,
|
|
12
10
|
} from './constants';
|
|
13
11
|
|
|
14
|
-
export const
|
|
15
|
-
type:
|
|
16
|
-
previewData,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const getVideoPreview = (previewData) => ({
|
|
20
|
-
type: GENERATE_VIDEO_PREVIEW_REQUEST,
|
|
21
|
-
previewData,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const getCarouselPreview = (previewData) => ({
|
|
25
|
-
type: GENERATE_CAROUSEL_PREVIEW_REQUEST,
|
|
12
|
+
export const getPreview = (previewData) => ({
|
|
13
|
+
type: GENERATE_PREVIEW_REQUEST,
|
|
26
14
|
previewData,
|
|
27
15
|
});
|
|
28
16
|
|
|
@@ -5,17 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
export const GENERATE_VIDEO_PREVIEW_REQUEST = 'app/CapFacebookPreview/GET_VIDEO_PREVIEW_REQUEST';
|
|
13
|
-
export const GENERATE_VIDEO_PREVIEW_SUCCESS = 'app/CapFacebookPreview/GET_VIDEO_PREVIEW_SUCCESS';
|
|
14
|
-
export const GENERATE_VIDEO_PREVIEW_FAILURE = 'app/CapFacebookPreview/GET_VIDEO_PREVIEW_FAILURE';
|
|
15
|
-
|
|
16
|
-
export const GENERATE_CAROUSEL_PREVIEW_REQUEST = 'app/CapFacebookPreview/GET_CAROUSEL_PREVIEW_REQUEST';
|
|
17
|
-
export const GENERATE_CAROUSEL_PREVIEW_SUCCESS = 'app/CapFacebookPreview/GET_CAROUSEL_PREVIEW_SUCCESS';
|
|
18
|
-
export const GENERATE_CAROUSEL_PREVIEW_FAILURE = 'app/CapFacebookPreview/GET_CAROUSEL_PREVIEW_FAILURE';
|
|
8
|
+
export const GENERATE_PREVIEW_REQUEST = 'app/CapFacebookPreview/GET_PREVIEW_REQUEST';
|
|
9
|
+
export const GENERATE_PREVIEW_SUCCESS = 'app/CapFacebookPreview/GET_PREVIEW_SUCCESS';
|
|
10
|
+
export const GENERATE_PREVIEW_FAILURE = 'app/CapFacebookPreview/GET_PREVIEW_FAILURE';
|
|
19
11
|
|
|
20
12
|
export const CLEAR_PREVIEW = 'app/CapFacebookPreview/CLEAR_PREVIEW';
|
|
21
13
|
|
|
@@ -42,7 +42,7 @@ export const CapFacebookPreview = (props) => {
|
|
|
42
42
|
selectedAd,
|
|
43
43
|
primaryText,
|
|
44
44
|
callToAction,
|
|
45
|
-
orgUnitFacebookPageSettingsMap,
|
|
45
|
+
orgUnitFacebookPageSettingsMap = {},
|
|
46
46
|
accessToken,
|
|
47
47
|
accountId,
|
|
48
48
|
} = props;
|
|
@@ -222,11 +222,11 @@ export const CapFacebookPreview = (props) => {
|
|
|
222
222
|
value: {link: webSiteLink},
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
facebookPreviewActions.
|
|
225
|
+
facebookPreviewActions.getPreview(data);
|
|
226
226
|
} else {
|
|
227
227
|
data.params.creative.object_story_spec.video_data = {
|
|
228
228
|
image_url: videoData.previewUrl,
|
|
229
|
-
|
|
229
|
+
video_id: videoData.videoId,
|
|
230
230
|
message: primaryText,
|
|
231
231
|
link_description: linkDesc,
|
|
232
232
|
};
|
|
@@ -236,7 +236,7 @@ export const CapFacebookPreview = (props) => {
|
|
|
236
236
|
value: {link: webSiteLink},
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
facebookPreviewActions.
|
|
239
|
+
facebookPreviewActions.getPreview(data);
|
|
240
240
|
}
|
|
241
241
|
} else {
|
|
242
242
|
const childData = previewData.map((obj) => {
|
|
@@ -254,7 +254,7 @@ export const CapFacebookPreview = (props) => {
|
|
|
254
254
|
if (obj.subType === VIDEO) {
|
|
255
255
|
arrayData = {
|
|
256
256
|
...arrayData,
|
|
257
|
-
|
|
257
|
+
video_id: obj.videoData.videoId,
|
|
258
258
|
picture: obj.videoData.previewUrl,
|
|
259
259
|
};
|
|
260
260
|
} else {
|
|
@@ -273,7 +273,7 @@ export const CapFacebookPreview = (props) => {
|
|
|
273
273
|
multi_share_end_card: false,
|
|
274
274
|
},
|
|
275
275
|
};
|
|
276
|
-
facebookPreviewActions.
|
|
276
|
+
facebookPreviewActions.getPreview(data);
|
|
277
277
|
}
|
|
278
278
|
setDisableAfterPreviewGenerate(true);
|
|
279
279
|
};
|
|
@@ -16,20 +16,14 @@ const initialState = fromJS({
|
|
|
16
16
|
|
|
17
17
|
function capFacebookPreviewReducer(state = initialState, action) {
|
|
18
18
|
switch (action.type) {
|
|
19
|
-
case types.
|
|
20
|
-
case types.GENERATE_VIDEO_PREVIEW_REQUEST:
|
|
21
|
-
case types.GENERATE_CAROUSEL_PREVIEW_REQUEST:
|
|
19
|
+
case types.GENERATE_PREVIEW_REQUEST:
|
|
22
20
|
return state.set('isFetchingPreview', true)
|
|
23
21
|
.set('previewIframe', "")
|
|
24
22
|
.set("previewIframeError", "");
|
|
25
|
-
case types.
|
|
26
|
-
case types.GENERATE_VIDEO_PREVIEW_SUCCESS:
|
|
27
|
-
case types.GENERATE_CAROUSEL_PREVIEW_SUCCESS:
|
|
23
|
+
case types.GENERATE_PREVIEW_SUCCESS:
|
|
28
24
|
return state.set('isFetchingPreview', false)
|
|
29
25
|
.set('previewIframe', get(action, 'payload.fbPreview[0].body', ""));
|
|
30
|
-
case types.
|
|
31
|
-
case types.GENERATE_VIDEO_PREVIEW_FAILURE:
|
|
32
|
-
case types.GENERATE_CAROUSEL_PREVIEW_FAILURE:
|
|
26
|
+
case types.GENERATE_PREVIEW_FAILURE:
|
|
33
27
|
return state.set('isFetchingPreview', false)
|
|
34
28
|
.set('previewIframe', "")
|
|
35
29
|
.set("previewIframeError", get(action, 'payload.message', ""));
|
|
@@ -3,70 +3,24 @@ import { LOCATION_CHANGE } from 'react-router-redux';
|
|
|
3
3
|
import * as Api from '../../services/api';
|
|
4
4
|
import * as type from './constants';
|
|
5
5
|
|
|
6
|
-
export function*
|
|
6
|
+
export function* getFacebookPreview(previewData) {
|
|
7
7
|
try {
|
|
8
|
-
const response = yield call(Api.
|
|
8
|
+
const response = yield call(Api.getFacebookPreview, previewData );
|
|
9
9
|
const { status, response: responsePreview } = response;
|
|
10
10
|
if (status && status.isError) {
|
|
11
11
|
yield put({
|
|
12
|
-
type: type.
|
|
12
|
+
type: type.GENERATE_PREVIEW_FAILURE,
|
|
13
13
|
payload: status,
|
|
14
14
|
});
|
|
15
15
|
} else {
|
|
16
16
|
yield put({
|
|
17
|
-
type: type.
|
|
17
|
+
type: type.GENERATE_PREVIEW_SUCCESS,
|
|
18
18
|
payload: responsePreview,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
} catch (error) {
|
|
22
22
|
yield put({
|
|
23
|
-
type: type.
|
|
24
|
-
payload: error,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function* getVideoFacebookPreview(previewData) {
|
|
30
|
-
try {
|
|
31
|
-
const response = yield call(Api.getVideoFacebookPreview, previewData);
|
|
32
|
-
const { status, response: responsePreview } = response;
|
|
33
|
-
if (status && status.isError) {
|
|
34
|
-
yield put({
|
|
35
|
-
type: type.GENERATE_VIDEO_PREVIEW_FAILURE,
|
|
36
|
-
payload: status,
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
yield put({
|
|
40
|
-
type: type.GENERATE_VIDEO_PREVIEW_SUCCESS,
|
|
41
|
-
payload: responsePreview,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
yield put({
|
|
46
|
-
type: type.GENERATE_VIDEO_PREVIEW_FAILURE,
|
|
47
|
-
payload: error,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function* getCarouselFacebookPreview(previewData) {
|
|
53
|
-
try {
|
|
54
|
-
const response = yield call(Api.getCarouselFacebookPreview, previewData);
|
|
55
|
-
const { status, response: responsePreview } = response;
|
|
56
|
-
if (status && status.isError) {
|
|
57
|
-
yield put({
|
|
58
|
-
type: type.GENERATE_CAROUSEL_PREVIEW_FAILURE,
|
|
59
|
-
payload: status,
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
yield put({
|
|
63
|
-
type: type.GENERATE_CAROUSEL_PREVIEW_SUCCESS,
|
|
64
|
-
payload: responsePreview,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
} catch (error) {
|
|
68
|
-
yield put({
|
|
69
|
-
type: type.GENERATE_CAROUSEL_PREVIEW_FAILURE,
|
|
23
|
+
type: type.GENERATE_PREVIEW_FAILURE,
|
|
70
24
|
payload: error,
|
|
71
25
|
});
|
|
72
26
|
}
|
|
@@ -74,26 +28,13 @@ export function* getCarouselFacebookPreview(previewData) {
|
|
|
74
28
|
|
|
75
29
|
|
|
76
30
|
function* watchImageFacebookPreview() {
|
|
77
|
-
const watcher = yield takeLatest(type.
|
|
78
|
-
yield take(LOCATION_CHANGE);
|
|
79
|
-
yield cancel(watcher);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function* watchVideoFacebookPreview() {
|
|
83
|
-
const watcher = yield takeLatest(type.GENERATE_VIDEO_PREVIEW_REQUEST, getVideoFacebookPreview);
|
|
31
|
+
const watcher = yield takeLatest(type.GENERATE_PREVIEW_REQUEST, getFacebookPreview);
|
|
84
32
|
yield take(LOCATION_CHANGE);
|
|
85
33
|
yield cancel(watcher);
|
|
86
34
|
}
|
|
87
35
|
|
|
88
|
-
function* watchCarouselFacebookPreview() {
|
|
89
|
-
const watcher = yield takeLatest(type.GENERATE_CAROUSEL_PREVIEW_REQUEST, getCarouselFacebookPreview);
|
|
90
|
-
yield take(LOCATION_CHANGE);
|
|
91
|
-
yield cancel(watcher);
|
|
92
|
-
}
|
|
93
36
|
|
|
94
37
|
export default [
|
|
95
38
|
watchImageFacebookPreview,
|
|
96
|
-
watchVideoFacebookPreview,
|
|
97
|
-
watchCarouselFacebookPreview,
|
|
98
39
|
];
|
|
99
40
|
|