@capillarytech/creatives-library 7.5.9 → 7.6.1
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 +0 -2
- package/index.js +0 -6
- package/package.json +1 -1
- package/reducers.js +1 -2
- package/routes.js +0 -5
- package/services/api.js +1 -34
- package/utils/common.js +1 -13
- package/v2Components/CapVideoUpload/messages.js +1 -1
- package/v2Components/TemplatePreview/index.js +2 -19
- package/v2Containers/App/constants.js +0 -21
- package/v2Containers/Cap/messages.js +0 -30
- package/v2Containers/CapFacebookPreview/index.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -55
- package/v2Containers/CreativesContainer/index.js +10 -20
- package/v2Containers/Facebook/Advertisement/messages.js +1 -1
- package/v2Containers/Facebook/actions.js +0 -62
- package/v2Containers/Facebook/constants.js +1 -25
- package/v2Containers/Facebook/index.js +107 -135
- package/v2Containers/Facebook/reducer.js +1 -95
- package/v2Containers/Facebook/sagas.js +0 -136
- package/v2Containers/Facebook/selectors.js +0 -10
- package/v2Containers/Line/Container/Video/index.js +41 -38
- package/v2Containers/Templates/_templates.scss +0 -26
- package/v2Containers/Templates/actions.js +1 -14
- package/v2Containers/Templates/constants.js +0 -8
- package/v2Containers/Templates/index.js +10 -117
- package/v2Containers/Templates/messages.js +4 -8
- package/v2Containers/Templates/reducer.js +0 -22
- package/v2Containers/Templates/sagas.js +1 -26
- package/v2Containers/TemplatesV2/index.js +13 -13
- package/v2Containers/Viber/index.js +1 -2
package/config/app.js
CHANGED
|
@@ -5,7 +5,6 @@ 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',
|
|
9
8
|
auth_endpoint: '/arya/api/v1/auth',
|
|
10
9
|
arya_endpoint: '/arya/api/v1',
|
|
11
10
|
login_url: '/auth/login',
|
|
@@ -18,7 +17,6 @@ const config = {
|
|
|
18
17
|
development: {
|
|
19
18
|
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
20
19
|
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',
|
|
22
20
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
23
21
|
arya_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1',
|
|
24
22
|
subscription_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/org-settings/subscription',
|
package/index.js
CHANGED
|
@@ -75,10 +75,6 @@ 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
|
-
|
|
82
78
|
import CreativesContainer from './v2Containers/CreativesContainer';
|
|
83
79
|
import CreativesContainerReducer from './v2Containers/CreativesContainer/reducer';
|
|
84
80
|
import { updateCharCount } from './utils/smsCharCountV2';
|
|
@@ -105,7 +101,6 @@ const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
|
105
101
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
106
102
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
107
103
|
const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
108
|
-
const FacebookPreviewContainer = { FacebookPreview, FacebookPreviewReducer, FacebookPreviewSaga };
|
|
109
104
|
|
|
110
105
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
111
106
|
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
@@ -150,5 +145,4 @@ export { CapContainer,
|
|
|
150
145
|
GalleryContainer,
|
|
151
146
|
FTPContainer,
|
|
152
147
|
ViberContainer,
|
|
153
|
-
FacebookPreviewContainer,
|
|
154
148
|
};
|
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
|
+
|
|
13
13
|
|
|
14
14
|
import capReducer from 'containers/Cap/reducer';
|
|
15
15
|
import appReducer from 'containers/App/reducer';
|
|
@@ -64,7 +64,6 @@ export default function createReducer(asyncReducers) {
|
|
|
64
64
|
email: emailReducer,
|
|
65
65
|
ebill: ebillReducer,
|
|
66
66
|
beeEditor: beeEditorReducer,
|
|
67
|
-
facebookPreview: CapFacebookPreviewReducer,
|
|
68
67
|
FTP: ftpReducer,
|
|
69
68
|
...asyncReducers,
|
|
70
69
|
});
|
package/routes.js
CHANGED
|
@@ -637,8 +637,6 @@ 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'),
|
|
642
640
|
]);
|
|
643
641
|
|
|
644
642
|
const renderRoute = loadModule(cb);
|
|
@@ -660,7 +658,6 @@ export default function createRoutes(store) {
|
|
|
660
658
|
facebookSagas, facebookReducer,
|
|
661
659
|
lineCreateSagas, lineCreateReducer,
|
|
662
660
|
viberSagas, viberReducer,
|
|
663
|
-
capFacebookPreviewSagas, capFacebookPreviewReducer,
|
|
664
661
|
]) => {
|
|
665
662
|
injectReducer('templates', reducer.default);
|
|
666
663
|
injectReducer('cap', capReducer.default);
|
|
@@ -678,7 +675,6 @@ export default function createRoutes(store) {
|
|
|
678
675
|
injectReducer('facebook', facebookReducer.default);
|
|
679
676
|
injectReducer('lineCreate', lineCreateReducer.default);
|
|
680
677
|
injectReducer('viber', viberReducer.default);
|
|
681
|
-
injectReducer('facebookPreview', capFacebookPreviewReducer.default);
|
|
682
678
|
injectSagas(gallerySagas.default);
|
|
683
679
|
injectSagas(sagas.default);
|
|
684
680
|
injectSagas(capSagas.default);
|
|
@@ -695,7 +691,6 @@ export default function createRoutes(store) {
|
|
|
695
691
|
injectSagas(facebookSagas.default);
|
|
696
692
|
injectSagas(lineCreateSagas.default);
|
|
697
693
|
injectSagas(viberSagas.default);
|
|
698
|
-
injectSagas(capFacebookPreviewSagas.default);
|
|
699
694
|
renderRoute(component);
|
|
700
695
|
});
|
|
701
696
|
importModules.catch(errorLoading);
|
package/services/api.js
CHANGED
|
@@ -11,15 +11,12 @@ 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
|
-
|
|
16
14
|
let API_AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
17
15
|
let ARYA_ENDPOINT = config.development.arya_endpoint;
|
|
18
16
|
let SUBSCRIPTION_API_ENDPOINT = config.development.subscription_api_endpoint;
|
|
19
17
|
if (process.env.NODE_ENV === 'production') {
|
|
20
18
|
API_ENDPOINT = config.production.api_endpoint;
|
|
21
19
|
CAMPAIGNS_API_ENDPOINT = config.production.campaigns_api_endpoint;
|
|
22
|
-
CAMPAIGNS_API_ORG_ENDPOINT = config.production.campaigns_api_org_endpoint;
|
|
23
20
|
API_AUTH_ENDPOINT = config.production.auth_endpoint;
|
|
24
21
|
ARYA_ENDPOINT = config.production.arya_endpoint;
|
|
25
22
|
SUBSCRIPTION_API_ENDPOINT = config.production.subscription_api_endpoint;
|
|
@@ -206,7 +203,6 @@ export const createWeChatTemplate = ({template}) => {
|
|
|
206
203
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|
|
207
204
|
return request(url, getAPICallObject('POST', template));
|
|
208
205
|
};
|
|
209
|
-
|
|
210
206
|
export const createMobilePushTemplate = ({template}) => {
|
|
211
207
|
console.log('in api.js', template);
|
|
212
208
|
const url = `${API_ENDPOINT}/templates/MOBILEPUSH`;
|
|
@@ -249,6 +245,7 @@ export const getTemplateDetails = ({id, channel}) => {
|
|
|
249
245
|
};
|
|
250
246
|
|
|
251
247
|
export const getAllTemplates = ({channel, queryParams}) => {
|
|
248
|
+
console.log('in api.js', channel, queryParams);
|
|
252
249
|
const url = `${API_ENDPOINT}/templates/${channel}?query=${encodeURIComponent(JSON.stringify(queryParams))}`;
|
|
253
250
|
return request(url, getAPICallObject('GET'));
|
|
254
251
|
};
|
|
@@ -373,11 +370,6 @@ export const createViberTemplate = ({template}) => {
|
|
|
373
370
|
return request(url, getAPICallObject('POST', template));
|
|
374
371
|
};
|
|
375
372
|
|
|
376
|
-
export const createFacebookADTemplate = ({template}) => {
|
|
377
|
-
const url = `${API_ENDPOINT}/templates/FACEBOOK`;
|
|
378
|
-
return request(url, getAPICallObject('POST', template));
|
|
379
|
-
};
|
|
380
|
-
|
|
381
373
|
export const getLocizMessage = async (locale) => {
|
|
382
374
|
const appName = 'creatives_v2';
|
|
383
375
|
const url = `${ARYA_ENDPOINT}/translations/${appName}/${locale}`;
|
|
@@ -411,28 +403,3 @@ export const createCustomRow = (data) => {
|
|
|
411
403
|
const url = `${API_ENDPOINT}/cms/saveRows`;
|
|
412
404
|
return request(url, getAPICallObject('POST', data));
|
|
413
405
|
};
|
|
414
|
-
|
|
415
|
-
export const getImageFacebookPreview = ({previewData}) => {
|
|
416
|
-
const url = `${API_ENDPOINT}/facebook/getImagePreview`;
|
|
417
|
-
return request(url, getAPICallObject('POST', previewData));
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
export const getVideoFacebookPreview = ({previewData}) => {
|
|
421
|
-
const url = `${API_ENDPOINT}/facebook/getVideoPreview`;
|
|
422
|
-
return request(url, getAPICallObject('POST', previewData));
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
export const getCarouselFacebookPreview = ({previewData}) => {
|
|
426
|
-
const url = `${API_ENDPOINT}/facebook/getCarouselPreview`;
|
|
427
|
-
return request(url, getAPICallObject('POST', previewData));
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
export const getOrgOUs = ({ orgID }) => {
|
|
431
|
-
const url = `${ARYA_ENDPOINT}/org/${orgID}/oulist`;
|
|
432
|
-
return request(url, getAPICallObject('GET'));
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
export const getOrgLevelCampaignSettings = () => {
|
|
436
|
-
const url = `${CAMPAIGNS_API_ORG_ENDPOINT}/settings`;
|
|
437
|
-
return request(url, getAPICallObject('GET', null, false, true));
|
|
438
|
-
};
|
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,15 +215,3 @@ 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
|
-
};
|
|
@@ -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
|
|
19
|
+
import { VIBER } 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,7 +30,6 @@ 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';
|
|
34
33
|
|
|
35
34
|
class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
35
|
onPreviewContentClicked = (channel) => {
|
|
@@ -261,7 +260,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
261
260
|
|
|
262
261
|
return (
|
|
263
262
|
<CapRow>
|
|
264
|
-
{this.props.showCount &&
|
|
263
|
+
{this.props.showCount && <CapColumn span={16}>
|
|
265
264
|
{channel && channel.toLowerCase() === 'sms' && <CapHeading type="h3">
|
|
266
265
|
<FormattedMessage {...messages.charactersTotal} values={{smsCount: smsDetails.parts, charCount: smsDetails.chars_used}}/>
|
|
267
266
|
{smsDetails.unicode &&
|
|
@@ -638,18 +637,6 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
638
637
|
</div>
|
|
639
638
|
) : ''
|
|
640
639
|
}
|
|
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
|
-
/>
|
|
651
|
-
</div>
|
|
652
|
-
)}
|
|
653
640
|
</div>
|
|
654
641
|
|
|
655
642
|
</CapColumn>
|
|
@@ -673,10 +660,6 @@ TemplatePreview.propTypes = {
|
|
|
673
660
|
onPreviewContentClicked: PropTypes.func,
|
|
674
661
|
onTestContentClicked: PropTypes.func,
|
|
675
662
|
showTestAndPreviewIcon: PropTypes.bool,
|
|
676
|
-
fbContent: PropTypes.oneOfType([
|
|
677
|
-
PropTypes.object,
|
|
678
|
-
PropTypes.any,
|
|
679
|
-
]),
|
|
680
663
|
};
|
|
681
664
|
|
|
682
665
|
export default (injectIntl(TemplatePreview));
|
|
@@ -25,8 +25,6 @@ export const EDIT = 'edit';
|
|
|
25
25
|
export const PREVIEW = 'preview';
|
|
26
26
|
|
|
27
27
|
export const VIBER = 'viber';
|
|
28
|
-
export const FACEBOOK = 'facebook';
|
|
29
|
-
|
|
30
28
|
export const TRACK_EDIT_SMS = 'editSms';
|
|
31
29
|
export const TRACK_EDIT_EMAIL = 'editEmail';
|
|
32
30
|
export const TRACK_EDIT_MPUSH = 'editMpush';
|
|
@@ -56,22 +54,3 @@ export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
|
56
54
|
export const NO_COMMUNICATION = 'NO_COMMUNICATION';
|
|
57
55
|
export const FTP = 'FTP';
|
|
58
56
|
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,34 +113,4 @@ 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
|
-
|
|
145
116
|
});
|
|
146
|
-
|
|
@@ -164,8 +164,6 @@ function SlideBoxContent(props) {
|
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
|
|
167
|
-
const isCreateFacebook = slidBoxContent === 'createTemplate' && channel === constants.FACEBOOK;
|
|
168
|
-
|
|
169
167
|
const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
|
|
170
168
|
const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === constants.CALL_TASK;
|
|
171
169
|
let isEditSms = false;
|
|
@@ -187,7 +185,7 @@ function SlideBoxContent(props) {
|
|
|
187
185
|
isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
|
|
188
186
|
isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
|
|
189
187
|
isEditFacebook = slidBoxContent === 'editTemplate' && channel === constants.FACEBOOK;
|
|
190
|
-
isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER
|
|
188
|
+
isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER);
|
|
191
189
|
isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
|
|
192
190
|
isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
|
|
193
191
|
isEditFTP = slidBoxContent === 'editTemplate' && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
|
|
@@ -265,36 +263,6 @@ function SlideBoxContent(props) {
|
|
|
265
263
|
};
|
|
266
264
|
return template.content;
|
|
267
265
|
}
|
|
268
|
-
case constants.FACEBOOK: {
|
|
269
|
-
const template = cloneDeep(templateDataObject.versions.base);
|
|
270
|
-
const {
|
|
271
|
-
type: fbType = "",
|
|
272
|
-
primaryText = "",
|
|
273
|
-
callToAction = "",
|
|
274
|
-
displayLink = "",
|
|
275
|
-
} = template.content.FacebookAd[0] || {};
|
|
276
|
-
const previewData = Object.values(template.content.FacebookAd).map((obj) => ({
|
|
277
|
-
imageData: obj.imgSrc ? {imageSrc: obj.imgSrc} : {},
|
|
278
|
-
linkDesc: obj.linkDesc,
|
|
279
|
-
linkHeadLine: obj.linkHeadLine,
|
|
280
|
-
subType: obj.subType,
|
|
281
|
-
videoData: obj.video ? { videoSrc: obj.originalContentUrl,
|
|
282
|
-
videoName: obj.videoName,
|
|
283
|
-
videoHeight: obj.videoHeight,
|
|
284
|
-
videoWidth: obj.videoWidth,
|
|
285
|
-
previewUrl: obj.previewImageUrl,
|
|
286
|
-
} : {},
|
|
287
|
-
webSiteLink: obj.webSiteLink,
|
|
288
|
-
}));
|
|
289
|
-
const fbContent = {
|
|
290
|
-
selectedAd: fbType,
|
|
291
|
-
previewData,
|
|
292
|
-
primaryText,
|
|
293
|
-
callToAction,
|
|
294
|
-
displayLink,
|
|
295
|
-
};
|
|
296
|
-
return fbContent;
|
|
297
|
-
}
|
|
298
266
|
default:
|
|
299
267
|
return get(templateDataObject, `versions.base.content`);
|
|
300
268
|
}
|
|
@@ -537,22 +505,6 @@ function SlideBoxContent(props) {
|
|
|
537
505
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
538
506
|
onTestContentClicked={onTestContentClicked}/>
|
|
539
507
|
}
|
|
540
|
-
{
|
|
541
|
-
isCreateFacebook && (
|
|
542
|
-
<Facebook
|
|
543
|
-
templateData={templateData}
|
|
544
|
-
messageDetails={messageDetails}
|
|
545
|
-
cap={cap}
|
|
546
|
-
onFacebookSubmit={onFacebookSubmit}
|
|
547
|
-
onCreateComplete={onCreateComplete}
|
|
548
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
549
|
-
isFullMode={isFullMode}
|
|
550
|
-
createNew
|
|
551
|
-
getFormSubscriptionData={getFormData}
|
|
552
|
-
|
|
553
|
-
/>
|
|
554
|
-
)
|
|
555
|
-
}
|
|
556
508
|
{
|
|
557
509
|
isEditFacebook && (
|
|
558
510
|
<Facebook
|
|
@@ -560,12 +512,7 @@ function SlideBoxContent(props) {
|
|
|
560
512
|
messageDetails={messageDetails}
|
|
561
513
|
cap={cap}
|
|
562
514
|
onFacebookSubmit={onFacebookSubmit}
|
|
563
|
-
onCreateComplete={onCreateComplete}
|
|
564
515
|
isFullMode={isFullMode}
|
|
565
|
-
params={{
|
|
566
|
-
id: templateData._id,
|
|
567
|
-
}}
|
|
568
|
-
getFormSubscriptionData={getFormData}
|
|
569
516
|
/>
|
|
570
517
|
)
|
|
571
518
|
}
|
|
@@ -649,7 +596,6 @@ SlideBoxContent.propTypes = {
|
|
|
649
596
|
onChannelChange: PropTypes.func,
|
|
650
597
|
currentChannel: PropTypes.string,
|
|
651
598
|
onEmailModeChange: PropTypes.func,
|
|
652
|
-
onFacebookAdModeChange: PropTypes.func,
|
|
653
599
|
emailCreateMode: PropTypes.string,
|
|
654
600
|
templateStep: PropTypes.string,
|
|
655
601
|
onCreateNextStep: PropTypes.func,
|
|
@@ -51,7 +51,6 @@ class Creatives extends React.Component {
|
|
|
51
51
|
currentChannel: this.props.channel || 'sms',
|
|
52
52
|
weChatTemplateType: '',
|
|
53
53
|
weChatMaptemplateStep: 0,
|
|
54
|
-
|
|
55
54
|
};
|
|
56
55
|
this.creativesTemplateSteps = {
|
|
57
56
|
1: 'modeSelection',
|
|
@@ -105,6 +104,7 @@ class Creatives extends React.Component {
|
|
|
105
104
|
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || currentChannel.toUpperCase() === constants.MOBILE_PUSH || currentChannel.toUpperCase() === constants.WECHAT) {
|
|
106
105
|
templateStep = prevState.templateStep + 2;
|
|
107
106
|
}
|
|
107
|
+
|
|
108
108
|
return {
|
|
109
109
|
templateStep,
|
|
110
110
|
};
|
|
@@ -114,8 +114,6 @@ class Creatives extends React.Component {
|
|
|
114
114
|
onEmailModeChange = (mode) => {
|
|
115
115
|
this.setState({ emailCreateMode: mode});
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
117
|
onMobilepushModeChange = (mode) => {
|
|
120
118
|
this.setState({ mobilePushCreateMode: mode});
|
|
121
119
|
}
|
|
@@ -363,11 +361,11 @@ class Creatives extends React.Component {
|
|
|
363
361
|
const { Templates, templateData: templateDataProps } = this.props;
|
|
364
362
|
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
365
363
|
const selectedViberAccount = Templates && Templates.selectedViberAccount;
|
|
366
|
-
const accountDetails =
|
|
364
|
+
const accountDetails = (selectedViberAccount ? JSON.stringify(selectedViberAccount) : selectedAccountDetails);
|
|
367
365
|
const accountId = selectedAccountId || (selectedViberAccount ? selectedViberAccount.id : '');
|
|
368
366
|
const { versions } = template.value;
|
|
369
367
|
const content = cloneDeep(versions.base.content);
|
|
370
|
-
content.scenarioKey = get(accountDetails, 'configs.scenario_key');
|
|
368
|
+
content.scenarioKey = accountDetails ? get(JSON.parse(accountDetails), 'configs.scenario_key') : "";
|
|
371
369
|
templateData = {
|
|
372
370
|
channel,
|
|
373
371
|
accountId,
|
|
@@ -481,19 +479,17 @@ class Creatives extends React.Component {
|
|
|
481
479
|
showFooter = true;
|
|
482
480
|
}
|
|
483
481
|
|
|
482
|
+
|
|
484
483
|
if (showFooter) {
|
|
485
|
-
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') ||
|
|
486
|
-
([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
484
|
+
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') || (channel === constants.SMS && currentStep === 'modeSelection') || (channel === constants.WECHAT && currentStep === 'modeSelection'))) {
|
|
487
485
|
showFooter = showFooter && !this.state.isLoadingContent;
|
|
488
|
-
} else if (slidBoxContent === "editTemplate" &&
|
|
489
|
-
([constants.SMS, constants.WECHAT, constants.EMAIL].includes(channel) &&
|
|
490
|
-
currentStep === 'modeSelection')) {
|
|
486
|
+
} else if (slidBoxContent === "editTemplate" && ((channel === constants.EMAIL && currentStep === 'modeSelection') || (channel === constants.SMS && currentStep === 'modeSelection') || (channel === constants.WECHAT && currentStep === 'modeSelection'))) {
|
|
491
487
|
showFooter = showFooter && !this.state.isLoadingContent;
|
|
492
488
|
}
|
|
493
489
|
}
|
|
494
490
|
|
|
495
491
|
const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
|
|
496
|
-
if ([constants.LINE, constants.VIBER
|
|
492
|
+
if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
|
|
497
493
|
showFooter = false;
|
|
498
494
|
}
|
|
499
495
|
|
|
@@ -577,13 +573,6 @@ class Creatives extends React.Component {
|
|
|
577
573
|
}
|
|
578
574
|
return false;
|
|
579
575
|
}
|
|
580
|
-
shouldShowHeader = () => {
|
|
581
|
-
const {currentChannel} = this.state;
|
|
582
|
-
if (currentChannel === constants.FACEBOOK) {
|
|
583
|
-
return false;
|
|
584
|
-
}
|
|
585
|
-
return true;
|
|
586
|
-
}
|
|
587
576
|
render() {
|
|
588
577
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
589
578
|
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
@@ -593,7 +582,7 @@ class Creatives extends React.Component {
|
|
|
593
582
|
<SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
594
583
|
<CapSlideBox
|
|
595
584
|
header={
|
|
596
|
-
|
|
585
|
+
<SlideBoxHeader
|
|
597
586
|
key="creatives-container-slidebox-header"
|
|
598
587
|
channel={currentChannel}
|
|
599
588
|
messages={this.props.messages}
|
|
@@ -610,7 +599,8 @@ class Creatives extends React.Component {
|
|
|
610
599
|
weChatTemplateType={weChatTemplateType}
|
|
611
600
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
612
601
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
613
|
-
/>
|
|
602
|
+
/>
|
|
603
|
+
}
|
|
614
604
|
content={
|
|
615
605
|
<SlideBoxContent
|
|
616
606
|
key="creatives-container-slidebox-content"
|
|
@@ -6,70 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
GET_MARKETING_OBJECTIVES,
|
|
9
|
-
UPLOAD_FB_AD_ASSET_REQUEST,
|
|
10
|
-
CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
11
|
-
EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
12
|
-
GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
|
|
13
|
-
CLEAR_FACEBOOK_AD_ASSET,
|
|
14
|
-
CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
|
|
15
|
-
CLEAR_FACEBOOK_AD_DATA,
|
|
16
|
-
CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
|
|
17
|
-
GET_ORG_OU_LIST_REQUEST,
|
|
18
9
|
} from './constants';
|
|
19
10
|
|
|
20
11
|
export const getMarketingObjectives = () => ({
|
|
21
12
|
type: GET_MARKETING_OBJECTIVES,
|
|
22
13
|
});
|
|
23
|
-
|
|
24
|
-
export const uploadFbAdAsset = (file, assetType, fileParams, templateType) => ({
|
|
25
|
-
type: UPLOAD_FB_AD_ASSET_REQUEST,
|
|
26
|
-
file,
|
|
27
|
-
assetType,
|
|
28
|
-
fileParams,
|
|
29
|
-
templateType,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const createTemplate = (template, callback) => ({
|
|
33
|
-
type: CREATE_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
34
|
-
template,
|
|
35
|
-
callback,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const getOrgOUs = (orgID) => ({
|
|
39
|
-
type: GET_ORG_OU_LIST_REQUEST,
|
|
40
|
-
orgID,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// FOR EDIT
|
|
44
|
-
|
|
45
|
-
export const editTemplate = (template, callback) => ({
|
|
46
|
-
type: EDIT_FACEBOOK_AD_TEMPLATE_REQUEST,
|
|
47
|
-
template,
|
|
48
|
-
callback,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const getTemplateDetails = (id, callback) => ({
|
|
52
|
-
type: GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST,
|
|
53
|
-
id,
|
|
54
|
-
channel: 'FACEBOOK',
|
|
55
|
-
callback,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const clearData = () => ({
|
|
59
|
-
type: CLEAR_FACEBOOK_AD_DATA,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export const clearEditResponse = () => ({
|
|
63
|
-
type: CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export const clearCreateResponse = () => ({
|
|
68
|
-
type: CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const clearFbAdAsset = (templateType) => ({
|
|
72
|
-
type: CLEAR_FACEBOOK_AD_ASSET,
|
|
73
|
-
templateType,
|
|
74
|
-
});
|
|
75
|
-
|
|
@@ -4,36 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const prefix = 'app/
|
|
7
|
+
const prefix = 'app/Facebook';
|
|
8
8
|
|
|
9
9
|
export const GET_MARKETING_OBJECTIVES = `${prefix}/GET_MARKETING_OBJECTIVES`;
|
|
10
10
|
export const SET_MARKETING_OBJECTIVES_SUCCESS = `${prefix}/SET_MARKETING_OBJECTIVES_SUCCESS`;
|
|
11
11
|
export const SET_MARKETING_OBJECTIVES_FAILURE = `${prefix}/SET_MARKETING_OBJECTIVES_FAILURE`;
|
|
12
|
-
export const UPLOAD_FB_AD_ASSET_REQUEST = `${prefix}/UPLOAD_ASSET_REQUEST`;
|
|
13
|
-
export const UPLOAD_FB_AD_ASSET_SUCCESS = `${prefix}/UPLOAD_ASSET_SUCCESS`;
|
|
14
|
-
export const UPLOAD_FB_AD_ASSET_FAILURE = `${prefix}/UPLOAD_ASSET_FAILURE`;
|
|
15
|
-
export const CREATE_FACEBOOK_AD_TEMPLATE_REQUEST = `${prefix}/CREATE_FACEBOOK_AD_TEMPLATE_REQUEST`;
|
|
16
|
-
export const CREATE_FACEBOOK_AD_TEMPLATE_SUCCESS = `${prefix}/CREATE_FACEBOOK_AD_TEMPLATE_SUCCESS`;
|
|
17
|
-
export const CREATE_FACEBOOK_AD_TEMPLATE_FAILURE = `${prefix}/CREATE_FACEBOOK_AD_TEMPLATE_FAILURE`;
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
export const GET_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST = `${prefix}/EDIT/CREATE_FACEBOOK_AD_TEMPLATE_DETAILS_REQUEST`;
|
|
21
|
-
export const GET_FACEBOOK_AD_TEMPLATE_DETAILS_SUCCESS = `${prefix}/EDIT/CREATE_FACEBOOK_AD_TEMPLATE_DETAILS_SUCCESS`;
|
|
22
|
-
export const GET_FACEBOOK_AD_TEMPLATE_DETAILS_FAILURE = `${prefix}/EDIT/CREATE_FACEBOOK_AD_TEMPLATE_DETAILS_FAILURE`;
|
|
23
|
-
|
|
24
|
-
export const EDIT_FACEBOOK_AD_TEMPLATE_REQUEST = `${prefix}/Edit/EDIT_FACEBOOK_AD_TEMPLATE_REQUEST`;
|
|
25
|
-
export const EDIT_FACEBOOK_AD_TEMPLATE_SUCCESS = `${prefix}/Edit/EDIT_FACEBOOK_AD_TEMPLATE_SUCCESS`;
|
|
26
|
-
export const EDIT_FACEBOOK_AD_TEMPLATE_FAILURE = `${prefix}/Edit/EDIT_FACEBOOK_AD_TEMPLATE_FAILURE`;
|
|
27
|
-
|
|
28
|
-
export const CLEAR_FACEBOOK_AD_EDIT_RESPONSE_REQUEST = `${prefix}/Edit/CLEAR_EDIT_RESPONSE_REQUEST`;
|
|
29
|
-
export const CLEAR_FACEBOOK_AD_DATA = `${prefix}/Edit/CLEAR_DATA`;
|
|
30
|
-
export const CLEAR_FACEBOOK_AD_CREATE_RESPONSE_REQUEST = `${prefix}/Create/CLEAR_EDIT_RESPONSE_REQUEST`;
|
|
31
|
-
export const CLEAR_FACEBOOK_AD_ASSET = `${prefix}/CLEAR_ASSET`;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export const GET_ORG_OU_LIST_REQUEST = `${prefix}/GET_ORG_OU_LIST_REQUEST`;
|
|
35
|
-
export const GET_ORG_OU_LIST_SUCCESS = `${prefix}/GET_ORG_OU_LIST_SUCCESS`;
|
|
36
|
-
export const GET_ORG_OU_LIST_FAILURE = `${prefix}/GET_ORG_OU_LIST_FAILURE`;
|
|
37
13
|
// marketing objectives constants
|
|
38
14
|
|
|
39
15
|
export const VALUE_APP_INSTALLS = 'VALUE_APP_INSTALLS';
|