@capillarytech/creatives-library 7.14.10 → 7.14.11

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.14.10",
4
+ "version": "7.14.11",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -10,7 +10,6 @@ import {
10
10
  import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
11
11
  import { isEmpty, get } from 'lodash';
12
12
  import './index.scss';
13
- import { WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
14
13
  import messages from './messages';
15
14
 
16
15
  function CapDocumentUpload(props) {
@@ -26,10 +25,11 @@ function CapDocumentUpload(props) {
26
25
  index,
27
26
  className,
28
27
  documentData,
29
- channel,
30
28
  whatsappDocParams,
31
29
  setWhatsappDocParams,
32
30
  docPreview,
31
+ supportedFormat,
32
+ supportedMaxSize,
33
33
  } = props;
34
34
  const {
35
35
  formatMessage,
@@ -55,7 +55,7 @@ function CapDocumentUpload(props) {
55
55
 
56
56
  const {CapHeadingSpan} = CapHeading;
57
57
 
58
- const DocComponent = useCallback(
58
+ const DocPreviewComponent = useCallback(
59
59
  () => (
60
60
  <div className={`upload uploaded-container ${props.ifError ? 'error' : ''}`}>
61
61
  {docPreview}
@@ -64,7 +64,7 @@ function CapDocumentUpload(props) {
64
64
  [documentSrc],
65
65
  );
66
66
 
67
- const WithLabel = LabelHOC(DocComponent);
67
+ const WithLabel = LabelHOC(DocPreviewComponent);
68
68
 
69
69
  const uploadDocuments = useCallback((e, {files}) => {
70
70
  if (e) {
@@ -168,15 +168,21 @@ function CapDocumentUpload(props) {
168
168
  {getDocumentSection()}
169
169
  </form>
170
170
  <div className="image-info-wrapper">
171
- {channel === WHATSAPP && (
172
- <>
173
- <CapHeadingSpan type="label2">
174
- <FormattedMessage {...messages.whatsappDocSize} />
175
- </CapHeadingSpan>
176
- </>
177
- )}
171
+ <CapHeadingSpan type="label2">
172
+ <FormattedMessage
173
+ {...messages.whatsappDocSize}
174
+ values={{
175
+ size: supportedMaxSize,
176
+ }}
177
+ />
178
+ </CapHeadingSpan>
178
179
  <CapHeadingSpan type="label2" className="image-format">
179
- <FormattedMessage {...messages.format} />
180
+ <FormattedMessage
181
+ {...messages.format}
182
+ values={{
183
+ format: supportedFormat,
184
+ }}
185
+ />
180
186
  </CapHeadingSpan>
181
187
  </div>
182
188
  </div>
@@ -195,7 +201,8 @@ CapDocumentUpload.propTypes = {
195
201
  updateOnReUpload: PropTypes.func,
196
202
  documentData: PropTypes.object,
197
203
  index: PropTypes.number,
198
- channel: PropTypes.string,
204
+ supportedFormat: PropTypes.string,
205
+ supportedMaxSize: PropTypes.string,
199
206
  whatsappDocParams: PropTypes.string,
200
207
  setWhatsappDocParams: PropTypes.func,
201
208
  docPreview: PropTypes.any,
@@ -15,7 +15,7 @@ $classPrefix: cap-custom-document-upload;
15
15
  margin-top: 8px;
16
16
  }
17
17
  .whatsapp-background div {
18
- background: #FAFBFC;
18
+ background: $CAP_G10;
19
19
  .ant-upload-list-item .ant-upload-list-item-progress {
20
20
  display: none;
21
21
  }
@@ -35,7 +35,7 @@ $classPrefix: cap-custom-document-upload;
35
35
  .pdf-label {
36
36
  width: 162px;
37
37
  height: 44px;
38
- background-color: #F4F5F7;
38
+ background-color: $CAP_G09;
39
39
  display: flex;
40
40
  .cap-image-v2 {
41
41
  margin: 6px 4px;
@@ -4,7 +4,7 @@ const scope = `creatives.componentsV2.CapDocumentUpload`;
4
4
  export default defineMessages({
5
5
  whatsappDocSize: {
6
6
  id: `${scope}.whatsappDocSize`,
7
- defaultMessage: 'Size upto: 16MB',
7
+ defaultMessage: 'Size upto: {size}',
8
8
  },
9
9
  uploadComputer: {
10
10
  id: `${scope}.uploadComputer`,
@@ -28,7 +28,7 @@ export default defineMessages({
28
28
  },
29
29
  format: {
30
30
  id: `${scope}.format`,
31
- defaultMessage: 'Format: PDF',
31
+ defaultMessage: 'Format: {format}',
32
32
  },
33
33
  docErrorDesc: {
34
34
  id: `${scope}.docErrorDesc`,
@@ -33,10 +33,10 @@ describe("test for document upload", () => {
33
33
  it("test for cap document upload", () => {
34
34
  renderComponent(props);
35
35
  expect(
36
- screen.getByText(/size upto: 16mb/i)
36
+ screen.getByText(/size upto:/i)
37
37
  ).toBeInTheDocument();
38
38
  expect(
39
- screen.getByText(/format: pdf/i)
39
+ screen.getByText(/format:/i)
40
40
  ).toBeInTheDocument();
41
41
  expect(
42
42
  screen.getByText(/drag and drop document here/i)
@@ -66,6 +66,5 @@ describe("test for document upload", () => {
66
66
  },
67
67
  };
68
68
  renderComponent(props1);
69
- expect(true).toBe(true);
70
69
  });
71
70
  });
@@ -34,8 +34,8 @@ function CapVideoUpload(props) {
34
34
  onVideoUploadUpdateAssestList,
35
35
  index,
36
36
  videoData,
37
- className,
38
37
  channel,
38
+ errorMessage,
39
39
  } = props;
40
40
  const [isVideoError, updateVideoErrorMessage] = useState(false);
41
41
  const [isVideo, updateVideoStatus] = useState(false);
@@ -131,8 +131,8 @@ function CapVideoUpload(props) {
131
131
  type,
132
132
  } = data;
133
133
  if (incorrectFile || size > videoSize) {
134
- if (channel === WHATSAPP) {
135
- updateVideoErrorMessage(formatMessage(messages.whatsappErrorMessage));
134
+ if (errorMessage) {
135
+ updateVideoErrorMessage(errorMessage);
136
136
  } else {
137
137
  updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
138
138
  }
@@ -172,11 +172,6 @@ function CapVideoUpload(props) {
172
172
  return (
173
173
  (
174
174
  <>
175
- {channel === WHATSAPP &&
176
- <CapError type="error" className="upload-video-error">
177
- {isVideoError}
178
- </CapError>
179
- }
180
175
  <CapUploader.CapDragger
181
176
  customRequest={(data) => capUploaderCustomVideoRequest(data)}
182
177
  className="form-builder-dragger whatsapp-background"
@@ -191,11 +186,9 @@ function CapVideoUpload(props) {
191
186
  <FormattedMessage {...messages.selectFromComputer} />
192
187
  </CapButton>
193
188
  </CapUploader.CapDragger>
194
- {channel !== WHATSAPP &&
195
- <CapError type="error" className="upload-video-error">
196
- {isVideoError}
197
- </CapError>
198
- }
189
+ <CapError type="error" className="upload-video-error">
190
+ {isVideoError}
191
+ </CapError>
199
192
  </>
200
193
  )
201
194
  );
@@ -249,9 +242,9 @@ function CapVideoUpload(props) {
249
242
  <FormattedMessage {...messages.imageReUpload} />
250
243
  </CapButton>
251
244
  </div>
252
- <div style={{ display: 'flex', justifyContent: 'center', margin: '4px' }}>
245
+ <div className={channel === WHATSAPP ? 'video-panel-wp' : 'video-panel'}>
253
246
  <video
254
- width={channel === WHATSAPP ? "300" : "230"}
247
+ width="230"
255
248
  poster={previewUrl}
256
249
  className="line-image-src"
257
250
  key={`${index}-video`}
@@ -280,8 +273,8 @@ function CapVideoUpload(props) {
280
273
  };
281
274
  return (
282
275
  <CapSpin spinning={isSpinning}>
283
- <div style={style} className={className}>
284
- <form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP && "video-form"}>
276
+ <div style={style} className="cap-custom-video-upload">
277
+ <form encType="multipart/form-data" id={`form`} className={channel !== WHATSAPP ? "video-form" : ""}>
285
278
  <input
286
279
  key={`videoFile`}
287
280
  style={{ display: 'none' }}
@@ -336,7 +329,7 @@ CapVideoUpload.propTypes = {
336
329
  index: PropTypes.number,
337
330
  videoData: PropTypes.object,
338
331
  channel: PropTypes.string,
339
- className: PropTypes.string,
332
+ errorMessage: PropTypes.string,
340
333
  };
341
334
 
342
335
  export default injectIntl(CapVideoUpload);
@@ -30,13 +30,20 @@ $classPrefix: cap-custom-video-upload;
30
30
  padding-left:9%;
31
31
  }
32
32
  .whatsapp-background div {
33
- background: #FAFBFC;
33
+ background: $CAP_G10;
34
34
  .ant-upload-list-item .ant-upload-list-item-progress {
35
35
  display: none;
36
36
  }
37
- }
37
+ }
38
38
  }
39
-
40
39
  .whatsapp-format {
41
40
  float: right;
42
- }
41
+ }
42
+ .video-panel-wp {
43
+ display: flex;
44
+ justify-content: center;
45
+ margin: 4px;
46
+ }
47
+ .video-panel {
48
+ display: flex;
49
+ }
@@ -41,7 +41,7 @@ export default defineMessages({
41
41
  },
42
42
  whatsappErrorMessage: {
43
43
  id: `${scope}.whatsappErrorMessage`,
44
- defaultMessage: 'Please upload the document with allowed file extension and size',
44
+ defaultMessage: 'Please upload the video with allowed file extension, size, dimension and aspect ratio',
45
45
  },
46
46
  videoRatioDescription: {
47
47
  id: `${scope}.videoRatioDescription`,
@@ -22,7 +22,7 @@ import {
22
22
  import Carousel from '../Carousel';
23
23
  import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
24
24
  import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg';
25
- import videoPlay from '../../assets/videoPlay.svg'
25
+ import videoPlay from '../../assets/videoPlay.svg';
26
26
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
27
27
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
28
28
  const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
@@ -385,20 +385,26 @@ export class Creatives extends React.Component {
385
385
  } = {},
386
386
  } = templateData;
387
387
  let mediaParams = {};
388
- if (mediaType === WHATSAPP_MEDIA_TYPES.IMAGE) {
389
- mediaParams = {
390
- imageUrl: whatsappMedia?.url,
391
- };
392
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.VIDEO) {
393
- mediaParams = {
394
- videoUrl: whatsappMedia?.url,
395
- videoPreviewImg: whatsappMedia?.previewUrl,
396
- };
397
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.DOCUMENT) {
398
- mediaParams = {
399
- documentUrl: whatsappMedia?.url,
400
- whatsappDocParams: whatsappMedia?.docParams,
401
- };
388
+ switch (mediaType) {
389
+ case (WHATSAPP_MEDIA_TYPES.IMAGE):
390
+ mediaParams = {
391
+ imageUrl: whatsappMedia?.url,
392
+ };
393
+ break;
394
+ case (WHATSAPP_MEDIA_TYPES.VIDEO):
395
+ mediaParams = {
396
+ videoUrl: whatsappMedia?.url,
397
+ videoPreviewImg: whatsappMedia?.previewUrl,
398
+ };
399
+ break;
400
+ case (WHATSAPP_MEDIA_TYPES.DOCUMENT):
401
+ mediaParams = {
402
+ documentUrl: whatsappMedia?.url,
403
+ whatsappDocParams: whatsappMedia?.docParams,
404
+ };
405
+ break;
406
+ default:
407
+ break;
402
408
  }
403
409
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
404
410
  if (btn.type === 'PHONE_NUMBER') {
@@ -650,21 +656,27 @@ export class Creatives extends React.Component {
650
656
  varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
651
657
  "{{unsubscribe}}";
652
658
  }
653
- let whatsappMedia;
654
- if (mediaType === WHATSAPP_MEDIA_TYPES.IMAGE) {
655
- whatsappMedia = {
656
- url: imageUrl,
657
- };
658
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.VIDEO) {
659
- whatsappMedia = {
660
- url: videoUrl,
661
- previewUrl: videoPreviewImg,
662
- };
663
- } else if (mediaType === WHATSAPP_MEDIA_TYPES.DOCUMENT) {
664
- whatsappMedia = {
665
- url: documentUrl,
666
- docParams: whatsappDocParams,
667
- };
659
+ let whatsappMedia = {};
660
+ switch (mediaType) {
661
+ case (WHATSAPP_MEDIA_TYPES.IMAGE):
662
+ whatsappMedia = {
663
+ url: imageUrl,
664
+ };
665
+ break;
666
+ case (WHATSAPP_MEDIA_TYPES.VIDEO):
667
+ whatsappMedia = {
668
+ url: videoUrl,
669
+ previewUrl: videoPreviewImg,
670
+ };
671
+ break;
672
+ case (WHATSAPP_MEDIA_TYPES.DOCUMENT):
673
+ whatsappMedia = {
674
+ url: documentUrl,
675
+ docParams: whatsappDocParams,
676
+ };
677
+ break;
678
+ default:
679
+ break;
668
680
  }
669
681
  templateData = {
670
682
  channel,
@@ -628,4 +628,20 @@
628
628
  -webkit-line-clamp: 10;
629
629
  -webkit-box-orient: vertical;
630
630
  overflow: hidden;
631
+ }
632
+
633
+ .video-preview {
634
+ position: relative;
635
+ }
636
+ .icon-position {
637
+ width: 50%;
638
+ height: 50%;
639
+ position: absolute;
640
+ left: 0;
641
+ top: 0;
642
+ }
643
+ .video-icon {
644
+ position: absolute;
645
+ right: -17px;
646
+ bottom: -17px;
631
647
  }
@@ -106,7 +106,7 @@ import { getRCSContent } from '../Rcs/utils';
106
106
  import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS } from '../CreativesContainer/constants';
107
107
 
108
108
  import {CREATIVE} from '../Facebook/constants';
109
-
109
+ import videoPlay from '../../assets/videoPlay.svg';
110
110
  import emailIllustration from '../Assets/images/emailIllustration.svg';
111
111
  import smsIllustration from '../Assets/images/smsIllustration.svg';
112
112
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -1067,7 +1067,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1067
1067
  break;
1068
1068
  }
1069
1069
  case WHATSAPP: {
1070
- const { whatsappImageSrc = '', templateMsg, docPreview} = getWhatsappContent(template);
1070
+ const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoSrc = ''} = getWhatsappContent(template);
1071
1071
  templateData.title = (
1072
1072
  <CapRow>
1073
1073
  <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
@@ -1079,6 +1079,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1079
1079
  {whatsappImageSrc && (
1080
1080
  <CapImage src={whatsappImageSrc} className="whatsapp-image" />
1081
1081
  )}
1082
+ {whatsappVideoSrc && (
1083
+ <div className="video-preview">
1084
+ <CapImage
1085
+ src={whatsappVideoSrc}
1086
+ className="whatsapp-image"
1087
+ />
1088
+ <div className="icon-position">
1089
+ <CapImage className="video-icon" src={videoPlay} />
1090
+ </div>
1091
+ </div>
1092
+ // <CapImage src={whatsappVideoSrc} className="whatsapp-image" />
1093
+ )}
1082
1094
  <div className="whatsapp-doc">{docPreview}</div>
1083
1095
  <span
1084
1096
  className={`${
@@ -786,6 +786,7 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
786
786
  className="whatsapp-image"
787
787
  src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
788
788
  />
789
+
789
790
  <div
790
791
  className="whatsapp-doc"
791
792
  />
@@ -1223,6 +1224,7 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
1223
1224
  className="whatsapp-image"
1224
1225
  src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
1225
1226
  />
1227
+
1226
1228
  <div
1227
1229
  className="whatsapp-doc"
1228
1230
  />
@@ -1660,6 +1662,7 @@ exports[`Test Templates container Test max templates warning 1`] = `
1660
1662
  className="whatsapp-image"
1661
1663
  src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/c9edc114-923b-4ac7-82d0-d6682213.jpg"
1662
1664
  />
1665
+
1663
1666
  <div
1664
1667
  className="whatsapp-doc"
1665
1668
  />
@@ -187,6 +187,9 @@ export const WHATSAPP_DOCUMENT_SIZE = 16000000; // 16MB
187
187
  export const HOST_TWILIO = 'twiliowhatsapptrans';
188
188
  export const HOST_KARIX = 'karixwhatsappbulk';
189
189
  export const SIZE_UNITS = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
190
+ export const PAGES = "pages";
191
+ export const PAGE = "page";
192
+ export const PDF = "PDF";
190
193
 
191
194
  export const LANGUAGE_OPTIONS = [
192
195
  {