@capillarytech/creatives-library 7.6.3 → 7.6.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.6.3",
4
+ "version": "7.6.4",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -137,6 +137,8 @@ function SlideBoxContent(props) {
137
137
  handleClose,
138
138
  onFTPSubmit,
139
139
  campaignSettings,
140
+ messageStrategy,
141
+ fbAdManger,
140
142
  } = props;
141
143
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
142
144
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
@@ -334,6 +336,7 @@ function SlideBoxContent(props) {
334
336
  slidBoxContent={slidBoxContent}
335
337
  FTPMode="create"
336
338
  selectedOfferDetails={selectedOfferDetails}
339
+ messageStrategy={messageStrategy}
337
340
  />
338
341
  )}
339
342
  {isPreview && (
@@ -558,7 +561,8 @@ function SlideBoxContent(props) {
558
561
  isFullMode={isFullMode}
559
562
  createNew
560
563
  getFormSubscriptionData={getFormData}
561
-
564
+ messageStrategy={messageStrategy}
565
+ fbAdManger={fbAdManger}
562
566
  />
563
567
  )
564
568
  }
@@ -687,5 +691,7 @@ SlideBoxContent.propTypes = {
687
691
  saveMessage: PropTypes.func,
688
692
  selectedAccount: PropTypes.object,
689
693
  onFTPSubmit: PropTypes.func,
694
+ messageStrategy: PropTypes.string,
695
+
690
696
  };
691
697
  export default SlideBoxContent;
@@ -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',
@@ -87,8 +86,12 @@ class Creatives extends React.Component {
87
86
  onEditTemplate = () => {
88
87
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
89
88
  };
90
- onCreateNew = () => {
91
- this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true });
89
+ onCreateNew = (fbAdManger) => {
90
+ if (fbAdManger) {
91
+ this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true, fbAdManger });
92
+ } else {
93
+ this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true });
94
+ }
92
95
  };
93
96
 
94
97
  onShowTemplates = () => {
@@ -637,6 +640,7 @@ class Creatives extends React.Component {
637
640
  onEnterTemplateName={this.onEnterTemplateName}
638
641
  onRemoveTemplateName={this.onRemoveTemplateName}
639
642
  onResetStep={this.resetStep}
643
+ fbAdManger={this.state.fbAdManger}
640
644
  cap={cap}
641
645
  setIsLoadingContent={this.setIsLoadingContent}
642
646
  onMobilepushModeChange={this.onMobilepushModeChange}
@@ -661,6 +665,7 @@ class Creatives extends React.Component {
661
665
  handleClose={this.handleCloseSlideBox}
662
666
  onFTPSubmit={getCreativesData}
663
667
  editor={editor}
668
+ messageStrategy={this.props.strategy}
664
669
  />
665
670
  }
666
671
  footer={this.shouldShowFooter() &&
@@ -713,6 +718,8 @@ Creatives.propTypes = {
713
718
  selectedWeChatAccount: PropTypes.object,
714
719
  Templates: PropTypes.object,
715
720
  selectedAccount: PropTypes.object,
721
+ strategy: PropTypes.string,
722
+
716
723
  };
717
724
  const mapStatesToProps = () => createStructuredSelector({
718
725
  isLoading: isLoadingSelector(),
@@ -978,4 +978,3 @@ Advertisement.propTypes = {
978
978
  };
979
979
 
980
980
  export default injectIntl(Advertisement);
981
-
@@ -50,7 +50,7 @@ export default css`
50
50
 
51
51
  .parameter-list-item {
52
52
  list-style: none;
53
- margin-bottom: ${CAP_SPACE_28};
53
+ margin-bottom: 60px;
54
54
 
55
55
  .parameter-index {
56
56
  float: left;
@@ -47,3 +47,7 @@ export const VALUE_REACH = 'VALUE_REACH';
47
47
  export const VALUE_VIDEO_VIEWS = 'VALUE_VIDEO_VIEWS';
48
48
  export const VALUE_LINK_CLICKS = 'VALUE_LINK_CLICKS';
49
49
  export const VALUE_POST_ENGAGEMENT = 'VALUE_POST_ENGAGEMENT';
50
+
51
+
52
+ export const AD_MANAGER = "AD_MANAGER";
53
+ export const CREATIVE = "CREATIVE";
@@ -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,9 @@ import {
15
15
  CapDrawer,
16
16
  CapCustomCard,
17
17
  CapIcon,
18
+ CapRadioGroup,
18
19
  } from '@capillarytech/cap-ui-library';
20
+ import Templates from '../Templates';
19
21
  import { createStructuredSelector } from 'reselect';
20
22
  import { connect } from 'react-redux';
21
23
  import { bindActionCreators } from 'redux';
@@ -38,6 +40,8 @@ import {
38
40
  VALUE_REACH,
39
41
  VALUE_VIDEO_VIEWS,
40
42
  VALUE_LINK_CLICKS,
43
+ AD_MANAGER,
44
+ CREATIVE,
41
45
  } from './constants';
42
46
 
43
47
  const StyledCampaignDetailCapColumn = withStyles(CapColumn, CampaignDetailCapColumn);
@@ -183,12 +187,22 @@ const Facebook = (props) => {
183
187
  onCreateComplete,
184
188
  params,
185
189
  facebookTemplateData,
190
+ messageStrategy,
191
+ router,
192
+ handlePeviewTemplate,
193
+ renderNewCardGrid,
194
+ onSelectTemplate,
195
+ createNew,
196
+ fbAdManger,
186
197
  } = props;
187
198
  const {
188
199
  selectedMarketingObjective: fbMarketingObjectiveValue = VALUE_REACH,
189
200
  } = templateData || {};
190
201
  const [isDrawerVisible, setDrawerVisibility] = useState(false);
191
202
  const [selectedMarketingObjective, setMarketingObjective] = useState(socialObjective || fbMarketingObjectiveValue);
203
+ const [adManager, setAdManager] = useState(AD_MANAGER);
204
+ const [showTemplateList, setTemplateList] = useState(false);
205
+
192
206
 
193
207
  useEffect(() => {
194
208
  if (!isFullMode) {
@@ -225,131 +239,184 @@ const Facebook = (props) => {
225
239
 
226
240
  const onMarketingObjectiveSelect = (value) => setMarketingObjective(value);
227
241
 
228
- return (
229
- !isFullMode ? (<div className={className}>
230
- <div className="is-scrollable-section" >
231
- <div className="account-details-wrapper">
232
- <div className="account-name-section">
233
- <CapHeading type="h4">
234
- <FormattedMessage {...messages.fbAccount} />
235
- </CapHeading>
236
- <CapHeading type="h3">{accountName}</CapHeading>
237
- </div>
242
+ const radioOptions = [{
243
+ label: intl.formatMessage(messages.capFbAdManager), value: CREATIVE,
244
+ }, {
245
+ label: intl.formatMessage(messages.fbAdManager), value: AD_MANAGER,
246
+ }];
238
247
 
239
- <div className="account-section-container">
240
- <CapHeading type="h3">
241
- <FormattedMessage {...messages.fbAdCampaignSetDetailsTitle} />
242
- </CapHeading>
243
- <CapLabel type="label1">
244
- <FormattedMessage
245
- {...messages.fbAdCampaignSetDetailsDescription}
246
- />
247
- </CapLabel>
248
- </div>
248
+ const onChangeAdManager = useCallback(({ target: { value } }) => {
249
+ setAdManager(value);
250
+ }, [setAdManager]);
249
251
 
250
- <CapRow span={12} type="flex">
251
- {campaignDataList.map(({ label, value, onChange }, index) => (
252
- <StyledCampaignDetailCapColumn
253
- span={index % 2 === 0 ? 6 : 14}
254
- key={label}
255
- >
256
- <CapRow>
257
- <CapLabel type="label2">
258
- <FormattedMessage {...messages[label]} />
259
- </CapLabel>
260
- <CapHeading type="h4">
261
- {value}
262
- {!socialRemoteCampaignId && onChange && (
263
- <CapButton
264
- type="flat"
265
- className="marketingObjective-change-button facebook-marketing-objective-change"
266
- onClick={onChange}
267
- >
268
- <FormattedMessage {...messages.fbChange} />
269
- </CapButton>
270
- )}
271
- </CapHeading>
272
- </CapRow>
273
- </StyledCampaignDetailCapColumn>
274
- ))}
275
- </CapRow>
276
- <CapDrawer
277
- content={
278
- <MarketingObjective
279
- selectedMarketingObjective={selectedMarketingObjective}
280
- onMarketingObjectiveSelect={onMarketingObjectiveSelect}
281
- defaultmarketingObjective={socialObjective || fbMarketingObjectiveValue}
282
- onSubmit={setDrawerVisibility}
283
- marketingObjectiveList={categorizedMarketingObjectiveList}
284
- />
285
- }
286
- visible={isDrawerVisible}
287
- width={380}
288
- onClose={() => setDrawerVisibility(false)}
289
- />
290
- </div>
252
+ const onFacebookAdManagerContinue = useCallback(() => {
253
+ if (adManager === AD_MANAGER) {
254
+ onFacebookSubmit({ channel: "FACEBOOK", selectedMarketingObjective, accountId });
255
+ } else {
256
+ setTemplateList(true);
257
+ }
258
+ }, [
259
+ selectedMarketingObjective,
260
+ accountId,
261
+ adManager,
262
+ setAdManager,
263
+ setTemplateList,
264
+ showTemplateList,
265
+ ]);
266
+ const query = {type: 'embedded', module: 'library'};
267
+ const location = {pathname: `/FACEBOOK`, search: '', query};
268
+ return (showTemplateList ? (
269
+ <Templates
270
+ key={"FACEBOOK"}
271
+ location={location}
272
+ route={{name: "FACEBOOK"}}
273
+ router={router}
274
+ isFullMode={isFullMode}
275
+ createNew={createNew}
276
+ onSelectTemplate={onSelectTemplate}
277
+ renderNewCardGrid={renderNewCardGrid}
278
+ handlePeviewTemplate={handlePeviewTemplate}
279
+ fbAdManger={CREATIVE}
280
+ />
281
+ ) :
282
+ (!isFullMode && messageStrategy !== "X_ENGAGE" && fbAdManger !== CREATIVE) ?
283
+ (<div className={className}>
284
+
285
+ <div className="is-scrollable-section" >
286
+ <div className="account-details-wrapper">
287
+ <div className="account-name-section">
288
+ <CapHeading type="h4">
289
+ <FormattedMessage {...messages.fbAccount} />
290
+ </CapHeading>
291
+ <CapHeading type="h3">{accountName}</CapHeading>
292
+ </div>
291
293
 
292
- <div className="ad-section">
293
- <div className="account-section-container">
294
- <CapHeading type="h3">
295
- <FormattedMessage {...messages.fbAdsTitle} />
296
- </CapHeading>
297
- <CapLabel type="label1">
298
- <FormattedMessage {...messages.fbAdsDescription} />
299
- </CapLabel>
300
- </div>
294
+ <div className="account-section-container">
295
+ <CapHeading type="h3">
296
+ <FormattedMessage {...messages.fbAdCampaignSetDetailsTitle} />
297
+ </CapHeading>
298
+ <CapLabel type="label1">
299
+ <FormattedMessage
300
+ {...messages.fbAdCampaignSetDetailsDescription}
301
+ />
302
+ </CapLabel>
303
+ </div>
301
304
 
302
- <div>
303
- <CapRow span={12} type="flex">
304
- <CapColumn span={6}>
305
- <CapCustomCard
306
- type="Facebook"
307
- FBDynamicComponent={() => (
308
- <CapIcon
309
- size="l"
310
- type="scenery"
311
- className="facebook-dynamic-content"
312
- />
313
- )}
305
+ <CapRow span={12} type="flex">
306
+ {campaignDataList.map(({ label, value, onChange }, index) => (
307
+ <StyledCampaignDetailCapColumn
308
+ span={index % 2 === 0 ? 6 : 14}
309
+ key={label}
310
+ >
311
+ <CapRow>
312
+ <CapLabel type="label2">
313
+ <FormattedMessage {...messages[label]} />
314
+ </CapLabel>
315
+ <CapHeading type="h4">
316
+ {value}
317
+ {!socialRemoteCampaignId && onChange && (
318
+ <CapButton
319
+ type="flat"
320
+ className="marketingObjective-change-button facebook-marketing-objective-change"
321
+ onClick={onChange}
322
+ >
323
+ <FormattedMessage {...messages.fbChange} />
324
+ </CapButton>
325
+ )}
326
+ </CapHeading>
327
+ </CapRow>
328
+ </StyledCampaignDetailCapColumn>
329
+ ))}
330
+ </CapRow>
331
+ <CapDrawer
332
+ content={
333
+ <MarketingObjective
334
+ selectedMarketingObjective={selectedMarketingObjective}
335
+ onMarketingObjectiveSelect={onMarketingObjectiveSelect}
336
+ defaultmarketingObjective={socialObjective || fbMarketingObjectiveValue}
337
+ onSubmit={setDrawerVisibility}
338
+ marketingObjectiveList={categorizedMarketingObjectiveList}
314
339
  />
315
- </CapColumn>
316
- <CapColumn span={16}>
317
- <ul className="parameter-list">
318
- {adSetParameters.map((parameter, index) => (
319
- <li key={parameter} className="parameter-list-item">
320
- <CapLabel type="label2" className="parameter-index">
321
- {index + 1}
322
- </CapLabel>
323
- <CapHeading type="h5">
324
- <FormattedMessage {...messages[parameter]} />
325
- </CapHeading>
326
- </li>
327
- ))}
328
- </ul>
329
- </CapColumn>
330
- </CapRow>
331
- </div>
332
- </div>
333
- </div>
334
- <CapButton
335
- className="facebook-confirm-button"
336
- type="primary"
337
- onClick={() =>
338
- onFacebookSubmit({ channel: "FACEBOOK", selectedMarketingObjective, accountId })
339
- }
340
- >
341
- <FormattedMessage {...messages.fbConfirm} />
342
- </CapButton>
343
- </div>) : <div style={{height: '1200px'}}>
344
- <Advertisement
345
- isFullMode={isFullMode}
346
- actions={facebookActions}
347
- fbADData={fbADData}
348
- onCreateComplete={onCreateComplete}
349
- templateData={templateData}
350
- params={params}
351
- facebookTemplateData={facebookTemplateData}
352
- /></div>
340
+ }
341
+ visible={isDrawerVisible}
342
+ width={380}
343
+ onClose={() => setDrawerVisibility(false)}
344
+ />
345
+ </div>
346
+
347
+ <div className="ad-section">
348
+ <CapHeading type="h4" style={{marginBottom: 17}}>
349
+ <FormattedMessage
350
+ {...messages.adManagerHeading}
351
+ />
352
+ </CapHeading>
353
+ <CapRadioGroup
354
+ style={{paddingBottom: '18px'}}
355
+ options={radioOptions}
356
+ onChange={onChangeAdManager}
357
+ value={adManager}
358
+ key={`fb-ad-creatives`}
359
+ />
360
+ {adManager === AD_MANAGER ? <>
361
+ <div className="account-section-container">
362
+ <CapLabel type="label1">
363
+ <FormattedMessage {...messages.fbAdsDescription} />
364
+ </CapLabel>
365
+ </div>
366
+
367
+
368
+ <CapRow span={12} type="flex">
369
+ <CapColumn span={6}>
370
+ <CapCustomCard
371
+ type="Facebook"
372
+ FBDynamicComponent={() => (
373
+ <CapIcon
374
+ size="l"
375
+ type="scenery"
376
+ className="facebook-dynamic-content"
377
+ />
378
+ )}
379
+ />
380
+ </CapColumn>
381
+ <CapColumn span={16}>
382
+ <ul className="parameter-list">
383
+ {adSetParameters.map((parameter, index) => (
384
+ <li key={parameter} className="parameter-list-item">
385
+ <CapLabel type="label2" className="parameter-index">
386
+ {index + 1}
387
+ </CapLabel>
388
+ <CapHeading type="h5">
389
+ <FormattedMessage {...messages[parameter]} />
390
+ </CapHeading>
391
+ </li>
392
+ ))}
393
+ </ul>
394
+ </CapColumn>
395
+ </CapRow></> : <CapLabel type="label1"><FormattedMessage {...messages.capAdManagerHeading}/></CapLabel>}
396
+
397
+ </div>
398
+ </div>
399
+ <CapButton
400
+ className="facebook-confirm-button"
401
+ type="primary"
402
+ onClick={onFacebookAdManagerContinue}
403
+ >
404
+ <FormattedMessage {...messages.fbContinue} />
405
+ </CapButton>
406
+ </div>
407
+ ) :
408
+ <div style={{height: '1200px'}}>
409
+ <Advertisement
410
+ isFullMode={isFullMode}
411
+ actions={facebookActions}
412
+ fbADData={fbADData}
413
+ onCreateComplete={onCreateComplete}
414
+ templateData={templateData}
415
+ params={params}
416
+ facebookTemplateData={facebookTemplateData}
417
+ messageStrategy={messageStrategy}
418
+ />
419
+ </div>
353
420
  );
354
421
  };
355
422
 
@@ -367,6 +434,7 @@ Facebook.propTypes = {
367
434
  fbADData: PropTypes.object,
368
435
  onCreateComplete: PropTypes.func,
369
436
  facebookTemplateData: PropTypes.object,
437
+ messageStrategy: PropTypes.string,
370
438
  };
371
439
 
372
440
  Facebook.defaultProps = {
@@ -42,7 +42,7 @@ export default defineMessages({
42
42
  },
43
43
  fbAdsDescription: {
44
44
  id: `${messagePrefix}.fbAdsDescription`,
45
- defaultMessage: 'You may create ads in Facebook Ad Manager under the below mentioned ad set. The performance of these ads will be reported here in Engage+.',
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
- fbConfirm: {
60
- id: `${messagePrefix}.fbConfirm`,
61
- defaultMessage: 'Confirm',
59
+ fbContinue: {
60
+ id: `${messagePrefix}.fbContinue`,
61
+ defaultMessage: 'Continue',
62
62
  },
63
63
  fbChange: {
64
64
  id: `${messagePrefix}.fbChange`,
@@ -164,4 +164,20 @@ 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
+ }
167
183
  });
@@ -1141,7 +1141,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1141
1141
  let routeParams = {};
1142
1142
  timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
1143
1143
  if (this.isEnabledInLibraryModule("callCreateFromProps")) {
1144
- this.props.createNew();
1144
+ if (this.props.fbAdManger === "CREATIVE") {
1145
+ this.props.createNew(this.props.fbAdManger);
1146
+ } else{
1147
+ this.props.createNew();
1148
+ }
1145
1149
  } else if (ev.key && (ev.key.toLowerCase() === "text" || ev.key.toLowerCase() === "image")) {
1146
1150
  routeParams = {
1147
1151
  pathname: `/${channel === 'line' ? 'line' : 'mobilepush'}/create/${ev.key.toLowerCase()}`,
@@ -148,13 +148,14 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
148
148
  );
149
149
 
150
150
  getFacebookComponent = () => {
151
- const { messageDetails, cap, onFacebookSubmit, isFullMode } = this.props;
151
+ const { messageDetails, cap, onFacebookSubmit, messageStrategy } = this.props;
152
152
  return (
153
153
  <Facebook
154
154
  {...this.props}
155
155
  messageDetails={messageDetails}
156
156
  cap={cap}
157
157
  onFacebookSubmit={onFacebookSubmit}
158
+ messageStrategy={messageStrategy}
158
159
  />
159
160
  );
160
161
  }
@@ -178,19 +179,21 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
178
179
  getTemplatesComponent(channel) {
179
180
  // const templates = this.props.Templates[`${channel}Templates`];
180
181
  let query = {};
181
- if (!this.props.isFullMode) {
182
+ const {isFullMode, messageStrategy} = this.props;
183
+ if (!isFullMode) {
182
184
  query = {type: 'embedded', module: 'library'};
183
185
  switch (channel) {
184
186
  case 'line':
185
187
  return this.getLineComponent();
186
188
  case 'ftp':
187
189
  return this.getFTPComponent();
188
- case 'facebook':
189
- return this.getFacebookComponent();
190
190
  default:
191
191
  break;
192
192
  }
193
193
  }
194
+ if (messageStrategy !== "X_ENGAGE" && channel === 'facebook' && !isFullMode) {
195
+ return this.getFacebookComponent();
196
+ }
194
197
  const location = {pathname: `/${channel}`, search: '', query};
195
198
  switch (channel) {
196
199
  case 'call_task':
@@ -208,6 +211,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
208
211
  onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
209
212
  renderNewCardGrid={this.getTemplateDataForGrid}
210
213
  handlePeviewTemplate={this.props.handlePeviewTemplate}
214
+ messageStrategy={this.props.messageStrategy}
211
215
  />);
212
216
  }
213
217
  }
@@ -287,6 +291,7 @@ TemplatesV2.propTypes = {
287
291
  cap: PropTypes.object,
288
292
  authData: PropTypes.object,
289
293
  FTPMode: PropTypes.string,
294
+ messageStrategy: PropTypes.string,
290
295
  };
291
296
 
292
297
  TemplatesV2.defaultProps = {