@capillarytech/creatives-library 7.7.1 → 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/index.js +3 -3
- package/package.json +1 -1
- package/v2Components/TemplatePreview/index.js +1 -0
- 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/Facebook/Advertisement/index.js +63 -34
- 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/Templates/index.js +37 -21
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +1 -1
- package/v2Containers/TemplatesV2/index.js +23 -6
- package/v2Containers/TemplatesV2/messages.js +4 -0
- 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
|
@@ -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
|
});
|
|
@@ -62,6 +62,8 @@ import {
|
|
|
62
62
|
} from '../App/constants';
|
|
63
63
|
import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK } from '../CreativesContainer/constants';
|
|
64
64
|
|
|
65
|
+
import {CREATIVE} from '../Facebook/constants';
|
|
66
|
+
|
|
65
67
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
66
68
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
67
69
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -321,7 +323,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
321
323
|
}
|
|
322
324
|
const fbSetting = get(nextProps.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
|
|
323
325
|
const { accountName = "",
|
|
324
|
-
|
|
326
|
+
orgUnitFacebookPageSettingsMap = {},
|
|
325
327
|
} = fbSetting[0] || {};
|
|
326
328
|
let pageAccessToken = false;
|
|
327
329
|
if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
|
|
@@ -508,7 +510,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
508
510
|
}
|
|
509
511
|
|
|
510
512
|
this.setState({activeMode: TEMPLATES_MODE});
|
|
511
|
-
|
|
513
|
+
|
|
512
514
|
this.getAllTemplates({params, resetPage: true});
|
|
513
515
|
});
|
|
514
516
|
}
|
|
@@ -1136,12 +1138,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1136
1138
|
const channel = this.state.channel.toLowerCase();
|
|
1137
1139
|
//const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
|
|
1138
1140
|
let routeParams = {};
|
|
1141
|
+
const {fbAdManager} = this.props;
|
|
1139
1142
|
const isLibraryMode = this.isEnabledInLibraryModule("callCreateFromProps");
|
|
1140
|
-
if(!isLibraryMode) {
|
|
1143
|
+
if (!isLibraryMode) {
|
|
1141
1144
|
timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
|
|
1142
1145
|
}
|
|
1143
1146
|
if (isLibraryMode) {
|
|
1144
|
-
this.props.
|
|
1147
|
+
if (this.props.fbAdManager === CREATIVE) {
|
|
1148
|
+
this.props.createNew(fbAdManager);
|
|
1149
|
+
} else {
|
|
1150
|
+
this.props.createNew();
|
|
1151
|
+
}
|
|
1145
1152
|
} else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
|
|
1146
1153
|
routeParams = {
|
|
1147
1154
|
pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
|
|
@@ -1411,7 +1418,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1411
1418
|
}
|
|
1412
1419
|
}
|
|
1413
1420
|
if (this.isEnabledInLibraryModule("callSelectFromProps")) {
|
|
1414
|
-
this.props.onSelectTemplate(id);
|
|
1421
|
+
this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManager);
|
|
1415
1422
|
} else {
|
|
1416
1423
|
timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
|
|
1417
1424
|
if (this.state.channel.toLowerCase() === 'ebill') {
|
|
@@ -1424,6 +1431,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1424
1431
|
}
|
|
1425
1432
|
}
|
|
1426
1433
|
|
|
1434
|
+
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
1435
|
+
|
|
1436
|
+
|
|
1427
1437
|
handlePreviewClick(template, modeType) {
|
|
1428
1438
|
this.togglePreview();
|
|
1429
1439
|
const templateInfo = cloneDeep(template);
|
|
@@ -1801,9 +1811,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1801
1811
|
const isWechatChannel = channel === WECHAT;
|
|
1802
1812
|
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
1803
1813
|
const isLineChannel = channel === LINE;
|
|
1814
|
+
const isFacebookChannel = channel === FACEBOOK;
|
|
1804
1815
|
|
|
1805
1816
|
|
|
1806
|
-
if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts)) {
|
|
1817
|
+
if ((isWechatChannel || isMobilePushChannel || isLineChannel) && !isEmpty(weCrmAccounts) && !isFacebookChannel ) {
|
|
1807
1818
|
forEach(weCrmAccounts, (account) => {
|
|
1808
1819
|
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || isMobilePushChannel || isLineChannel) {
|
|
1809
1820
|
if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
|
|
@@ -1943,28 +1954,33 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1943
1954
|
render() {
|
|
1944
1955
|
const isFullMode = this.isFullMode();
|
|
1945
1956
|
const { activeMode, channel, wechatFilter, lineFilter } = this.state;
|
|
1946
|
-
let
|
|
1957
|
+
let showFbAds = false;
|
|
1947
1958
|
if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
pageAccessToken
|
|
1959
|
+
const campaignSettings = this.props.Templates.campaignSettings;
|
|
1960
|
+
if (campaignSettings && isEmpty(campaignSettings?.accountSettings)) {
|
|
1961
|
+
showFbAds = true;
|
|
1962
|
+
} else if (!isEmpty(campaignSettings?.accountSettings)) {
|
|
1963
|
+
const fbSetting = get(this.props.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
|
|
1964
|
+
const { orgUnitFacebookPageSettingsMap = {} } = fbSetting[0] || {};
|
|
1965
|
+
let pageAccessToken = false;
|
|
1966
|
+
if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
|
|
1967
|
+
Object.values(orgUnitFacebookPageSettingsMap).forEach((obj) => {
|
|
1968
|
+
if (obj.pageAccessToken) {
|
|
1969
|
+
pageAccessToken = true;
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
if (!pageAccessToken) {
|
|
1973
|
+
showFbAds = true;
|
|
1958
1974
|
}
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
showForFacebook = false;
|
|
1975
|
+
} else {
|
|
1976
|
+
showFbAds = true;
|
|
1962
1977
|
}
|
|
1963
1978
|
}
|
|
1964
1979
|
}
|
|
1980
|
+
|
|
1965
1981
|
const showForViber = (![VIBER_CHANNEL, FACEBOOK_CHANNEL].includes(channel.toLowerCase()) ||
|
|
1966
1982
|
(channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))) ||
|
|
1967
|
-
(channel.toLowerCase() === FACEBOOK_CHANNEL &&
|
|
1983
|
+
(channel.toLowerCase() === FACEBOOK_CHANNEL && showFbAds)
|
|
1968
1984
|
);
|
|
1969
1985
|
|
|
1970
1986
|
|
|
@@ -372,6 +372,6 @@ export default defineMessages({
|
|
|
372
372
|
},
|
|
373
373
|
"noAccountsPresentFacebook": {
|
|
374
374
|
id: `${scope}.noAccountsPresentFacebook`,
|
|
375
|
-
defaultMessage: "Facebook
|
|
375
|
+
defaultMessage: "Please setup the Facebook account & Facebook page to start creating content in Capillary's FB content creator.",
|
|
376
376
|
},
|
|
377
377
|
});
|
|
@@ -9,7 +9,7 @@ import * as types from './constants';
|
|
|
9
9
|
|
|
10
10
|
const initialState = fromJS({
|
|
11
11
|
getAllTemplatesInProgress: false,
|
|
12
|
-
fetchingOrgLevelCampaignSettings:
|
|
12
|
+
fetchingOrgLevelCampaignSettings: false,
|
|
13
13
|
templates: [],
|
|
14
14
|
deleteResponse: {},
|
|
15
15
|
deleteTemplateInProgress: false,
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
12
|
import { bindActionCreators } from 'redux';
|
|
13
|
-
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon } from '@capillarytech/cap-ui-library';
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get } from 'lodash';
|
|
15
15
|
import isEmpty from 'lodash/isEmpty';
|
|
16
16
|
import Helmet from 'react-helmet';
|
|
@@ -45,6 +45,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
45
45
|
channelsToDisable = [],
|
|
46
46
|
isFullMode,
|
|
47
47
|
onChannelChange,
|
|
48
|
+
showDisabledFBInfo,
|
|
48
49
|
} = props;
|
|
49
50
|
|
|
50
51
|
const defaultPanes = {
|
|
@@ -80,6 +81,15 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
80
81
|
if (channelsToDisable.includes(pane.key)) {
|
|
81
82
|
// eslint-disable-next-line no-param-reassign
|
|
82
83
|
pane.disabled = true;
|
|
84
|
+
if (pane.key === 'facebook' && showDisabledFBInfo) {
|
|
85
|
+
pane.tab = (<CapTooltip
|
|
86
|
+
title={
|
|
87
|
+
intl.formatMessage(messages.facebookDisableinfo)
|
|
88
|
+
}
|
|
89
|
+
>
|
|
90
|
+
{intl.formatMessage(messages.facebook)}
|
|
91
|
+
</CapTooltip>);
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
return pane;
|
|
85
95
|
});
|
|
@@ -148,13 +158,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
148
158
|
);
|
|
149
159
|
|
|
150
160
|
getFacebookComponent = () => {
|
|
151
|
-
const { messageDetails, cap, onFacebookSubmit,
|
|
161
|
+
const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisabledFBInfo, orgUnitId } = this.props;
|
|
152
162
|
return (
|
|
153
163
|
<Facebook
|
|
154
164
|
{...this.props}
|
|
155
165
|
messageDetails={messageDetails}
|
|
156
166
|
cap={cap}
|
|
157
167
|
onFacebookSubmit={onFacebookSubmit}
|
|
168
|
+
messageStrategy={messageStrategy}
|
|
169
|
+
showDisabledFBInfo={showDisabledFBInfo}
|
|
170
|
+
orgUnitId={orgUnitId}
|
|
158
171
|
/>
|
|
159
172
|
);
|
|
160
173
|
}
|
|
@@ -178,19 +191,21 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
178
191
|
getTemplatesComponent(channel) {
|
|
179
192
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
180
193
|
let query = {};
|
|
181
|
-
|
|
194
|
+
const {isFullMode, messageStrategy} = this.props;
|
|
195
|
+
if (!isFullMode) {
|
|
182
196
|
query = {type: 'embedded', module: 'library'};
|
|
183
197
|
switch (channel) {
|
|
184
198
|
case 'line':
|
|
185
199
|
return this.getLineComponent();
|
|
186
200
|
case 'ftp':
|
|
187
201
|
return this.getFTPComponent();
|
|
188
|
-
case 'facebook':
|
|
189
|
-
return this.getFacebookComponent();
|
|
190
202
|
default:
|
|
191
203
|
break;
|
|
192
204
|
}
|
|
193
205
|
}
|
|
206
|
+
if (messageStrategy !== "X_ENGAGE" && channel === 'facebook' && !isFullMode) {
|
|
207
|
+
return this.getFacebookComponent();
|
|
208
|
+
}
|
|
194
209
|
const location = {pathname: `/${channel}`, search: '', query};
|
|
195
210
|
switch (channel) {
|
|
196
211
|
case 'call_task':
|
|
@@ -205,9 +220,10 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
205
220
|
router={this.props.router}
|
|
206
221
|
isFullMode={this.props.isFullMode}
|
|
207
222
|
createNew={this.props.createNew}
|
|
208
|
-
onSelectTemplate={
|
|
223
|
+
onSelectTemplate={this.props.onSelectTemplate}
|
|
209
224
|
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
210
225
|
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
226
|
+
messageStrategy={this.props.messageStrategy}
|
|
211
227
|
/>);
|
|
212
228
|
}
|
|
213
229
|
}
|
|
@@ -287,6 +303,7 @@ TemplatesV2.propTypes = {
|
|
|
287
303
|
cap: PropTypes.object,
|
|
288
304
|
authData: PropTypes.object,
|
|
289
305
|
FTPMode: PropTypes.string,
|
|
306
|
+
messageStrategy: PropTypes.string,
|
|
290
307
|
};
|
|
291
308
|
|
|
292
309
|
TemplatesV2.defaultProps = {
|