@capillarytech/creatives-library 8.0.353-alpha.1 → 8.0.353-alpha.2
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 +9 -108
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +0 -93
- package/v2Components/CommonTestAndPreview/index.js +7 -47
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +0 -364
- package/v2Components/FormBuilder/index.js +48 -10
- package/v2Containers/CreativesContainer/index.js +61 -25
- package/v2Containers/Email/index.js +33 -2
- package/v2Containers/Templates/_templates.scss +0 -76
- package/v2Containers/Templates/index.js +0 -73
- package/v2Containers/Viber/constants.js +0 -19
- package/v2Containers/Viber/index.js +46 -664
- package/v2Containers/Viber/index.scss +0 -148
- package/v2Containers/Viber/messages.js +0 -116
|
@@ -153,82 +153,6 @@
|
|
|
153
153
|
line-clamp: 3;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
.viber-carousel-static-content {
|
|
157
|
-
width: 100%;
|
|
158
|
-
overflow: hidden;
|
|
159
|
-
.viber-carousel-static-message-box {
|
|
160
|
-
width: 100%;
|
|
161
|
-
height: 2.25rem;
|
|
162
|
-
border-radius: $CAP_SPACE_04;
|
|
163
|
-
background: $CAP_WHITE;
|
|
164
|
-
margin-bottom: $CAP_SPACE_08;
|
|
165
|
-
padding: 0 $CAP_SPACE_08;
|
|
166
|
-
display: flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
}
|
|
169
|
-
.viber-carousel-static-message {
|
|
170
|
-
display: block;
|
|
171
|
-
width: 100%;
|
|
172
|
-
color: $CAP_G01;
|
|
173
|
-
overflow: hidden;
|
|
174
|
-
text-overflow: ellipsis;
|
|
175
|
-
white-space: nowrap;
|
|
176
|
-
}
|
|
177
|
-
.viber-carousel-static-cards {
|
|
178
|
-
display: flex;
|
|
179
|
-
gap: $CAP_SPACE_08;
|
|
180
|
-
overflow: hidden;
|
|
181
|
-
}
|
|
182
|
-
.viber-carousel-static-card {
|
|
183
|
-
flex: 1;
|
|
184
|
-
min-width: 0;
|
|
185
|
-
background: $CAP_WHITE;
|
|
186
|
-
border-radius: $CAP_SPACE_04;
|
|
187
|
-
padding: $CAP_SPACE_06;
|
|
188
|
-
overflow: hidden;
|
|
189
|
-
}
|
|
190
|
-
.viber-carousel-static-image,
|
|
191
|
-
.viber-carousel-static-image-placeholder {
|
|
192
|
-
width: 100%;
|
|
193
|
-
height: 5.357rem;
|
|
194
|
-
border-radius: $CAP_SPACE_04;
|
|
195
|
-
}
|
|
196
|
-
.viber-carousel-static-image {
|
|
197
|
-
object-fit: cover;
|
|
198
|
-
}
|
|
199
|
-
.viber-carousel-static-image-placeholder {
|
|
200
|
-
background: $CAP_G07;
|
|
201
|
-
}
|
|
202
|
-
.viber-carousel-static-text {
|
|
203
|
-
display: block;
|
|
204
|
-
color: $CAP_G01;
|
|
205
|
-
margin: $CAP_SPACE_04 0;
|
|
206
|
-
line-height: 1.3;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
text-overflow: ellipsis;
|
|
209
|
-
white-space: normal;
|
|
210
|
-
}
|
|
211
|
-
.viber-carousel-static-buttons {
|
|
212
|
-
display: flex;
|
|
213
|
-
flex-direction: column;
|
|
214
|
-
gap: $CAP_SPACE_04;
|
|
215
|
-
}
|
|
216
|
-
.viber-carousel-static-button {
|
|
217
|
-
display: block;
|
|
218
|
-
min-height: 1rem;
|
|
219
|
-
border-radius: $CAP_SPACE_12;
|
|
220
|
-
background: $CAP_PURPLE01;
|
|
221
|
-
color: $CAP_WHITE;
|
|
222
|
-
text-align: center;
|
|
223
|
-
padding: 0.179rem $CAP_SPACE_08;
|
|
224
|
-
white-space: normal;
|
|
225
|
-
}
|
|
226
|
-
.viber-carousel-static-button-secondary {
|
|
227
|
-
color: $CAP_PURPLE01;
|
|
228
|
-
background: $CAP_WHITE;
|
|
229
|
-
border: 1px solid $CAP_PURPLE01;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
156
|
|
|
233
157
|
}
|
|
234
158
|
|
|
@@ -72,7 +72,6 @@ import * as ebillActions from '../Ebill/actions';
|
|
|
72
72
|
import * as emailActions from '../Email/actions';
|
|
73
73
|
import * as lineActions from '../Line/Container/actions';
|
|
74
74
|
import * as viberActions from '../Viber/actions';
|
|
75
|
-
import { VIBER_MEDIA_TYPES } from '../Viber/constants';
|
|
76
75
|
import * as facebookActions from '../Facebook/actions';
|
|
77
76
|
import * as whatsappActions from '../Whatsapp/actions';
|
|
78
77
|
import * as rcsActions from '../Rcs/actions';
|
|
@@ -1372,11 +1371,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1372
1371
|
const image = viberContent.image || {};
|
|
1373
1372
|
const video = viberContent.video || {};
|
|
1374
1373
|
const button = viberContent.button || {};
|
|
1375
|
-
const messageType = viberContent.type || '';
|
|
1376
|
-
const cardsRaw = viberContent.cards;
|
|
1377
|
-
const cards = Array.isArray(cardsRaw) ? cardsRaw : [];
|
|
1378
|
-
const isCarousel =
|
|
1379
|
-
messageType === VIBER_MEDIA_TYPES.CAROUSEL || cards.length > 0;
|
|
1380
1374
|
|
|
1381
1375
|
const viberPreview = {
|
|
1382
1376
|
messageContent: text,
|
|
@@ -1394,19 +1388,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1394
1388
|
};
|
|
1395
1389
|
}
|
|
1396
1390
|
|
|
1397
|
-
if (isCarousel) {
|
|
1398
|
-
viberPreview.type = VIBER_MEDIA_TYPES.CAROUSEL;
|
|
1399
|
-
viberPreview.cards = cards.map((card) => ({
|
|
1400
|
-
text: card?.text || '',
|
|
1401
|
-
mediaUrl: card?.mediaUrl || '',
|
|
1402
|
-
buttons: (card?.buttons || []).map((btn) => ({
|
|
1403
|
-
title: btn?.title || '',
|
|
1404
|
-
action: btn?.action || '',
|
|
1405
|
-
})),
|
|
1406
|
-
}));
|
|
1407
|
-
viberPreview.showCarouselEditorPreview = true;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
1391
|
// Extract account name
|
|
1411
1392
|
const accountName = get(template, 'definition.accountName', '');
|
|
1412
1393
|
|
|
@@ -1415,18 +1396,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1415
1396
|
viberPreviewContent: viberPreview,
|
|
1416
1397
|
accountName: accountName ? [accountName] : [],
|
|
1417
1398
|
brandName: accountName ? [accountName] : [],
|
|
1418
|
-
messageContent: text,
|
|
1419
|
-
...(isCarousel && {
|
|
1420
|
-
type: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
1421
|
-
cards: viberPreview.cards,
|
|
1422
|
-
}),
|
|
1423
|
-
...(!isCarousel && !isEmpty(button) && button.text && (button.url || viberContent.buttonURL) && {
|
|
1424
|
-
button: {
|
|
1425
|
-
text: button.text,
|
|
1426
|
-
url: button.url || viberContent.buttonURL || '',
|
|
1427
|
-
},
|
|
1428
|
-
}),
|
|
1429
|
-
buttonURL: button.url || viberContent.buttonURL || '',
|
|
1430
1399
|
};
|
|
1431
1400
|
}
|
|
1432
1401
|
|
|
@@ -2372,52 +2341,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2372
2341
|
image = {},
|
|
2373
2342
|
button = {},
|
|
2374
2343
|
video = {},
|
|
2375
|
-
type = '',
|
|
2376
|
-
cards = [],
|
|
2377
2344
|
} = {},
|
|
2378
2345
|
} = {},
|
|
2379
2346
|
} = template.versions.base;
|
|
2380
|
-
const isViberCarousel = type === VIBER_MEDIA_TYPES.CAROUSEL;
|
|
2381
2347
|
templateData.content = text;
|
|
2382
|
-
if (isViberCarousel) {
|
|
2383
|
-
const previewCards = Array.isArray(cards) ? cards.slice(0, 1) : [];
|
|
2384
|
-
templateData.className = 'viber-carousel-static';
|
|
2385
|
-
templateData.content = (
|
|
2386
|
-
<CapRow className="viber-carousel-static-content">
|
|
2387
|
-
<CapRow className="viber-carousel-static-message-box">
|
|
2388
|
-
<CapLabel type="label1" className="viber-carousel-static-message">
|
|
2389
|
-
{text}
|
|
2390
|
-
</CapLabel>
|
|
2391
|
-
</CapRow>
|
|
2392
|
-
<CapRow className="viber-carousel-static-cards">
|
|
2393
|
-
{previewCards.map((card, cardIdx) => (
|
|
2394
|
-
<CapRow className="viber-carousel-static-card" key={`viber-static-card-${cardIdx}`}>
|
|
2395
|
-
{card?.mediaUrl ? (
|
|
2396
|
-
<CapImage src={card.mediaUrl} className="viber-carousel-static-image" />
|
|
2397
|
-
) : (
|
|
2398
|
-
<CapRow className="viber-carousel-static-image-placeholder" />
|
|
2399
|
-
)}
|
|
2400
|
-
<CapLabel type="label1" className="viber-carousel-static-text">
|
|
2401
|
-
{card?.text}
|
|
2402
|
-
</CapLabel>
|
|
2403
|
-
<CapRow className="viber-carousel-static-buttons">
|
|
2404
|
-
{(Array.isArray(card?.buttons) && card.buttons.length ? card.buttons : [{}, {}]).slice(0, 2).map((carouselButton, btnIdx) => (
|
|
2405
|
-
<CapLabel
|
|
2406
|
-
key={`viber-static-btn-${cardIdx}-${btnIdx}`}
|
|
2407
|
-
type="label1"
|
|
2408
|
-
className={`viber-carousel-static-button ${btnIdx === 1 ? 'viber-carousel-static-button-secondary' : ''}`}
|
|
2409
|
-
>
|
|
2410
|
-
{(carouselButton?.title || '').trim()}
|
|
2411
|
-
</CapLabel>
|
|
2412
|
-
))}
|
|
2413
|
-
</CapRow>
|
|
2414
|
-
</CapRow>
|
|
2415
|
-
))}
|
|
2416
|
-
</CapRow>
|
|
2417
|
-
</CapRow>
|
|
2418
|
-
);
|
|
2419
|
-
break;
|
|
2420
|
-
}
|
|
2421
2348
|
if (!isEmpty(image)) {
|
|
2422
2349
|
const { url = '' } = image;
|
|
2423
2350
|
templateData.url = url;
|
|
@@ -47,22 +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
|
-
/** Recommended / validated carousel image height in pixels (passed to image upload). */
|
|
61
|
-
export const VIBER_CAROUSEL_IMG_HEIGHT = 600;
|
|
62
|
-
/** Recommended / validated carousel image width in pixels (passed to image upload). */
|
|
63
|
-
export const VIBER_CAROUSEL_IMG_WIDTH = 696;
|
|
64
|
-
/** Maximum carousel image file size (bytes). 10_000_000 ≈ 10 MB (decimal). */
|
|
65
|
-
export const VIBER_CAROUSEL_IMG_SIZE = 10000000;
|
|
66
51
|
export const ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER = /\.(jpe?g|png)$/i;
|
|
67
52
|
export const ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER = /\.(mp4|3gp|m4v|mov)$/i;
|
|
68
53
|
export const NONE = 'NONE';
|
|
@@ -84,10 +69,6 @@ export const mediaRadioOptions = [
|
|
|
84
69
|
value: VIBER_MEDIA_TYPES.VIDEO,
|
|
85
70
|
label: <FormattedMessage {...messages.mediaVideo} />,
|
|
86
71
|
},
|
|
87
|
-
{
|
|
88
|
-
value: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
89
|
-
label: <FormattedMessage {...messages.mediaCarousel} />,
|
|
90
|
-
},
|
|
91
72
|
];
|
|
92
73
|
|
|
93
74
|
export const buttonRadioOptions = [
|