@capillarytech/creatives-library 7.6.9 → 7.6.10

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.9",
4
+ "version": "7.6.10",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -139,6 +139,8 @@ function SlideBoxContent(props) {
139
139
  campaignSettings,
140
140
  messageStrategy,
141
141
  fbAdManger,
142
+ showDisableInfoForFacebook,
143
+ orgUnitId,
142
144
  } = props;
143
145
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
144
146
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
@@ -337,6 +339,8 @@ function SlideBoxContent(props) {
337
339
  FTPMode="create"
338
340
  selectedOfferDetails={selectedOfferDetails}
339
341
  messageStrategy={messageStrategy}
342
+ showDisableInfoForFacebook={showDisableInfoForFacebook}
343
+ orgUnitId={orgUnitId}
340
344
  />
341
345
  )}
342
346
  {isPreview && (
@@ -564,6 +568,7 @@ function SlideBoxContent(props) {
564
568
  messageStrategy={messageStrategy}
565
569
  fbAdManger={fbAdManger}
566
570
  onSelectTemplate={onSelectTemplate}
571
+ orgUnitId={orgUnitId}
567
572
  />
568
573
  )
569
574
  }
@@ -694,6 +699,8 @@ SlideBoxContent.propTypes = {
694
699
  selectedAccount: PropTypes.object,
695
700
  onFTPSubmit: PropTypes.func,
696
701
  messageStrategy: PropTypes.string,
697
-
702
+ fbAdManger: PropTypes.string,
703
+ showDisableInfoForFacebook: PropTypes.boolean,
704
+ orgUnitId: PropTypes.any,
698
705
  };
699
706
  export default SlideBoxContent;
@@ -25,6 +25,9 @@ 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/constant';
30
+
28
31
 
29
32
  const classPrefix = 'add-creatives-section';
30
33
 
@@ -74,11 +77,11 @@ class Creatives extends React.Component {
74
77
  }
75
78
 
76
79
  onSelectTemplate = (template, fbAdManger) => {
80
+ const data = {slidBoxContent: 'editTemplate', templateData: template};
77
81
  if (fbAdManger) {
78
- this.setState({ slidBoxContent: 'editTemplate', templateData: template, fbAdManger});
79
- } else {
80
- this.setState({ slidBoxContent: 'editTemplate', templateData: template });
82
+ data.fbAdManger = fbAdManger;
81
83
  }
84
+ this.setState(data);
82
85
  };
83
86
  onPreviewTemplate = (template) => {
84
87
  const templateData = template;
@@ -91,11 +94,11 @@ class Creatives extends React.Component {
91
94
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
92
95
  };
93
96
  onCreateNew = (fbAdManger) => {
97
+ const data = { slidBoxContent: 'createTemplate', showSlideBox: true };
94
98
  if (fbAdManger) {
95
- this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true, fbAdManger });
96
- } else {
97
- this.setState({ slidBoxContent: 'createTemplate', showSlideBox: true });
99
+ data.fbAdManger = fbAdManger;
98
100
  }
101
+ this.setState(data);
99
102
  };
100
103
 
101
104
  onShowTemplates = () => {
@@ -227,29 +230,33 @@ class Creatives extends React.Component {
227
230
  break;
228
231
  }
229
232
  case constants.FACEBOOK: {
230
- if (templateData.fbContentType === "CREATIVE") {
231
- const { creativeType, selectedFacebookAccount } = templateData || {};
232
- const fBContent = templateData.facebookCreativeList;
233
+ if (templateData.fbContentType === CREATIVE) {
234
+ const {
235
+ creativeType = "",
236
+ selectedFacebookAccount = {},
237
+ facebookCreativeList: fbCreativeList = [],
238
+ } = templateData || {};
239
+ const fBContent = fbCreativeList;
233
240
  const facebookCreativeList = [];
234
241
  fBContent.forEach((obj) => {
235
242
  const data = cloneDeep(obj);
236
- const {subType, linkDescription, imageLink, websiteLink, videoId} = obj;
243
+ const {subType, linkDescription, imageLink, websiteLink, videoId, videoName, videoUrl} = obj || {};
237
244
  delete data.linkDescription;
238
245
  delete data.websiteLink;
239
246
  data.linkDesc = linkDescription;
240
247
  data.webSiteLink = websiteLink;
241
248
  data.type = creativeType;
242
249
  switch (subType) {
243
- case "IMAGE":
250
+ case IMAGE:
244
251
  data.imgSrc = imageLink;
245
252
  delete data.imageLink;
246
253
  break;
247
- case "VIDEO":
254
+ case VIDEO:
248
255
  data.video = {
249
256
  previewImageUrl: imageLink,
250
257
  videoId,
251
- videoSrc: "",
252
- videoName: "",
258
+ videoSrc: videoUrl,
259
+ videoName,
253
260
  };
254
261
  delete data.imageLink;
255
262
  break;
@@ -267,7 +274,7 @@ class Creatives extends React.Component {
267
274
  },
268
275
  },
269
276
  },
270
- type: "FACEBOOK",
277
+ type: constants.FACEBOOK,
271
278
  edit: true,
272
279
  selectedFacebookAccount,
273
280
  };
@@ -446,27 +453,27 @@ class Creatives extends React.Component {
446
453
  data.websiteLink = webSiteLink;
447
454
 
448
455
  switch (subType) {
449
- case "IMAGE":
456
+ case IMAGE:
450
457
  data.imageLink = imgSrc;
451
458
  delete data.imgSrc;
452
459
  break;
453
- case "VIDEO":
460
+ case VIDEO:
454
461
  data.imageLink = video.previewImageUrl;
455
462
  data.videoId = video.videoId;
463
+ data.videoUrl = video.videoSrc;
464
+ data.videoName = video.videoName;
456
465
  delete data.video;
457
466
  break;
458
- case "CAROUSEL":
459
- break;
460
467
  default:
461
468
  break;
462
469
  }
463
470
  facebookCreativeList.push(data);
464
471
  });
465
472
  templateData = {
466
- fbContentType: "CREATIVE",
473
+ fbContentType: CREATIVE,
467
474
  creativeType: type,
468
475
  facebookCreativeList,
469
- channel: "FACEBOOK",
476
+ channel: constants.FACEBOOK,
470
477
  accountId,
471
478
  selectedMarketingObjective: template.value.selectedMarketingObjective,
472
479
  };
@@ -719,6 +726,7 @@ class Creatives extends React.Component {
719
726
  campaignSettings={this.props.Templates.campaignSettings}
720
727
  location={this.props.location}
721
728
  messageDetails={this.props.messageDetails}
729
+ showDisableInfoForFacebook={this.props.showDisableInfoForFacebook}
722
730
  getFormData={this.getFormData}
723
731
  onCallTaskSubmit={this.onCallTaskSubmit}
724
732
  onCreateNew={this.onCreateNew}
@@ -760,6 +768,7 @@ class Creatives extends React.Component {
760
768
  onFTPSubmit={getCreativesData}
761
769
  editor={editor}
762
770
  messageStrategy={this.props.strategy}
771
+ orgUnitId={this.props.orgUnitId}
763
772
  />
764
773
  }
765
774
  footer={this.shouldShowFooter() &&
@@ -813,7 +822,7 @@ Creatives.propTypes = {
813
822
  Templates: PropTypes.object,
814
823
  selectedAccount: PropTypes.object,
815
824
  strategy: PropTypes.string,
816
-
825
+ orgUnitId: PropTypes.number,
817
826
  };
818
827
  const mapStatesToProps = () => createStructuredSelector({
819
828
  isLoading: isLoadingSelector(),
@@ -90,6 +90,7 @@ export const Advertisement = (props) => {
90
90
  facebookTemplateData,
91
91
  selectedMarketingObjective,
92
92
  fbAdManger,
93
+ orgUnitId,
93
94
  } = props;
94
95
  const {
95
96
  formatMessage,
@@ -822,12 +823,18 @@ export const Advertisement = (props) => {
822
823
  proxyOrgList.find(({ orgID }) => orgID === Number(orgId)) || {}
823
824
  ).orgName;
824
825
  if (!status) {
826
+ // !status is the case of library
827
+ //if org id is the parent org
825
828
  if (orgUnitFacebookPageSettingsMap[-1] && !pageId) {
826
829
  setPageId(-1);
827
830
  }
828
831
  if (orgUnitFacebookPageSettingsMap[-1]) {
829
832
  pageAccessOrgsOptions.push({label: orgName, value: -1});
830
833
  }
834
+ // if we are coming from default startegy and calling templates from facebook/index.js
835
+ if (!pageId && orgUnitId && orgUnitFacebookPageSettingsMap[orgUnitId]) {
836
+ setPageId(orgUnitId);
837
+ }
831
838
  } else if (status === 'SUCCESS') {
832
839
  Object.keys(data).forEach((obj) => {
833
840
  if ((orgUnitFacebookPageSettingsMap[data[obj]] || {}).pageAccessToken) {
@@ -16,6 +16,7 @@ import {
16
16
  CapCustomCard,
17
17
  CapIcon,
18
18
  CapRadioGroup,
19
+ CapTooltip,
19
20
  } from '@capillarytech/cap-ui-library';
20
21
  import Templates from '../Templates';
21
22
  import { createStructuredSelector } from 'reselect';
@@ -195,6 +196,8 @@ const Facebook = (props) => {
195
196
  createNew,
196
197
  fbAdManger,
197
198
  getFormSubscriptionData,
199
+ showDisableInfoForFacebook,
200
+ orgUnitId,
198
201
  } = props;
199
202
  const {
200
203
  selectedMarketingObjective: fbMarketingObjectiveValue = VALUE_REACH,
@@ -241,7 +244,7 @@ const Facebook = (props) => {
241
244
  const onMarketingObjectiveSelect = (value) => setMarketingObjective(value);
242
245
 
243
246
  const radioOptions = [{
244
- label: intl.formatMessage(messages.capFbAdManager), value: CREATIVE,
247
+ label: showDisableInfoForFacebook ? <CapTooltip title={intl.formatMessage(messages.facebookDisableinfo)}>{intl.formatMessage(messages.capFbAdManager)}</CapTooltip> : intl.formatMessage(messages.capFbAdManager), value: CREATIVE, disabled: showDisableInfoForFacebook,
245
248
  }, {
246
249
  label: intl.formatMessage(messages.fbAdManager), value: AD_MANAGER,
247
250
  }];
@@ -419,6 +422,7 @@ const Facebook = (props) => {
419
422
  getFormSubscriptionData={getFormSubscriptionData}
420
423
  selectedMarketingObjective={selectedMarketingObjective}
421
424
  fbAdManger={fbAdManger}
425
+ orgUnitId={orgUnitId}
422
426
  />
423
427
  </div>
424
428
  );
@@ -172,12 +172,16 @@ export default defineMessages({
172
172
  id: `${messagePrefix}.fbAdManager`,
173
173
  defaultMessage: 'Facebook ad manager',
174
174
  },
175
- adManagerHeading:{
175
+ adManagerHeading: {
176
176
  id: `${messagePrefix}.adManagerHeading`,
177
- defaultMessage: "Where do you want to create your Facebook ad creative?"
177
+ defaultMessage: "Where do you want to create your Facebook ad creative?",
178
178
  },
179
- capAdManagerHeading:{
179
+ capAdManagerHeading: {
180
180
  id: `${messagePrefix}.capAdManagerHeading`,
181
- defaultMessage: "You can create Facebook ads creative in Engage+ Facebook ad Manager."
182
- }
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
+ },
183
187
  });
@@ -511,7 +511,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
511
511
  }
512
512
 
513
513
  this.setState({activeMode: TEMPLATES_MODE});
514
-
514
+
515
515
  this.getAllTemplates({params, resetPage: true});
516
516
  });
517
517
  }
@@ -1139,10 +1139,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1139
1139
  const channel = this.state.channel.toLowerCase();
1140
1140
  //const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
1141
1141
  let routeParams = {};
1142
+ const {fbAdManger} = this.props;
1142
1143
  timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
1143
1144
  if (this.isEnabledInLibraryModule("callCreateFromProps")) {
1144
1145
  if (this.props.fbAdManger === "CREATIVE") {
1145
- this.props.createNew(this.props.fbAdManger);
1146
+ this.props.createNew(fbAdManger);
1146
1147
  } else {
1147
1148
  this.props.createNew();
1148
1149
  }
@@ -1953,10 +1954,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1953
1954
  const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1954
1955
  let showForFacebook = false;
1955
1956
  if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
1956
- const campaignSettings = this.props.Templates.campaignSettings
1957
+ const campaignSettings = this.props.Templates.campaignSettings;
1957
1958
  if (campaignSettings && isEmpty(campaignSettings?.accountSettings)) {
1958
1959
  showForFacebook = true;
1959
- } else if(!isEmpty(campaignSettings?.accountSettings)) {
1960
+ } else if (!isEmpty(campaignSettings?.accountSettings)) {
1960
1961
  const fbSetting = get(this.props.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
1961
1962
  const { orgUnitFacebookPageSettingsMap = {} } = fbSetting[0] || {};
1962
1963
  let pageAccessToken = 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
+ showDisableInfoForFacebook,
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' && showDisableInfoForFacebook) {
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,7 +158,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
148
158
  );
149
159
 
150
160
  getFacebookComponent = () => {
151
- const { messageDetails, cap, onFacebookSubmit, messageStrategy } = this.props;
161
+ const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisableInfoForFacebook, orgUnitId } = this.props;
152
162
  return (
153
163
  <Facebook
154
164
  {...this.props}
@@ -156,6 +166,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
156
166
  cap={cap}
157
167
  onFacebookSubmit={onFacebookSubmit}
158
168
  messageStrategy={messageStrategy}
169
+ showDisableInfoForFacebook={showDisableInfoForFacebook}
170
+ orgUnitId={orgUnitId}
159
171
  />
160
172
  );
161
173
  }
@@ -66,4 +66,8 @@ export default defineMessages({
66
66
  id: 'creatives.containersV2.TemplatesV2.line',
67
67
  defaultMessage: 'Line',
68
68
  },
69
+ facebookDisableinfo: {
70
+ id: `creatives.containersV2.TemplatesV2.facebookDisableinfo`,
71
+ defaultMessage: 'Please integrate Facebook Ad page ID & username to enable this option.',
72
+ },
69
73
  });