@capillarytech/creatives-library 9.0.13-alpha.0 → 9.0.13-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.
- package/constants/unified.js +0 -3
- package/package.json +1 -1
- package/utils/common.js +0 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +132 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +108 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +141 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +132 -0
- package/v2Components/CommonTestAndPreview/index.js +244 -26
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +364 -0
- package/v2Components/FormBuilder/_formBuilder.scss +0 -8
- package/v2Components/FormBuilder/index.js +4479 -41
- package/v2Containers/Templates/_templates.scss +83 -0
- package/v2Containers/Templates/index.js +90 -10
- package/v2Containers/Viber/constants.js +21 -0
- package/v2Containers/Viber/index.js +719 -49
- package/v2Containers/Viber/index.scss +175 -0
- package/v2Containers/Viber/messages.js +121 -0
- package/v2Containers/Viber/tests/index.test.js +80 -0
- package/v2Components/FormBuilder/Classic.js +0 -4487
- package/v2Components/FormBuilder/Functional/FormBuilderShell.js +0 -369
- package/v2Components/FormBuilder/Functional/channels/registry.js +0 -17
- package/v2Components/FormBuilder/Functional/channels/sms/buildSubmitPayload.js +0 -9
- package/v2Components/FormBuilder/Functional/channels/sms/config.js +0 -30
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -46
- package/v2Components/FormBuilder/Functional/channels/sms/getLiquidContent.js +0 -13
- package/v2Components/FormBuilder/Functional/channels/sms/index.js +0 -22
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -52
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getLiquidContent.test.js +0 -25
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -87
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +0 -89
- package/v2Components/FormBuilder/Functional/constants.js +0 -39
- package/v2Components/FormBuilder/Functional/core/schema/fieldRegistry.js +0 -38
- package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +0 -85
- package/v2Components/FormBuilder/Functional/core/store/formReducer.js +0 -81
- package/v2Components/FormBuilder/Functional/core/store/selectors.js +0 -30
- package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +0 -91
- package/v2Components/FormBuilder/Functional/index.js +0 -26
- package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +0 -59
- package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +0 -32
- package/v2Components/FormBuilder/Functional/layout/Section.js +0 -118
- package/v2Components/FormBuilder/Functional/renderers/smsRenderers.js +0 -265
- package/v2Components/FormBuilder/Functional/tests/channelRegistry.test.js +0 -21
- package/v2Components/FormBuilder/Functional/tests/fieldRegistry.test.js +0 -65
- package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +0 -97
- package/v2Components/FormBuilder/Functional/tests/fixtures/smsParityCases.js +0 -192
- package/v2Components/FormBuilder/Functional/tests/formReducer.test.js +0 -129
- package/v2Components/FormBuilder/Functional/tests/initializeFormState.test.js +0 -132
- package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +0 -40
- package/v2Components/FormBuilder/Functional/tests/section.test.js +0 -99
- package/v2Components/FormBuilder/Functional/tests/selectors.test.js +0 -67
- package/v2Components/FormBuilder/Functional/tests/sms.crossFlowParity.test.js +0 -155
- package/v2Components/FormBuilder/Functional/tests/sms.liquid.test.js +0 -172
- package/v2Components/FormBuilder/Functional/tests/sms.rollout.test.js +0 -122
- package/v2Components/FormBuilder/Functional/tests/sms.shell.parity.test.js +0 -329
- package/v2Components/FormBuilder/Functional/tests/smsRenderers.test.js +0 -162
- package/v2Components/FormBuilder/Functional/tests/toLegacyFormData.test.js +0 -95
- package/v2Components/FormBuilder/tests/__snapshots__/sms.characterization.test.js.snap +0 -114
- package/v2Components/FormBuilder/tests/entryGate.test.js +0 -106
- package/v2Components/FormBuilder/tests/sms.characterization.test.js +0 -336
- package/v2Components/TemplatePreview/coderabbits_comments +0 -171
|
@@ -153,6 +153,89 @@
|
|
|
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
|
+
min-height: 2.25rem;
|
|
162
|
+
height: auto;
|
|
163
|
+
border-radius: $CAP_SPACE_04;
|
|
164
|
+
background: $CAP_WHITE;
|
|
165
|
+
margin-bottom: $CAP_SPACE_08;
|
|
166
|
+
padding: $CAP_SPACE_04 $CAP_SPACE_08;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: flex-start;
|
|
169
|
+
}
|
|
170
|
+
.viber-carousel-static-message {
|
|
171
|
+
display: -webkit-box;
|
|
172
|
+
width: 100%;
|
|
173
|
+
color: $CAP_G01;
|
|
174
|
+
line-height: 1.3;
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
text-overflow: ellipsis;
|
|
177
|
+
-webkit-line-clamp: 2;
|
|
178
|
+
line-clamp: 2;
|
|
179
|
+
-webkit-box-orient: vertical;
|
|
180
|
+
white-space: normal;
|
|
181
|
+
word-break: break-word;
|
|
182
|
+
}
|
|
183
|
+
.viber-carousel-static-cards {
|
|
184
|
+
display: flex;
|
|
185
|
+
gap: $CAP_SPACE_08;
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
}
|
|
188
|
+
.viber-carousel-static-card {
|
|
189
|
+
flex: 1;
|
|
190
|
+
min-width: 0;
|
|
191
|
+
background: $CAP_WHITE;
|
|
192
|
+
border-radius: $CAP_SPACE_04;
|
|
193
|
+
padding: $CAP_SPACE_06;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
}
|
|
196
|
+
.viber-carousel-static-image,
|
|
197
|
+
.viber-carousel-static-image-placeholder {
|
|
198
|
+
width: 100%;
|
|
199
|
+
height: 5.357rem;
|
|
200
|
+
border-radius: $CAP_SPACE_04;
|
|
201
|
+
}
|
|
202
|
+
.viber-carousel-static-image {
|
|
203
|
+
object-fit: cover;
|
|
204
|
+
}
|
|
205
|
+
.viber-carousel-static-image-placeholder {
|
|
206
|
+
background: $CAP_G07;
|
|
207
|
+
}
|
|
208
|
+
.viber-carousel-static-text {
|
|
209
|
+
display: block;
|
|
210
|
+
color: $CAP_G01;
|
|
211
|
+
margin: $CAP_SPACE_04 0;
|
|
212
|
+
line-height: 1.3;
|
|
213
|
+
overflow: hidden;
|
|
214
|
+
text-overflow: ellipsis;
|
|
215
|
+
white-space: normal;
|
|
216
|
+
}
|
|
217
|
+
.viber-carousel-static-buttons {
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
gap: $CAP_SPACE_04;
|
|
221
|
+
}
|
|
222
|
+
.viber-carousel-static-button {
|
|
223
|
+
display: block;
|
|
224
|
+
min-height: 1.5rem;
|
|
225
|
+
border-radius: $CAP_SPACE_12;
|
|
226
|
+
background: $CAP_PURPLE01;
|
|
227
|
+
color: $CAP_WHITE;
|
|
228
|
+
text-align: center;
|
|
229
|
+
padding: 0.179rem $CAP_SPACE_08;
|
|
230
|
+
white-space: normal;
|
|
231
|
+
}
|
|
232
|
+
.viber-carousel-static-button-secondary {
|
|
233
|
+
color: $CAP_PURPLE01;
|
|
234
|
+
background: transparent;
|
|
235
|
+
border: none;
|
|
236
|
+
box-shadow: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
156
239
|
|
|
157
240
|
}
|
|
158
241
|
|
|
@@ -73,6 +73,7 @@ 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';
|
|
76
77
|
import * as facebookActions from '../Facebook/actions';
|
|
77
78
|
import * as whatsappActions from '../Whatsapp/actions';
|
|
78
79
|
import * as rcsActions from '../Rcs/actions';
|
|
@@ -1377,6 +1378,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1377
1378
|
const image = viberContent.image || {};
|
|
1378
1379
|
const video = viberContent.video || {};
|
|
1379
1380
|
const button = viberContent.button || {};
|
|
1381
|
+
const messageType = viberContent.type || '';
|
|
1382
|
+
const cardsRaw = viberContent.cards;
|
|
1383
|
+
const cards = Array.isArray(cardsRaw) ? cardsRaw : [];
|
|
1384
|
+
const isCarousel =
|
|
1385
|
+
messageType === VIBER_MEDIA_TYPES.CAROUSEL || cards.length > 0;
|
|
1380
1386
|
|
|
1381
1387
|
const viberPreview = {
|
|
1382
1388
|
messageContent: text,
|
|
@@ -1394,14 +1400,39 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1394
1400
|
};
|
|
1395
1401
|
}
|
|
1396
1402
|
|
|
1403
|
+
if (isCarousel) {
|
|
1404
|
+
viberPreview.type = VIBER_MEDIA_TYPES.CAROUSEL;
|
|
1405
|
+
viberPreview.cards = cards.map((card) => ({
|
|
1406
|
+
text: card?.text || '',
|
|
1407
|
+
mediaUrl: card?.mediaUrl || '',
|
|
1408
|
+
buttons: (card?.buttons || []).map((btn) => ({
|
|
1409
|
+
title: btn?.title || '',
|
|
1410
|
+
action: btn?.action || '',
|
|
1411
|
+
})),
|
|
1412
|
+
}));
|
|
1413
|
+
viberPreview.showCarouselEditorPreview = true;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1397
1416
|
// Extract account name
|
|
1398
1417
|
const accountName = get(template, 'definition.accountName', '');
|
|
1399
1418
|
|
|
1400
1419
|
// Return Viber content object (same as Viber/index.js getTemplateContent)
|
|
1401
1420
|
return {
|
|
1402
1421
|
viberPreviewContent: viberPreview,
|
|
1403
|
-
accountName: accountName
|
|
1404
|
-
brandName: accountName
|
|
1422
|
+
accountName: accountName || '',
|
|
1423
|
+
brandName: accountName || '',
|
|
1424
|
+
messageContent: text,
|
|
1425
|
+
...(isCarousel && {
|
|
1426
|
+
type: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
1427
|
+
cards: viberPreview.cards,
|
|
1428
|
+
}),
|
|
1429
|
+
...(!isCarousel && !isEmpty(button) && button.text && (button.url || viberContent.buttonURL) && {
|
|
1430
|
+
button: {
|
|
1431
|
+
text: button.text,
|
|
1432
|
+
url: button.url || viberContent.buttonURL || '',
|
|
1433
|
+
},
|
|
1434
|
+
}),
|
|
1435
|
+
buttonURL: button.url || viberContent.buttonURL || '',
|
|
1405
1436
|
};
|
|
1406
1437
|
}
|
|
1407
1438
|
|
|
@@ -2414,10 +2445,52 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2414
2445
|
image = {},
|
|
2415
2446
|
button = {},
|
|
2416
2447
|
video = {},
|
|
2448
|
+
type = '',
|
|
2449
|
+
cards = [],
|
|
2417
2450
|
} = {},
|
|
2418
2451
|
} = {},
|
|
2419
2452
|
} = template.versions.base;
|
|
2453
|
+
const isViberCarousel = type === VIBER_MEDIA_TYPES.CAROUSEL;
|
|
2420
2454
|
templateData.content = text;
|
|
2455
|
+
if (isViberCarousel) {
|
|
2456
|
+
const previewCards = Array.isArray(cards) ? cards.slice(0, 1) : [];
|
|
2457
|
+
templateData.className = 'viber-carousel-static';
|
|
2458
|
+
templateData.content = (
|
|
2459
|
+
<CapRow className="viber-carousel-static-content">
|
|
2460
|
+
<CapRow className="viber-carousel-static-message-box">
|
|
2461
|
+
<CapLabel type="label1" className="viber-carousel-static-message">
|
|
2462
|
+
{text}
|
|
2463
|
+
</CapLabel>
|
|
2464
|
+
</CapRow>
|
|
2465
|
+
<CapRow className="viber-carousel-static-cards">
|
|
2466
|
+
{previewCards.map((card, cardIdx) => (
|
|
2467
|
+
<CapRow className="viber-carousel-static-card" key={`viber-static-card-${cardIdx}`}>
|
|
2468
|
+
{card?.mediaUrl ? (
|
|
2469
|
+
<CapImage src={card.mediaUrl} className="viber-carousel-static-image" />
|
|
2470
|
+
) : (
|
|
2471
|
+
<CapRow className="viber-carousel-static-image-placeholder" />
|
|
2472
|
+
)}
|
|
2473
|
+
<CapLabel type="label1" className="viber-carousel-static-text">
|
|
2474
|
+
{card?.text}
|
|
2475
|
+
</CapLabel>
|
|
2476
|
+
<CapRow className="viber-carousel-static-buttons">
|
|
2477
|
+
{(Array.isArray(card?.buttons) && card.buttons.length ? card.buttons : [{}, {}]).slice(0, 2).map((carouselButton, btnIdx) => (
|
|
2478
|
+
<CapLabel
|
|
2479
|
+
key={`viber-static-btn-${cardIdx}-${btnIdx}`}
|
|
2480
|
+
type="label1"
|
|
2481
|
+
className={`viber-carousel-static-button ${btnIdx === 1 ? 'viber-carousel-static-button-secondary' : ''}`}
|
|
2482
|
+
>
|
|
2483
|
+
{(carouselButton?.title || '').trim()}
|
|
2484
|
+
</CapLabel>
|
|
2485
|
+
))}
|
|
2486
|
+
</CapRow>
|
|
2487
|
+
</CapRow>
|
|
2488
|
+
))}
|
|
2489
|
+
</CapRow>
|
|
2490
|
+
</CapRow>
|
|
2491
|
+
);
|
|
2492
|
+
break;
|
|
2493
|
+
}
|
|
2421
2494
|
if (!isEmpty(image)) {
|
|
2422
2495
|
const { url = '' } = image;
|
|
2423
2496
|
templateData.url = url;
|
|
@@ -5001,15 +5074,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
5001
5074
|
? this.props.Templates.selectedWhatsappAccount.name
|
|
5002
5075
|
: null
|
|
5003
5076
|
}
|
|
5004
|
-
// Pass formData for
|
|
5077
|
+
// Pass formData for tag extraction (EMAIL/SMS use nested formData; VIBER uses content object)
|
|
5005
5078
|
formData={
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5079
|
+
(() => {
|
|
5080
|
+
const previewContent = this.state.testAndPreviewContent;
|
|
5081
|
+
const channelUpper = this.state.channel?.toUpperCase();
|
|
5082
|
+
if (!previewContent || typeof previewContent !== 'object') {
|
|
5083
|
+
return null;
|
|
5084
|
+
}
|
|
5085
|
+
if ([EMAIL, SMS].includes(channelUpper)) {
|
|
5086
|
+
return previewContent.formData || null;
|
|
5087
|
+
}
|
|
5088
|
+
if (channelUpper === VIBER) {
|
|
5089
|
+
return previewContent;
|
|
5090
|
+
}
|
|
5091
|
+
return null;
|
|
5092
|
+
})()
|
|
5013
5093
|
}
|
|
5014
5094
|
/>
|
|
5015
5095
|
)}
|
|
@@ -47,7 +47,24 @@ export const VIBER_MEDIA_TYPES = {
|
|
|
47
47
|
TEXT: 'TEXT',
|
|
48
48
|
IMAGE: 'IMAGE',
|
|
49
49
|
VIDEO: 'VIDEO',
|
|
50
|
+
CAROUSEL: 'CAROUSEL',
|
|
50
51
|
};
|
|
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;
|
|
51
68
|
export const ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER = /\.(jpe?g|png)$/i;
|
|
52
69
|
export const ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER = /\.(mp4|3gp|m4v|mov)$/i;
|
|
53
70
|
export const NONE = 'NONE';
|
|
@@ -69,6 +86,10 @@ export const mediaRadioOptions = [
|
|
|
69
86
|
value: VIBER_MEDIA_TYPES.VIDEO,
|
|
70
87
|
label: <FormattedMessage {...messages.mediaVideo} />,
|
|
71
88
|
},
|
|
89
|
+
{
|
|
90
|
+
value: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
91
|
+
label: <FormattedMessage {...messages.mediaCarousel} />,
|
|
92
|
+
},
|
|
72
93
|
];
|
|
73
94
|
|
|
74
95
|
export const buttonRadioOptions = [
|