@capillarytech/creatives-library 7.17.116 → 7.17.118-alpha.0

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 (30) hide show
  1. package/containers/App/constants.js +1 -0
  2. package/package.json +1 -1
  3. package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +16 -12
  4. package/utils/common.js +5 -0
  5. package/v2Components/CapImageUpload/constants.js +6 -0
  6. package/v2Components/CapImageUpload/index.js +15 -16
  7. package/v2Components/CapImageUpload/messages.js +1 -5
  8. package/v2Components/CapVideoUpload/constants.js +5 -0
  9. package/v2Components/CapVideoUpload/index.js +28 -8
  10. package/v2Components/CapVideoUpload/index.scss +4 -1
  11. package/v2Components/CapVideoUpload/messages.js +4 -4
  12. package/v2Components/FormBuilder/index.js +19 -1
  13. package/v2Components/FormBuilder/messages.js +4 -0
  14. package/v2Components/TemplatePreview/_templatePreview.scss +21 -0
  15. package/v2Components/TemplatePreview/index.js +56 -45
  16. package/v2Containers/CreativesContainer/SlideBoxContent.js +10 -4
  17. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -0
  18. package/v2Containers/CreativesContainer/messages.js +4 -0
  19. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +11 -0
  20. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +225 -0
  21. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +35 -20
  22. package/v2Containers/Templates/_templates.scss +9 -4
  23. package/v2Containers/Templates/index.js +29 -8
  24. package/v2Containers/Viber/constants.js +58 -0
  25. package/v2Containers/Viber/index.js +409 -421
  26. package/v2Containers/Viber/index.scss +113 -0
  27. package/v2Containers/Viber/messages.js +68 -0
  28. package/v2Containers/Viber/style.js +20 -0
  29. package/v2Containers/Viber/tests/index.test.js +297 -0
  30. package/v2Containers/Viber/tests/mockData.js +134 -0
@@ -658,6 +658,231 @@ exports[`Test SlideBoxContent container Should render correct component for rcs
658
658
  </SlideBoxContent__CreativesWrapper>
659
659
  `;
660
660
 
661
+ exports[`Test SlideBoxContent container Should render correct component for viber channel preview mode 1`] = `
662
+ <SlideBoxContent__CreativesWrapper>
663
+ <InjectIntl(TemplatePreview)
664
+ channel="viber"
665
+ charCounterEnabled={false}
666
+ content={
667
+ Object {
668
+ "viberPreviewContent": Object {
669
+ "buttonText": undefined,
670
+ "messageContent": "",
671
+ "videoParams": Object {
672
+ "viberVideoPreviewImg": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
673
+ "viberVideoSrc": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
674
+ },
675
+ },
676
+ }
677
+ }
678
+ showCount={true}
679
+ templateData={
680
+ Object {
681
+ "_id": "6646ef8af3c82f686462cf91",
682
+ "createdAt": "2024-05-17T05:47:54.636Z",
683
+ "createdBy": "50685415",
684
+ "isActive": true,
685
+ "name": "test temp_2",
686
+ "orgId": 1231,
687
+ "type": "VIBER",
688
+ "updatedAt": "2024-05-17T12:05:52.950Z",
689
+ "updatedBy": "50685415",
690
+ "versions": Object {
691
+ "base": Object {
692
+ "content": Object {
693
+ "content": Object {
694
+ "video": Object {
695
+ "duration": "",
696
+ "thumbnailUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
697
+ "url": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
698
+ },
699
+ },
700
+ "destinations": Array [
701
+ Object {
702
+ "to": Object {
703
+ "phoneNumber": "{{viber_user_id}}",
704
+ },
705
+ },
706
+ ],
707
+ },
708
+ },
709
+ "history": Array [],
710
+ },
711
+ }
712
+ }
713
+ viberBrandName=""
714
+ />
715
+ </SlideBoxContent__CreativesWrapper>
716
+ `;
717
+
718
+ exports[`Test SlideBoxContent container Should render correct component for viber channel preview mode 2`] = `
719
+ <SlideBoxContent__CreativesWrapper>
720
+ <InjectIntl(TemplatePreview)
721
+ channel="viber"
722
+ charCounterEnabled={false}
723
+ content={
724
+ Object {
725
+ "viberPreviewContent": Object {
726
+ "buttonText": "test button",
727
+ "imageURL": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/19e1c698-7be8-4f03-beb5-c96b11a3.jpg",
728
+ "messageContent": "test msg",
729
+ },
730
+ }
731
+ }
732
+ showCount={true}
733
+ templateData={
734
+ Object {
735
+ "_id": "664670d929ce5e6fd17c355f",
736
+ "createdAt": "2024-05-16T20:47:21.488Z",
737
+ "createdBy": "50685415",
738
+ "isActive": true,
739
+ "name": "test temp_1",
740
+ "orgId": 1231,
741
+ "type": "VIBER",
742
+ "updatedAt": "2024-05-17T13:25:49.078Z",
743
+ "updatedBy": "50685415",
744
+ "versions": Object {
745
+ "base": Object {
746
+ "content": Object {
747
+ "content": Object {
748
+ "button": Object {
749
+ "text": "test button",
750
+ "url": "https://www.figma.com/file/2iksCNafQinyHxqAoKYR0z/Badges-in-Campaigns-and-Journeys?type=design&node-id=10-66632&mode=design&t=J0LMbSnho0paUjJK-0",
751
+ },
752
+ "image": Object {
753
+ "url": "https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/19e1c698-7be8-4f03-beb5-c96b11a3.jpg",
754
+ },
755
+ "text": "test msg",
756
+ },
757
+ "destinations": Array [
758
+ Object {
759
+ "to": Object {
760
+ "phoneNumber": "{{viber_user_id}}",
761
+ },
762
+ },
763
+ ],
764
+ },
765
+ },
766
+ "history": Array [],
767
+ },
768
+ }
769
+ }
770
+ viberBrandName=""
771
+ />
772
+ </SlideBoxContent__CreativesWrapper>
773
+ `;
774
+
775
+ exports[`Test SlideBoxContent container Should render correct component for viber channel preview mode 3`] = `
776
+ <SlideBoxContent__CreativesWrapper>
777
+ <InjectIntl(TemplatePreview)
778
+ channel="viber"
779
+ charCounterEnabled={false}
780
+ content={
781
+ Object {
782
+ "viberPreviewContent": Object {
783
+ "buttonText": "test button",
784
+ "messageContent": "test video message test video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video message test video message test video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest overrrrrrrrr",
785
+ "videoParams": Object {
786
+ "viberVideoPreviewImg": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
787
+ "viberVideoSrc": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
788
+ },
789
+ },
790
+ }
791
+ }
792
+ showCount={true}
793
+ templateData={
794
+ Object {
795
+ "_id": "6646ef8af3c82f686462cf91",
796
+ "createdAt": "2024-05-17T05:47:54.636Z",
797
+ "createdBy": "50685415",
798
+ "isActive": true,
799
+ "name": "test temp_2",
800
+ "orgId": 1231,
801
+ "type": "VIBER",
802
+ "updatedAt": "2024-05-17T12:05:52.950Z",
803
+ "updatedBy": "50685415",
804
+ "versions": Object {
805
+ "base": Object {
806
+ "content": Object {
807
+ "content": Object {
808
+ "button": Object {
809
+ "text": "test button",
810
+ "url": "https://www.test.com/file/",
811
+ },
812
+ "text": "test video message test video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video message test video message test video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest video messagetest overrrrrrrrr",
813
+ "video": Object {
814
+ "duration": "",
815
+ "thumbnailUrl": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
816
+ "url": "https://crm-nightly-new-fileservice.s3.amazonaws.com/video_screenshot_assets__1715924855107.png/1040",
817
+ },
818
+ },
819
+ "destinations": Array [
820
+ Object {
821
+ "to": Object {
822
+ "phoneNumber": "{{viber_user_id}}",
823
+ },
824
+ },
825
+ ],
826
+ },
827
+ },
828
+ "history": Array [],
829
+ },
830
+ }
831
+ }
832
+ viberBrandName=""
833
+ />
834
+ </SlideBoxContent__CreativesWrapper>
835
+ `;
836
+
837
+ exports[`Test SlideBoxContent container Should render correct component for viber channel preview mode 4`] = `
838
+ <SlideBoxContent__CreativesWrapper>
839
+ <InjectIntl(TemplatePreview)
840
+ channel="viber"
841
+ charCounterEnabled={false}
842
+ content={
843
+ Object {
844
+ "viberPreviewContent": Object {
845
+ "buttonText": undefined,
846
+ "messageContent": "test",
847
+ },
848
+ }
849
+ }
850
+ showCount={true}
851
+ templateData={
852
+ Object {
853
+ "_id": "6646ef8af3c82f686462cf91",
854
+ "createdAt": "2024-05-17T05:47:54.636Z",
855
+ "createdBy": "50685415",
856
+ "isActive": true,
857
+ "name": "test temp_2",
858
+ "orgId": 1231,
859
+ "type": "VIBER",
860
+ "updatedAt": "2024-05-17T12:05:52.950Z",
861
+ "updatedBy": "50685415",
862
+ "versions": Object {
863
+ "base": Object {
864
+ "content": Object {
865
+ "content": Object {
866
+ "text": "test",
867
+ },
868
+ "destinations": Array [
869
+ Object {
870
+ "to": Object {
871
+ "phoneNumber": "{{viber_user_id}}",
872
+ },
873
+ },
874
+ ],
875
+ },
876
+ },
877
+ "history": Array [],
878
+ },
879
+ }
880
+ }
881
+ viberBrandName=""
882
+ />
883
+ </SlideBoxContent__CreativesWrapper>
884
+ `;
885
+
661
886
  exports[`Test SlideBoxContent container Should render correct component for whatsapp channel create mode 1`] = `
662
887
  <SlideBoxContent__CreativesWrapper>
663
888
  <Connect(UserIsAuthenticated(Connect(InjectIntl(CreativesCommon))))
@@ -52033,17 +52033,20 @@ new message content.",
52033
52033
  </span>
52034
52034
  </CapHeading__CapHeadingSpan>
52035
52035
  <CapHeading__CapHeadingSpan
52036
- className="image-size"
52037
52036
  type="label2"
52038
52037
  >
52039
52038
  <span
52040
- className="image-size CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
52039
+ className="CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
52041
52040
  type="label2"
52042
52041
  >
52043
52042
  <FormattedMessage
52044
- defaultMessage="Size upto: 2MB"
52043
+ defaultMessage="Size upto: {size}MB"
52045
52044
  id="creatives.componentsV2.CapImageUpload.imageSize"
52046
- values={Object {}}
52045
+ values={
52046
+ Object {
52047
+ "size": 2,
52048
+ }
52049
+ }
52047
52050
  >
52048
52051
  <span>
52049
52052
  Size upto: 2MB
@@ -67476,17 +67479,20 @@ new message content.",
67476
67479
  </span>
67477
67480
  </CapHeading__CapHeadingSpan>
67478
67481
  <CapHeading__CapHeadingSpan
67479
- className="image-size"
67480
67482
  type="label2"
67481
67483
  >
67482
67484
  <span
67483
- className="image-size CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
67485
+ className="CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
67484
67486
  type="label2"
67485
67487
  >
67486
67488
  <FormattedMessage
67487
- defaultMessage="Size upto: 2MB"
67489
+ defaultMessage="Size upto: {size}MB"
67488
67490
  id="creatives.componentsV2.CapImageUpload.imageSize"
67489
- values={Object {}}
67491
+ values={
67492
+ Object {
67493
+ "size": 2,
67494
+ }
67495
+ }
67490
67496
  >
67491
67497
  <span>
67492
67498
  Size upto: 2MB
@@ -82813,17 +82819,20 @@ new message content.",
82813
82819
  </span>
82814
82820
  </CapHeading__CapHeadingSpan>
82815
82821
  <CapHeading__CapHeadingSpan
82816
- className="image-size"
82817
82822
  type="label2"
82818
82823
  >
82819
82824
  <span
82820
- className="image-size CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
82825
+ className="CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
82821
82826
  type="label2"
82822
82827
  >
82823
82828
  <FormattedMessage
82824
- defaultMessage="Size upto: 2MB"
82829
+ defaultMessage="Size upto: {size}MB"
82825
82830
  id="creatives.componentsV2.CapImageUpload.imageSize"
82826
- values={Object {}}
82831
+ values={
82832
+ Object {
82833
+ "size": 2,
82834
+ }
82835
+ }
82827
82836
  >
82828
82837
  <span>
82829
82838
  Size upto: 2MB
@@ -98256,17 +98265,20 @@ new message content.",
98256
98265
  </span>
98257
98266
  </CapHeading__CapHeadingSpan>
98258
98267
  <CapHeading__CapHeadingSpan
98259
- className="image-size"
98260
98268
  type="label2"
98261
98269
  >
98262
98270
  <span
98263
- className="image-size CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
98271
+ className="CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
98264
98272
  type="label2"
98265
98273
  >
98266
98274
  <FormattedMessage
98267
- defaultMessage="Size upto: 2MB"
98275
+ defaultMessage="Size upto: {size}MB"
98268
98276
  id="creatives.componentsV2.CapImageUpload.imageSize"
98269
- values={Object {}}
98277
+ values={
98278
+ Object {
98279
+ "size": 2,
98280
+ }
98281
+ }
98270
98282
  >
98271
98283
  <span>
98272
98284
  Size upto: 2MB
@@ -122750,17 +122762,20 @@ new message content.",
122750
122762
  </span>
122751
122763
  </CapHeading__CapHeadingSpan>
122752
122764
  <CapHeading__CapHeadingSpan
122753
- className="image-size"
122754
122765
  type="label2"
122755
122766
  >
122756
122767
  <span
122757
- className="image-size CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
122768
+ className="CapHeading__CapHeadingSpan-vrvcag-1 gVHIPQ"
122758
122769
  type="label2"
122759
122770
  >
122760
122771
  <FormattedMessage
122761
- defaultMessage="Size upto: 2MB"
122772
+ defaultMessage="Size upto: {size}MB"
122762
122773
  id="creatives.componentsV2.CapImageUpload.imageSize"
122763
- values={Object {}}
122774
+ values={
122775
+ Object {
122776
+ "size": 2,
122777
+ }
122778
+ }
122764
122779
  >
122765
122780
  <span>
122766
122781
  Size upto: 2MB
@@ -117,7 +117,7 @@
117
117
  }
118
118
  .VIBER {
119
119
  &.cap-custom-card{
120
- height: 241px;
120
+ height: 21.125rem;
121
121
  .ant-card-body {
122
122
  padding:0px 24px 0px;
123
123
  .button-content {
@@ -137,18 +137,18 @@
137
137
  .truncate-text-viber{
138
138
  .ant-card-meta-description{
139
139
  display: -webkit-box;
140
- -webkit-line-clamp: 9;
140
+ -webkit-line-clamp: 13;
141
141
  -webkit-box-orient: vertical;
142
142
  }
143
143
  }
144
144
  .truncate-text-with-button{
145
145
  .ant-card-meta-description{
146
- -webkit-line-clamp: 8;
146
+ -webkit-line-clamp: 13;
147
147
  }
148
148
  }
149
149
  .truncate-text-with-image{
150
150
  .ant-card-meta-description{
151
- -webkit-line-clamp: 2;
151
+ -webkit-line-clamp: 3;
152
152
  }
153
153
  }
154
154
 
@@ -620,6 +620,11 @@
620
620
  max-height: 123px;
621
621
  margin-bottom: 4px;
622
622
  }
623
+ .viber-image{
624
+ width: 100%;
625
+ max-height: 11rem;
626
+ margin-bottom: $CAP_SPACE_04;
627
+ }
623
628
  .whatsapp-doc {
624
629
  width: 100%;
625
630
  max-height: 123px;
@@ -1232,20 +1232,41 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1232
1232
  case VIBER: {
1233
1233
  const {
1234
1234
  content: {
1235
- viber: {
1235
+ content: {
1236
1236
  text = '',
1237
- imageURL = '',
1238
- buttonURL = '',
1239
- buttonText = '',
1237
+ image = {},
1238
+ button = {},
1239
+ video = {},
1240
1240
  } = {},
1241
1241
  } = {},
1242
1242
  } = template.versions.base;
1243
1243
  templateData.content = text;
1244
- if (imageURL) {
1245
- templateData.url = imageURL;
1244
+ if (!isEmpty(image)) {
1245
+ const { url = '' } = image;
1246
+ templateData.url = url;
1247
+ templateData.mediaContent = (
1248
+ <CapImage src={url} className="viber-image" />
1249
+ );
1250
+ }
1251
+ if (!isEmpty(video)) {
1252
+ const { thumbnailUrl = '' } = video;
1253
+ templateData.url = thumbnailUrl;
1254
+ templateData.mediaContent = (
1255
+ <>
1256
+ <div className="video-preview">
1257
+ <CapImage
1258
+ src={thumbnailUrl}
1259
+ className="viber-image"
1260
+ />
1261
+ <div className="icon-position">
1262
+ <CapImage className="video-icon" src={videoPlay} />
1263
+ </div>
1264
+ </div>
1265
+ </>
1266
+ );
1246
1267
  }
1247
- if (buttonURL && buttonText) {
1248
- templateData.buttonText = buttonText;
1268
+ if (!isEmpty(button)) {
1269
+ templateData.buttonText = button?.text;
1249
1270
  }
1250
1271
  break;
1251
1272
  }
@@ -1,8 +1,15 @@
1
+ import { FormattedMessage } from "react-intl";
2
+ import React from 'react';
3
+ import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
4
+ import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
5
+ import messages from "./messages";
6
+
1
7
  export const DEFAULT_ACTION = 'app/v2Containers/Viber/DEFAULT_ACTION';
2
8
  export const ALLOWED_EXTENSIONS_REGEX = (/\.(jpe?g|png)$/i);
3
9
  export const VIBER_IMG_HEIGHT = 400;
4
10
  export const VIBER_IMG_WIDTH = 300;
5
11
  export const VIBER_IMG_SIZE = 10000000;
12
+ export const VIBER_VIDEO_SIZE = 209715200;
6
13
  export const charLimit = 1000;
7
14
 
8
15
  export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_REQUEST';
@@ -28,3 +35,54 @@ export const CLEAR_VIBER_DATA = 'app/v2Containers/VIBER/Edit/CLEAR_DATA';
28
35
  export const CLEAR_VIBER_CREATE_RESPONSE_REQUEST = 'app/v2Containers/VIBER/Create/CLEAR_EDIT_RESPONSE_REQUEST';
29
36
  export const CLEAR_VIBER_ASSET = 'app/v2Containers/Viber/CLEAR_ASSET';
30
37
 
38
+ export const VIBER_MEDIA_TYPES = {
39
+ TEXT: 'TEXT',
40
+ IMAGE: 'IMAGE',
41
+ VIDEO: 'VIDEO',
42
+ };
43
+ export const ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER = /\.(jpe?g|png)$/i;
44
+ export const ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER = /\.(mp4|3gp|m4v|mov)$/i;
45
+ export const NONE = 'NONE';
46
+ export const CTA = 'CTA';
47
+ export const VIBER_BUTTON_TYPES = {
48
+ NONE,
49
+ CTA,
50
+ };
51
+ export const mediaRadioOptions = [
52
+ {
53
+ value: VIBER_MEDIA_TYPES.TEXT,
54
+ label: <FormattedMessage {...messages.mediaText} />,
55
+ },
56
+ {
57
+ value: VIBER_MEDIA_TYPES.IMAGE,
58
+ label: <FormattedMessage {...messages.mediaImage} />,
59
+ },
60
+ {
61
+ value: VIBER_MEDIA_TYPES.VIDEO,
62
+ label: <FormattedMessage {...messages.mediaVideo} />,
63
+ },
64
+ ];
65
+
66
+ export const buttonRadioOptions = [
67
+ {
68
+ value: VIBER_BUTTON_TYPES.NONE,
69
+ label: (
70
+ <CapHeading type="h4" className="viber-button-none">
71
+ {<FormattedMessage {...messages.btnTypeNone} />}
72
+ </CapHeading>
73
+ ),
74
+ },
75
+ {
76
+ value: VIBER_BUTTON_TYPES.CTA,
77
+ label: (
78
+ <>
79
+ <div className="viber-button-cta">
80
+ <CapHeading type="h4">
81
+ {<FormattedMessage {...messages.btnTypeCTA} />}
82
+ </CapHeading>
83
+ <CapLabel>{<FormattedMessage {...messages.ctaDesc} />}</CapLabel>
84
+ </div>
85
+ </>
86
+ ),
87
+ },
88
+ ];