@capillarytech/creatives-library 9.0.43 → 9.0.44
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/CapDeviceContent/index.scss +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +15 -106
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -139
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +5 -1
- 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/v2Components/FormBuilder/_formBuilder.scss +1 -1
- package/v2Containers/Email/_email.scss +4 -0
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +14 -10
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +14 -9
- package/v2Containers/Templates/_templates.scss +12 -180
- package/v2Containers/Templates/index.js +18 -104
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +15 -6
- package/v2Containers/Viber/constants.js +0 -21
- package/v2Containers/Viber/index.js +49 -719
- package/v2Containers/Viber/index.scss +0 -175
- package/v2Containers/Viber/messages.js +0 -121
- package/v2Containers/Viber/tests/index.test.js +0 -80
- package/v2Containers/Whatsapp/index.js +4 -2
- package/v2Containers/Whatsapp/index.scss +8 -5
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +280 -224
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +0 -127
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +0 -133
package/package.json
CHANGED
|
@@ -14,18 +14,9 @@ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
|
14
14
|
import CapImage from '@capillarytech/cap-ui-library/CapImage';
|
|
15
15
|
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
16
16
|
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
17
|
-
import {
|
|
18
|
-
ANDROID,
|
|
19
|
-
IOS,
|
|
20
|
-
ANDROID_DEVICE_NAME,
|
|
21
|
-
IOS_DEVICE_NAME,
|
|
22
|
-
VIBER_ACCOUNT_NAME,
|
|
23
|
-
MEDIA_TYPE_CAROUSEL,
|
|
24
|
-
} from '../constants';
|
|
17
|
+
import { ANDROID, IOS, ANDROID_DEVICE_NAME, IOS_DEVICE_NAME, VIBER_ACCOUNT_NAME } from '../constants';
|
|
25
18
|
import messages from '../messages';
|
|
26
19
|
import videoPlay from '../../../assets/videoPlay.svg';
|
|
27
|
-
import { getTrimmedText, hasTrimmedText } from '../utils';
|
|
28
|
-
import ViberCarouselPreviewCards from './ViberCarouselPreviewCards';
|
|
29
20
|
|
|
30
21
|
// Import device mockup images (same as SMS)
|
|
31
22
|
const smsMobileAndroid = require('../../../assets/Android.png');
|
|
@@ -52,35 +43,7 @@ const ViberPreviewContent = ({
|
|
|
52
43
|
imageURL = '',
|
|
53
44
|
videoParams = {},
|
|
54
45
|
buttonText = '',
|
|
55
|
-
type = '',
|
|
56
|
-
cards = [],
|
|
57
|
-
showCarouselEditorPreview = false,
|
|
58
46
|
} = viberContent;
|
|
59
|
-
const hasCarouselContent = type === MEDIA_TYPE_CAROUSEL;
|
|
60
|
-
|
|
61
|
-
const cardHasMeaningfulContent = (card) => {
|
|
62
|
-
if (!card || typeof card !== 'object') return false;
|
|
63
|
-
return (
|
|
64
|
-
hasTrimmedText(card?.text) ||
|
|
65
|
-
hasTrimmedText(card?.mediaUrl) ||
|
|
66
|
-
(card.buttons ?? []).some(button => hasTrimmedText(button?.title))
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const hasMeaningfulCarousel =
|
|
71
|
-
hasCarouselContent &&
|
|
72
|
-
Array.isArray(cards) &&
|
|
73
|
-
cards.length > 0 &&
|
|
74
|
-
cards.some(cardHasMeaningfulContent);
|
|
75
|
-
|
|
76
|
-
const showCarouselInPreview =
|
|
77
|
-
hasCarouselContent && (Boolean(showCarouselEditorPreview) || hasMeaningfulCarousel);
|
|
78
|
-
|
|
79
|
-
const previewCarouselCards =
|
|
80
|
-
hasCarouselContent && Array.isArray(cards) && cards.length ? cards : hasCarouselContent ? [{}] : [];
|
|
81
|
-
|
|
82
|
-
const trimmedMessageContent = getTrimmedText(messageContent);
|
|
83
|
-
const trimmedButtonText = getTrimmedText(buttonText);
|
|
84
47
|
|
|
85
48
|
// Get account name (first letter for icon)
|
|
86
49
|
const accountIcon = (accountName || brandName || 'V')[0]?.toUpperCase();
|
|
@@ -136,15 +99,8 @@ const ViberPreviewContent = ({
|
|
|
136
99
|
);
|
|
137
100
|
}
|
|
138
101
|
|
|
139
|
-
// Check if there's any content to display
|
|
140
|
-
const hasContent =
|
|
141
|
-
trimmedMessageContent
|
|
142
|
-
|| hasTrimmedText(imageURL)
|
|
143
|
-
|| videoParams?.viberVideoSrc
|
|
144
|
-
|| trimmedButtonText
|
|
145
|
-
|| hasMeaningfulCarousel
|
|
146
|
-
|| (hasCarouselContent && showCarouselEditorPreview)
|
|
147
|
-
);
|
|
102
|
+
// Check if there's any content to display
|
|
103
|
+
const hasContent = messageContent || imageURL || videoParams?.viberVideoSrc || buttonText;
|
|
148
104
|
|
|
149
105
|
// Render normal Viber preview
|
|
150
106
|
return (
|
|
@@ -169,34 +125,23 @@ const ViberPreviewContent = ({
|
|
|
169
125
|
|
|
170
126
|
{/* Viber Message Container */}
|
|
171
127
|
{hasContent && (
|
|
172
|
-
<CapRow className={`viber-message-container ${
|
|
128
|
+
<CapRow className={`viber-message-container ${device !== ANDROID ? 'viber-message-container-ios' : ''}`}>
|
|
173
129
|
{/* Brand Name Display (from TemplatePreview line 1136) */}
|
|
174
|
-
<CapRow
|
|
175
|
-
type="flex"
|
|
176
|
-
align="middle"
|
|
177
|
-
fullWidth={showCarouselInPreview}
|
|
178
|
-
className={`msg-container viber-preview ${showCarouselInPreview ? 'viber-preview-carousel' : ''}`}
|
|
179
|
-
>
|
|
130
|
+
<CapRow type="flex" align="middle" className="msg-container viber-preview">
|
|
180
131
|
{/* Account Icon (from TemplatePreview line 1146-1160) */}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
</CapRow>
|
|
185
|
-
)}
|
|
132
|
+
<CapRow type='flex' className="viber-account-icon">
|
|
133
|
+
{accountIcon}
|
|
134
|
+
</CapRow>
|
|
186
135
|
|
|
187
136
|
{/* Message Bubble (from TemplatePreview line 1161-1223) */}
|
|
188
|
-
<CapRow
|
|
189
|
-
useLegacy
|
|
190
|
-
fullWidth={showCarouselInPreview}
|
|
191
|
-
className={`message-pop align-left viber-message-pop ${showCarouselInPreview ? 'viber-message-pop-carousel' : ''}`}
|
|
192
|
-
>
|
|
137
|
+
<CapRow useLegacy className="message-pop align-left viber-message-pop">
|
|
193
138
|
{/* Text Viber preview */}
|
|
194
|
-
{
|
|
139
|
+
{messageContent && (
|
|
195
140
|
<CapLabel type="label15" className="viber-message-text">{messageContent}</CapLabel>
|
|
196
141
|
)}
|
|
197
142
|
|
|
198
143
|
{/* Image Viber preview */}
|
|
199
|
-
{
|
|
144
|
+
{imageURL && (
|
|
200
145
|
<CapImage
|
|
201
146
|
src={imageURL}
|
|
202
147
|
className="viber-image-preview"
|
|
@@ -226,42 +171,16 @@ const ViberPreviewContent = ({
|
|
|
226
171
|
)}
|
|
227
172
|
|
|
228
173
|
{/* Button Viber preview */}
|
|
229
|
-
{
|
|
174
|
+
{buttonText && (
|
|
230
175
|
<CapLabel className="viber-button-base">
|
|
231
176
|
<p className="viber-button-card-text">
|
|
232
177
|
{buttonText}
|
|
233
178
|
</p>
|
|
234
179
|
</CapLabel>
|
|
235
180
|
)}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
<CapRow type="flex-column" className="viber-carousel-message-pop">
|
|
240
|
-
{trimmedMessageContent ? (
|
|
241
|
-
<CapLabel
|
|
242
|
-
type="label15"
|
|
243
|
-
className="message-pop-item align-left viber-message-text viber-carousel-message-box-text"
|
|
244
|
-
>
|
|
245
|
-
{messageContent}
|
|
246
|
-
</CapLabel>
|
|
247
|
-
) : (
|
|
248
|
-
<CapRow className="viber-carousel-message-box-placeholder" />
|
|
249
|
-
)}
|
|
250
|
-
<CapLabel type="label1" className="viber-carousel-message-timestamp">
|
|
251
|
-
{timestamp}
|
|
252
|
-
</CapLabel>
|
|
253
|
-
</CapRow>
|
|
254
|
-
|
|
255
|
-
<CapRow type="flex-column" fullWidth className="viber-carousel-cards-pop">
|
|
256
|
-
<ViberCarouselPreviewCards cards={previewCarouselCards} />
|
|
257
|
-
</CapRow>
|
|
258
|
-
</CapRow>
|
|
259
|
-
)}
|
|
260
|
-
{!showCarouselInPreview && (
|
|
261
|
-
<CapLabel type="label1" className="viber-timestamp">
|
|
262
|
-
{timestamp}
|
|
263
|
-
</CapLabel>
|
|
264
|
-
)}
|
|
181
|
+
<CapLabel type="label1" className="viber-timestamp">
|
|
182
|
+
{timestamp}
|
|
183
|
+
</CapLabel>
|
|
265
184
|
<CapRow useLegacy className="empty-placeholder" />
|
|
266
185
|
</CapRow>
|
|
267
186
|
|
|
@@ -295,16 +214,6 @@ ViberPreviewContent.propTypes = {
|
|
|
295
214
|
viberVideoPreviewImg: PropTypes.string,
|
|
296
215
|
}),
|
|
297
216
|
buttonText: PropTypes.string,
|
|
298
|
-
type: PropTypes.string,
|
|
299
|
-
cards: PropTypes.arrayOf(PropTypes.shape({
|
|
300
|
-
text: PropTypes.string,
|
|
301
|
-
mediaUrl: PropTypes.string,
|
|
302
|
-
buttons: PropTypes.arrayOf(PropTypes.shape({
|
|
303
|
-
title: PropTypes.string,
|
|
304
|
-
action: PropTypes.string,
|
|
305
|
-
})),
|
|
306
|
-
})),
|
|
307
|
-
showCarouselEditorPreview: PropTypes.bool,
|
|
308
217
|
}),
|
|
309
218
|
}),
|
|
310
219
|
device: PropTypes.oneOf([ANDROID, IOS]),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
@import '~@capillarytech/cap-ui-library/styles/_variables';
|
|
2
|
-
@import './_viberCarouselPreviewCards.scss';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* UnifiedPreview Styles
|
|
@@ -783,13 +782,9 @@
|
|
|
783
782
|
|
|
784
783
|
.viber-content-overlay {
|
|
785
784
|
top: 3.2rem;
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
.sms-navigation-bar.viber-navigation-bar {
|
|
789
|
-
width: calc(100% - #{$CAP_SPACE_06} - #{$CAP_SPACE_08});
|
|
785
|
+
.viber-navigation-bar {
|
|
790
786
|
margin-left: $CAP_SPACE_06;
|
|
791
787
|
margin-right: $CAP_SPACE_08;
|
|
792
|
-
box-sizing: border-box;
|
|
793
788
|
}
|
|
794
789
|
}
|
|
795
790
|
|
|
@@ -2412,21 +2407,12 @@
|
|
|
2412
2407
|
// Body content follows TemplatePreview Viber structure
|
|
2413
2408
|
.sms-content-overlay {
|
|
2414
2409
|
&.viber-preview {
|
|
2415
|
-
overflow: hidden;
|
|
2416
|
-
|
|
2417
2410
|
// Viber message container
|
|
2418
2411
|
.viber-message-container {
|
|
2419
2412
|
position: relative;
|
|
2420
2413
|
flex: 1;
|
|
2421
2414
|
display: flex;
|
|
2422
2415
|
flex-direction: column;
|
|
2423
|
-
overflow-x: hidden;
|
|
2424
|
-
overflow-y: auto;
|
|
2425
|
-
-webkit-overflow-scrolling: touch;
|
|
2426
|
-
min-width: 0;
|
|
2427
|
-
max-width: 100%;
|
|
2428
|
-
box-sizing: border-box;
|
|
2429
|
-
width: calc(100% - #{$CAP_SPACE_06} - #{$CAP_SPACE_08});
|
|
2430
2416
|
padding: 0 $CAP_SPACE_16;
|
|
2431
2417
|
background-color: #ffffff;
|
|
2432
2418
|
margin-left: $CAP_SPACE_06;
|
|
@@ -2434,20 +2420,6 @@
|
|
|
2434
2420
|
border-bottom-left-radius: 2.6rem;
|
|
2435
2421
|
border-bottom-right-radius: 2.6rem;
|
|
2436
2422
|
|
|
2437
|
-
&.viber-message-container-carousel {
|
|
2438
|
-
padding-left: $CAP_SPACE_08;
|
|
2439
|
-
padding-right: $CAP_SPACE_08;
|
|
2440
|
-
width: calc(100% - #{$CAP_SPACE_04} - #{$CAP_SPACE_04});
|
|
2441
|
-
margin-left: $CAP_SPACE_04;
|
|
2442
|
-
margin-right: $CAP_SPACE_04;
|
|
2443
|
-
|
|
2444
|
-
> .ant-row,
|
|
2445
|
-
.ant-row.msg-container.viber-preview-carousel {
|
|
2446
|
-
margin-left: 0;
|
|
2447
|
-
margin-right: 0;
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
2423
|
// Brand name display (from TemplatePreview line 1136)
|
|
2452
2424
|
.viber-brand-name {
|
|
2453
2425
|
position: absolute;
|
|
@@ -2469,16 +2441,6 @@
|
|
|
2469
2441
|
flex-direction: row;
|
|
2470
2442
|
align-items: start;
|
|
2471
2443
|
|
|
2472
|
-
&.viber-preview-carousel {
|
|
2473
|
-
width: 100%;
|
|
2474
|
-
max-width: 100%;
|
|
2475
|
-
margin-left: 0;
|
|
2476
|
-
margin-right: 0;
|
|
2477
|
-
max-height: 100%;
|
|
2478
|
-
min-width: 0;
|
|
2479
|
-
box-sizing: border-box;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
2444
|
// Account icon (from TemplatePreview line 1146-1160)
|
|
2483
2445
|
.viber-account-icon {
|
|
2484
2446
|
width: $CAP_SPACE_20;
|
|
@@ -2503,22 +2465,6 @@
|
|
|
2503
2465
|
border-radius: $CAP_SPACE_04;
|
|
2504
2466
|
padding: $CAP_SPACE_04;
|
|
2505
2467
|
|
|
2506
|
-
&.viber-message-pop-carousel {
|
|
2507
|
-
width: 100%;
|
|
2508
|
-
max-width: 100%;
|
|
2509
|
-
min-width: 0;
|
|
2510
|
-
left: 0;
|
|
2511
|
-
margin-top: 0;
|
|
2512
|
-
padding: 0;
|
|
2513
|
-
background: transparent;
|
|
2514
|
-
display: flex;
|
|
2515
|
-
flex-direction: column;
|
|
2516
|
-
align-items: flex-start;
|
|
2517
|
-
gap: $CAP_SPACE_06;
|
|
2518
|
-
overflow: hidden;
|
|
2519
|
-
box-sizing: border-box;
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
2468
|
// Text Viber preview (from TemplatePreview line 1166-1174)
|
|
2523
2469
|
.viber-message-text {
|
|
2524
2470
|
margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
|
|
@@ -2590,85 +2536,6 @@
|
|
|
2590
2536
|
}
|
|
2591
2537
|
}
|
|
2592
2538
|
|
|
2593
|
-
.viber-carousel-preview {
|
|
2594
|
-
width: 100%;
|
|
2595
|
-
max-width: 100%;
|
|
2596
|
-
min-width: 0;
|
|
2597
|
-
display: flex;
|
|
2598
|
-
flex-direction: column;
|
|
2599
|
-
align-items: flex-start;
|
|
2600
|
-
gap: $CAP_SPACE_06;
|
|
2601
|
-
overflow: hidden;
|
|
2602
|
-
box-sizing: border-box;
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
|
-
.viber-carousel-message-pop,
|
|
2606
|
-
.viber-carousel-cards-pop {
|
|
2607
|
-
width: 100%;
|
|
2608
|
-
max-width: 100%;
|
|
2609
|
-
min-width: 0;
|
|
2610
|
-
background: $CAP_G08;
|
|
2611
|
-
border-radius: $CAP_SPACE_06;
|
|
2612
|
-
padding: $CAP_SPACE_08;
|
|
2613
|
-
box-sizing: border-box;
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
.viber-carousel-message-pop {
|
|
2617
|
-
margin-top: 0;
|
|
2618
|
-
width: 85%;
|
|
2619
|
-
border-radius: 0 $CAP_SPACE_06 $CAP_SPACE_06 $CAP_SPACE_06;
|
|
2620
|
-
display: flex;
|
|
2621
|
-
flex-direction: column;
|
|
2622
|
-
overflow: hidden;
|
|
2623
|
-
}
|
|
2624
|
-
|
|
2625
|
-
.viber-carousel-cards-pop {
|
|
2626
|
-
margin-top: 0;
|
|
2627
|
-
width: 100%;
|
|
2628
|
-
background: transparent;
|
|
2629
|
-
border: none;
|
|
2630
|
-
border-radius: 0;
|
|
2631
|
-
padding: 0;
|
|
2632
|
-
overflow: hidden;
|
|
2633
|
-
}
|
|
2634
|
-
|
|
2635
|
-
.viber-carousel-message-box {
|
|
2636
|
-
width: 100%;
|
|
2637
|
-
min-height: 2.25rem;
|
|
2638
|
-
height: auto;
|
|
2639
|
-
border-radius: $CAP_SPACE_04;
|
|
2640
|
-
background: transparent;
|
|
2641
|
-
padding: 0 $CAP_SPACE_08;
|
|
2642
|
-
display: flex;
|
|
2643
|
-
align-items: center;
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
.viber-carousel-message-box-text {
|
|
2647
|
-
color: $CAP_G01;
|
|
2648
|
-
margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
|
|
2649
|
-
white-space: normal;
|
|
2650
|
-
word-break: break-word;
|
|
2651
|
-
overflow-wrap: break-word;
|
|
2652
|
-
overflow: hidden;
|
|
2653
|
-
max-width: 100%;
|
|
2654
|
-
box-sizing: border-box;
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
.viber-carousel-message-box-placeholder {
|
|
2658
|
-
width: 100%;
|
|
2659
|
-
height: 0.875rem;
|
|
2660
|
-
border-radius: $CAP_SPACE_04;
|
|
2661
|
-
background: $CAP_G07;
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
.viber-carousel-message-timestamp,
|
|
2665
|
-
.viber-carousel-cards-timestamp {
|
|
2666
|
-
display: block;
|
|
2667
|
-
text-align: right;
|
|
2668
|
-
margin-top: $CAP_SPACE_06;
|
|
2669
|
-
color: $CAP_G04;
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
2539
|
.empty-placeholder {
|
|
2673
2540
|
height: $CAP_SPACE_08;
|
|
2674
2541
|
}
|
|
@@ -2682,11 +2549,6 @@
|
|
|
2682
2549
|
.viber-message-container-ios {
|
|
2683
2550
|
margin-left: 1rem;
|
|
2684
2551
|
margin-right: 1rem;
|
|
2685
|
-
|
|
2686
|
-
&.viber-message-container-carousel {
|
|
2687
|
-
margin-left: $CAP_SPACE_04;
|
|
2688
|
-
margin-right: $CAP_SPACE_04;
|
|
2689
|
-
}
|
|
2690
2552
|
}
|
|
2691
2553
|
}
|
|
2692
2554
|
}
|
|
@@ -228,8 +228,6 @@ export const CHANNEL_NAME_MOBILE_PUSH = 'MOBILE_PUSH';
|
|
|
228
228
|
export const DEFAULT_SENDER = 'test1';
|
|
229
229
|
export const VIBER_API_SCENARIO_KEY = 'viber-api';
|
|
230
230
|
export const VIBER_USER_ID_PATTERN = '{{viber_user_id}}';
|
|
231
|
-
/** Fallback title line-height (px) when computed style is unavailable. */
|
|
232
|
-
export const DEFAULT_CAROUSEL_TITLE_LINE_HEIGHT_PX = 18;
|
|
233
231
|
export const UNSUBSCRIBE_TAG_NAME = 'unsubscribe';
|
|
234
232
|
export const IN_APP_CHANNEL_NAME = 'in-app';
|
|
235
233
|
export const MOBILE_PUSH_CHANNEL_NAME = 'mobile push';
|