@capillarytech/creatives-library 7.6.11 → 7.6.12

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.11",
4
+ "version": "7.6.12",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -651,6 +651,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
651
651
  pageId: content.pageId}}
652
652
  accountId={content.accountId}
653
653
  accessToken={content.accessToken}
654
+ defaultGeneratePreview
654
655
  />
655
656
  </div>
656
657
  )}
@@ -45,6 +45,7 @@ export const CapFacebookPreview = (props) => {
45
45
  orgUnitFacebookPageSettingsMap = {},
46
46
  accessToken,
47
47
  accountId,
48
+ defaultGeneratePreview,
48
49
  } = props;
49
50
  const {
50
51
  formatMessage,
@@ -294,11 +295,10 @@ export const CapFacebookPreview = (props) => {
294
295
  <iframe
295
296
  src={src}
296
297
  key={random}
297
- scrolling="yes"
298
298
  style={{border: "none"}}
299
299
  width={width}
300
+ scrolling="yes"
300
301
  height={height}
301
- loading="lazy"
302
302
  />
303
303
  </>);
304
304
  };
@@ -317,6 +317,9 @@ export const CapFacebookPreview = (props) => {
317
317
 
318
318
  useEffect(() => {
319
319
  facebookPreviewActions.clearPreview();
320
+ if (defaultGeneratePreview) {
321
+ generatePreview();
322
+ }
320
323
  }, []);
321
324
 
322
325
  useEffect(() => {
@@ -335,7 +338,6 @@ export const CapFacebookPreview = (props) => {
335
338
  setDisableAfterPreviewGenerate(false);
336
339
  }
337
340
  }, [previewIframeError]);
338
-
339
341
  return (
340
342
  <CapSpin spinning={isFetchingPreview}>
341
343
  <div style={{display: 'inline-block'}}>
@@ -138,8 +138,8 @@ function SlideBoxContent(props) {
138
138
  onFTPSubmit,
139
139
  campaignSettings,
140
140
  messageStrategy,
141
- fbAdManger,
142
- showDisableInfoForFacebook,
141
+ fbAdManager,
142
+ showDisabledFBInfo,
143
143
  orgUnitId,
144
144
  } = props;
145
145
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
@@ -339,7 +339,7 @@ function SlideBoxContent(props) {
339
339
  FTPMode="create"
340
340
  selectedOfferDetails={selectedOfferDetails}
341
341
  messageStrategy={messageStrategy}
342
- showDisableInfoForFacebook={showDisableInfoForFacebook}
342
+ showDisabledFBInfo={showDisabledFBInfo}
343
343
  orgUnitId={orgUnitId}
344
344
  />
345
345
  )}
@@ -566,7 +566,7 @@ function SlideBoxContent(props) {
566
566
  createNew
567
567
  getFormSubscriptionData={getFormData}
568
568
  messageStrategy={messageStrategy}
569
- fbAdManger={fbAdManger}
569
+ fbAdManager={fbAdManager}
570
570
  onSelectTemplate={onSelectTemplate}
571
571
  orgUnitId={orgUnitId}
572
572
  />
@@ -585,7 +585,7 @@ function SlideBoxContent(props) {
585
585
  id: templateData._id,
586
586
  }}
587
587
  getFormSubscriptionData={getFormData}
588
- fbAdManger={fbAdManger}
588
+ fbAdManager={fbAdManager}
589
589
  />
590
590
  )
591
591
  }
@@ -699,8 +699,8 @@ SlideBoxContent.propTypes = {
699
699
  selectedAccount: PropTypes.object,
700
700
  onFTPSubmit: PropTypes.func,
701
701
  messageStrategy: PropTypes.string,
702
- fbAdManger: PropTypes.string,
703
- showDisableInfoForFacebook: PropTypes.boolean,
702
+ fbAdManager: PropTypes.string,
703
+ showDisabledFBInfo: PropTypes.boolean,
704
704
  orgUnitId: PropTypes.any,
705
705
  };
706
706
  export default SlideBoxContent;
@@ -76,10 +76,10 @@ class Creatives extends React.Component {
76
76
  this.setState({templateNameExists: false});
77
77
  }
78
78
 
79
- onSelectTemplate = (template, fbAdManger) => {
79
+ onSelectTemplate = (template, fbAdManager) => {
80
80
  const data = {slidBoxContent: 'editTemplate', templateData: template};
81
- if (fbAdManger) {
82
- data.fbAdManger = fbAdManger;
81
+ if (fbAdManager) {
82
+ data.fbAdManager = fbAdManager;
83
83
  }
84
84
  this.setState(data);
85
85
  };
@@ -93,10 +93,10 @@ class Creatives extends React.Component {
93
93
  onEditTemplate = () => {
94
94
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true });
95
95
  };
96
- onCreateNew = (fbAdManger) => {
96
+ onCreateNew = (fbAdManager) => {
97
97
  const data = { slidBoxContent: 'createTemplate', showSlideBox: true };
98
- if (fbAdManger) {
99
- data.fbAdManger = fbAdManger;
98
+ if (fbAdManager) {
99
+ data.fbAdManager = fbAdManager;
100
100
  }
101
101
  this.setState(data);
102
102
  };
@@ -438,7 +438,7 @@ class Creatives extends React.Component {
438
438
  break;
439
439
  case constants.FACEBOOK: {
440
440
  if (template.value) {
441
- const FacebookAd = template.value.versions.base.content.FacebookAd;
441
+ const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
442
442
  const type = FacebookAd[0].type;
443
443
  const {accountId} = this.props.Templates.selectedFacebookAccount || template.value || {};
444
444
  const facebookCreativeList = [];
@@ -726,7 +726,7 @@ class Creatives extends React.Component {
726
726
  campaignSettings={this.props.Templates.campaignSettings}
727
727
  location={this.props.location}
728
728
  messageDetails={this.props.messageDetails}
729
- showDisableInfoForFacebook={this.props.showDisableInfoForFacebook}
729
+ showDisabledFBInfo={this.props.showDisabledFBInfo}
730
730
  getFormData={this.getFormData}
731
731
  onCallTaskSubmit={this.onCallTaskSubmit}
732
732
  onCreateNew={this.onCreateNew}
@@ -742,7 +742,7 @@ class Creatives extends React.Component {
742
742
  onEnterTemplateName={this.onEnterTemplateName}
743
743
  onRemoveTemplateName={this.onRemoveTemplateName}
744
744
  onResetStep={this.resetStep}
745
- fbAdManger={this.state.fbAdManger}
745
+ fbAdManager={this.state.fbAdManager}
746
746
  cap={cap}
747
747
  setIsLoadingContent={this.setIsLoadingContent}
748
748
  onMobilepushModeChange={this.onMobilepushModeChange}
@@ -89,7 +89,6 @@ export const Advertisement = (props) => {
89
89
  getFormSubscriptionData,
90
90
  facebookTemplateData,
91
91
  selectedMarketingObjective,
92
- fbAdManger,
93
92
  orgUnitId,
94
93
  } = props;
95
94
  const {
@@ -163,7 +162,7 @@ export const Advertisement = (props) => {
163
162
  }, [paramObj.id]);
164
163
 
165
164
  useEffect(() => {
166
- if ((params && params.id) || templateData?.edit) {
165
+ if (params?.id || templateData?.edit) {
167
166
  const { FacebookAd = [], pageOrgUnitId: editPageId} = get(templateData, `versions.base.content`) || get(fbADData, `templateDetails.versions.base.content`) || {};
168
167
  const editMessageTitle = (templateData || {}).name || get(fbADData, 'templateDetails.name');
169
168
  const editFBContent = Object.values(FacebookAd);
@@ -222,6 +221,7 @@ export const Advertisement = (props) => {
222
221
  }
223
222
  }, [fbADData[`templateDetails`] || templateData]);
224
223
 
224
+
225
225
  const CustomToolTip = useCallback((msg) => <CapTooltipWithInfo
226
226
  infoIconProps={{svgProps: {width: 12, height: 12}, style: {marginLeft: 5}}}
227
227
  title={msg}
@@ -452,6 +452,7 @@ export const Advertisement = (props) => {
452
452
  updateMessageTitle(val);
453
453
  }, [messageTitle]);
454
454
 
455
+
455
456
  const isDisableDone = useCallback((isPreview) => {
456
457
  let flag = false;
457
458
  if (primaryText === "" ) {
@@ -501,7 +502,6 @@ export const Advertisement = (props) => {
501
502
  selectedAd,
502
503
  ]
503
504
  );
504
-
505
505
  const isDisableContinue = () => isFullMode ? (messageTitle.trim() === "" || selectedAd === "") : ( selectedAd === "");
506
506
 
507
507
  const onClickContinue = useCallback(() => { updateStep('createFacebookAd'); }, [step]);
@@ -812,7 +812,7 @@ export const Advertisement = (props) => {
812
812
  }, [pageId]);
813
813
 
814
814
  const selectedFacebookAccount = templateData?.edit ? templateData?.selectedFacebookAccount : facebookTemplateData?.selectedFacebookAccount;
815
- const {orgUnitFacebookPageSettingsMap = {}, employeeAccessToken: accessToken = "", accountId = "" } = selectedFacebookAccount;
815
+ const {orgUnitFacebookPageSettingsMap = {}, employeeAccessToken: accessToken = "", accountId = "" } = selectedFacebookAccount || {};
816
816
 
817
817
  const getPageAccessOrgs = useCallback(() => {
818
818
  const {status, data } = fbADData.orgOuData || {};
@@ -30,7 +30,7 @@ $classPrefix: add-facebook-ad-section;
30
30
 
31
31
  .cap-header-facebook-ad{
32
32
  position: fixed;
33
- top: 27px;
33
+ top: 58px;
34
34
  z-index: 1000;
35
35
  .title-desc-container{
36
36
  padding-left: 10px;
@@ -194,9 +194,9 @@ const Facebook = (props) => {
194
194
  renderNewCardGrid,
195
195
  onSelectTemplate,
196
196
  createNew,
197
- fbAdManger,
197
+ fbAdManager,
198
198
  getFormSubscriptionData,
199
- showDisableInfoForFacebook,
199
+ showDisabledFBInfo,
200
200
  orgUnitId,
201
201
  } = props;
202
202
  const {
@@ -244,7 +244,7 @@ const Facebook = (props) => {
244
244
  const onMarketingObjectiveSelect = (value) => setMarketingObjective(value);
245
245
 
246
246
  const radioOptions = [{
247
- label: showDisableInfoForFacebook ? <CapTooltip title={intl.formatMessage(messages.facebookDisableinfo)}>{intl.formatMessage(messages.capFbAdManager)}</CapTooltip> : intl.formatMessage(messages.capFbAdManager), value: CREATIVE, disabled: showDisableInfoForFacebook,
247
+ label: showDisabledFBInfo ? <CapTooltip title={intl.formatMessage(messages.facebookDisableinfo)}>{intl.formatMessage(messages.capFbAdManager)}</CapTooltip> : intl.formatMessage(messages.capFbAdManager), value: CREATIVE, disabled: showDisabledFBInfo,
248
248
  }, {
249
249
  label: intl.formatMessage(messages.fbAdManager), value: AD_MANAGER,
250
250
  }];
@@ -280,10 +280,10 @@ const Facebook = (props) => {
280
280
  onSelectTemplate={onSelectTemplate}
281
281
  renderNewCardGrid={renderNewCardGrid}
282
282
  handlePeviewTemplate={handlePeviewTemplate}
283
- fbAdManger={CREATIVE}
283
+ fbAdManager={CREATIVE}
284
284
  />
285
285
  ) :
286
- (!isFullMode && fbAdManger !== CREATIVE && messageStrategy === "DEFAULT" ) ?
286
+ (!isFullMode && fbAdManager !== CREATIVE && messageStrategy === "DEFAULT" ) ?
287
287
  (<div className={className}>
288
288
 
289
289
  <div className="is-scrollable-section" >
@@ -421,7 +421,7 @@ const Facebook = (props) => {
421
421
  messageStrategy={messageStrategy}
422
422
  getFormSubscriptionData={getFormSubscriptionData}
423
423
  selectedMarketingObjective={selectedMarketingObjective}
424
- fbAdManger={fbAdManger}
424
+ fbAdManager={fbAdManager}
425
425
  orgUnitId={orgUnitId}
426
426
  />
427
427
  </div>
@@ -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
- orgUnitFacebookPageSettingsMap = {},
326
+ orgUnitFacebookPageSettingsMap = {},
325
327
  } = fbSetting[0] || {};
326
328
  let pageAccessToken = false;
327
329
  if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
@@ -454,7 +456,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
454
456
  this.setState({previewTemplate: nextProps.Templates.templateDetails});
455
457
  }
456
458
 
457
- if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat', 'mobilepush'].indexOf(this.state.channel.toLowerCase()) > -1)) {
459
+ if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat'].indexOf(this.state.channel.toLowerCase()) > -1)) {
458
460
  const paramsDefault = {
459
461
  name: this.state.searchText,
460
462
  sortBy: this.state.sortBy,
@@ -464,9 +466,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
464
466
  paramsDefault.wecrmToken = nextProps.Templates.weCrmAccounts[0].configs.wecrm_token;
465
467
  paramsDefault.originalId = nextProps.Templates.weCrmAccounts[0].sourceAccountIdentifier;
466
468
  nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
467
- } else if (this.state.channel.toLowerCase() === 'mobilepush') {
468
- nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
469
- paramsDefault.accountId = nextProps.Templates.weCrmAccounts[0].id;
470
469
  }
471
470
  this.setState({defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: nextProps.Templates.weCrmAccounts[0].name });
472
471
  this.getAllTemplates({params: paramsDefault}, true);
@@ -1139,11 +1138,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1139
1138
  const channel = this.state.channel.toLowerCase();
1140
1139
  //const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
1141
1140
  let routeParams = {};
1142
- const {fbAdManger} = this.props;
1141
+ const {fbAdManager} = this.props;
1143
1142
  timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
1144
1143
  if (this.isEnabledInLibraryModule("callCreateFromProps")) {
1145
- if (this.props.fbAdManger === "CREATIVE") {
1146
- this.props.createNew(fbAdManger);
1144
+ if (this.props.fbAdManager === CREATIVE) {
1145
+ this.props.createNew(fbAdManager);
1147
1146
  } else {
1148
1147
  this.props.createNew();
1149
1148
  }
@@ -1417,7 +1416,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1417
1416
  }
1418
1417
  }
1419
1418
  if (this.isEnabledInLibraryModule("callSelectFromProps")) {
1420
- this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManger);
1419
+ this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManager);
1421
1420
  } else {
1422
1421
  if (this.state.channel.toLowerCase() === 'ebill') {
1423
1422
  pathName = `/ebill/edit/${id}`;
@@ -1952,11 +1951,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1952
1951
  render() {
1953
1952
  const isFullMode = this.isFullMode();
1954
1953
  const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1955
- let showForFacebook = false;
1954
+ let showFbAds = false;
1956
1955
  if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
1957
1956
  const campaignSettings = this.props.Templates.campaignSettings;
1958
1957
  if (campaignSettings && isEmpty(campaignSettings?.accountSettings)) {
1959
- showForFacebook = true;
1958
+ showFbAds = true;
1960
1959
  } else if (!isEmpty(campaignSettings?.accountSettings)) {
1961
1960
  const fbSetting = get(this.props.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
1962
1961
  const { orgUnitFacebookPageSettingsMap = {} } = fbSetting[0] || {};
@@ -1968,17 +1967,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1968
1967
  }
1969
1968
  });
1970
1969
  if (!pageAccessToken) {
1971
- showForFacebook = true;
1970
+ showFbAds = true;
1972
1971
  }
1973
1972
  } else {
1974
- showForFacebook = true;
1973
+ showFbAds = true;
1975
1974
  }
1976
1975
  }
1977
1976
  }
1978
1977
 
1979
1978
  const showForViber = (![VIBER_CHANNEL, FACEBOOK_CHANNEL].includes(channel.toLowerCase()) ||
1980
1979
  (channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))) ||
1981
- (channel.toLowerCase() === FACEBOOK_CHANNEL && showForFacebook)
1980
+ (channel.toLowerCase() === FACEBOOK_CHANNEL && showFbAds)
1982
1981
  );
1983
1982
 
1984
1983
 
@@ -45,7 +45,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
45
45
  channelsToDisable = [],
46
46
  isFullMode,
47
47
  onChannelChange,
48
- showDisableInfoForFacebook,
48
+ showDisabledFBInfo,
49
49
  } = props;
50
50
 
51
51
  const defaultPanes = {
@@ -81,7 +81,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
81
81
  if (channelsToDisable.includes(pane.key)) {
82
82
  // eslint-disable-next-line no-param-reassign
83
83
  pane.disabled = true;
84
- if (pane.key === 'facebook' && showDisableInfoForFacebook) {
84
+ if (pane.key === 'facebook' && showDisabledFBInfo) {
85
85
  pane.tab = (<CapTooltip
86
86
  title={
87
87
  intl.formatMessage(messages.facebookDisableinfo)
@@ -158,7 +158,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
158
158
  );
159
159
 
160
160
  getFacebookComponent = () => {
161
- const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisableInfoForFacebook, orgUnitId } = this.props;
161
+ const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisabledFBInfo, orgUnitId } = this.props;
162
162
  return (
163
163
  <Facebook
164
164
  {...this.props}
@@ -166,7 +166,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
166
166
  cap={cap}
167
167
  onFacebookSubmit={onFacebookSubmit}
168
168
  messageStrategy={messageStrategy}
169
- showDisableInfoForFacebook={showDisableInfoForFacebook}
169
+ showDisabledFBInfo={showDisabledFBInfo}
170
170
  orgUnitId={orgUnitId}
171
171
  />
172
172
  );