@capillarytech/creatives-library 9.0.13-alpha.1 → 9.0.13
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 -108
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -141
- package/v2Components/CommonTestAndPreview/index.js +26 -244
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +0 -364
- package/v2Components/ErrorInfoNote/index.js +1 -1
- package/v2Components/ErrorInfoNote/style.scss +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +216 -96
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +37 -17
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +77 -37
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +530 -250
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +3 -3
- package/v2Containers/Templates/_templates.scss +1 -84
- package/v2Containers/Templates/index.js +10 -90
- 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/tests/__snapshots__/index.test.js.snap +2645 -11346
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +0 -132
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +0 -132
package/package.json
CHANGED
|
@@ -14,25 +14,14 @@ 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 ViberCarouselPreviewCards from './ViberCarouselPreviewCards';
|
|
28
20
|
|
|
29
21
|
// Import device mockup images (same as SMS)
|
|
30
22
|
const smsMobileAndroid = require('../../../assets/Android.png');
|
|
31
23
|
const smsMobileIos = require('../../../assets/iOS.png');
|
|
32
24
|
|
|
33
|
-
const getTrimmedText = (value = '') => (value ?? '').trim();
|
|
34
|
-
const hasTrimmedText = (value = '') => Boolean(getTrimmedText(value));
|
|
35
|
-
|
|
36
25
|
const ViberPreviewContent = ({
|
|
37
26
|
content,
|
|
38
27
|
device,
|
|
@@ -54,35 +43,7 @@ const ViberPreviewContent = ({
|
|
|
54
43
|
imageURL = '',
|
|
55
44
|
videoParams = {},
|
|
56
45
|
buttonText = '',
|
|
57
|
-
type = '',
|
|
58
|
-
cards = [],
|
|
59
|
-
showCarouselEditorPreview = false,
|
|
60
46
|
} = viberContent;
|
|
61
|
-
const hasCarouselContent = type === MEDIA_TYPE_CAROUSEL;
|
|
62
|
-
|
|
63
|
-
const cardHasMeaningfulContent = (card) => {
|
|
64
|
-
if (!card || typeof card !== 'object') return false;
|
|
65
|
-
return (
|
|
66
|
-
hasTrimmedText(card?.text) ||
|
|
67
|
-
hasTrimmedText(card?.mediaUrl) ||
|
|
68
|
-
(card.buttons ?? []).some(button => hasTrimmedText(button?.title))
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const hasMeaningfulCarousel =
|
|
73
|
-
hasCarouselContent &&
|
|
74
|
-
Array.isArray(cards) &&
|
|
75
|
-
cards.length > 0 &&
|
|
76
|
-
cards.some(cardHasMeaningfulContent);
|
|
77
|
-
|
|
78
|
-
const showCarouselInPreview =
|
|
79
|
-
hasCarouselContent && (Boolean(showCarouselEditorPreview) || hasMeaningfulCarousel);
|
|
80
|
-
|
|
81
|
-
const previewCarouselCards =
|
|
82
|
-
hasCarouselContent && Array.isArray(cards) && cards.length ? cards : hasCarouselContent ? [{}] : [];
|
|
83
|
-
|
|
84
|
-
const trimmedMessageContent = getTrimmedText(messageContent);
|
|
85
|
-
const trimmedButtonText = getTrimmedText(buttonText);
|
|
86
47
|
|
|
87
48
|
// Get account name (first letter for icon)
|
|
88
49
|
const accountIcon = (accountName || brandName || 'V')[0]?.toUpperCase();
|
|
@@ -138,15 +99,8 @@ const ViberPreviewContent = ({
|
|
|
138
99
|
);
|
|
139
100
|
}
|
|
140
101
|
|
|
141
|
-
// Check if there's any content to display
|
|
142
|
-
const hasContent =
|
|
143
|
-
trimmedMessageContent
|
|
144
|
-
|| hasTrimmedText(imageURL)
|
|
145
|
-
|| videoParams?.viberVideoSrc
|
|
146
|
-
|| trimmedButtonText
|
|
147
|
-
|| hasMeaningfulCarousel
|
|
148
|
-
|| (hasCarouselContent && showCarouselEditorPreview)
|
|
149
|
-
);
|
|
102
|
+
// Check if there's any content to display
|
|
103
|
+
const hasContent = messageContent || imageURL || videoParams?.viberVideoSrc || buttonText;
|
|
150
104
|
|
|
151
105
|
// Render normal Viber preview
|
|
152
106
|
return (
|
|
@@ -171,34 +125,23 @@ const ViberPreviewContent = ({
|
|
|
171
125
|
|
|
172
126
|
{/* Viber Message Container */}
|
|
173
127
|
{hasContent && (
|
|
174
|
-
<CapRow className={`viber-message-container ${
|
|
128
|
+
<CapRow className={`viber-message-container ${device !== ANDROID ? 'viber-message-container-ios' : ''}`}>
|
|
175
129
|
{/* Brand Name Display (from TemplatePreview line 1136) */}
|
|
176
|
-
<CapRow
|
|
177
|
-
type="flex"
|
|
178
|
-
align="middle"
|
|
179
|
-
fullWidth={showCarouselInPreview}
|
|
180
|
-
className={`msg-container viber-preview ${showCarouselInPreview ? 'viber-preview-carousel' : ''}`}
|
|
181
|
-
>
|
|
130
|
+
<CapRow type="flex" align="middle" className="msg-container viber-preview">
|
|
182
131
|
{/* Account Icon (from TemplatePreview line 1146-1160) */}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
</CapRow>
|
|
187
|
-
)}
|
|
132
|
+
<CapRow type='flex' className="viber-account-icon">
|
|
133
|
+
{accountIcon}
|
|
134
|
+
</CapRow>
|
|
188
135
|
|
|
189
136
|
{/* Message Bubble (from TemplatePreview line 1161-1223) */}
|
|
190
|
-
<CapRow
|
|
191
|
-
useLegacy
|
|
192
|
-
fullWidth={showCarouselInPreview}
|
|
193
|
-
className={`message-pop align-left viber-message-pop ${showCarouselInPreview ? 'viber-message-pop-carousel' : ''}`}
|
|
194
|
-
>
|
|
137
|
+
<CapRow useLegacy className="message-pop align-left viber-message-pop">
|
|
195
138
|
{/* Text Viber preview */}
|
|
196
|
-
{
|
|
139
|
+
{messageContent && (
|
|
197
140
|
<CapLabel type="label15" className="viber-message-text">{messageContent}</CapLabel>
|
|
198
141
|
)}
|
|
199
142
|
|
|
200
143
|
{/* Image Viber preview */}
|
|
201
|
-
{
|
|
144
|
+
{imageURL && (
|
|
202
145
|
<CapImage
|
|
203
146
|
src={imageURL}
|
|
204
147
|
className="viber-image-preview"
|
|
@@ -228,42 +171,16 @@ const ViberPreviewContent = ({
|
|
|
228
171
|
)}
|
|
229
172
|
|
|
230
173
|
{/* Button Viber preview */}
|
|
231
|
-
{
|
|
174
|
+
{buttonText && (
|
|
232
175
|
<CapLabel className="viber-button-base">
|
|
233
176
|
<p className="viber-button-card-text">
|
|
234
177
|
{buttonText}
|
|
235
178
|
</p>
|
|
236
179
|
</CapLabel>
|
|
237
180
|
)}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<CapRow type="flex-column" className="viber-carousel-message-pop">
|
|
242
|
-
{trimmedMessageContent ? (
|
|
243
|
-
<CapLabel
|
|
244
|
-
type="label15"
|
|
245
|
-
className="message-pop-item align-left viber-message-text viber-carousel-message-box-text"
|
|
246
|
-
>
|
|
247
|
-
{messageContent}
|
|
248
|
-
</CapLabel>
|
|
249
|
-
) : (
|
|
250
|
-
<CapRow className="viber-carousel-message-box-placeholder" />
|
|
251
|
-
)}
|
|
252
|
-
<CapLabel type="label1" className="viber-carousel-message-timestamp">
|
|
253
|
-
{timestamp}
|
|
254
|
-
</CapLabel>
|
|
255
|
-
</CapRow>
|
|
256
|
-
|
|
257
|
-
<CapRow type="flex-column" fullWidth className="viber-carousel-cards-pop">
|
|
258
|
-
<ViberCarouselPreviewCards cards={previewCarouselCards} />
|
|
259
|
-
</CapRow>
|
|
260
|
-
</CapRow>
|
|
261
|
-
)}
|
|
262
|
-
{!showCarouselInPreview && (
|
|
263
|
-
<CapLabel type="label1" className="viber-timestamp">
|
|
264
|
-
{timestamp}
|
|
265
|
-
</CapLabel>
|
|
266
|
-
)}
|
|
181
|
+
<CapLabel type="label1" className="viber-timestamp">
|
|
182
|
+
{timestamp}
|
|
183
|
+
</CapLabel>
|
|
267
184
|
<CapRow useLegacy className="empty-placeholder" />
|
|
268
185
|
</CapRow>
|
|
269
186
|
|
|
@@ -297,16 +214,6 @@ ViberPreviewContent.propTypes = {
|
|
|
297
214
|
viberVideoPreviewImg: PropTypes.string,
|
|
298
215
|
}),
|
|
299
216
|
buttonText: PropTypes.string,
|
|
300
|
-
type: PropTypes.string,
|
|
301
|
-
cards: PropTypes.arrayOf(PropTypes.shape({
|
|
302
|
-
text: PropTypes.string,
|
|
303
|
-
mediaUrl: PropTypes.string,
|
|
304
|
-
buttons: PropTypes.arrayOf(PropTypes.shape({
|
|
305
|
-
title: PropTypes.string,
|
|
306
|
-
action: PropTypes.string,
|
|
307
|
-
})),
|
|
308
|
-
})),
|
|
309
|
-
showCarouselEditorPreview: PropTypes.bool,
|
|
310
217
|
}),
|
|
311
218
|
}),
|
|
312
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
|
|
@@ -575,8 +574,6 @@
|
|
|
575
574
|
height: calc(100% - 4.5rem);
|
|
576
575
|
display: flex;
|
|
577
576
|
flex-direction: column;
|
|
578
|
-
overflow: hidden;
|
|
579
|
-
box-sizing: border-box;
|
|
580
577
|
|
|
581
578
|
&.sms-content-overlay-android {
|
|
582
579
|
height: calc(100% - 3.8rem);
|
|
@@ -755,13 +752,9 @@
|
|
|
755
752
|
|
|
756
753
|
.viber-content-overlay {
|
|
757
754
|
top: 3.2rem;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
.sms-navigation-bar.viber-navigation-bar {
|
|
761
|
-
width: calc(100% - #{$CAP_SPACE_06} - #{$CAP_SPACE_08});
|
|
755
|
+
.viber-navigation-bar {
|
|
762
756
|
margin-left: $CAP_SPACE_06;
|
|
763
757
|
margin-right: $CAP_SPACE_08;
|
|
764
|
-
box-sizing: border-box;
|
|
765
758
|
}
|
|
766
759
|
}
|
|
767
760
|
|
|
@@ -2117,21 +2110,12 @@
|
|
|
2117
2110
|
// Body content follows TemplatePreview Viber structure
|
|
2118
2111
|
.sms-content-overlay {
|
|
2119
2112
|
&.viber-preview {
|
|
2120
|
-
overflow: hidden;
|
|
2121
|
-
|
|
2122
2113
|
// Viber message container
|
|
2123
2114
|
.viber-message-container {
|
|
2124
2115
|
position: relative;
|
|
2125
2116
|
flex: 1;
|
|
2126
2117
|
display: flex;
|
|
2127
2118
|
flex-direction: column;
|
|
2128
|
-
overflow-x: hidden;
|
|
2129
|
-
overflow-y: auto;
|
|
2130
|
-
-webkit-overflow-scrolling: touch;
|
|
2131
|
-
min-width: 0;
|
|
2132
|
-
max-width: 100%;
|
|
2133
|
-
box-sizing: border-box;
|
|
2134
|
-
width: calc(100% - #{$CAP_SPACE_06} - #{$CAP_SPACE_08});
|
|
2135
2119
|
padding: 0 $CAP_SPACE_16;
|
|
2136
2120
|
background-color: #ffffff;
|
|
2137
2121
|
margin-left: $CAP_SPACE_06;
|
|
@@ -2139,20 +2123,6 @@
|
|
|
2139
2123
|
border-bottom-left-radius: 2.6rem;
|
|
2140
2124
|
border-bottom-right-radius: 2.6rem;
|
|
2141
2125
|
|
|
2142
|
-
&.viber-message-container-carousel {
|
|
2143
|
-
padding-left: $CAP_SPACE_08;
|
|
2144
|
-
padding-right: $CAP_SPACE_08;
|
|
2145
|
-
width: calc(100% - #{$CAP_SPACE_04} - #{$CAP_SPACE_04});
|
|
2146
|
-
margin-left: $CAP_SPACE_04;
|
|
2147
|
-
margin-right: $CAP_SPACE_04;
|
|
2148
|
-
|
|
2149
|
-
> .ant-row,
|
|
2150
|
-
.ant-row.msg-container.viber-preview-carousel {
|
|
2151
|
-
margin-left: 0;
|
|
2152
|
-
margin-right: 0;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
2126
|
// Brand name display (from TemplatePreview line 1136)
|
|
2157
2127
|
.viber-brand-name {
|
|
2158
2128
|
position: absolute;
|
|
@@ -2174,16 +2144,6 @@
|
|
|
2174
2144
|
flex-direction: row;
|
|
2175
2145
|
align-items: start;
|
|
2176
2146
|
|
|
2177
|
-
&.viber-preview-carousel {
|
|
2178
|
-
width: 100%;
|
|
2179
|
-
max-width: 100%;
|
|
2180
|
-
margin-left: 0;
|
|
2181
|
-
margin-right: 0;
|
|
2182
|
-
max-height: 100%;
|
|
2183
|
-
min-width: 0;
|
|
2184
|
-
box-sizing: border-box;
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
2147
|
// Account icon (from TemplatePreview line 1146-1160)
|
|
2188
2148
|
.viber-account-icon {
|
|
2189
2149
|
width: $CAP_SPACE_20;
|
|
@@ -2208,22 +2168,6 @@
|
|
|
2208
2168
|
border-radius: $CAP_SPACE_04;
|
|
2209
2169
|
padding: $CAP_SPACE_04;
|
|
2210
2170
|
|
|
2211
|
-
&.viber-message-pop-carousel {
|
|
2212
|
-
width: 100%;
|
|
2213
|
-
max-width: 100%;
|
|
2214
|
-
min-width: 0;
|
|
2215
|
-
left: 0;
|
|
2216
|
-
margin-top: 0;
|
|
2217
|
-
padding: 0;
|
|
2218
|
-
background: transparent;
|
|
2219
|
-
display: flex;
|
|
2220
|
-
flex-direction: column;
|
|
2221
|
-
align-items: flex-start;
|
|
2222
|
-
gap: $CAP_SPACE_06;
|
|
2223
|
-
overflow: hidden;
|
|
2224
|
-
box-sizing: border-box;
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
2171
|
// Text Viber preview (from TemplatePreview line 1166-1174)
|
|
2228
2172
|
.viber-message-text {
|
|
2229
2173
|
margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
|
|
@@ -2294,85 +2238,6 @@
|
|
|
2294
2238
|
}
|
|
2295
2239
|
}
|
|
2296
2240
|
|
|
2297
|
-
.viber-carousel-preview {
|
|
2298
|
-
width: 100%;
|
|
2299
|
-
max-width: 100%;
|
|
2300
|
-
min-width: 0;
|
|
2301
|
-
display: flex;
|
|
2302
|
-
flex-direction: column;
|
|
2303
|
-
align-items: flex-start;
|
|
2304
|
-
gap: $CAP_SPACE_06;
|
|
2305
|
-
overflow: hidden;
|
|
2306
|
-
box-sizing: border-box;
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
.viber-carousel-message-pop,
|
|
2310
|
-
.viber-carousel-cards-pop {
|
|
2311
|
-
width: 100%;
|
|
2312
|
-
max-width: 100%;
|
|
2313
|
-
min-width: 0;
|
|
2314
|
-
background: $CAP_G08;
|
|
2315
|
-
border-radius: $CAP_SPACE_06;
|
|
2316
|
-
padding: $CAP_SPACE_08;
|
|
2317
|
-
box-sizing: border-box;
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
.viber-carousel-message-pop {
|
|
2321
|
-
margin-top: 0;
|
|
2322
|
-
width: 85%;
|
|
2323
|
-
border-radius: 0 $CAP_SPACE_06 $CAP_SPACE_06 $CAP_SPACE_06;
|
|
2324
|
-
display: flex;
|
|
2325
|
-
flex-direction: column;
|
|
2326
|
-
overflow: hidden;
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
|
-
.viber-carousel-cards-pop {
|
|
2330
|
-
margin-top: 0;
|
|
2331
|
-
width: 100%;
|
|
2332
|
-
background: transparent;
|
|
2333
|
-
border: none;
|
|
2334
|
-
border-radius: 0;
|
|
2335
|
-
padding: 0;
|
|
2336
|
-
overflow: hidden;
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
.viber-carousel-message-box {
|
|
2340
|
-
width: 100%;
|
|
2341
|
-
min-height: 2.25rem;
|
|
2342
|
-
height: auto;
|
|
2343
|
-
border-radius: $CAP_SPACE_04;
|
|
2344
|
-
background: transparent;
|
|
2345
|
-
padding: 0 $CAP_SPACE_08;
|
|
2346
|
-
display: flex;
|
|
2347
|
-
align-items: center;
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
.viber-carousel-message-box-text {
|
|
2351
|
-
color: $CAP_G01;
|
|
2352
|
-
margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
|
|
2353
|
-
white-space: normal;
|
|
2354
|
-
word-break: break-word;
|
|
2355
|
-
overflow-wrap: break-word;
|
|
2356
|
-
overflow: hidden;
|
|
2357
|
-
max-width: 100%;
|
|
2358
|
-
box-sizing: border-box;
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
.viber-carousel-message-box-placeholder {
|
|
2362
|
-
width: 100%;
|
|
2363
|
-
height: 0.875rem;
|
|
2364
|
-
border-radius: $CAP_SPACE_04;
|
|
2365
|
-
background: $CAP_G07;
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
.viber-carousel-message-timestamp,
|
|
2369
|
-
.viber-carousel-cards-timestamp {
|
|
2370
|
-
display: block;
|
|
2371
|
-
text-align: right;
|
|
2372
|
-
margin-top: $CAP_SPACE_06;
|
|
2373
|
-
color: $CAP_G04;
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
2241
|
.empty-placeholder {
|
|
2377
2242
|
height: $CAP_SPACE_08;
|
|
2378
2243
|
}
|
|
@@ -2386,11 +2251,6 @@
|
|
|
2386
2251
|
.viber-message-container-ios {
|
|
2387
2252
|
margin-left: 1rem;
|
|
2388
2253
|
margin-right: 1rem;
|
|
2389
|
-
|
|
2390
|
-
&.viber-message-container-carousel {
|
|
2391
|
-
margin-left: $CAP_SPACE_04;
|
|
2392
|
-
margin-right: $CAP_SPACE_04;
|
|
2393
|
-
}
|
|
2394
2254
|
}
|
|
2395
2255
|
}
|
|
2396
2256
|
}
|