@capillarytech/creatives-library 7.14.8 → 7.14.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.
@@ -0,0 +1,3 @@
1
+ <svg width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.0026 0.333496C7.8026 0.333496 0.335938 7.80016 0.335938 17.0002C0.335938 26.2002 7.8026 33.6668 17.0026 33.6668C26.2026 33.6668 33.6693 26.2002 33.6693 17.0002C33.6693 7.80016 26.2026 0.333496 17.0026 0.333496ZM12.8359 21.4502V12.5502C12.8359 11.2335 14.3026 10.4335 15.4026 11.1502L22.3193 15.6002C23.3359 16.2502 23.3359 17.7502 22.3193 18.4002L15.4026 22.8502C14.3026 23.5668 12.8359 22.7668 12.8359 21.4502Z" fill="#091E42"/>
3
+ </svg>
package/config/app.js CHANGED
@@ -17,7 +17,6 @@ const config = {
17
17
  },
18
18
  development: {
19
19
  api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
20
- //api_endpoint: "http://localhost:2022/arya/api/v1/creatives",
21
20
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
22
21
  campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
23
22
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.14.8",
4
+ "version": "7.14.10",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,8 +1,6 @@
1
1
  /* eslint-disable camelcase */
2
2
  import React, { useState, useEffect, useCallback } from 'react';
3
3
  import PropTypes from "prop-types";
4
- import "@react-pdf-viewer/core/lib/styles/index.css";
5
- import "@react-pdf-viewer/default-layout/lib/styles/index.css";
6
4
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
7
5
  import {
8
6
  CapUploader,
@@ -22,7 +20,6 @@ function CapDocumentUpload(props) {
22
20
  documentSize,
23
21
  uploadAsset,
24
22
  supportedExtensions,
25
- style,
26
23
  documentSrc,
27
24
  updateDocumentSrc,
28
25
  updateOnReUpload,
@@ -30,7 +27,6 @@ function CapDocumentUpload(props) {
30
27
  className,
31
28
  documentData,
32
29
  channel,
33
- channelSpecificStyle,
34
30
  whatsappDocParams,
35
31
  setWhatsappDocParams,
36
32
  docPreview,
@@ -123,22 +119,23 @@ function CapDocumentUpload(props) {
123
119
 
124
120
  const getDocumentSection = useCallback(() => {
125
121
  if (documentSrc === "") {
126
- return (<>
127
- <CapUploader.CapDragger
128
- customRequest={capUploaderCustomRequest}
129
- className="form-builder-dragger whatsapp-background"
130
- showUploadList={!isDocError}
131
- >
132
- <CapHeading className="dragger-title" type="h7">
133
- <FormattedMessage {...messages.dragAndDrop} />
134
- </CapHeading>
135
- <CapHeading className="dragger-or" type="label6">
136
- <FormattedMessage {...messages.or} />
137
- </CapHeading>
138
- <CapButton className="dragger-button upload-doc" type="secondary">
139
- <FormattedMessage {...messages.uploadComputer} />
140
- </CapButton>
141
- </CapUploader.CapDragger>
122
+ return (
123
+ <>
124
+ <CapUploader.CapDragger
125
+ customRequest={capUploaderCustomRequest}
126
+ className="form-builder-dragger whatsapp-background"
127
+ showUploadList={!isDocError}
128
+ >
129
+ <CapHeading className="dragger-title" type="h7">
130
+ <FormattedMessage {...messages.dragAndDrop} />
131
+ </CapHeading>
132
+ <CapHeading className="dragger-or" type="label6">
133
+ <FormattedMessage {...messages.or} />
134
+ </CapHeading>
135
+ <CapButton className="dragger-button upload-doc" type="secondary">
136
+ <FormattedMessage {...messages.uploadComputer} />
137
+ </CapButton>
138
+ </CapUploader.CapDragger>
142
139
  </>
143
140
  );
144
141
  }
@@ -147,7 +144,6 @@ function CapDocumentUpload(props) {
147
144
  className="dragger-button re-upload"
148
145
  type="flat"
149
146
  onClick={onReUpload}
150
- style={channelSpecificStyle ? { marginTop: '-16px'} : {}}
151
147
  >
152
148
  <FormattedMessage {...messages.docReUpload} />
153
149
  </CapButton>
@@ -155,16 +151,15 @@ function CapDocumentUpload(props) {
155
151
  }, [isDocError, documentSrc]);
156
152
 
157
153
  return (
158
- <div style={style} className="cap-custom-document-upload">
154
+ <div className="cap-custom-document-upload document-div">
159
155
  <WithLabel
160
156
  key={`with-label`}
161
157
  errorMessage={isDocError} ifError={!!isDocError}
162
-
163
- />
158
+ />
164
159
  <form encType="multipart/form-data" id={`form`} className={className}>
165
160
  <input
166
161
  key={`docFile`}
167
- style={{ display: 'none' }}
162
+ className="input-div"
168
163
  id="fileName"
169
164
  type="file"
170
165
  onChange={(e) => uploadDocuments(e, { files: e.target.files })}
@@ -193,7 +188,6 @@ CapDocumentUpload.propTypes = {
193
188
  documentSize: PropTypes.number,
194
189
  uploadAsset: PropTypes.func,
195
190
  supportedExtensions: PropTypes.any,
196
- style: PropTypes.any,
197
191
  documentSrc: PropTypes.string,
198
192
  updateDocumentSrc: PropTypes.func,
199
193
  intl: intlShape,
@@ -204,7 +198,6 @@ CapDocumentUpload.propTypes = {
204
198
  channel: PropTypes.string,
205
199
  whatsappDocParams: PropTypes.string,
206
200
  setWhatsappDocParams: PropTypes.func,
207
- channelSpecificStyle: PropTypes.bool,
208
201
  docPreview: PropTypes.any,
209
202
  };
210
203
 
@@ -6,6 +6,9 @@ $classPrefix: cap-custom-document-upload;
6
6
  .upload-doc {
7
7
  margin-right: $CAP_SPACE_08;
8
8
  }
9
+ .input-div {
10
+ display: none;
11
+ }
9
12
  .image-info-wrapper {
10
13
  display: flex;
11
14
  justify-content: space-between;
@@ -61,3 +64,6 @@ $classPrefix: cap-custom-document-upload;
61
64
  }
62
65
 
63
66
  }
67
+ .document-div {
68
+ padding-top: '20px';
69
+ }
@@ -33,6 +33,6 @@ export default defineMessages({
33
33
  docErrorDesc: {
34
34
  id: `${scope}.docErrorDesc`,
35
35
  defaultMessage:
36
- 'Please upload the document with allowed file extension, size, dimension and aspect ratio',
36
+ 'Please upload the document with allowed file extension and size',
37
37
  },
38
38
  });
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import { injectIntl } from 'react-intl';
3
+ import '@testing-library/jest-dom';
4
+ import userEvent from '@testing-library/user-event';
5
+ import {
6
+ render,
7
+ screen,
8
+ } from '../../../utils/test-utils';
9
+ import CapDocumentUpload from '../index';
10
+
11
+ const ComponentToRender = injectIntl(CapDocumentUpload);
12
+ const renderComponent = (props) => render(
13
+ <ComponentToRender {...props} />
14
+ );
15
+
16
+ describe("test for document upload", () => {
17
+ const props = {
18
+ allowedExtensionsRegex: (/\.(pdf)$/i),
19
+ documentSize: 16000000,
20
+ uploadAsset: jest.fn(),
21
+ documentSrc: '',
22
+ updateDocumentSrc: jest.fn(),
23
+ updateOnReUpload: jest.fn(),
24
+ index: 0,
25
+ className: 'cap-custom-document-upload',
26
+ documentData: {},
27
+ channel: 'WHATSAPP',
28
+ channelSpecificStyle: null,
29
+ whatsappDocParams: {},
30
+ setWhatsappDocParams: jest.fn(),
31
+ docPreview: <></>,
32
+ };
33
+ it("test for cap document upload", () => {
34
+ renderComponent(props);
35
+ expect(
36
+ screen.getByText(/size upto: 16mb/i)
37
+ ).toBeInTheDocument();
38
+ expect(
39
+ screen.getByText(/format: pdf/i)
40
+ ).toBeInTheDocument();
41
+ expect(
42
+ screen.getByText(/drag and drop document here/i)
43
+ ).toBeInTheDocument();
44
+ const button = screen.getByRole('button', {
45
+ name: /drag and drop document here or select from computer/i,
46
+ });
47
+ userEvent.click(button);
48
+ });
49
+ it("test for cap document upload 1", () => {
50
+ const props1 = {
51
+ ...props,
52
+ documentData: {
53
+ uploadedAssetData0: {
54
+ file_size: 134532,
55
+ name: 'sample.pdf',
56
+ secure_file_path: "https://www.africau.edu/images/default/sample.pdf",
57
+ karixFileHandle: 'abcd',
58
+ },
59
+ },
60
+ documentSrc: "https://www.africau.edu/images/default/sample.pdf",
61
+ whatsappDocParams: {
62
+ whatsappDocName: 'sample.pdf',
63
+ whatsappDocSize: 134532,
64
+ whatsappDocPages: 2,
65
+ whatsappDocImg: 'https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g',
66
+ },
67
+ };
68
+ renderComponent(props1);
69
+ expect(true).toBe(true);
70
+ });
71
+ });
@@ -10,15 +10,14 @@ import CapDrawer from '@capillarytech/cap-ui-library/CapDrawer';
10
10
  import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
11
11
  import moment from 'moment';
12
12
  import isEmpty from 'lodash/isEmpty';
13
- import messages from './messages';
14
13
  import {
15
14
  CapHeading,
16
15
  CapButton,
17
16
  CapError,
18
17
  CapUploader,
19
18
  CapSpin,
20
- CapNotification,
21
19
  } from '@capillarytech/cap-ui-library';
20
+ import messages from './messages';
22
21
  import {bytes2Size} from '../../utils/common';
23
22
  import { WHATSAPP } from './constants';
24
23
  import './index.scss';
@@ -56,6 +55,7 @@ function CapVideoUpload(props) {
56
55
  } = uploadedAssetList;
57
56
 
58
57
  const [isTemplateDrawerRequired, updateTemplateDrawerRequirement] = useState(false);
58
+
59
59
  const uploadVideo = useCallback((e, { files }) => {
60
60
  if (e) {
61
61
  e.preventDefault();
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { injectIntl } from 'react-intl';
3
+ import userEvent from '@testing-library/user-event';
4
+ import '@testing-library/jest-dom';
5
+ import {
6
+ render,
7
+ screen,
8
+ } from '../../../utils/test-utils';
9
+ import CapVideoUpload from '../index';
10
+
11
+ const ComponentToRender = injectIntl(CapVideoUpload);
12
+ const renderComponent = (props) => render(
13
+ <ComponentToRender {...props} />
14
+ );
15
+
16
+ describe("test for document upload", () => {
17
+ const props = {
18
+ allowedExtensionsRegex: (/\.(mp4|3gpp)$/i),
19
+ videoSize: 16000000,
20
+ uploadAsset: jest.fn(),
21
+ supportedExtensions: '',
22
+ uploadedAssetList: {},
23
+ updateDocumentSrc: jest.fn(),
24
+ updateOnReUpload: jest.fn(),
25
+ index: 0,
26
+ className: 'cap-custom-video-upload',
27
+ videoData: {},
28
+ channel: 'WHATSAPP',
29
+ onVideoUploadUpdateAssestList: jest.fn(),
30
+ };
31
+ it("test for cap document upload", () => {
32
+ renderComponent(props);
33
+ expect(
34
+ screen.getByText(/file size: up to 16 mb/i)
35
+ ).toBeInTheDocument();
36
+ expect(
37
+ screen.getByText(
38
+ /format: mp4 and 3gpp \(h\.264 video codec and aac audio codec\)/i)
39
+ ).toBeInTheDocument();
40
+ expect(
41
+ screen.getByText(/drag and drop video here/i)
42
+ ).toBeInTheDocument();
43
+ const button = screen.getByRole('button', {
44
+ name: /drag and drop video here or select from computer/i,
45
+ });
46
+ userEvent.click(button);
47
+ });
48
+ it("test for cap document upload 1", () => {
49
+ const props1 = {
50
+ ...props,
51
+ videoData: {
52
+ uploadedAssetData0: {
53
+ _id: "63f3126a8f9d2d85450a99d3",
54
+ type: "VIDEO",
55
+ isActive: true,
56
+ name: "sample_960x540_Xs2E4anK.mp4",
57
+ createdBy: "15000449",
58
+ updatedBy: "15000449",
59
+ orgId: 50074,
60
+ metaInfo: {
61
+ file_handle: null,
62
+ name: "sample_960x540_Xs2E4anK.mp4",
63
+ content_type: null,
64
+ file_size: 1320775,
65
+ added_on: 1676874342000,
66
+ last_modified_on: 1676874342000,
67
+ acl: null,
68
+ secure_file_path: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
69
+ public_url: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
70
+ video_file_path_preview: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/video_screenshot_assets__1676874342082.png/1040"
71
+ },
72
+ createdAt: "2023-02-20T06:25:46.637Z",
73
+ updatedAt: "2023-02-20T06:25:46.637Z",
74
+ __v: 0,
75
+ },
76
+ },
77
+ uploadedAssetList: {
78
+ videoSrc: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/69d66812-291f-4658-9da8-c6d30eef.mp4",
79
+ videoId: "",
80
+ videoName: "sample_960x540_Xs2E4anK.mp4",
81
+ videoHeight: 540,
82
+ videoWidth: 960,
83
+ previewUrl: "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/video_screenshot_assets__1676874342082.png/1040"
84
+ },
85
+ };
86
+ renderComponent(props1);
87
+ const reUploadBtn = screen.getByRole('button', {name: /re upload/i});
88
+ userEvent.click(reUploadBtn);
89
+ });
90
+ });
@@ -457,4 +457,20 @@
457
457
  span {
458
458
  font-size: $FONT_SIZE_VS;
459
459
  }
460
+ }
461
+
462
+ .video-preview {
463
+ position: relative;
464
+ }
465
+ .icon-position {
466
+ width: 50%;
467
+ height: 50%;
468
+ position: absolute;
469
+ left: 0;
470
+ top: 0;
471
+ }
472
+ .video-icon {
473
+ position: absolute;
474
+ right: -17px;
475
+ bottom: -17px;
460
476
  }
@@ -22,6 +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
26
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
26
27
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
27
28
  const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
@@ -741,11 +742,16 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
741
742
  />
742
743
  )}
743
744
  {content?.whatsappVideoPreviewImg && (
744
- <CapImage
745
- src={content.whatsappVideoPreviewImg}
746
- className="whatsapp-image"
747
- alt={formatMessage(messages.previewGenerated)}
748
- />
745
+ <div className="video-preview">
746
+ <CapImage
747
+ src={content.whatsappVideoPreviewImg}
748
+ className="whatsapp-image"
749
+ alt={formatMessage(messages.previewGenerated)}
750
+ />
751
+ <div className="icon-position">
752
+ <CapImage className="video-icon" src={videoPlay} />
753
+ </div>
754
+ </div>
749
755
  )}
750
756
  {content?.docPreview && (
751
757
  <div className="whatsapp-image">
@@ -31,7 +31,7 @@ import { IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TE
31
31
  import {IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
32
32
  import { CREATIVE } from '../Facebook/constants';
33
33
  import { LOYALTY } from '../App/constants';
34
- import { WHATSAPP_STATUSES } from '../Whatsapp/constants';
34
+ import { WHATSAPP_STATUSES, WHATSAPP_MEDIA_TYPES } from '../Whatsapp/constants';
35
35
 
36
36
  import { updateImagesInHtml } from '../../utils/cdnTransformation';
37
37
 
@@ -381,9 +381,25 @@ export class Creatives extends React.Component {
381
381
  buttonType = 'NONE',
382
382
  buttons = [],
383
383
  mediaType = 'TEXT',
384
- whatsappMedia: { url: imageUrl = '' } = {},
384
+ whatsappMedia = {},
385
385
  } = {},
386
386
  } = templateData;
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
+ };
402
+ }
387
403
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
388
404
  if (btn.type === 'PHONE_NUMBER') {
389
405
  btn.phone_number = btn.phoneNumber;
@@ -410,7 +426,7 @@ export class Creatives extends React.Component {
410
426
  category,
411
427
  varMapped,
412
428
  mediaType,
413
- imageUrl,
429
+ ...mediaParams,
414
430
  buttonType,
415
431
  buttons: modifiedButtons,
416
432
  languages: [
@@ -606,6 +622,10 @@ export class Creatives extends React.Component {
606
622
  buttonType = 'NONE',
607
623
  buttons = [],
608
624
  imageUrl = '',
625
+ videoUrl = '',
626
+ documentUrl = '',
627
+ videoPreviewImg = '',
628
+ whatsappDocParams = {},
609
629
  } = cloneDeep(versions.base.content.whatsapp);
610
630
 
611
631
  const modifiedButtons = cloneDeep(buttons).map((btn) => {
@@ -630,7 +650,22 @@ export class Creatives extends React.Component {
630
650
  varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
631
651
  "{{unsubscribe}}";
632
652
  }
633
-
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
+ };
668
+ }
634
669
  templateData = {
635
670
  channel,
636
671
  accountId,
@@ -646,9 +681,7 @@ export class Creatives extends React.Component {
646
681
  buttonType,
647
682
  buttons: modifiedButtons,
648
683
  mediaType,
649
- whatsappMedia: {
650
- url: imageUrl,
651
- },
684
+ whatsappMedia,
652
685
  },
653
686
  };
654
687
  }
@@ -784,7 +784,6 @@ export const Whatsapp = (props) => {
784
784
  );
785
785
  const renderDocumentComponent = () => (
786
786
  <CapDocumentUpload
787
- style={{ paddingTop: '20px' }}
788
787
  allowedExtensionsRegex={ALLOWED_EXTENSIONS_DOCUMENT_REGEX}
789
788
  documentSize={WHATSAPP_DOCUMENT_SIZE}
790
789
  uploadAsset={uploadWhatsappImage}
@@ -3,6 +3,8 @@ import {
3
3
  getWhatsappStatus,
4
4
  getWhatsappCategory,
5
5
  getWhatsappCta,
6
+ bytesConversion,
7
+ getWhatsappDocPreview,
6
8
  } from '../utils';
7
9
  import mockdata from '../../mockdata';
8
10
 
@@ -12,6 +14,8 @@ const {
12
14
  getWhatsappStatusOutput1,
13
15
  getWhatsappCategoryOutput1,
14
16
  getWhatsappCategoryOutput2,
17
+ getWhatsappDocPreviewOutput,
18
+ getWhatsappDocPreviewOutput1,
15
19
  } = mockdata;
16
20
 
17
21
  describe('Test utils', () => {
@@ -19,6 +23,8 @@ describe('Test utils', () => {
19
23
  expect(getWhatsappContent(whatsappPreviewTemplateData)).toMatchSnapshot();
20
24
  expect(getWhatsappContent(whatsappPreviewTemplateData2)).toMatchSnapshot();
21
25
  expect(getWhatsappContent({})).toMatchSnapshot();
26
+ expect(bytesConversion(1024)).toEqual('1.0 KB');
27
+ expect(bytesConversion('abcd')).toEqual('0 bytes');
22
28
  });
23
29
 
24
30
  it('test getWhatsappContent for preview', () => {
@@ -45,4 +51,22 @@ describe('Test utils', () => {
45
51
  getWhatsappCategoryOutput2,
46
52
  );
47
53
  });
54
+
55
+ it('test getWhatsappDocPreview', () => {
56
+ const whatsappDocParams = {
57
+ whatsappDocName: "java_tutorial__QtdfGkr.pdf",
58
+ whatsappDocSize: 1089150,
59
+ whatsappDocPages: 2,
60
+ whatsappDocImg: "https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g",
61
+ };
62
+ expect(getWhatsappDocPreview(whatsappDocParams)).toEqual(
63
+ getWhatsappDocPreviewOutput,
64
+ );
65
+ expect(getWhatsappDocPreview({
66
+ ...whatsappDocParams,
67
+ whatsappDocPages: 1,
68
+ })).toEqual(
69
+ getWhatsappDocPreviewOutput1,
70
+ );
71
+ });
48
72
  });
@@ -19,7 +19,7 @@ import {
19
19
  import './styles.scss';
20
20
  import pdfIcon from "../../assets/pdfIcon.svg";
21
21
 
22
- function bytesConversion(x) {
22
+ export function bytesConversion(x) {
23
23
  let l;
24
24
  l = 0;
25
25
  let n;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
+ import { CapImage, CapLabel } from '@capillarytech/cap-ui-library';
4
+ import pdfIcon from '../assets/pdfIcon.svg';
3
5
 
4
6
  export default {
5
7
  whatsappTemplates: {
@@ -957,6 +959,50 @@ export default {
957
959
  type: 'WHATSAPP',
958
960
  channel: 'WHATSAPP',
959
961
  },
962
+ getWhatsappDocPreviewOutput:
963
+ (
964
+ <>
965
+ <div className="pdf-img-box">
966
+ <CapImage src={"https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g"} alt="upload-document-src" className="pdf-preview-img" />
967
+ </div>
968
+ <div className="pdf-label">
969
+ <CapImage src={pdfIcon} />
970
+ <div className="pdf-info">
971
+ <div className="pdf-name-div">
972
+ <CapLabel type="label9" className="pdf-name">java_tutorial</CapLabel>
973
+ <CapLabel type="label9">{".pdf"}</CapLabel>
974
+ </div>
975
+ <CapLabel className="pdf-info-sec">
976
+ {
977
+ `2 pages · 1.0 MB · PDF`
978
+ }
979
+ </CapLabel>
980
+ </div>
981
+ </div>
982
+ </>
983
+ ),
984
+ getWhatsappDocPreviewOutput1:
985
+ (
986
+ <>
987
+ <div className="pdf-img-box">
988
+ <CapImage src={"https://play-lh.googleusercontent.com/BkRfMfIRPR9hUnmIYGDgHHKjow-g18-ouP6B2ko__VnyUHSi1spcc78UtZ4sVUtBH4g"} alt="upload-document-src" className="pdf-preview-img" />
989
+ </div>
990
+ <div className="pdf-label">
991
+ <CapImage src={pdfIcon} />
992
+ <div className="pdf-info">
993
+ <div className="pdf-name-div">
994
+ <CapLabel type="label9" className="pdf-name">java_tutorial</CapLabel>
995
+ <CapLabel type="label9">{".pdf"}</CapLabel>
996
+ </div>
997
+ <CapLabel className="pdf-info-sec">
998
+ {
999
+ `1 page · 1.0 MB · PDF`
1000
+ }
1001
+ </CapLabel>
1002
+ </div>
1003
+ </div>
1004
+ </>
1005
+ ),
960
1006
  rcsEditTemplateData: {
961
1007
  mode: 'edit',
962
1008
  _id: '620e213d39bd394c58aeaaca',