@capillarytech/creatives-library 7.5.4 → 7.5.6

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.
Files changed (48) hide show
  1. package/assets/facebookEmptyPlaceholder.png +0 -0
  2. package/config/app.js +2 -0
  3. package/index.js +6 -0
  4. package/package.json +1 -1
  5. package/reducers.js +2 -1
  6. package/routes.js +5 -0
  7. package/services/api.js +34 -1
  8. package/utils/common.js +13 -1
  9. package/v2Components/CapImageUpload/index.js +260 -0
  10. package/v2Components/CapImageUpload/index.scss +32 -0
  11. package/v2Components/CapImageUpload/messages.js +49 -0
  12. package/v2Components/CapRadioCardCustom/index.js +66 -0
  13. package/v2Components/CapVideoUpload/index.js +299 -0
  14. package/v2Components/CapVideoUpload/index.scss +29 -0
  15. package/v2Components/CapVideoUpload/messages.js +54 -0
  16. package/v2Components/TemplatePreview/index.js +19 -2
  17. package/v2Containers/App/constants.js +21 -0
  18. package/v2Containers/Cap/messages.js +30 -0
  19. package/v2Containers/CapFacebookPreview/actions.js +31 -0
  20. package/v2Containers/CapFacebookPreview/constants.js +21 -0
  21. package/v2Containers/CapFacebookPreview/index.js +396 -0
  22. package/v2Containers/CapFacebookPreview/messages.js +138 -0
  23. package/v2Containers/CapFacebookPreview/reducer.js +37 -0
  24. package/v2Containers/CapFacebookPreview/sagas.js +99 -0
  25. package/v2Containers/CapFacebookPreview/selectors.js +25 -0
  26. package/v2Containers/CreativesContainer/SlideBoxContent.js +55 -1
  27. package/v2Containers/CreativesContainer/index.js +19 -9
  28. package/v2Containers/Facebook/Advertisement/constant.js +12 -0
  29. package/v2Containers/Facebook/Advertisement/index.js +955 -0
  30. package/v2Containers/Facebook/Advertisement/index.scss +49 -0
  31. package/v2Containers/Facebook/Advertisement/messages.js +155 -0
  32. package/v2Containers/Facebook/Advertisement/video.js +0 -0
  33. package/v2Containers/Facebook/actions.js +62 -0
  34. package/v2Containers/Facebook/constants.js +25 -1
  35. package/v2Containers/Facebook/index.js +133 -107
  36. package/v2Containers/Facebook/reducer.js +95 -1
  37. package/v2Containers/Facebook/sagas.js +136 -0
  38. package/v2Containers/Facebook/selectors.js +10 -0
  39. package/v2Containers/Line/Container/Video/index.js +38 -41
  40. package/v2Containers/Templates/_templates.scss +26 -0
  41. package/v2Containers/Templates/actions.js +14 -1
  42. package/v2Containers/Templates/constants.js +8 -0
  43. package/v2Containers/Templates/index.js +117 -10
  44. package/v2Containers/Templates/messages.js +8 -4
  45. package/v2Containers/Templates/reducer.js +22 -0
  46. package/v2Containers/Templates/sagas.js +26 -1
  47. package/v2Containers/TemplatesV2/index.js +13 -13
  48. package/v2Containers/Viber/index.js +2 -1
@@ -164,6 +164,8 @@ function SlideBoxContent(props) {
164
164
 
165
165
 
166
166
  const isCreateSms = slidBoxContent === 'createTemplate' && channel === constants.SMS;
167
+ const isCreateFacebook = slidBoxContent === 'createTemplate' && channel === constants.FACEBOOK;
168
+
167
169
  const isCreateMPush = slidBoxContent === 'createTemplate' && channel === constants.MOBILE_PUSH;
168
170
  const isCreateCallTask = slidBoxContent === 'createTemplate' && channel === constants.CALL_TASK;
169
171
  let isEditSms = false;
@@ -185,7 +187,7 @@ function SlideBoxContent(props) {
185
187
  isEditEmailWithId = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && templateData._id;
186
188
  isEmailEditWithContent = slidBoxContent === 'editTemplate' && channel === constants.EMAIL && !templateData._id;
187
189
  isEditFacebook = slidBoxContent === 'editTemplate' && channel === constants.FACEBOOK;
188
- isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER);
190
+ isPreview = slidBoxContent === 'preview' && (channel === constants.SMS || channel === constants.LINE || channel === constants.VIBER || channel === constants.FACEBOOK);
189
191
  isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
190
192
  isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
191
193
  isEditFTP = slidBoxContent === 'editTemplate' && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
@@ -263,6 +265,36 @@ function SlideBoxContent(props) {
263
265
  };
264
266
  return template.content;
265
267
  }
268
+ case constants.FACEBOOK: {
269
+ const template = cloneDeep(templateDataObject.versions.base);
270
+ const {
271
+ type: fbType = "",
272
+ primaryText = "",
273
+ callToAction = "",
274
+ displayLink = "",
275
+ } = template.content.FacebookAd[0] || {};
276
+ const previewData = Object.values(template.content.FacebookAd).map((obj) => ({
277
+ imageData: obj.imgSrc ? {imageSrc: obj.imgSrc} : {},
278
+ linkDesc: obj.linkDesc,
279
+ linkHeadLine: obj.linkHeadLine,
280
+ subType: obj.subType,
281
+ videoData: obj.video ? { videoSrc: obj.originalContentUrl,
282
+ videoName: obj.videoName,
283
+ videoHeight: obj.videoHeight,
284
+ videoWidth: obj.videoWidth,
285
+ previewUrl: obj.previewImageUrl,
286
+ } : {},
287
+ webSiteLink: obj.webSiteLink,
288
+ }));
289
+ const fbContent = {
290
+ selectedAd: fbType,
291
+ previewData,
292
+ primaryText,
293
+ callToAction,
294
+ displayLink,
295
+ };
296
+ return fbContent;
297
+ }
266
298
  default:
267
299
  return get(templateDataObject, `versions.base.content`);
268
300
  }
@@ -505,6 +537,22 @@ function SlideBoxContent(props) {
505
537
  onPreviewContentClicked={onPreviewContentClicked}
506
538
  onTestContentClicked={onTestContentClicked}/>
507
539
  }
540
+ {
541
+ isCreateFacebook && (
542
+ <Facebook
543
+ templateData={templateData}
544
+ messageDetails={messageDetails}
545
+ cap={cap}
546
+ onFacebookSubmit={onFacebookSubmit}
547
+ onCreateComplete={onCreateComplete}
548
+ setIsLoadingContent={setIsLoadingContent}
549
+ isFullMode={isFullMode}
550
+ createNew
551
+ getFormSubscriptionData={getFormData}
552
+
553
+ />
554
+ )
555
+ }
508
556
  {
509
557
  isEditFacebook && (
510
558
  <Facebook
@@ -512,7 +560,12 @@ function SlideBoxContent(props) {
512
560
  messageDetails={messageDetails}
513
561
  cap={cap}
514
562
  onFacebookSubmit={onFacebookSubmit}
563
+ onCreateComplete={onCreateComplete}
515
564
  isFullMode={isFullMode}
565
+ params={{
566
+ id: templateData._id,
567
+ }}
568
+ getFormSubscriptionData={getFormData}
516
569
  />
517
570
  )
518
571
  }
@@ -596,6 +649,7 @@ SlideBoxContent.propTypes = {
596
649
  onChannelChange: PropTypes.func,
597
650
  currentChannel: PropTypes.string,
598
651
  onEmailModeChange: PropTypes.func,
652
+ onFacebookAdModeChange: PropTypes.func,
599
653
  emailCreateMode: PropTypes.string,
600
654
  templateStep: PropTypes.string,
601
655
  onCreateNextStep: PropTypes.func,
@@ -51,6 +51,7 @@ class Creatives extends React.Component {
51
51
  currentChannel: this.props.channel || 'sms',
52
52
  weChatTemplateType: '',
53
53
  weChatMaptemplateStep: 0,
54
+
54
55
  };
55
56
  this.creativesTemplateSteps = {
56
57
  1: 'modeSelection',
@@ -104,7 +105,6 @@ class Creatives extends React.Component {
104
105
  if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || currentChannel.toUpperCase() === constants.MOBILE_PUSH || currentChannel.toUpperCase() === constants.WECHAT) {
105
106
  templateStep = prevState.templateStep + 2;
106
107
  }
107
-
108
108
  return {
109
109
  templateStep,
110
110
  };
@@ -114,6 +114,8 @@ class Creatives extends React.Component {
114
114
  onEmailModeChange = (mode) => {
115
115
  this.setState({ emailCreateMode: mode});
116
116
  }
117
+
118
+
117
119
  onMobilepushModeChange = (mode) => {
118
120
  this.setState({ mobilePushCreateMode: mode});
119
121
  }
@@ -479,17 +481,19 @@ class Creatives extends React.Component {
479
481
  showFooter = true;
480
482
  }
481
483
 
482
-
483
484
  if (showFooter) {
484
- if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') || (channel === constants.SMS && currentStep === 'modeSelection') || (channel === constants.WECHAT && currentStep === 'modeSelection'))) {
485
+ if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent') ||
486
+ ([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
485
487
  showFooter = showFooter && !this.state.isLoadingContent;
486
- } else if (slidBoxContent === "editTemplate" && ((channel === constants.EMAIL && currentStep === 'modeSelection') || (channel === constants.SMS && currentStep === 'modeSelection') || (channel === constants.WECHAT && currentStep === 'modeSelection'))) {
488
+ } else if (slidBoxContent === "editTemplate" &&
489
+ ([constants.SMS, constants.WECHAT, constants.EMAIL].includes(channel) &&
490
+ currentStep === 'modeSelection')) {
487
491
  showFooter = showFooter && !this.state.isLoadingContent;
488
492
  }
489
493
  }
490
494
 
491
495
  const isLineViberChannel = templateData && [constants.LINE, constants.VIBER].includes(templateData);
492
- if ([constants.LINE, constants.VIBER].includes(channel) || isLineViberChannel) {
496
+ if ([constants.LINE, constants.VIBER, constants.FACEBOOK].includes(channel) || isLineViberChannel) {
493
497
  showFooter = false;
494
498
  }
495
499
 
@@ -573,6 +577,13 @@ class Creatives extends React.Component {
573
577
  }
574
578
  return false;
575
579
  }
580
+ shouldShowHeader = () => {
581
+ const {currentChannel} = this.state;
582
+ if (currentChannel === constants.FACEBOOK) {
583
+ return false;
584
+ }
585
+ return true;
586
+ }
576
587
  render() {
577
588
  const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
578
589
  const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
@@ -582,7 +593,7 @@ class Creatives extends React.Component {
582
593
  <SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
583
594
  <CapSlideBox
584
595
  header={
585
- <SlideBoxHeader
596
+ this.shouldShowHeader() && <SlideBoxHeader
586
597
  key="creatives-container-slidebox-header"
587
598
  channel={currentChannel}
588
599
  messages={this.props.messages}
@@ -599,8 +610,7 @@ class Creatives extends React.Component {
599
610
  weChatTemplateType={weChatTemplateType}
600
611
  showPrefix={!isUploading} // not show back button when email template is being uploaded
601
612
  templateStep={this.creativesTemplateSteps[templateStep]}
602
- />
603
- }
613
+ />}
604
614
  content={
605
615
  <SlideBoxContent
606
616
  key="creatives-container-slidebox-content"
@@ -718,4 +728,4 @@ function mapDispatchToProps(dispatch) {
718
728
  actions: bindActionCreators(actions, dispatch),
719
729
  };
720
730
  }
721
- export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
731
+ export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
@@ -0,0 +1,12 @@
1
+ export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
2
+ export const FB_AD_IMG_HEIGHT = 1080;
3
+ export const FB_AD_IMG_WIDTH = 1080;
4
+ export const FB_AD_IMG_SIZE = 10000000; // 10 mb
5
+ export const ALLOWED_EXTENSIONS_VIDEO_REGEX = (/\.(mp4)$/i);
6
+ export const FB_AD_VIDEO_SIZE = 4000000000; // 4gb
7
+ export const MAX_CAROUSEL_ALLOWED = 10;
8
+
9
+ export const IMAGE = 'IMAGE';
10
+ export const VIDEO = 'VIDEO';
11
+ export const CAROUSEL = 'CAROUSEL';
12
+ export const IMAGE_VIDEO = 'imageVideo';