@capillarytech/creatives-library 7.7.0 → 7.7.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/app.js +5 -0
- package/index.html +2 -2
- package/index.js +3 -3
- package/package.json +4 -2
- package/services/api.js +2 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +41 -0
- package/utils/gtmTrackers/index.js +17 -0
- package/v2Components/TemplatePreview/index.js +1 -0
- package/v2Containers/App/constants.js +11 -0
- package/v2Containers/Cap/index.js +23 -29
- package/v2Containers/CapFacebookPreview/index.js +9 -9
- package/v2Containers/CapFacebookPreview/index.scss +15 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -1
- package/v2Containers/CreativesContainer/index.js +122 -12
- package/v2Containers/Email/index.js +14 -3
- package/v2Containers/EmailWrapper/index.js +10 -3
- package/v2Containers/Facebook/Advertisement/index.js +72 -36
- package/v2Containers/Facebook/Advertisement/index.scss +1 -1
- package/v2Containers/Facebook/Facebook.style.js +1 -1
- package/v2Containers/Facebook/constants.js +4 -0
- package/v2Containers/Facebook/index.js +198 -122
- package/v2Containers/Facebook/messages.js +24 -4
- package/v2Containers/Line/Container/index.js +32 -4
- package/v2Containers/MobilePush/Create/index.js +25 -4
- package/v2Containers/MobilePush/Edit/index.js +27 -5
- package/v2Containers/MobilePush/Edit/sagas.js +1 -1
- package/v2Containers/MobilePush/commonMethods.js +19 -1
- package/v2Containers/Sms/Create/index.js +14 -2
- package/v2Containers/Sms/Edit/index.js +15 -2
- package/v2Containers/Templates/index.js +43 -27
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +4 -2
- package/v2Containers/TemplatesV2/index.js +23 -6
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Viber/index.js +19 -3
- package/v2Containers/WeChat/MapTemplates/index.js +12 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +11 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
|
-
import React, { useState, useEffect } from "react";
|
|
7
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
8
8
|
import { injectIntl, FormattedMessage, intlShape } from "react-intl";
|
|
9
9
|
import {
|
|
10
10
|
CapHeading,
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
CapDrawer,
|
|
16
16
|
CapCustomCard,
|
|
17
17
|
CapIcon,
|
|
18
|
+
CapRadioGroup,
|
|
19
|
+
CapTooltip,
|
|
18
20
|
} from '@capillarytech/cap-ui-library';
|
|
21
|
+
import Templates from '../Templates';
|
|
19
22
|
import { createStructuredSelector } from 'reselect';
|
|
20
23
|
import { connect } from 'react-redux';
|
|
21
24
|
import { bindActionCreators } from 'redux';
|
|
@@ -38,6 +41,8 @@ import {
|
|
|
38
41
|
VALUE_REACH,
|
|
39
42
|
VALUE_VIDEO_VIEWS,
|
|
40
43
|
VALUE_LINK_CLICKS,
|
|
44
|
+
AD_MANAGER,
|
|
45
|
+
CREATIVE,
|
|
41
46
|
} from './constants';
|
|
42
47
|
|
|
43
48
|
const StyledCampaignDetailCapColumn = withStyles(CapColumn, CampaignDetailCapColumn);
|
|
@@ -183,12 +188,25 @@ const Facebook = (props) => {
|
|
|
183
188
|
onCreateComplete,
|
|
184
189
|
params,
|
|
185
190
|
facebookTemplateData,
|
|
191
|
+
messageStrategy,
|
|
192
|
+
router,
|
|
193
|
+
handlePeviewTemplate,
|
|
194
|
+
renderNewCardGrid,
|
|
195
|
+
onSelectTemplate,
|
|
196
|
+
createNew,
|
|
197
|
+
fbAdManager,
|
|
198
|
+
getFormSubscriptionData,
|
|
199
|
+
showDisabledFBInfo,
|
|
200
|
+
orgUnitId,
|
|
186
201
|
} = props;
|
|
187
202
|
const {
|
|
188
203
|
selectedMarketingObjective: fbMarketingObjectiveValue = VALUE_REACH,
|
|
189
204
|
} = templateData || {};
|
|
190
205
|
const [isDrawerVisible, setDrawerVisibility] = useState(false);
|
|
191
206
|
const [selectedMarketingObjective, setMarketingObjective] = useState(socialObjective || fbMarketingObjectiveValue);
|
|
207
|
+
const [adManager, setAdManager] = useState(AD_MANAGER);
|
|
208
|
+
const [showTemplateList, setTemplateList] = useState(false);
|
|
209
|
+
|
|
192
210
|
|
|
193
211
|
useEffect(() => {
|
|
194
212
|
if (!isFullMode) {
|
|
@@ -225,131 +243,188 @@ const Facebook = (props) => {
|
|
|
225
243
|
|
|
226
244
|
const onMarketingObjectiveSelect = (value) => setMarketingObjective(value);
|
|
227
245
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<CapHeading type="h4">
|
|
234
|
-
<FormattedMessage {...messages.fbAccount} />
|
|
235
|
-
</CapHeading>
|
|
236
|
-
<CapHeading type="h3">{accountName}</CapHeading>
|
|
237
|
-
</div>
|
|
246
|
+
const radioOptions = [{
|
|
247
|
+
label: showDisabledFBInfo ? <CapTooltip title={intl.formatMessage(messages.facebookDisableinfo)}>{intl.formatMessage(messages.capFbAdManager)}</CapTooltip> : intl.formatMessage(messages.capFbAdManager), value: CREATIVE, disabled: showDisabledFBInfo,
|
|
248
|
+
}, {
|
|
249
|
+
label: intl.formatMessage(messages.fbAdManager), value: AD_MANAGER,
|
|
250
|
+
}];
|
|
238
251
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
</CapHeading>
|
|
243
|
-
<CapLabel type="label1">
|
|
244
|
-
<FormattedMessage
|
|
245
|
-
{...messages.fbAdCampaignSetDetailsDescription}
|
|
246
|
-
/>
|
|
247
|
-
</CapLabel>
|
|
248
|
-
</div>
|
|
252
|
+
const onChangeAdManager = useCallback(({ target: { value } }) => {
|
|
253
|
+
setAdManager(value);
|
|
254
|
+
}, [setAdManager]);
|
|
249
255
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
256
|
+
const onFacebookAdManagerContinue = useCallback(() => {
|
|
257
|
+
if (adManager === AD_MANAGER) {
|
|
258
|
+
onFacebookSubmit({ channel: "FACEBOOK", selectedMarketingObjective, accountId });
|
|
259
|
+
} else {
|
|
260
|
+
setTemplateList(true);
|
|
261
|
+
}
|
|
262
|
+
}, [
|
|
263
|
+
selectedMarketingObjective,
|
|
264
|
+
accountId,
|
|
265
|
+
adManager,
|
|
266
|
+
setAdManager,
|
|
267
|
+
setTemplateList,
|
|
268
|
+
showTemplateList,
|
|
269
|
+
]);
|
|
270
|
+
const query = {type: 'embedded', module: 'library'};
|
|
271
|
+
const location = {pathname: `/FACEBOOK`, search: '', query};
|
|
272
|
+
return (showTemplateList ? (
|
|
273
|
+
<Templates
|
|
274
|
+
key={"FACEBOOK"}
|
|
275
|
+
location={location}
|
|
276
|
+
route={{name: "FACEBOOK"}}
|
|
277
|
+
router={router}
|
|
278
|
+
isFullMode={isFullMode}
|
|
279
|
+
createNew={createNew}
|
|
280
|
+
onSelectTemplate={onSelectTemplate}
|
|
281
|
+
renderNewCardGrid={renderNewCardGrid}
|
|
282
|
+
handlePeviewTemplate={handlePeviewTemplate}
|
|
283
|
+
fbAdManager={CREATIVE}
|
|
284
|
+
/>
|
|
285
|
+
) :
|
|
286
|
+
(!isFullMode && fbAdManager !== CREATIVE && messageStrategy === "DEFAULT" ) ?
|
|
287
|
+
(<div className={className}>
|
|
288
|
+
|
|
289
|
+
<div className="is-scrollable-section" >
|
|
290
|
+
<div className="account-details-wrapper">
|
|
291
|
+
<div className="account-name-section">
|
|
292
|
+
<CapHeading type="h4">
|
|
293
|
+
<FormattedMessage {...messages.fbAccount} />
|
|
294
|
+
</CapHeading>
|
|
295
|
+
<CapHeading type="h3">{accountName}</CapHeading>
|
|
296
|
+
</div>
|
|
291
297
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
<div className="account-section-container">
|
|
299
|
+
<CapHeading type="h3">
|
|
300
|
+
<FormattedMessage {...messages.fbAdCampaignSetDetailsTitle} />
|
|
301
|
+
</CapHeading>
|
|
302
|
+
<CapLabel type="label1">
|
|
303
|
+
<FormattedMessage
|
|
304
|
+
{...messages.fbAdCampaignSetDetailsDescription}
|
|
305
|
+
/>
|
|
306
|
+
</CapLabel>
|
|
307
|
+
</div>
|
|
301
308
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
<CapRow span={12} type="flex">
|
|
310
|
+
{campaignDataList.map(({ label, value, onChange }, index) => (
|
|
311
|
+
<StyledCampaignDetailCapColumn
|
|
312
|
+
span={index % 2 === 0 ? 6 : 14}
|
|
313
|
+
key={label}
|
|
314
|
+
>
|
|
315
|
+
<CapRow>
|
|
316
|
+
<CapLabel type="label2">
|
|
317
|
+
<FormattedMessage {...messages[label]} />
|
|
318
|
+
</CapLabel>
|
|
319
|
+
<CapHeading type="h4">
|
|
320
|
+
{value}
|
|
321
|
+
{!socialRemoteCampaignId && onChange && (
|
|
322
|
+
<CapButton
|
|
323
|
+
type="flat"
|
|
324
|
+
className="marketingObjective-change-button facebook-marketing-objective-change"
|
|
325
|
+
onClick={onChange}
|
|
326
|
+
>
|
|
327
|
+
<FormattedMessage {...messages.fbChange} />
|
|
328
|
+
</CapButton>
|
|
329
|
+
)}
|
|
330
|
+
</CapHeading>
|
|
331
|
+
</CapRow>
|
|
332
|
+
</StyledCampaignDetailCapColumn>
|
|
333
|
+
))}
|
|
334
|
+
</CapRow>
|
|
335
|
+
<CapDrawer
|
|
336
|
+
content={
|
|
337
|
+
<MarketingObjective
|
|
338
|
+
selectedMarketingObjective={selectedMarketingObjective}
|
|
339
|
+
onMarketingObjectiveSelect={onMarketingObjectiveSelect}
|
|
340
|
+
defaultmarketingObjective={socialObjective || fbMarketingObjectiveValue}
|
|
341
|
+
onSubmit={setDrawerVisibility}
|
|
342
|
+
marketingObjectiveList={categorizedMarketingObjectiveList}
|
|
314
343
|
/>
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
344
|
+
}
|
|
345
|
+
visible={isDrawerVisible}
|
|
346
|
+
width={380}
|
|
347
|
+
onClose={() => setDrawerVisibility(false)}
|
|
348
|
+
/>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<div className="ad-section">
|
|
352
|
+
<CapHeading type="h4" style={{marginBottom: 17}}>
|
|
353
|
+
<FormattedMessage
|
|
354
|
+
{...messages.adManagerHeading}
|
|
355
|
+
/>
|
|
356
|
+
</CapHeading>
|
|
357
|
+
<CapRadioGroup
|
|
358
|
+
style={{paddingBottom: '18px'}}
|
|
359
|
+
options={radioOptions}
|
|
360
|
+
onChange={onChangeAdManager}
|
|
361
|
+
value={adManager}
|
|
362
|
+
key={`fb-ad-creatives`}
|
|
363
|
+
/>
|
|
364
|
+
{adManager === AD_MANAGER ? <>
|
|
365
|
+
<div className="account-section-container">
|
|
366
|
+
<CapLabel type="label1">
|
|
367
|
+
<FormattedMessage {...messages.fbAdsDescription} />
|
|
368
|
+
</CapLabel>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
<CapRow span={12} type="flex">
|
|
373
|
+
<CapColumn span={6}>
|
|
374
|
+
<CapCustomCard
|
|
375
|
+
type="Facebook"
|
|
376
|
+
FBDynamicComponent={() => (
|
|
377
|
+
<CapIcon
|
|
378
|
+
size="l"
|
|
379
|
+
type="scenery"
|
|
380
|
+
className="facebook-dynamic-content"
|
|
381
|
+
/>
|
|
382
|
+
)}
|
|
383
|
+
/>
|
|
384
|
+
</CapColumn>
|
|
385
|
+
<CapColumn span={16}>
|
|
386
|
+
<ul className="parameter-list">
|
|
387
|
+
{adSetParameters.map((parameter, index) => (
|
|
388
|
+
<li key={parameter} className="parameter-list-item">
|
|
389
|
+
<CapLabel type="label2" className="parameter-index">
|
|
390
|
+
{index + 1}
|
|
391
|
+
</CapLabel>
|
|
392
|
+
<CapHeading type="h5">
|
|
393
|
+
<FormattedMessage {...messages[parameter]} />
|
|
394
|
+
</CapHeading>
|
|
395
|
+
</li>
|
|
396
|
+
))}
|
|
397
|
+
</ul>
|
|
398
|
+
</CapColumn>
|
|
399
|
+
</CapRow></> : <CapLabel type="label1"><FormattedMessage {...messages.capAdManagerHeading}/></CapLabel>}
|
|
400
|
+
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
<CapButton
|
|
404
|
+
className="facebook-confirm-button"
|
|
405
|
+
type="primary"
|
|
406
|
+
onClick={onFacebookAdManagerContinue}
|
|
407
|
+
>
|
|
408
|
+
<FormattedMessage {...messages.fbContinue} />
|
|
409
|
+
</CapButton>
|
|
410
|
+
</div>
|
|
411
|
+
) :
|
|
412
|
+
<div style={{height: '1200px'}}>
|
|
413
|
+
<Advertisement
|
|
414
|
+
isFullMode={isFullMode}
|
|
415
|
+
actions={facebookActions}
|
|
416
|
+
fbADData={fbADData}
|
|
417
|
+
onCreateComplete={onCreateComplete}
|
|
418
|
+
templateData={templateData}
|
|
419
|
+
params={params}
|
|
420
|
+
facebookTemplateData={facebookTemplateData}
|
|
421
|
+
messageStrategy={messageStrategy}
|
|
422
|
+
getFormSubscriptionData={getFormSubscriptionData}
|
|
423
|
+
selectedMarketingObjective={selectedMarketingObjective}
|
|
424
|
+
fbAdManager={fbAdManager}
|
|
425
|
+
orgUnitId={orgUnitId}
|
|
426
|
+
/>
|
|
427
|
+
</div>
|
|
353
428
|
);
|
|
354
429
|
};
|
|
355
430
|
|
|
@@ -367,11 +442,12 @@ Facebook.propTypes = {
|
|
|
367
442
|
fbADData: PropTypes.object,
|
|
368
443
|
onCreateComplete: PropTypes.func,
|
|
369
444
|
facebookTemplateData: PropTypes.object,
|
|
445
|
+
messageStrategy: PropTypes.string,
|
|
446
|
+
getFormSubscriptionData: PropTypes.func,
|
|
370
447
|
};
|
|
371
448
|
|
|
372
449
|
Facebook.defaultProps = {
|
|
373
450
|
marketingObjectiveList: [""],
|
|
374
|
-
|
|
375
451
|
};
|
|
376
452
|
|
|
377
453
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -42,7 +42,7 @@ export default defineMessages({
|
|
|
42
42
|
},
|
|
43
43
|
fbAdsDescription: {
|
|
44
44
|
id: `${messagePrefix}.fbAdsDescription`,
|
|
45
|
-
defaultMessage: '
|
|
45
|
+
defaultMessage: 'Proceed with empty content block & you can create ads in Facebook Ad Manager under the mentioned ad set.',
|
|
46
46
|
},
|
|
47
47
|
fbAdsDetailOne: {
|
|
48
48
|
id: `${messagePrefix}.fbAdsDetailOne`,
|
|
@@ -56,9 +56,9 @@ export default defineMessages({
|
|
|
56
56
|
id: `${messagePrefix}.fbAdsDetailThree`,
|
|
57
57
|
defaultMessage: 'You can create ads later in Facebook ad manager.',
|
|
58
58
|
},
|
|
59
|
-
|
|
60
|
-
id: `${messagePrefix}.
|
|
61
|
-
defaultMessage: '
|
|
59
|
+
fbContinue: {
|
|
60
|
+
id: `${messagePrefix}.fbContinue`,
|
|
61
|
+
defaultMessage: 'Continue',
|
|
62
62
|
},
|
|
63
63
|
fbChange: {
|
|
64
64
|
id: `${messagePrefix}.fbChange`,
|
|
@@ -164,4 +164,24 @@ export default defineMessages({
|
|
|
164
164
|
id: `${messagePrefix}.fbMarketingObjectiveStoreTrafficDescription`,
|
|
165
165
|
defaultMessage: 'Drive visits to your physical stores by showing ads to people who are nearby.',
|
|
166
166
|
},
|
|
167
|
+
capFbAdManager: {
|
|
168
|
+
id: `${messagePrefix}.capFbAdManager`,
|
|
169
|
+
defaultMessage: 'Capillary Facebook ad manager',
|
|
170
|
+
},
|
|
171
|
+
fbAdManager: {
|
|
172
|
+
id: `${messagePrefix}.fbAdManager`,
|
|
173
|
+
defaultMessage: 'Facebook ad manager',
|
|
174
|
+
},
|
|
175
|
+
adManagerHeading: {
|
|
176
|
+
id: `${messagePrefix}.adManagerHeading`,
|
|
177
|
+
defaultMessage: "Where do you want to create your Facebook ad creative?",
|
|
178
|
+
},
|
|
179
|
+
capAdManagerHeading: {
|
|
180
|
+
id: `${messagePrefix}.capAdManagerHeading`,
|
|
181
|
+
defaultMessage: "You can create Facebook ads creative in Engage+ Facebook ad Manager.",
|
|
182
|
+
},
|
|
183
|
+
facebookDisableinfo: {
|
|
184
|
+
id: `${messagePrefix}.facebookDisableinfo`,
|
|
185
|
+
defaultMessage: 'Please integrate Facebook Ad page ID & username to enable this option.',
|
|
186
|
+
},
|
|
167
187
|
});
|
|
@@ -18,11 +18,11 @@ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
|
18
18
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
19
19
|
// GA
|
|
20
20
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
21
|
-
import { TRACK_CREATE_LINE, TRACK_EDIT_LINE } from '../../App/constants';
|
|
21
|
+
import { CREATE, EDIT, TRACK_CREATE_LINE, TRACK_EDIT_LINE } from '../../App/constants';
|
|
22
22
|
|
|
23
23
|
import LineWrapper from './Wrapper';
|
|
24
24
|
import messages from './messages';
|
|
25
|
-
import { TEXT, IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, MAX_LINE_WRAPPER_LIMIT, MAX_LINE_WRAPPER_LIMIT_FULL_MODE, DEFAULT_VIDEO_URI } from './constants';
|
|
25
|
+
import { TEXT, IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, MAX_LINE_WRAPPER_LIMIT, MAX_LINE_WRAPPER_LIMIT_FULL_MODE, DEFAULT_VIDEO_URI, VIDEO, TEMPLATE } from './constants';
|
|
26
26
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
27
27
|
|
|
28
28
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
@@ -32,6 +32,8 @@ import {makeSelectCreateLine, makeSelectLine } from './selectors';
|
|
|
32
32
|
import * as compActions from './actions';
|
|
33
33
|
import * as templateActionsConfig from '../../Templates/actions';
|
|
34
34
|
import withCreatives from '../../../hoc/withCreatives';
|
|
35
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
36
|
+
import { LINE } from '../../CreativesContainer/constants';
|
|
35
37
|
|
|
36
38
|
const { stopTimer } = GA.timeTracker;
|
|
37
39
|
|
|
@@ -348,6 +350,19 @@ export const LineContainer = ({
|
|
|
348
350
|
}
|
|
349
351
|
}
|
|
350
352
|
|
|
353
|
+
const formatFSPayload = (lineWrapperContents) => {
|
|
354
|
+
const [ {
|
|
355
|
+
messageTitle,
|
|
356
|
+
messageContent: content,
|
|
357
|
+
type,
|
|
358
|
+
} = {}] = lineWrapperContents;
|
|
359
|
+
return {
|
|
360
|
+
name: messageTitle,
|
|
361
|
+
content,
|
|
362
|
+
imageAdded: [IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, TEMPLATE].includes(type),
|
|
363
|
+
videoAdded: type === VIDEO
|
|
364
|
+
}
|
|
365
|
+
}
|
|
351
366
|
const formatSubmitPayload = (lineWrapperContents) => {
|
|
352
367
|
const [ {
|
|
353
368
|
messageTitle,
|
|
@@ -561,11 +576,17 @@ export const LineContainer = ({
|
|
|
561
576
|
createCallback(errorMessage);
|
|
562
577
|
if (!errorMessage) {
|
|
563
578
|
// stop timer for create line
|
|
564
|
-
stopTimer(TRACK_CREATE_LINE, {
|
|
579
|
+
const timeTaken = stopTimer(TRACK_CREATE_LINE, {
|
|
565
580
|
category: 'Creatives',
|
|
566
581
|
action: TRACK_CREATE_LINE,
|
|
567
582
|
label: getLineType(lineWrapperContents),
|
|
568
583
|
});
|
|
584
|
+
gtmPush('creativeDetails', Object.assign({
|
|
585
|
+
id: resp.templateId,
|
|
586
|
+
channel: LINE,
|
|
587
|
+
mode: CREATE,
|
|
588
|
+
timeTaken,
|
|
589
|
+
}, formatFSPayload(lineWrapperContents)));
|
|
569
590
|
onCreateComplete();
|
|
570
591
|
}
|
|
571
592
|
}
|
|
@@ -604,11 +625,18 @@ export const LineContainer = ({
|
|
|
604
625
|
editCallback(errorMessage);
|
|
605
626
|
if (!errorMessage) {
|
|
606
627
|
// stop timer for edit line
|
|
607
|
-
stopTimer(TRACK_EDIT_LINE, {
|
|
628
|
+
const timeTaken = stopTimer(TRACK_EDIT_LINE, {
|
|
608
629
|
category: 'Creatives',
|
|
609
630
|
action: TRACK_EDIT_LINE,
|
|
610
631
|
label: getLineType(lineWrapperContents),
|
|
611
632
|
});
|
|
633
|
+
gtmPush('creativeDetails', Object.assign({
|
|
634
|
+
id: resp.templateId._id,
|
|
635
|
+
channel: LINE,
|
|
636
|
+
mode: EDIT,
|
|
637
|
+
timeTaken,
|
|
638
|
+
}, formatFSPayload(lineWrapperContents)));
|
|
639
|
+
|
|
612
640
|
onCreateComplete();
|
|
613
641
|
}
|
|
614
642
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
7
|
+
import PropTypes, { object } from 'prop-types';
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { bindActionCreators } from 'redux';
|
|
@@ -22,11 +22,15 @@ import * as actions from './actions';
|
|
|
22
22
|
import withCreatives from '../../../hoc/withCreatives';
|
|
23
23
|
|
|
24
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
25
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
26
|
+
|
|
25
27
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
26
28
|
import messages from './messages';
|
|
27
29
|
import getEventsMap from '../eventsMap';
|
|
28
30
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
29
|
-
import { TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
31
|
+
import { CREATE, TRACK_CREATE_MPUSH } from '../../App/constants';
|
|
32
|
+
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
33
|
+
import { getContent } from '../commonMethods';
|
|
30
34
|
|
|
31
35
|
const PrefixWrapper = styled.div`
|
|
32
36
|
margin-right: 16px;
|
|
@@ -1401,16 +1405,33 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1401
1405
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, eventsMap, isSchemaChanged: true});
|
|
1402
1406
|
this.injectEvents(schema);
|
|
1403
1407
|
};
|
|
1408
|
+
|
|
1404
1409
|
saveFormData = (formData) => {
|
|
1405
1410
|
//this function gets called from form bulder only when the form data is valid
|
|
1406
1411
|
const obj = this.getTransformedData(formData);
|
|
1412
|
+
const content = getContent(obj);
|
|
1413
|
+
const {
|
|
1414
|
+
definition: {
|
|
1415
|
+
mode: definitionMode
|
|
1416
|
+
}
|
|
1417
|
+
} = obj || {};
|
|
1407
1418
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
1408
|
-
this.props.actions.createTemplate(obj, () => {
|
|
1409
|
-
GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1419
|
+
this.props.actions.createTemplate(obj, (response) => {
|
|
1420
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1410
1421
|
category: 'Creatives',
|
|
1411
1422
|
action: TRACK_CREATE_MPUSH,
|
|
1412
1423
|
label,
|
|
1413
1424
|
});
|
|
1425
|
+
gtmPush('creativeDetails', {
|
|
1426
|
+
id: response.templateId,
|
|
1427
|
+
name: obj.name,
|
|
1428
|
+
channel: MOBILE_PUSH,
|
|
1429
|
+
timeTaken,
|
|
1430
|
+
content,
|
|
1431
|
+
mode: CREATE,
|
|
1432
|
+
imageAdded: definitionMode === 'image'
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1414
1435
|
this.discardValues();
|
|
1415
1436
|
const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
|
|
1416
1437
|
CapNotification.success({message, key: 'createMpushSuccess'});
|
|
@@ -26,11 +26,13 @@ import messages from './messages';
|
|
|
26
26
|
import './_mobilePushCreate.scss';
|
|
27
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
28
|
import withCreatives from '../../../hoc/withCreatives';
|
|
29
|
+
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
29
30
|
|
|
30
31
|
import getEventsMap from '../eventsMap';
|
|
31
|
-
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields} from '../commonMethods';
|
|
32
|
+
import {getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields, getContent} from '../commonMethods';
|
|
32
33
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
33
|
-
import { TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
34
|
+
import { EDIT, TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
35
|
+
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
34
36
|
|
|
35
37
|
const PrefixWrapper = styled.div`
|
|
36
38
|
margin-right: 16px;
|
|
@@ -271,14 +273,34 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
271
273
|
this.setState({modalContent: {...this.state.modalContent, show: false}});
|
|
272
274
|
}
|
|
273
275
|
};
|
|
274
|
-
onUpdateTemplateComplete = () => {
|
|
275
|
-
|
|
276
|
+
onUpdateTemplateComplete = (response) => {
|
|
277
|
+
const obj = this.getTransformedData(this.state.formData);
|
|
278
|
+
const content = getContent(obj);
|
|
279
|
+
const {
|
|
280
|
+
definition: {
|
|
281
|
+
mode: definitionMode
|
|
282
|
+
}
|
|
283
|
+
} = obj || {};
|
|
276
284
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
277
|
-
GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
285
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
278
286
|
category: 'Creatives',
|
|
279
287
|
action: TRACK_EDIT_MPUSH,
|
|
280
288
|
label,
|
|
281
289
|
});
|
|
290
|
+
try {
|
|
291
|
+
gtmPush('creativeDetails', {
|
|
292
|
+
id: response.templateId,
|
|
293
|
+
name: obj.name,
|
|
294
|
+
channel: MOBILE_PUSH,
|
|
295
|
+
timeTaken,
|
|
296
|
+
content,
|
|
297
|
+
mode: EDIT,
|
|
298
|
+
imageAdded: definitionMode === 'image'
|
|
299
|
+
})
|
|
300
|
+
} catch(e) {
|
|
301
|
+
console.log(e);
|
|
302
|
+
}
|
|
303
|
+
|
|
282
304
|
this.resetSchema();
|
|
283
305
|
this.setState({
|
|
284
306
|
formData: {},
|
|
@@ -15,7 +15,7 @@ export function* editTemplate(template) {
|
|
|
15
15
|
errorMsg = result.message;
|
|
16
16
|
}
|
|
17
17
|
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
18
|
-
yield call(template.callback);
|
|
18
|
+
yield call(template.callback, {templateId: result?.response?.templateId._id});
|
|
19
19
|
} catch (error) {
|
|
20
20
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
21
21
|
}
|
|
@@ -246,6 +246,24 @@ function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formDa
|
|
|
246
246
|
}
|
|
247
247
|
return inputFields;
|
|
248
248
|
}
|
|
249
|
+
|
|
250
|
+
function getContent(obj) {
|
|
251
|
+
const {
|
|
252
|
+
versions : {
|
|
253
|
+
base: {
|
|
254
|
+
ANDROID: {
|
|
255
|
+
title : androidTitle,
|
|
256
|
+
message : androidMessage
|
|
257
|
+
} = {},
|
|
258
|
+
IOS: {
|
|
259
|
+
title: iosTitle,
|
|
260
|
+
message: iosMessage
|
|
261
|
+
} = {}
|
|
262
|
+
} = {}
|
|
263
|
+
} = {}
|
|
264
|
+
} = obj;
|
|
265
|
+
return `${androidTitle} ${androidMessage} ${iosTitle} ${iosMessage}`;
|
|
266
|
+
}
|
|
249
267
|
export {
|
|
250
|
-
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields,
|
|
268
|
+
getPrimaryCtaFields, getSecondaryCtaFields, getLinkTypeFields, getContent
|
|
251
269
|
};
|