@capillarytech/creatives-library 9.0.50-alpha.1 → 9.0.50
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 +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +15 -106
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -139
- package/v2Components/CommonTestAndPreview/constants.js +0 -2
- package/v2Components/CommonTestAndPreview/index.js +26 -240
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +0 -364
- package/v2Components/CommonTestAndPreview/tests/utils.test.js +0 -49
- package/v2Components/CommonTestAndPreview/utils.js +0 -20
- package/v2Containers/CreativesContainer/index.js +4 -9
- package/v2Containers/CreativesContainer/tests/index.test.js +4 -3
- package/v2Containers/Rcs/carouselUtils.js +43 -13
- package/v2Containers/Rcs/index.js +32 -8
- package/v2Containers/Rcs/tests/carouselUtils.test.js +23 -4
- package/v2Containers/Rcs/tests/index.test.js +265 -3
- package/v2Containers/Rcs/tests/utils.test.js +59 -74
- package/v2Containers/Rcs/utils.js +9 -34
- package/v2Containers/Templates/_templates.scss +1 -179
- package/v2Containers/Templates/index.js +10 -97
- package/v2Containers/Viber/constants.js +0 -21
- package/v2Containers/Viber/index.js +43 -711
- package/v2Containers/Viber/index.scss +0 -175
- package/v2Containers/Viber/messages.js +0 -121
- package/v2Containers/Viber/tests/index.test.js +0 -80
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +0 -127
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +0 -133
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
line-clamp: 3;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
+
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
&.no-image .ant-card-meta {
|
|
@@ -167,44 +168,6 @@
|
|
|
167
168
|
word-wrap: break-word;
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
|
-
|
|
171
|
-
&.viber-carousel-static {
|
|
172
|
-
height: auto;
|
|
173
|
-
min-height: 21.125rem;
|
|
174
|
-
overflow: visible;
|
|
175
|
-
|
|
176
|
-
.ant-card-body {
|
|
177
|
-
height: auto;
|
|
178
|
-
overflow: visible;
|
|
179
|
-
padding-bottom: $CAP_SPACE_12;
|
|
180
|
-
|
|
181
|
-
.ant-card-meta,
|
|
182
|
-
.ant-card-meta-detail,
|
|
183
|
-
.ant-card-meta-description {
|
|
184
|
-
height: auto;
|
|
185
|
-
max-height: none;
|
|
186
|
-
overflow: visible;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.truncate-text-viber {
|
|
190
|
-
.ant-card-meta-description {
|
|
191
|
-
display: block;
|
|
192
|
-
overflow: visible;
|
|
193
|
-
max-height: none;
|
|
194
|
-
-webkit-box-orient: unset;
|
|
195
|
-
-webkit-line-clamp: unset;
|
|
196
|
-
line-clamp: unset;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.content,
|
|
201
|
-
.cards,
|
|
202
|
-
.card {
|
|
203
|
-
overflow: visible;
|
|
204
|
-
height: auto;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
171
|
|
|
209
172
|
|
|
210
173
|
&.carousel-img-section {
|
|
@@ -1259,147 +1222,6 @@
|
|
|
1259
1222
|
max-height: 11rem;
|
|
1260
1223
|
margin-bottom: $CAP_SPACE_04;
|
|
1261
1224
|
}
|
|
1262
|
-
|
|
1263
|
-
/* Listing carousel preview: always grow with content so title + buttons stay visible for any image */
|
|
1264
|
-
.cap-custom-card.ant-card.VIBER.viber-carousel-static {
|
|
1265
|
-
height: auto;
|
|
1266
|
-
min-height: 21.125rem;
|
|
1267
|
-
overflow: visible;
|
|
1268
|
-
|
|
1269
|
-
> .ant-card-body {
|
|
1270
|
-
height: auto;
|
|
1271
|
-
max-height: none;
|
|
1272
|
-
overflow: visible;
|
|
1273
|
-
padding-bottom: $CAP_SPACE_12;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
.ant-card-meta,
|
|
1277
|
-
.ant-card-meta-detail,
|
|
1278
|
-
.ant-card-meta-description,
|
|
1279
|
-
.truncate-text-viber,
|
|
1280
|
-
.truncate-text-viber .ant-card-meta-description {
|
|
1281
|
-
height: auto;
|
|
1282
|
-
max-height: none;
|
|
1283
|
-
overflow: visible;
|
|
1284
|
-
display: block;
|
|
1285
|
-
-webkit-line-clamp: unset;
|
|
1286
|
-
line-clamp: unset;
|
|
1287
|
-
-webkit-box-orient: unset;
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
.viber-carousel-static {
|
|
1292
|
-
.content {
|
|
1293
|
-
width: 100%;
|
|
1294
|
-
overflow: visible;
|
|
1295
|
-
display: flex;
|
|
1296
|
-
flex-direction: column;
|
|
1297
|
-
height: auto;
|
|
1298
|
-
|
|
1299
|
-
.message-box {
|
|
1300
|
-
width: 100%;
|
|
1301
|
-
height: auto;
|
|
1302
|
-
border-radius: $CAP_SPACE_04;
|
|
1303
|
-
background: $CAP_WHITE;
|
|
1304
|
-
margin-bottom: $CAP_SPACE_08;
|
|
1305
|
-
display: flex;
|
|
1306
|
-
align-items: flex-start;
|
|
1307
|
-
|
|
1308
|
-
.message {
|
|
1309
|
-
display: -webkit-box;
|
|
1310
|
-
width: 100%;
|
|
1311
|
-
color: $CAP_G01;
|
|
1312
|
-
line-height: 1.3;
|
|
1313
|
-
overflow: hidden;
|
|
1314
|
-
text-overflow: ellipsis;
|
|
1315
|
-
-webkit-line-clamp: 2;
|
|
1316
|
-
line-clamp: 2;
|
|
1317
|
-
-webkit-box-orient: vertical;
|
|
1318
|
-
white-space: normal;
|
|
1319
|
-
word-break: break-word;
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
.cards {
|
|
1324
|
-
display: flex;
|
|
1325
|
-
gap: $CAP_SPACE_08;
|
|
1326
|
-
overflow: visible;
|
|
1327
|
-
width: 100%;
|
|
1328
|
-
height: auto;
|
|
1329
|
-
|
|
1330
|
-
.card {
|
|
1331
|
-
flex: 1;
|
|
1332
|
-
min-width: 0;
|
|
1333
|
-
width: 100%;
|
|
1334
|
-
background: $CAP_WHITE;
|
|
1335
|
-
border-radius: $CAP_SPACE_04;
|
|
1336
|
-
overflow: visible;
|
|
1337
|
-
display: flex;
|
|
1338
|
-
flex-direction: column;
|
|
1339
|
-
height: auto;
|
|
1340
|
-
|
|
1341
|
-
.image {
|
|
1342
|
-
width: 100%;
|
|
1343
|
-
max-height: 11rem;
|
|
1344
|
-
margin-bottom: $CAP_SPACE_04;
|
|
1345
|
-
border-radius: $CAP_SPACE_04;
|
|
1346
|
-
display: block;
|
|
1347
|
-
flex-shrink: 0;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
.image-placeholder {
|
|
1351
|
-
width: 100%;
|
|
1352
|
-
height: 7.143rem;
|
|
1353
|
-
border-radius: $CAP_SPACE_04;
|
|
1354
|
-
background: $CAP_G07;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
.text {
|
|
1358
|
-
display: -webkit-box;
|
|
1359
|
-
color: $CAP_G01;
|
|
1360
|
-
margin: $CAP_SPACE_04 0;
|
|
1361
|
-
line-height: 1.3;
|
|
1362
|
-
overflow: hidden;
|
|
1363
|
-
text-overflow: ellipsis;
|
|
1364
|
-
white-space: normal;
|
|
1365
|
-
-webkit-line-clamp: 2;
|
|
1366
|
-
line-clamp: 2;
|
|
1367
|
-
-webkit-box-orient: vertical;
|
|
1368
|
-
flex-shrink: 0;
|
|
1369
|
-
width: 100%;
|
|
1370
|
-
visibility: visible;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
.buttons {
|
|
1374
|
-
display: flex;
|
|
1375
|
-
flex-direction: column;
|
|
1376
|
-
gap: $CAP_SPACE_04;
|
|
1377
|
-
flex-shrink: 0;
|
|
1378
|
-
width: 100%;
|
|
1379
|
-
visibility: visible;
|
|
1380
|
-
|
|
1381
|
-
.button {
|
|
1382
|
-
display: block;
|
|
1383
|
-
min-height: 1.5rem;
|
|
1384
|
-
border-radius: $CAP_SPACE_12;
|
|
1385
|
-
background: $CAP_PURPLE01;
|
|
1386
|
-
color: $CAP_WHITE;
|
|
1387
|
-
text-align: center;
|
|
1388
|
-
padding: 0.179rem $CAP_SPACE_08;
|
|
1389
|
-
white-space: normal;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
.button-secondary {
|
|
1393
|
-
color: $CAP_PURPLE01;
|
|
1394
|
-
background: transparent;
|
|
1395
|
-
border: none;
|
|
1396
|
-
box-shadow: none;
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
1225
|
.whatsapp-doc {
|
|
1404
1226
|
width: 100%;
|
|
1405
1227
|
max-height: 123px;
|
|
@@ -73,7 +73,6 @@ import * as ebillActions from '../Ebill/actions';
|
|
|
73
73
|
import * as emailActions from '../Email/actions';
|
|
74
74
|
import * as lineActions from '../Line/Container/actions';
|
|
75
75
|
import * as viberActions from '../Viber/actions';
|
|
76
|
-
import { VIBER_MEDIA_TYPES } from '../Viber/constants';
|
|
77
76
|
import * as facebookActions from '../Facebook/actions';
|
|
78
77
|
import * as whatsappActions from '../Whatsapp/actions';
|
|
79
78
|
import * as rcsActions from '../Rcs/actions';
|
|
@@ -1406,11 +1405,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1406
1405
|
const image = viberContent.image || {};
|
|
1407
1406
|
const video = viberContent.video || {};
|
|
1408
1407
|
const button = viberContent.button || {};
|
|
1409
|
-
const messageType = viberContent.type || '';
|
|
1410
|
-
const cardsRaw = viberContent.cards;
|
|
1411
|
-
const cards = Array.isArray(cardsRaw) ? cardsRaw : [];
|
|
1412
|
-
const isCarousel =
|
|
1413
|
-
messageType === VIBER_MEDIA_TYPES.CAROUSEL || cards.length > 0;
|
|
1414
1408
|
|
|
1415
1409
|
const viberPreview = {
|
|
1416
1410
|
messageContent: text,
|
|
@@ -1428,39 +1422,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1428
1422
|
};
|
|
1429
1423
|
}
|
|
1430
1424
|
|
|
1431
|
-
if (isCarousel) {
|
|
1432
|
-
viberPreview.type = VIBER_MEDIA_TYPES.CAROUSEL;
|
|
1433
|
-
viberPreview.cards = cards.map((card) => ({
|
|
1434
|
-
text: card?.text || '',
|
|
1435
|
-
mediaUrl: card?.mediaUrl || '',
|
|
1436
|
-
buttons: (card?.buttons || []).map((btn) => ({
|
|
1437
|
-
title: btn?.title || '',
|
|
1438
|
-
action: btn?.action || '',
|
|
1439
|
-
})),
|
|
1440
|
-
}));
|
|
1441
|
-
viberPreview.showCarouselEditorPreview = true;
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
1425
|
// Extract account name
|
|
1445
1426
|
const accountName = get(template, 'definition.accountName', '');
|
|
1446
1427
|
|
|
1447
1428
|
// Return Viber content object (same as Viber/index.js getTemplateContent)
|
|
1448
1429
|
return {
|
|
1449
1430
|
viberPreviewContent: viberPreview,
|
|
1450
|
-
accountName: accountName
|
|
1451
|
-
brandName: accountName
|
|
1452
|
-
messageContent: text,
|
|
1453
|
-
...(isCarousel && {
|
|
1454
|
-
type: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
1455
|
-
cards: viberPreview.cards,
|
|
1456
|
-
}),
|
|
1457
|
-
...(!isCarousel && !isEmpty(button) && button.text && (button.url || viberContent.buttonURL) && {
|
|
1458
|
-
button: {
|
|
1459
|
-
text: button.text,
|
|
1460
|
-
url: button.url || viberContent.buttonURL || '',
|
|
1461
|
-
},
|
|
1462
|
-
}),
|
|
1463
|
-
buttonURL: button.url || viberContent.buttonURL || '',
|
|
1431
|
+
accountName: accountName ? [accountName] : [],
|
|
1432
|
+
brandName: accountName ? [accountName] : [],
|
|
1464
1433
|
};
|
|
1465
1434
|
}
|
|
1466
1435
|
|
|
@@ -2500,59 +2469,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2500
2469
|
image = {},
|
|
2501
2470
|
button = {},
|
|
2502
2471
|
video = {},
|
|
2503
|
-
type = '',
|
|
2504
|
-
cards = [],
|
|
2505
2472
|
} = {},
|
|
2506
2473
|
} = {},
|
|
2507
2474
|
} = template.versions.base;
|
|
2508
|
-
const isViberCarousel = type === VIBER_MEDIA_TYPES.CAROUSEL;
|
|
2509
2475
|
templateData.content = text;
|
|
2510
|
-
if (isViberCarousel) {
|
|
2511
|
-
const previewCards = Array.isArray(cards) ? cards.slice(0, 1) : [];
|
|
2512
|
-
// Bypass CapCustomCard Viber Meta + line-clamp (clips title/buttons for tall images).
|
|
2513
|
-
// Parent class `viber-carousel-static` scopes listing styles in _templates.scss.
|
|
2514
|
-
// cardType hits the default content path; keep VIBER for channel card styles.
|
|
2515
|
-
templateData.cardType = 'VIBER_CAROUSEL_PREVIEW';
|
|
2516
|
-
templateData.className = 'viber-carousel-static VIBER';
|
|
2517
|
-
templateData.content = (
|
|
2518
|
-
<CapRow vertical className="content">
|
|
2519
|
-
<CapRow className="message-box">
|
|
2520
|
-
<CapLabel type="label1" className="message">
|
|
2521
|
-
{text}
|
|
2522
|
-
</CapLabel>
|
|
2523
|
-
</CapRow>
|
|
2524
|
-
<CapRow className="cards">
|
|
2525
|
-
{previewCards?.map((card, cardIdx) => (
|
|
2526
|
-
<CapRow vertical className="card" key={`viber-carousel-static-card-${cardIdx}`}>
|
|
2527
|
-
{card?.mediaUrl ? (
|
|
2528
|
-
<CapImage src={card.mediaUrl} className="image" />
|
|
2529
|
-
) : (
|
|
2530
|
-
<CapRow className="image-placeholder" />
|
|
2531
|
-
)}
|
|
2532
|
-
<CapLabel type="label1" className="text">
|
|
2533
|
-
{card?.text}
|
|
2534
|
-
</CapLabel>
|
|
2535
|
-
<CapRow vertical className="buttons">
|
|
2536
|
-
{(Array.isArray(card?.buttons) && card.buttons.length
|
|
2537
|
-
? card.buttons
|
|
2538
|
-
: [{}, {}]
|
|
2539
|
-
).slice(0, 2).map((carouselButton, btnIdx) => (
|
|
2540
|
-
<CapLabel
|
|
2541
|
-
key={`viber-carousel-static-btn-${cardIdx}-${btnIdx}`}
|
|
2542
|
-
type="label1"
|
|
2543
|
-
className={`button${btnIdx === 1 ? ' button-secondary' : ''}`}
|
|
2544
|
-
>
|
|
2545
|
-
{(carouselButton?.title || '').trim()}
|
|
2546
|
-
</CapLabel>
|
|
2547
|
-
))}
|
|
2548
|
-
</CapRow>
|
|
2549
|
-
</CapRow>
|
|
2550
|
-
))}
|
|
2551
|
-
</CapRow>
|
|
2552
|
-
</CapRow>
|
|
2553
|
-
);
|
|
2554
|
-
break;
|
|
2555
|
-
}
|
|
2556
2476
|
if (!isEmpty(image)) {
|
|
2557
2477
|
const { url = '' } = image;
|
|
2558
2478
|
templateData.url = url;
|
|
@@ -5223,22 +5143,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
5223
5143
|
? this.props.Templates.selectedWhatsappAccount.name
|
|
5224
5144
|
: null
|
|
5225
5145
|
}
|
|
5226
|
-
// Pass formData for
|
|
5146
|
+
// Pass formData for EMAIL and SMS channels for tag extraction
|
|
5227
5147
|
formData={
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
return previewContent.formData || null;
|
|
5236
|
-
}
|
|
5237
|
-
if (channelUpper === VIBER) {
|
|
5238
|
-
return previewContent;
|
|
5239
|
-
}
|
|
5240
|
-
return null;
|
|
5241
|
-
})()
|
|
5148
|
+
this.state.testAndPreviewContent &&
|
|
5149
|
+
(this.state.channel?.toUpperCase() === EMAIL ||
|
|
5150
|
+
this.state.channel?.toUpperCase() === SMS) &&
|
|
5151
|
+
typeof this.state.testAndPreviewContent === 'object' &&
|
|
5152
|
+
this.state.testAndPreviewContent?.formData
|
|
5153
|
+
? this.state.testAndPreviewContent.formData
|
|
5154
|
+
: null
|
|
5242
5155
|
}
|
|
5243
5156
|
/>
|
|
5244
5157
|
)}
|
|
@@ -47,24 +47,7 @@ export const VIBER_MEDIA_TYPES = {
|
|
|
47
47
|
TEXT: 'TEXT',
|
|
48
48
|
IMAGE: 'IMAGE',
|
|
49
49
|
VIDEO: 'VIDEO',
|
|
50
|
-
CAROUSEL: 'CAROUSEL',
|
|
51
50
|
};
|
|
52
|
-
export const VIBER_CAROUSEL_MIN_CARDS = 2;
|
|
53
|
-
export const VIBER_CAROUSEL_MAX_CARDS = 5;
|
|
54
|
-
export const VIBER_CAROUSEL_MAX_BUTTONS = 2;
|
|
55
|
-
export const VIBER_CAROUSEL_CARD_TITLE_MIN_LENGTH = 2;
|
|
56
|
-
export const VIBER_CAROUSEL_CARD_TITLE_MAX_LENGTH = 38;
|
|
57
|
-
export const VIBER_CAROUSEL_FIRST_BUTTON_TITLE_MAX_LENGTH = 10;
|
|
58
|
-
export const VIBER_CAROUSEL_SECOND_BUTTON_TITLE_MAX_LENGTH = 12;
|
|
59
|
-
export const VIBER_CAROUSEL_BUTTON_URL_MAX_LENGTH = 1000;
|
|
60
|
-
export const STATIC_URL = 'STATIC_URL';
|
|
61
|
-
export const DYNAMIC_URL = 'DYNAMIC_URL';
|
|
62
|
-
/** Recommended / validated carousel image height in pixels (passed to image upload). */
|
|
63
|
-
export const VIBER_CAROUSEL_IMG_HEIGHT = 600;
|
|
64
|
-
/** Recommended / validated carousel image width in pixels (passed to image upload). */
|
|
65
|
-
export const VIBER_CAROUSEL_IMG_WIDTH = 696;
|
|
66
|
-
/** Maximum carousel image file size (bytes). 10_000_000 ≈ 10 MB (decimal). */
|
|
67
|
-
export const VIBER_CAROUSEL_IMG_SIZE = 10000000;
|
|
68
51
|
export const ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER = /\.(jpe?g|png)$/i;
|
|
69
52
|
export const ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER = /\.(mp4|3gp|m4v|mov)$/i;
|
|
70
53
|
export const NONE = 'NONE';
|
|
@@ -86,10 +69,6 @@ export const mediaRadioOptions = [
|
|
|
86
69
|
value: VIBER_MEDIA_TYPES.VIDEO,
|
|
87
70
|
label: <FormattedMessage {...messages.mediaVideo} />,
|
|
88
71
|
},
|
|
89
|
-
{
|
|
90
|
-
value: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
91
|
-
label: <FormattedMessage {...messages.mediaCarousel} />,
|
|
92
|
-
},
|
|
93
72
|
];
|
|
94
73
|
|
|
95
74
|
export const buttonRadioOptions = [
|