@capillarytech/creatives-library 8.0.86 → 8.0.87-alpha.1

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.
@@ -172,6 +172,42 @@
172
172
  }
173
173
 
174
174
  }
175
+
176
+ .WHATSAPP {
177
+ .cap-custom-card {
178
+ color: red;
179
+ .ant-card-body {
180
+ .ant-card-meta {
181
+ background-color: #f4f5f7;
182
+ padding: 0;
183
+ .ant-card-meta-description {
184
+ .whatsapp-container {
185
+ background-color: #FFFFFF;
186
+ padding: 0.857rem;
187
+ }
188
+ .whatsapp-carousel-container {
189
+ padding: 4px 0px 0.571rem;
190
+ border-radius: 6px;
191
+ background-color: rgb(255, 255, 255);
192
+ width: 80%;
193
+ flex-shrink: 0;
194
+ margin-right: 4px;
195
+ white-space: pre-wrap;
196
+ word-break: break-word;
197
+ overflow: auto;
198
+ text-align: left;
199
+ .whatsapp-carosuel-card {
200
+ margin: 2px 6px 1px 7px;
201
+ .whatsapp-carousel-body {
202
+ margin-bottom: 0.571rem;
203
+ }
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
175
211
  }
176
212
 
177
213
  .create-new-link{
@@ -116,7 +116,7 @@ import {
116
116
  } from '../Whatsapp/constants';
117
117
  import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
118
118
  import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
119
- import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill } from '../Whatsapp/utils';
119
+ import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill, getWhatsappCarouselButtonView } from '../Whatsapp/utils';
120
120
  import { getRCSContent } from '../Rcs/utils';
121
121
  import zaloMessages from '../Zalo/messages';
122
122
  import globalMessages from '../../v2Containers/Cap/messages';
@@ -134,7 +134,8 @@ import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAc
134
134
  import rcsIllustration from '../Assets/images/rcsIllustration.png';
135
135
  import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
136
136
  import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
137
-
137
+ import whatsappImageEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_image_preview.svg';
138
+ import whatsappVideoEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_video_preview.svg';
138
139
  import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
139
140
  import { GA } from '@capillarytech/cap-ui-utils';
140
141
  import { MAPP_SDK } from '../InApp/constants';
@@ -1110,8 +1111,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1110
1111
  ? this.getCreativesEditText(channelLowerCase)
1111
1112
  : messages.selectButton
1112
1113
  );
1113
-
1114
- const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
1114
+ const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
1115
1115
  const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
1116
1116
  const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
1117
1117
  const inappBodyType = androidBodyType || iosBodyType;
@@ -1366,7 +1366,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1366
1366
  break;
1367
1367
  }
1368
1368
  case WHATSAPP: {
1369
- const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview} = getWhatsappContent(template);
1369
+ const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview, carouselData = [] } = getWhatsappContent(template);
1370
1370
  templateData.title = (
1371
1371
  <CapRow>
1372
1372
  <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
@@ -1375,6 +1375,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1375
1375
  );
1376
1376
  templateData.content = (
1377
1377
  <>
1378
+ <div className='whatsapp-container'>
1378
1379
  {whatsappImageSrc && (
1379
1380
  <CapImage src={whatsappImageSrc} className="whatsapp-image" />
1380
1381
  )}
@@ -1404,6 +1405,64 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1404
1405
  {getWhatsappCta(template)}
1405
1406
  {getWhatsappQuickReply(template)}
1406
1407
  {getWhatsappAutoFill(template)}
1408
+ </div>
1409
+ <div
1410
+ style={{
1411
+ overflowX: "auto",
1412
+ display: "flex",
1413
+ paddingTop: "5px",
1414
+ paddingRight: "5px",
1415
+ whiteSpace: "nowrap",
1416
+ scrollbarWidth: "none", // Hide scrollbar in Firefox
1417
+ msOverflowStyle: "none", // Hide scrollbar in IE/Edge
1418
+ overflow: "hidden",
1419
+ }}
1420
+ className="scroll-container"
1421
+ >
1422
+ {carouselData.map((data, index) => {
1423
+ return (
1424
+ <div
1425
+ key={`carousel-${index}`}
1426
+ className="whatsapp-carousel-container"
1427
+ >
1428
+ <div className="whatsapp-carosuel-card">
1429
+ {data?.mediaType === "image" && (
1430
+ <CapImage
1431
+ src={data?.imageUrl ? data?.imageUrl : whatsappImageEmptyPreview}
1432
+ className="whatsapp-image"
1433
+ />
1434
+ )}
1435
+ {data?.mediaType === "video" && (
1436
+ <div className="video-preview">
1437
+ <CapImage
1438
+ src={data?.videoPreviewImg ? data?.videoPreviewImg : whatsappVideoEmptyPreview}
1439
+ className="whatsapp-image"
1440
+ />
1441
+ <div className="icon-position">
1442
+ <CapImage
1443
+ className="video-icon"
1444
+ src={videoPlay}
1445
+ />
1446
+ </div>
1447
+ </div>
1448
+ )}
1449
+ <span
1450
+ className={`${
1451
+ (data?.imageUrl || data?.videoPreviewImg)
1452
+ ? 'whatsapp-message-with-media'
1453
+ : 'whatsapp-message-without-media'
1454
+ }`}
1455
+ >
1456
+ <CapLabel type="label9" className='whatsapp-carousel-body'>
1457
+ {data?.bodyText}
1458
+ </CapLabel>
1459
+ </span>
1460
+ {getWhatsappCarouselButtonView(data?.buttons, false)}
1461
+ </div>
1462
+ </div>
1463
+ )
1464
+ })}
1465
+ </div>
1407
1466
  </>
1408
1467
  );
1409
1468
  break;
@@ -54,6 +54,56 @@ export const WHATSAPP_CATEGORIES = {
54
54
  transactional: 'TRANSACTIONAL',
55
55
  };
56
56
 
57
+ export const mediaTypeOptions = ({host, templateCategory}) => {
58
+ return [
59
+ {
60
+ key: 'TEXT',
61
+ value: WHATSAPP_MEDIA_TYPES.TEXT,
62
+ label: <FormattedMessage {...messages.none} />,
63
+ tagColor: CAP_PURPLE03,
64
+ tagTextColor: CAP_PURPLE02,
65
+ },
66
+ ...(host === HOST_TWILIO
67
+ ? []
68
+ : [
69
+ {
70
+ key: 'IMAGE',
71
+ value: WHATSAPP_MEDIA_TYPES.IMAGE,
72
+ label: <FormattedMessage {...messages.mediaImage} />,
73
+ tagColor: CAP_ORANGE01,
74
+ tagTextColor: CAP_ORANGE,
75
+ },
76
+ {
77
+ key: 'VIDEO',
78
+ value: WHATSAPP_MEDIA_TYPES.VIDEO,
79
+ label: <FormattedMessage {...messages.mediaVideo} />,
80
+ tagColor: CAP_GREEN02,
81
+ tagTextColor: CAP_GREEN01,
82
+ },
83
+ ...(templateCategory === WHATSAPP_CATEGORIES.marketing
84
+ ? [
85
+ {
86
+ key: 'CAROUSEL',
87
+ value: WHATSAPP_MEDIA_TYPES.CAROUSEL,
88
+ label: <FormattedMessage {...messages.mediaCarousel} />,
89
+ tagColor: CAP_PURPLE03,
90
+ tagTextColor: CAP_PURPLE02,
91
+ },
92
+ ]
93
+ : []
94
+ ),
95
+ {
96
+ key: 'DOCUMENT',
97
+ value: WHATSAPP_MEDIA_TYPES.DOCUMENT,
98
+ label: <FormattedMessage {...messages.mediaDocument} />,
99
+ tagColor: CAP_ORANGE01,
100
+ tagTextColor: CAP_ORANGE,
101
+ },
102
+ ]
103
+ ),
104
+ ];
105
+ };
106
+
57
107
  export const KARIX_GUPSHUP_CATEGORY_OPTIONS = [
58
108
  {
59
109
  key: 'utility',
@@ -212,14 +262,17 @@ export const WHATSAPP_MEDIA_TYPES = {
212
262
  IMAGE: 'IMAGE',
213
263
  VIDEO: 'VIDEO',
214
264
  DOCUMENT: 'DOCUMENT',
265
+ CAROUSEL: 'CAROUSEL',
215
266
  };
216
267
  export const NONE = 'NONE';
217
268
  export const CTA = 'CTA';
218
269
  export const QUICK_REPLY = 'QUICK_REPLY';
219
270
  export const HEADER_TEXT = 'header';
220
271
  export const FOOTER_TEXT = 'footer';
272
+ export const CAROUSEL_TEXT = 'carouselText';
221
273
  export const MESSAGE_TEXT = 'message';
222
- export const BUTTON_TEXT = 'buttonText'
274
+ export const BODY_TEXT = 'body';
275
+ export const BUTTON_TEXT = 'buttonText';
223
276
  export const WHATSAPP_BUTTON_TYPES = {
224
277
  NONE,
225
278
  CTA,
@@ -558,6 +611,35 @@ export const LANGUAGE_OPTIONS = [
558
611
  },
559
612
  ];
560
613
 
614
+ export const carouselMediaOptions = [
615
+ {
616
+ value: 'image',
617
+ label: <FormattedMessage {...messages.mediaImage} />,
618
+ },
619
+ {
620
+ value: 'video',
621
+ label: <FormattedMessage {...messages.mediaVideo} />,
622
+ },
623
+ ];
624
+
625
+ export const CAROUSEL_INITIAL_DATA = [{
626
+ mediaType: '',
627
+ bodyText: '',
628
+ bodyError: '',
629
+ addedVarCount: 0,
630
+ buttons: [
631
+ {
632
+ buttonType: PHONE_NUMBER,
633
+ text: '',
634
+ phone_number: '',
635
+ isSaved: false,
636
+ textError: '',
637
+ },
638
+ ],
639
+ }];
640
+
641
+ export const MAX_CAROUSEL_ALLOWED = 10;
642
+
561
643
  export const OTP_CONFIG_URI = "/org/setup/configurations/OTPConfigurations";
562
644
  export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
563
645
  export const CORRECT_TEMPLATE_FORMAT_URL = "https://developers.facebook.com/docs/whatsapp/updates-to-pricing/new-template-guidelines";