@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
package/app.js
CHANGED
|
@@ -78,11 +78,6 @@ const bugSnagErrorCallback = (event) => {
|
|
|
78
78
|
id: orgId,
|
|
79
79
|
});
|
|
80
80
|
event.setUser(userId, userEmail, userName);
|
|
81
|
-
if (window.FS && window.FS.getCurrentSessionURL) {
|
|
82
|
-
event.addMetadata('fullstory', {
|
|
83
|
-
urlAtTime: window.FS.getCurrentSessionURL(true),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
81
|
};
|
|
87
82
|
|
|
88
83
|
Bugsnag.start({
|
package/index.html
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
20
20
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
21
21
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
22
|
-
})(window,document,'script','dataLayer','GTM-
|
|
22
|
+
})(window,document,'script','dataLayer','GTM-NGLVR5C');</script>
|
|
23
23
|
<!-- End Google Tag Manager -->
|
|
24
24
|
<script>try{Typekit.load({ async: true });}catch(e){console.log(e)}</script>
|
|
25
25
|
<title>Capillary - Creatives</title>
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<noscript>
|
|
29
|
-
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-
|
|
29
|
+
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NGLVR5C"
|
|
30
30
|
height="0" width="0" style="display:none;visibility:hidden"></iframe>
|
|
31
31
|
</noscript>
|
|
32
32
|
<!-- End Google Tag Manager (noscript) -->
|
package/index.js
CHANGED
|
@@ -76,8 +76,8 @@ import viberSaga from './v2Containers/Viber/sagas';
|
|
|
76
76
|
import TemplatesV2 from './v2Containers/TemplatesV2/index';
|
|
77
77
|
|
|
78
78
|
import FacebookPreview from './v2Containers/CapFacebookPreview';
|
|
79
|
-
import
|
|
80
|
-
import
|
|
79
|
+
import FacebookPreviewReducer from './v2Containers/CapFacebookPreview/reducer';
|
|
80
|
+
import FacebookPreviewSaga from './v2Containers/CapFacebookPreview/sagas';
|
|
81
81
|
|
|
82
82
|
import CreativesContainer from './v2Containers/CreativesContainer';
|
|
83
83
|
import CreativesContainerReducer from './v2Containers/CreativesContainer/reducer';
|
|
@@ -105,7 +105,7 @@ const LineCreateContainer = {LineCreate, lineCreateReducer, lineCreateSaga};
|
|
|
105
105
|
const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
106
106
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
107
107
|
const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
108
|
-
const FacebookPreviewContainer = { FacebookPreview,
|
|
108
|
+
const FacebookPreviewContainer = { FacebookPreview, FacebookPreviewReducer, FacebookPreviewSaga };
|
|
109
109
|
|
|
110
110
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
111
111
|
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@babel/polyfill": "7.4.3",
|
|
16
16
|
"@bugsnag/js": "^7.2.1",
|
|
17
17
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
|
-
"@capillarytech/cap-ui-utils": "1.4
|
|
18
|
+
"@capillarytech/cap-ui-utils": "1.3.4",
|
|
19
19
|
"@mailupinc/bee-plugin": "^1.2.0",
|
|
20
20
|
"babel-cli": "^6.26.0",
|
|
21
21
|
"chalk": "1.1.3",
|
package/services/api.js
CHANGED
|
@@ -70,8 +70,6 @@ function checkStatus(response) {
|
|
|
70
70
|
tracker.trackException({
|
|
71
71
|
description: `API Error ${requestCallerName} returned ${status}`,
|
|
72
72
|
fatal: true,
|
|
73
|
-
apiError: true,
|
|
74
|
-
statusCode: status
|
|
75
73
|
});
|
|
76
74
|
}
|
|
77
75
|
if ((status >= 200 && status < 300) || [500, 409, 413].includes(response.status)) {
|
|
@@ -19,8 +19,6 @@ export const TRACK_CREATE_MPUSH = 'createMpush';
|
|
|
19
19
|
export const TRACK_CREATE_WECHAT = 'createWeChat';
|
|
20
20
|
export const TRACK_CREATE_IMAGE = 'createImage';
|
|
21
21
|
export const TRACK_CREATE_LINE = 'createLine';
|
|
22
|
-
export const TRACK_CREATE_VIBER = 'createViber';
|
|
23
|
-
export const TRACK_CREATE_FACEBOOK = 'createFacebook';
|
|
24
22
|
|
|
25
23
|
export const CREATE = 'create';
|
|
26
24
|
export const EDIT = 'edit';
|
|
@@ -35,8 +33,6 @@ export const TRACK_EDIT_MPUSH = 'editMpush';
|
|
|
35
33
|
export const TRACK_EDIT_WECHAT = 'editWeChat';
|
|
36
34
|
export const TRACK_EDIT_IMAGE = 'editImage';
|
|
37
35
|
export const TRACK_EDIT_LINE = 'editLine';
|
|
38
|
-
export const TRACK_EDIT_VIBER = 'editViber';
|
|
39
|
-
export const TRACK_EDIT_FACEBOOK = 'editFacebook';
|
|
40
36
|
|
|
41
37
|
export const CHANNEL_CREATE_TRACK_MAPPING = {
|
|
42
38
|
sms: TRACK_CREATE_SMS,
|
|
@@ -45,8 +41,6 @@ export const CHANNEL_CREATE_TRACK_MAPPING = {
|
|
|
45
41
|
wechat: TRACK_CREATE_WECHAT,
|
|
46
42
|
gallery: TRACK_CREATE_IMAGE,
|
|
47
43
|
line: TRACK_CREATE_LINE,
|
|
48
|
-
viber: TRACK_CREATE_VIBER,
|
|
49
|
-
facebook: TRACK_CREATE_FACEBOOK
|
|
50
44
|
};
|
|
51
45
|
|
|
52
46
|
export const CHANNEL_EDIT_TRACK_MAPPING = {
|
|
@@ -56,8 +50,6 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
|
|
|
56
50
|
wechat: TRACK_EDIT_WECHAT,
|
|
57
51
|
gallery: TRACK_EDIT_IMAGE,
|
|
58
52
|
line: TRACK_EDIT_LINE,
|
|
59
|
-
viber: TRACK_EDIT_VIBER,
|
|
60
|
-
facebook: TRACK_EDIT_FACEBOOK
|
|
61
53
|
};
|
|
62
54
|
export const GTM_TRACKING_ID = 'UA-110024621-2';
|
|
63
55
|
export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
@@ -83,6 +75,3 @@ export const FB_AD_CALL_TO_ACTION = {
|
|
|
83
75
|
SUBSCRIBE,
|
|
84
76
|
WATCH_MORE,
|
|
85
77
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export const CREATIVES = 'creatives';
|
|
@@ -77,11 +77,13 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
77
77
|
if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
78
78
|
this.setState({ isCreativesAccessible: false });
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
this.setDimensionData(userGtmData);
|
|
82
|
-
gtm.push({...userGtmData, event: 'userAuthenticated'});
|
|
80
|
+
this.setDimensionData();
|
|
83
81
|
});
|
|
84
82
|
this.props.actions.getTopbarMenuData();
|
|
83
|
+
if (this.props.Global.user) {
|
|
84
|
+
const userGtmData = this.getUserGtmData();
|
|
85
|
+
gtm.push(userGtmData);
|
|
86
|
+
}
|
|
85
87
|
if (this.props.Global.orgID !== undefined) {
|
|
86
88
|
gtm.push({orgId: this.props.Global.orgID});
|
|
87
89
|
}
|
|
@@ -131,6 +133,18 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
131
133
|
if (nextPropsUser && user && nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
|
|
132
134
|
this.props.appActions.getSidebar();
|
|
133
135
|
}
|
|
136
|
+
|
|
137
|
+
if (nextProps.Global.user && this.props.Global.user && (nextProps.Global.user.refID !== this.props.Global.user.refID)) {
|
|
138
|
+
const userGtmData = this.getUserGtmData(nextProps);
|
|
139
|
+
gtm.push(userGtmData);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
|
|
143
|
+
if (nextProps.Global.orgID !== undefined && !_.isEqual(nextProps.Global.orgID, this.props.Global.orgID)) {
|
|
144
|
+
const userGtmData = this.getUserGtmData(nextProps);
|
|
145
|
+
gtm.push(userGtmData);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
134
148
|
}
|
|
135
149
|
|
|
136
150
|
componentDidUpdate(prevProps) {
|
|
@@ -168,34 +182,26 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
168
182
|
logNewTab();
|
|
169
183
|
}
|
|
170
184
|
|
|
171
|
-
setDimensionData(
|
|
185
|
+
setDimensionData() {
|
|
186
|
+
const userGtmData = this.getUserGtmData();
|
|
172
187
|
Object.values(userGtmData).forEach((value, index) => {
|
|
173
188
|
GA.setCustomDimension({ [`dimension${index + 1}`]: value });
|
|
174
189
|
});
|
|
175
190
|
}
|
|
176
191
|
getUserGtmData(props) {
|
|
177
192
|
const selectedProps = props || this.props;
|
|
178
|
-
const { user: userData
|
|
193
|
+
const { user: userData } = selectedProps.Global;
|
|
179
194
|
if (userData) {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
EMAIL : userEmail
|
|
184
|
-
} = {},
|
|
185
|
-
proxyOrgList,
|
|
186
|
-
isCapUser,
|
|
187
|
-
refID
|
|
188
|
-
} = userData;
|
|
189
|
-
const {
|
|
190
|
-
orgName
|
|
191
|
-
} = _.find(proxyOrgList, {orgID});
|
|
195
|
+
const userName = userData.attributes.USERNAME;
|
|
196
|
+
const userEmail = userData.attributes.EMAIL;
|
|
197
|
+
const orgObj = _.find(userData.proxyOrgList, {orgID: selectedProps.Global.orgID});
|
|
192
198
|
const gtmData = {
|
|
193
|
-
isCapUser: isCapUser,
|
|
194
|
-
orgId: orgID,
|
|
195
|
-
orgName,
|
|
196
|
-
userId: refID,
|
|
197
|
-
userName: userName
|
|
198
|
-
userEmail: userEmail
|
|
199
|
+
isCapUser: userData.isCapUser,
|
|
200
|
+
orgId: selectedProps.Global.orgID,
|
|
201
|
+
orgName: orgObj && orgObj.orgName,
|
|
202
|
+
userId: userData.refID,
|
|
203
|
+
userName: userName && userName.value,
|
|
204
|
+
userEmail: userEmail && userEmail.value,
|
|
199
205
|
};
|
|
200
206
|
return gtmData;
|
|
201
207
|
}
|
|
@@ -45,7 +45,6 @@ export const CapFacebookPreview = (props) => {
|
|
|
45
45
|
orgUnitFacebookPageSettingsMap = {},
|
|
46
46
|
accessToken,
|
|
47
47
|
accountId,
|
|
48
|
-
defaultGeneratePreview,
|
|
49
48
|
} = props;
|
|
50
49
|
const {
|
|
51
50
|
formatMessage,
|
|
@@ -295,10 +294,11 @@ export const CapFacebookPreview = (props) => {
|
|
|
295
294
|
<iframe
|
|
296
295
|
src={src}
|
|
297
296
|
key={random}
|
|
297
|
+
scrolling="yes"
|
|
298
298
|
style={{border: "none"}}
|
|
299
299
|
width={width}
|
|
300
|
-
scrolling="yes"
|
|
301
300
|
height={height}
|
|
301
|
+
loading="lazy"
|
|
302
302
|
/>
|
|
303
303
|
</>);
|
|
304
304
|
};
|
|
@@ -317,9 +317,6 @@ export const CapFacebookPreview = (props) => {
|
|
|
317
317
|
|
|
318
318
|
useEffect(() => {
|
|
319
319
|
facebookPreviewActions.clearPreview();
|
|
320
|
-
if (defaultGeneratePreview) {
|
|
321
|
-
generatePreview();
|
|
322
|
-
}
|
|
323
320
|
}, []);
|
|
324
321
|
|
|
325
322
|
useEffect(() => {
|
|
@@ -338,6 +335,7 @@ export const CapFacebookPreview = (props) => {
|
|
|
338
335
|
setDisableAfterPreviewGenerate(false);
|
|
339
336
|
}
|
|
340
337
|
}, [previewIframeError]);
|
|
338
|
+
|
|
341
339
|
return (
|
|
342
340
|
<CapSpin spinning={isFetchingPreview}>
|
|
343
341
|
<div style={{display: 'inline-block'}}>
|
|
@@ -137,10 +137,6 @@ function SlideBoxContent(props) {
|
|
|
137
137
|
handleClose,
|
|
138
138
|
onFTPSubmit,
|
|
139
139
|
campaignSettings,
|
|
140
|
-
messageStrategy,
|
|
141
|
-
fbAdManager,
|
|
142
|
-
showDisabledFBInfo,
|
|
143
|
-
orgUnitId,
|
|
144
140
|
} = props;
|
|
145
141
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
146
142
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -338,9 +334,6 @@ function SlideBoxContent(props) {
|
|
|
338
334
|
slidBoxContent={slidBoxContent}
|
|
339
335
|
FTPMode="create"
|
|
340
336
|
selectedOfferDetails={selectedOfferDetails}
|
|
341
|
-
messageStrategy={messageStrategy}
|
|
342
|
-
showDisabledFBInfo={showDisabledFBInfo}
|
|
343
|
-
orgUnitId={orgUnitId}
|
|
344
337
|
/>
|
|
345
338
|
)}
|
|
346
339
|
{isPreview && (
|
|
@@ -565,10 +558,7 @@ function SlideBoxContent(props) {
|
|
|
565
558
|
isFullMode={isFullMode}
|
|
566
559
|
createNew
|
|
567
560
|
getFormSubscriptionData={getFormData}
|
|
568
|
-
|
|
569
|
-
fbAdManager={fbAdManager}
|
|
570
|
-
onSelectTemplate={onSelectTemplate}
|
|
571
|
-
orgUnitId={orgUnitId}
|
|
561
|
+
|
|
572
562
|
/>
|
|
573
563
|
)
|
|
574
564
|
}
|
|
@@ -585,7 +575,6 @@ function SlideBoxContent(props) {
|
|
|
585
575
|
id: templateData._id,
|
|
586
576
|
}}
|
|
587
577
|
getFormSubscriptionData={getFormData}
|
|
588
|
-
fbAdManager={fbAdManager}
|
|
589
578
|
/>
|
|
590
579
|
)
|
|
591
580
|
}
|
|
@@ -698,9 +687,5 @@ SlideBoxContent.propTypes = {
|
|
|
698
687
|
saveMessage: PropTypes.func,
|
|
699
688
|
selectedAccount: PropTypes.object,
|
|
700
689
|
onFTPSubmit: PropTypes.func,
|
|
701
|
-
messageStrategy: PropTypes.string,
|
|
702
|
-
fbAdManager: PropTypes.string,
|
|
703
|
-
showDisabledFBInfo: PropTypes.boolean,
|
|
704
|
-
orgUnitId: PropTypes.any,
|
|
705
690
|
};
|
|
706
691
|
export default SlideBoxContent;
|
|
@@ -25,9 +25,6 @@ import {isLoading as isLoadingSelector} from './selectors';
|
|
|
25
25
|
import messages from './messages';
|
|
26
26
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
27
27
|
import { makeSelectFetchingCmsData } from '../Email/selectors';
|
|
28
|
-
import {IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
29
|
-
import { CREATIVE } from '../Facebook/constants';
|
|
30
|
-
|
|
31
28
|
|
|
32
29
|
const classPrefix = 'add-creatives-section';
|
|
33
30
|
|
|
@@ -54,6 +51,7 @@ class Creatives extends React.Component {
|
|
|
54
51
|
currentChannel: this.props.channel || 'sms',
|
|
55
52
|
weChatTemplateType: '',
|
|
56
53
|
weChatMaptemplateStep: 0,
|
|
54
|
+
|
|
57
55
|
};
|
|
58
56
|
this.creativesTemplateSteps = {
|
|
59
57
|
1: 'modeSelection',
|
|
@@ -76,12 +74,8 @@ class Creatives extends React.Component {
|
|
|
76
74
|
this.setState({templateNameExists: false});
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
onSelectTemplate = (template
|
|
80
|
-
|
|
81
|
-
if (fbAdManager) {
|
|
82
|
-
data.fbAdManager = fbAdManager;
|
|
83
|
-
}
|
|
84
|
-
this.setState(data);
|
|
77
|
+
onSelectTemplate = (template) => {
|
|
78
|
+
this.setState({ slidBoxContent: 'editTemplate', templateData: template });
|
|
85
79
|
};
|
|
86
80
|
onPreviewTemplate = (template) => {
|
|
87
81
|
const templateData = template;
|
|
@@ -93,12 +87,8 @@ class Creatives extends React.Component {
|
|
|
93
87
|
onEditTemplate = () => {
|
|
94
88
|
this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
|
|
95
89
|
};
|
|
96
|
-
onCreateNew = (
|
|
97
|
-
|
|
98
|
-
if (fbAdManager) {
|
|
99
|
-
data.fbAdManager = fbAdManager;
|
|
100
|
-
}
|
|
101
|
-
this.setState(data);
|
|
90
|
+
onCreateNew = () => {
|
|
91
|
+
this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true });
|
|
102
92
|
};
|
|
103
93
|
|
|
104
94
|
onShowTemplates = () => {
|
|
@@ -230,61 +220,11 @@ class Creatives extends React.Component {
|
|
|
230
220
|
break;
|
|
231
221
|
}
|
|
232
222
|
case constants.FACEBOOK: {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
} = templateData || {};
|
|
239
|
-
const fBContent = fbCreativeList;
|
|
240
|
-
const facebookCreativeList = [];
|
|
241
|
-
fBContent.forEach((obj) => {
|
|
242
|
-
const data = cloneDeep(obj);
|
|
243
|
-
const {subType, linkDescription, imageLink, websiteLink, videoId, videoName, videoUrl} = obj || {};
|
|
244
|
-
delete data.linkDescription;
|
|
245
|
-
delete data.websiteLink;
|
|
246
|
-
data.linkDesc = linkDescription;
|
|
247
|
-
data.webSiteLink = websiteLink;
|
|
248
|
-
data.type = creativeType;
|
|
249
|
-
switch (subType) {
|
|
250
|
-
case IMAGE:
|
|
251
|
-
data.imgSrc = imageLink;
|
|
252
|
-
delete data.imageLink;
|
|
253
|
-
break;
|
|
254
|
-
case VIDEO:
|
|
255
|
-
data.video = {
|
|
256
|
-
previewImageUrl: imageLink,
|
|
257
|
-
videoId,
|
|
258
|
-
videoSrc: videoUrl,
|
|
259
|
-
videoName,
|
|
260
|
-
};
|
|
261
|
-
delete data.imageLink;
|
|
262
|
-
break;
|
|
263
|
-
default:
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
facebookCreativeList.push(data);
|
|
267
|
-
});
|
|
268
|
-
creativesTemplateData = {
|
|
269
|
-
versions: {
|
|
270
|
-
base: {
|
|
271
|
-
content: {
|
|
272
|
-
FacebookAd: {...facebookCreativeList},
|
|
273
|
-
pageOrgUnitId: this.props.orgUnitId,
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
type: constants.FACEBOOK,
|
|
278
|
-
edit: true,
|
|
279
|
-
selectedFacebookAccount,
|
|
280
|
-
};
|
|
281
|
-
} else {
|
|
282
|
-
creativesTemplateData = {
|
|
283
|
-
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
284
|
-
edit: true,
|
|
285
|
-
type: channel,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
223
|
+
creativesTemplateData = {
|
|
224
|
+
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
225
|
+
edit: true,
|
|
226
|
+
type: channel,
|
|
227
|
+
};
|
|
288
228
|
break;
|
|
289
229
|
}
|
|
290
230
|
case constants.LINE: {
|
|
@@ -436,50 +376,6 @@ class Creatives extends React.Component {
|
|
|
436
376
|
};
|
|
437
377
|
}
|
|
438
378
|
break;
|
|
439
|
-
case constants.FACEBOOK: {
|
|
440
|
-
if (template.value) {
|
|
441
|
-
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
442
|
-
const type = FacebookAd[0].type;
|
|
443
|
-
const {accountId} = this.props.Templates.selectedFacebookAccount || template.value || {};
|
|
444
|
-
const facebookCreativeList = [];
|
|
445
|
-
const fBContent = Object.values(FacebookAd);
|
|
446
|
-
fBContent.forEach((obj) => {
|
|
447
|
-
const data = cloneDeep(obj);
|
|
448
|
-
const {subType, linkDesc, imgSrc, webSiteLink, video} = obj;
|
|
449
|
-
delete data.type;
|
|
450
|
-
delete data.linkDesc;
|
|
451
|
-
delete data.webSiteLink;
|
|
452
|
-
data.linkDescription = linkDesc;
|
|
453
|
-
data.websiteLink = webSiteLink;
|
|
454
|
-
|
|
455
|
-
switch (subType) {
|
|
456
|
-
case IMAGE:
|
|
457
|
-
data.imageLink = imgSrc;
|
|
458
|
-
delete data.imgSrc;
|
|
459
|
-
break;
|
|
460
|
-
case VIDEO:
|
|
461
|
-
data.imageLink = video.previewImageUrl;
|
|
462
|
-
data.videoId = video.videoId;
|
|
463
|
-
data.videoUrl = video.videoSrc;
|
|
464
|
-
data.videoName = video.videoName;
|
|
465
|
-
delete data.video;
|
|
466
|
-
break;
|
|
467
|
-
default:
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
facebookCreativeList.push(data);
|
|
471
|
-
});
|
|
472
|
-
templateData = {
|
|
473
|
-
fbContentType: CREATIVE,
|
|
474
|
-
creativeType: type,
|
|
475
|
-
facebookCreativeList,
|
|
476
|
-
channel: constants.FACEBOOK,
|
|
477
|
-
accountId,
|
|
478
|
-
selectedMarketingObjective: template.value.selectedMarketingObjective,
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
break;
|
|
483
379
|
default:
|
|
484
380
|
break;
|
|
485
381
|
}
|
|
@@ -682,8 +578,8 @@ class Creatives extends React.Component {
|
|
|
682
578
|
return false;
|
|
683
579
|
}
|
|
684
580
|
shouldShowHeader = () => {
|
|
685
|
-
const {currentChannel
|
|
686
|
-
if (currentChannel
|
|
581
|
+
const {currentChannel} = this.state;
|
|
582
|
+
if (currentChannel === constants.FACEBOOK) {
|
|
687
583
|
return false;
|
|
688
584
|
}
|
|
689
585
|
return true;
|
|
@@ -726,7 +622,6 @@ class Creatives extends React.Component {
|
|
|
726
622
|
campaignSettings={this.props.Templates.campaignSettings}
|
|
727
623
|
location={this.props.location}
|
|
728
624
|
messageDetails={this.props.messageDetails}
|
|
729
|
-
showDisabledFBInfo={this.props.showDisabledFBInfo}
|
|
730
625
|
getFormData={this.getFormData}
|
|
731
626
|
onCallTaskSubmit={this.onCallTaskSubmit}
|
|
732
627
|
onCreateNew={this.onCreateNew}
|
|
@@ -742,7 +637,6 @@ class Creatives extends React.Component {
|
|
|
742
637
|
onEnterTemplateName={this.onEnterTemplateName}
|
|
743
638
|
onRemoveTemplateName={this.onRemoveTemplateName}
|
|
744
639
|
onResetStep={this.resetStep}
|
|
745
|
-
fbAdManager={this.state.fbAdManager}
|
|
746
640
|
cap={cap}
|
|
747
641
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
748
642
|
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
@@ -767,8 +661,6 @@ class Creatives extends React.Component {
|
|
|
767
661
|
handleClose={this.handleCloseSlideBox}
|
|
768
662
|
onFTPSubmit={getCreativesData}
|
|
769
663
|
editor={editor}
|
|
770
|
-
messageStrategy={this.props.strategy}
|
|
771
|
-
orgUnitId={this.props.orgUnitId}
|
|
772
664
|
/>
|
|
773
665
|
}
|
|
774
666
|
footer={this.shouldShowFooter() &&
|
|
@@ -821,8 +713,6 @@ Creatives.propTypes = {
|
|
|
821
713
|
selectedWeChatAccount: PropTypes.object,
|
|
822
714
|
Templates: PropTypes.object,
|
|
823
715
|
selectedAccount: PropTypes.object,
|
|
824
|
-
strategy: PropTypes.string,
|
|
825
|
-
orgUnitId: PropTypes.number,
|
|
826
716
|
};
|
|
827
717
|
const mapStatesToProps = () => createStructuredSelector({
|
|
828
718
|
isLoading: isLoadingSelector(),
|
|
@@ -31,9 +31,8 @@ import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
|
31
31
|
import withCreatives from '../../hoc/withCreatives';
|
|
32
32
|
import { EMAIL } from '../CreativesContainer/constants';
|
|
33
33
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
34
|
-
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL, BEE_PLUGIN
|
|
34
|
+
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL, BEE_PLUGIN } from '../App/constants';
|
|
35
35
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
36
|
-
import { gtmPush } from '../../utils/gtmTrackers';
|
|
37
36
|
const {CapCustomCardList} = CapCustomCard;
|
|
38
37
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
39
38
|
constructor(props) {
|
|
@@ -657,9 +656,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
657
656
|
});
|
|
658
657
|
}
|
|
659
658
|
onUpdateTemplateComplete = (createResponse) => {
|
|
660
|
-
const {isEdit, formData = {} } =
|
|
659
|
+
const {isEdit, formData = {} } = this.state || {};
|
|
661
660
|
const base = formData.base || {};
|
|
662
|
-
const { activeTab } = base;
|
|
663
661
|
const isDragDrop = _.get(base[base.activeTab], 'is_drag_drop');
|
|
664
662
|
let editorType = '';
|
|
665
663
|
if ( isDragDrop === true && this.checkBeeEditorAllowedForLibrary()) {
|
|
@@ -667,21 +665,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
667
665
|
} else if (isDragDrop === false && !this.checkBeeEditorAllowedForLibrary()) {
|
|
668
666
|
editorType = 'ckEditor';
|
|
669
667
|
}
|
|
670
|
-
|
|
668
|
+
GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL, {
|
|
671
669
|
category: 'Creatives',
|
|
672
670
|
action: isEdit ? TRACK_EDIT_EMAIL : TRACK_CREATE_EMAIL,
|
|
673
671
|
label: `using ${editorType}`,
|
|
674
672
|
});
|
|
675
673
|
if (createResponse && createResponse.templateId) {
|
|
676
|
-
gtmPush('creativeDetails', {
|
|
677
|
-
id: createResponse.templateId._id || createResponse.templateId,
|
|
678
|
-
name: formData['template-name'],
|
|
679
|
-
channel: EMAIL,
|
|
680
|
-
timeTaken,
|
|
681
|
-
content: base?.[activeTab]?.['template-content'],
|
|
682
|
-
mode: isEdit ? EDIT : CREATE
|
|
683
|
-
});
|
|
684
|
-
|
|
685
674
|
// this.resetSchema();
|
|
686
675
|
let message;
|
|
687
676
|
if (isEdit) {
|
|
@@ -27,8 +27,6 @@ import Email from '../Email';
|
|
|
27
27
|
import CmsTemplatesComponent from '../../v2Components/CmsTemplatesComponent';
|
|
28
28
|
import messages from './messages';
|
|
29
29
|
import { CHANNEL_CREATE_TRACK_MAPPING } from '../App/constants';
|
|
30
|
-
import { gtmPush } from '../../utils/gtmTrackers';
|
|
31
|
-
import { EMAIL } from '../CreativesContainer/constants';
|
|
32
30
|
|
|
33
31
|
const CapRadioCardWithLabel = ComponentWithLabelHOC(CapRadioCard);
|
|
34
32
|
const { timeTracker } = GA;
|
|
@@ -118,18 +116,13 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
118
116
|
};
|
|
119
117
|
CapNotification.error(message);
|
|
120
118
|
}
|
|
121
|
-
stopTimerGA
|
|
119
|
+
stopTimerGA=() => {
|
|
122
120
|
// stop timer
|
|
123
|
-
|
|
121
|
+
timeTracker.stopTimer(CHANNEL_CREATE_TRACK_MAPPING.email, {
|
|
124
122
|
category: 'Creatives',
|
|
125
123
|
action: 'Create',
|
|
126
124
|
label: 'uploadZip',
|
|
127
125
|
});
|
|
128
|
-
gtmPush('creativeDetails', {
|
|
129
|
-
channel: EMAIL,
|
|
130
|
-
timeTaken,
|
|
131
|
-
mode: 'uploadZip'
|
|
132
|
-
});
|
|
133
126
|
}
|
|
134
127
|
handleFileUpload = (file = {}) => {
|
|
135
128
|
const { templatesActions, intl, showNextStep, isUploading } = this.props;
|
|
@@ -140,8 +133,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
140
133
|
|
|
141
134
|
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
142
135
|
templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
|
|
143
|
-
this.stopTimerGA();
|
|
144
136
|
this.setState({ modeContent: { file } }, showNextStep);
|
|
137
|
+
stopTimerGA();
|
|
145
138
|
}, this.handleZipUploadError);
|
|
146
139
|
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
147
140
|
const reader = new FileReader();
|