@capillarytech/creatives-library 9.0.32 → 9.0.34-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/AppRoot.js +124 -0
- package/app-config.js +61 -0
- package/app.js +10 -175
- package/bootstrap.js +185 -0
- package/entry.js +67 -1
- package/mfe-exposed-components.js +2 -4
- package/package.json +2 -2
- package/services/api.js +9 -1
- package/styles/containers/layout/_layoutPage.scss +8 -6
- package/utils/getDataLayer.js +15 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
- package/utils/mfeDetect.js +1 -0
- package/utils/mfeFirstPaintReady.js +29 -0
- package/utils/mfeHistory.js +62 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +132 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +108 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +139 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +131 -0
- package/v2Components/CommonTestAndPreview/index.js +240 -26
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +364 -0
- package/v2Components/NavigationBar/index.js +9 -7
- package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
- package/v2Components/NavigationBar/tests/index.test.js +39 -19
- package/v2Containers/Cap/constants.js +1 -0
- package/v2Containers/Cap/index.js +57 -27
- package/v2Containers/Templates/_templates.scss +115 -1
- package/v2Containers/Templates/index.js +91 -10
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +5 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +8 -3
- package/v2Containers/TemplatesV2/index.js +22 -9
- 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
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
REQUEST,
|
|
31
31
|
DEFAULT,
|
|
32
32
|
ENABLE_PRODUCT_SUPPORT_VIDEOS,
|
|
33
|
+
ENABLE_NEW_LEFT_NAVIGATION,
|
|
33
34
|
CAMPAIGN_SETTINGS_URL,
|
|
34
35
|
} from './constants';
|
|
35
36
|
import './_cap.scss';
|
|
@@ -53,7 +54,8 @@ import { v2ViberSagas } from '../Viber/sagas';
|
|
|
53
54
|
import { v2FacebookSagas } from '../Facebook/sagas';
|
|
54
55
|
import createReducer from '../Line/Container/reducer';
|
|
55
56
|
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
56
|
-
|
|
57
|
+
import { getDataLayer } from '../../utils/getDataLayer';
|
|
58
|
+
const gtm = getDataLayer();
|
|
57
59
|
const {
|
|
58
60
|
logNewTab,
|
|
59
61
|
utilsGetOrgNameFromId,
|
|
@@ -72,18 +74,19 @@ const CapWrapper = styled.div`
|
|
|
72
74
|
min-height: 100%;
|
|
73
75
|
padding: 0;
|
|
74
76
|
flex-direction: column;
|
|
77
|
+
position: relative;
|
|
75
78
|
`;
|
|
76
79
|
GA.initialize({ accessKey: GTM_TRACKING_ID, trackUIError: true, trackLoadPerformance: 'creatives' });
|
|
77
80
|
|
|
78
81
|
const MainWrapper = styled.div`
|
|
79
82
|
position: relative;
|
|
80
|
-
min-height:
|
|
81
|
-
top:
|
|
83
|
+
min-height: 100%;
|
|
84
|
+
top: 0;
|
|
82
85
|
`;
|
|
83
86
|
|
|
84
87
|
const ContentWrapper = styled.div`
|
|
85
88
|
&& {
|
|
86
|
-
margin-left:
|
|
89
|
+
margin-left: 0;
|
|
87
90
|
}
|
|
88
91
|
`;
|
|
89
92
|
|
|
@@ -118,12 +121,16 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
118
121
|
const userGtmData = this.getUserGtmData();
|
|
119
122
|
this.setDimensionData(userGtmData);
|
|
120
123
|
gtm.push({ ...userGtmData, event: 'userAuthenticated' });
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
// In MFE mode the host already initialized auth (window.capAuth is set with
|
|
125
|
+
// the full superset); skip so we don't clobber it with the basic shape.
|
|
126
|
+
if (!window.capAuth) {
|
|
127
|
+
Auth.initialize({
|
|
128
|
+
permissions: userData.accessiblePermissions,
|
|
129
|
+
isCapUser: userData.isCapUser,
|
|
130
|
+
roles: Object.keys(userData.accessRoles),
|
|
131
|
+
accessibleFeatures,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
127
134
|
});
|
|
128
135
|
this.props.actions.getTopbarMenuData(parentModule);
|
|
129
136
|
if (this.props.Global.orgID !== undefined) {
|
|
@@ -500,6 +507,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
500
507
|
const type = this.props.location.query.type;
|
|
501
508
|
const toastMessages = this.props.Global.messages;
|
|
502
509
|
const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
|
|
510
|
+
const { accessibleFeatures = [] } = currentOrgDetails;
|
|
511
|
+
const isLatestLeftNavigationEnabled = accessibleFeatures.includes(ENABLE_NEW_LEFT_NAVIGATION);
|
|
503
512
|
return (
|
|
504
513
|
<CapWrapper>
|
|
505
514
|
{ this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
|
|
@@ -537,26 +546,47 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
537
546
|
campaignOrgV2Status={currentOrgDetails.org_campaign_v2_status}
|
|
538
547
|
handleLeftNavBarExpanded={this.handleLeftNavBarExpanded}
|
|
539
548
|
leftNavbarExpandedProp={this.state.leftNavbarExpanded}
|
|
540
|
-
/>) : ''}
|
|
541
|
-
<MainWrapper className="main">
|
|
542
549
|
|
|
543
|
-
<ContentWrapper
|
|
544
|
-
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
545
|
-
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
546
550
|
>
|
|
547
|
-
<
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
551
|
+
<MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
|
|
552
|
+
<ContentWrapper
|
|
553
|
+
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
554
|
+
isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
|
|
555
|
+
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
556
|
+
>
|
|
557
|
+
<Switch>
|
|
558
|
+
{componentRoutes.map(routeProps => {
|
|
559
|
+
return (
|
|
560
|
+
<RenderRoute
|
|
561
|
+
{...routeProps}
|
|
562
|
+
key={routeProps.path}
|
|
563
|
+
isLoggedIn={isLoggedIn}
|
|
564
|
+
/>
|
|
565
|
+
)}
|
|
566
|
+
)}
|
|
567
|
+
</Switch>
|
|
568
|
+
</ContentWrapper>
|
|
569
|
+
</MainWrapper>
|
|
570
|
+
</NavigationBar>) : (
|
|
571
|
+
<MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
|
|
572
|
+
<ContentWrapper
|
|
573
|
+
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
574
|
+
isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
|
|
575
|
+
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
576
|
+
>
|
|
577
|
+
<Switch>
|
|
578
|
+
{componentRoutes.map(routeProps => {
|
|
579
|
+
return (
|
|
580
|
+
<RenderRoute
|
|
581
|
+
{...routeProps}
|
|
582
|
+
key={routeProps.path}
|
|
583
|
+
isLoggedIn={isLoggedIn}
|
|
584
|
+
/>
|
|
585
|
+
)}
|
|
555
586
|
)}
|
|
556
|
-
|
|
557
|
-
</
|
|
558
|
-
</
|
|
559
|
-
</MainWrapper>
|
|
587
|
+
</Switch>
|
|
588
|
+
</ContentWrapper>
|
|
589
|
+
</MainWrapper>)}
|
|
560
590
|
</div>
|
|
561
591
|
{(toastMessages && toastMessages.length > 0) &&
|
|
562
592
|
toastMessages.map((message) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
2
|
|
|
3
3
|
.ant-tabs-content{
|
|
4
|
+
margin-top: $CAP_SPACE_08;
|
|
4
5
|
// .creatives-templates-list.full-mode{
|
|
5
6
|
.v2-pagination-container, .v2-pagination-container-half {
|
|
6
7
|
.ant-tabs-tabpane-active{
|
|
@@ -159,6 +160,96 @@
|
|
|
159
160
|
line-clamp: 3;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
163
|
+
.viber-carousel-static-content {
|
|
164
|
+
width: 100%;
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
.viber-carousel-static-message-box {
|
|
167
|
+
width: 100%;
|
|
168
|
+
height: auto;
|
|
169
|
+
border-radius: $CAP_SPACE_04;
|
|
170
|
+
background: $CAP_WHITE;
|
|
171
|
+
margin-bottom: $CAP_SPACE_08;
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: flex-start;
|
|
174
|
+
}
|
|
175
|
+
.viber-carousel-static-message {
|
|
176
|
+
display: -webkit-box;
|
|
177
|
+
width: 100%;
|
|
178
|
+
color: $CAP_G01;
|
|
179
|
+
line-height: 1.3;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
text-overflow: ellipsis;
|
|
182
|
+
-webkit-line-clamp: 2;
|
|
183
|
+
line-clamp: 2;
|
|
184
|
+
-webkit-box-orient: vertical;
|
|
185
|
+
white-space: normal;
|
|
186
|
+
word-break: break-word;
|
|
187
|
+
}
|
|
188
|
+
.viber-carousel-static-cards {
|
|
189
|
+
display: flex;
|
|
190
|
+
gap: $CAP_SPACE_08;
|
|
191
|
+
overflow: hidden;
|
|
192
|
+
}
|
|
193
|
+
.viber-carousel-static-card {
|
|
194
|
+
flex: 1;
|
|
195
|
+
min-width: 0;
|
|
196
|
+
background: $CAP_WHITE;
|
|
197
|
+
border-radius: $CAP_SPACE_04;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
}
|
|
202
|
+
.viber-carousel-static-image {
|
|
203
|
+
width: 100%;
|
|
204
|
+
max-height: 11rem;
|
|
205
|
+
margin-bottom: $CAP_SPACE_04;
|
|
206
|
+
border-radius: $CAP_SPACE_04;
|
|
207
|
+
display: block;
|
|
208
|
+
}
|
|
209
|
+
.viber-carousel-static-image-placeholder {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 7.143rem;
|
|
212
|
+
border-radius: $CAP_SPACE_04;
|
|
213
|
+
}
|
|
214
|
+
.viber-carousel-static-image-placeholder {
|
|
215
|
+
background: $CAP_G07;
|
|
216
|
+
}
|
|
217
|
+
.viber-carousel-static-text {
|
|
218
|
+
display: block;
|
|
219
|
+
color: $CAP_G01;
|
|
220
|
+
margin: $CAP_SPACE_04 0;
|
|
221
|
+
line-height: 1.3;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
text-overflow: ellipsis;
|
|
224
|
+
white-space: normal;
|
|
225
|
+
-webkit-line-clamp: 2;
|
|
226
|
+
line-clamp: 2;
|
|
227
|
+
-webkit-box-orient: vertical;
|
|
228
|
+
display: -webkit-box;
|
|
229
|
+
}
|
|
230
|
+
.viber-carousel-static-buttons {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
gap: $CAP_SPACE_04;
|
|
234
|
+
margin-top: auto;
|
|
235
|
+
}
|
|
236
|
+
.viber-carousel-static-button {
|
|
237
|
+
display: block;
|
|
238
|
+
min-height: 1.5rem;
|
|
239
|
+
border-radius: $CAP_SPACE_12;
|
|
240
|
+
background: $CAP_PURPLE01;
|
|
241
|
+
color: $CAP_WHITE;
|
|
242
|
+
text-align: center;
|
|
243
|
+
padding: 0.179rem $CAP_SPACE_08;
|
|
244
|
+
white-space: normal;
|
|
245
|
+
}
|
|
246
|
+
.viber-carousel-static-button-secondary {
|
|
247
|
+
color: $CAP_PURPLE01;
|
|
248
|
+
background: transparent;
|
|
249
|
+
border: none;
|
|
250
|
+
box-shadow: none;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
162
253
|
|
|
163
254
|
}
|
|
164
255
|
|
|
@@ -167,6 +258,30 @@
|
|
|
167
258
|
word-wrap: break-word;
|
|
168
259
|
}
|
|
169
260
|
}
|
|
261
|
+
|
|
262
|
+
&.viber-carousel-static {
|
|
263
|
+
height: auto;
|
|
264
|
+
min-height: 21.125rem;
|
|
265
|
+
|
|
266
|
+
.ant-card-body {
|
|
267
|
+
padding-bottom: $CAP_SPACE_12;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.truncate-text-viber {
|
|
271
|
+
.ant-card-meta-description {
|
|
272
|
+
display: block;
|
|
273
|
+
overflow: visible;
|
|
274
|
+
-webkit-line-clamp: unset;
|
|
275
|
+
line-clamp: unset;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.viber-carousel-static-content,
|
|
280
|
+
.viber-carousel-static-cards,
|
|
281
|
+
.viber-carousel-static-card {
|
|
282
|
+
overflow: visible;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
170
285
|
|
|
171
286
|
|
|
172
287
|
&.carousel-img-section {
|
|
@@ -1427,7 +1542,6 @@
|
|
|
1427
1542
|
justify-content: space-between;
|
|
1428
1543
|
align-items: center;
|
|
1429
1544
|
gap: $CAP_SPACE_08;
|
|
1430
|
-
margin-right: $CAP_SPACE_32;
|
|
1431
1545
|
}
|
|
1432
1546
|
|
|
1433
1547
|
.template-listing-more-btn {
|
|
@@ -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';
|
|
@@ -1396,6 +1397,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1396
1397
|
const image = viberContent.image || {};
|
|
1397
1398
|
const video = viberContent.video || {};
|
|
1398
1399
|
const button = viberContent.button || {};
|
|
1400
|
+
const messageType = viberContent.type || '';
|
|
1401
|
+
const cardsRaw = viberContent.cards;
|
|
1402
|
+
const cards = Array.isArray(cardsRaw) ? cardsRaw : [];
|
|
1403
|
+
const isCarousel =
|
|
1404
|
+
messageType === VIBER_MEDIA_TYPES.CAROUSEL || cards.length > 0;
|
|
1399
1405
|
|
|
1400
1406
|
const viberPreview = {
|
|
1401
1407
|
messageContent: text,
|
|
@@ -1413,14 +1419,39 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1413
1419
|
};
|
|
1414
1420
|
}
|
|
1415
1421
|
|
|
1422
|
+
if (isCarousel) {
|
|
1423
|
+
viberPreview.type = VIBER_MEDIA_TYPES.CAROUSEL;
|
|
1424
|
+
viberPreview.cards = cards.map((card) => ({
|
|
1425
|
+
text: card?.text || '',
|
|
1426
|
+
mediaUrl: card?.mediaUrl || '',
|
|
1427
|
+
buttons: (card?.buttons || []).map((btn) => ({
|
|
1428
|
+
title: btn?.title || '',
|
|
1429
|
+
action: btn?.action || '',
|
|
1430
|
+
})),
|
|
1431
|
+
}));
|
|
1432
|
+
viberPreview.showCarouselEditorPreview = true;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1416
1435
|
// Extract account name
|
|
1417
1436
|
const accountName = get(template, 'definition.accountName', '');
|
|
1418
1437
|
|
|
1419
1438
|
// Return Viber content object (same as Viber/index.js getTemplateContent)
|
|
1420
1439
|
return {
|
|
1421
1440
|
viberPreviewContent: viberPreview,
|
|
1422
|
-
accountName: accountName
|
|
1423
|
-
brandName: accountName
|
|
1441
|
+
accountName: accountName || '',
|
|
1442
|
+
brandName: accountName || '',
|
|
1443
|
+
messageContent: text,
|
|
1444
|
+
...(isCarousel && {
|
|
1445
|
+
type: VIBER_MEDIA_TYPES.CAROUSEL,
|
|
1446
|
+
cards: viberPreview.cards,
|
|
1447
|
+
}),
|
|
1448
|
+
...(!isCarousel && !isEmpty(button) && button.text && (button.url || viberContent.buttonURL) && {
|
|
1449
|
+
button: {
|
|
1450
|
+
text: button.text,
|
|
1451
|
+
url: button.url || viberContent.buttonURL || '',
|
|
1452
|
+
},
|
|
1453
|
+
}),
|
|
1454
|
+
buttonURL: button.url || viberContent.buttonURL || '',
|
|
1424
1455
|
};
|
|
1425
1456
|
}
|
|
1426
1457
|
|
|
@@ -2441,10 +2472,52 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2441
2472
|
image = {},
|
|
2442
2473
|
button = {},
|
|
2443
2474
|
video = {},
|
|
2475
|
+
type = '',
|
|
2476
|
+
cards = [],
|
|
2444
2477
|
} = {},
|
|
2445
2478
|
} = {},
|
|
2446
2479
|
} = template.versions.base;
|
|
2480
|
+
const isViberCarousel = type === VIBER_MEDIA_TYPES.CAROUSEL;
|
|
2447
2481
|
templateData.content = text;
|
|
2482
|
+
if (isViberCarousel) {
|
|
2483
|
+
const previewCards = Array.isArray(cards) ? cards.slice(0, 1) : [];
|
|
2484
|
+
templateData.className = 'viber-carousel-static';
|
|
2485
|
+
templateData.content = (
|
|
2486
|
+
<CapRow className="viber-carousel-static-content">
|
|
2487
|
+
<CapRow className="viber-carousel-static-message-box">
|
|
2488
|
+
<CapLabel type="label1" className="viber-carousel-static-message">
|
|
2489
|
+
{text}
|
|
2490
|
+
</CapLabel>
|
|
2491
|
+
</CapRow>
|
|
2492
|
+
<CapRow className="viber-carousel-static-cards">
|
|
2493
|
+
{previewCards.map((card, cardIdx) => (
|
|
2494
|
+
<CapRow className="viber-carousel-static-card" key={`viber-static-card-${cardIdx}`}>
|
|
2495
|
+
{card?.mediaUrl ? (
|
|
2496
|
+
<CapImage src={card.mediaUrl} className="viber-carousel-static-image" />
|
|
2497
|
+
) : (
|
|
2498
|
+
<CapRow className="viber-carousel-static-image-placeholder" />
|
|
2499
|
+
)}
|
|
2500
|
+
<CapLabel type="label1" className="viber-carousel-static-text">
|
|
2501
|
+
{card?.text}
|
|
2502
|
+
</CapLabel>
|
|
2503
|
+
<CapRow className="viber-carousel-static-buttons">
|
|
2504
|
+
{(Array.isArray(card?.buttons) && card.buttons.length ? card.buttons : [{}, {}]).slice(0, 2).map((carouselButton, btnIdx) => (
|
|
2505
|
+
<CapLabel
|
|
2506
|
+
key={`viber-static-btn-${cardIdx}-${btnIdx}`}
|
|
2507
|
+
type="label1"
|
|
2508
|
+
className={`viber-carousel-static-button ${btnIdx === 1 ? 'viber-carousel-static-button-secondary' : ''}`}
|
|
2509
|
+
>
|
|
2510
|
+
{(carouselButton?.title || '').trim()}
|
|
2511
|
+
</CapLabel>
|
|
2512
|
+
))}
|
|
2513
|
+
</CapRow>
|
|
2514
|
+
</CapRow>
|
|
2515
|
+
))}
|
|
2516
|
+
</CapRow>
|
|
2517
|
+
</CapRow>
|
|
2518
|
+
);
|
|
2519
|
+
break;
|
|
2520
|
+
}
|
|
2448
2521
|
if (!isEmpty(image)) {
|
|
2449
2522
|
const { url = '' } = image;
|
|
2450
2523
|
templateData.url = url;
|
|
@@ -4603,6 +4676,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
4603
4676
|
<CapButton
|
|
4604
4677
|
className={`create-new-${channelLowerCase} margin-l-8 margin-b-12`}
|
|
4605
4678
|
type={"primary"}
|
|
4679
|
+
isAddBtn
|
|
4606
4680
|
disabled={this.isCreateDisabled()}
|
|
4607
4681
|
onClick={this.createTemplate}
|
|
4608
4682
|
>
|
|
@@ -5064,15 +5138,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
5064
5138
|
? this.props.Templates.selectedWhatsappAccount.name
|
|
5065
5139
|
: null
|
|
5066
5140
|
}
|
|
5067
|
-
// Pass formData for
|
|
5141
|
+
// Pass formData for tag extraction (EMAIL/SMS use nested formData; VIBER uses content object)
|
|
5068
5142
|
formData={
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5143
|
+
(() => {
|
|
5144
|
+
const previewContent = this.state.testAndPreviewContent;
|
|
5145
|
+
const channelUpper = this.state.channel?.toUpperCase();
|
|
5146
|
+
if (!previewContent || typeof previewContent !== 'object') {
|
|
5147
|
+
return null;
|
|
5148
|
+
}
|
|
5149
|
+
if ([EMAIL, SMS].includes(channelUpper)) {
|
|
5150
|
+
return previewContent.formData || null;
|
|
5151
|
+
}
|
|
5152
|
+
if (channelUpper === VIBER) {
|
|
5153
|
+
return previewContent;
|
|
5154
|
+
}
|
|
5155
|
+
return null;
|
|
5156
|
+
})()
|
|
5076
5157
|
}
|
|
5077
5158
|
/>
|
|
5078
5159
|
)}
|
|
@@ -239,6 +239,7 @@ exports[`Test Templates container Should render sms illustration when no templat
|
|
|
239
239
|
<CapButton
|
|
240
240
|
className="create-new-sms margin-l-8 margin-b-12"
|
|
241
241
|
disabled={false}
|
|
242
|
+
isAddBtn={true}
|
|
242
243
|
onClick={[Function]}
|
|
243
244
|
type="primary"
|
|
244
245
|
>
|
|
@@ -813,6 +814,7 @@ exports[`Test Templates container Should render temlates when whatsapp templates
|
|
|
813
814
|
<CapButton
|
|
814
815
|
className="create-new-whatsapp margin-l-8 margin-b-12"
|
|
815
816
|
disabled={false}
|
|
817
|
+
isAddBtn={true}
|
|
816
818
|
onClick={[Function]}
|
|
817
819
|
type="primary"
|
|
818
820
|
>
|
|
@@ -1223,6 +1225,7 @@ exports[`Test Templates container Test max templates exceeded 1`] = `
|
|
|
1223
1225
|
<CapButton
|
|
1224
1226
|
className="create-new-whatsapp margin-l-8 margin-b-12"
|
|
1225
1227
|
disabled={false}
|
|
1228
|
+
isAddBtn={true}
|
|
1226
1229
|
onClick={[Function]}
|
|
1227
1230
|
type="primary"
|
|
1228
1231
|
>
|
|
@@ -1696,6 +1699,7 @@ exports[`Test Templates container Test max templates not exceeded 1`] = `
|
|
|
1696
1699
|
<CapButton
|
|
1697
1700
|
className="create-new-whatsapp margin-l-8 margin-b-12"
|
|
1698
1701
|
disabled={false}
|
|
1702
|
+
isAddBtn={true}
|
|
1699
1703
|
onClick={[Function]}
|
|
1700
1704
|
type="primary"
|
|
1701
1705
|
>
|
|
@@ -2169,6 +2173,7 @@ exports[`Test Templates container Test max templates warning 1`] = `
|
|
|
2169
2173
|
<CapButton
|
|
2170
2174
|
className="create-new-whatsapp margin-l-8 margin-b-12"
|
|
2171
2175
|
disabled={false}
|
|
2176
|
+
isAddBtn={true}
|
|
2172
2177
|
onClick={[Function]}
|
|
2173
2178
|
type="primary"
|
|
2174
2179
|
>
|
|
@@ -10,10 +10,9 @@ export default css`
|
|
|
10
10
|
|
|
11
11
|
.component-wrapper {
|
|
12
12
|
${(props) => props.isFullMode ? `
|
|
13
|
-
max-width: 71.25rem;
|
|
14
13
|
margin: 0 auto;
|
|
15
14
|
width: 100%;
|
|
16
|
-
padding: 0
|
|
15
|
+
padding: 0;
|
|
17
16
|
/* Only main channel tabs content, not HTML Editor validation panel tabs */
|
|
18
17
|
> .cap-tab-v2 > .ant-tabs-content-holder > .ant-tabs-content,
|
|
19
18
|
> .cap-tab-v2 > .ant-tabs-content {
|
|
@@ -97,6 +96,12 @@ export default css`
|
|
|
97
96
|
`;
|
|
98
97
|
|
|
99
98
|
export const CapTabStyle = css`
|
|
100
|
-
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24}
|
|
99
|
+
${(props) => props.isFullMode ? `margin-top: ${CAP_SPACE_24};` : ``
|
|
100
|
+
}
|
|
101
|
+
.ant-tabs-nav-list {
|
|
102
|
+
gap: 2rem;
|
|
103
|
+
}
|
|
104
|
+
.ant-tabs-tab + .ant-tabs-tab {
|
|
105
|
+
margin: 0 !important;
|
|
101
106
|
}
|
|
102
107
|
`;
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
12
|
import { bindActionCreators, compose } from 'redux';
|
|
13
|
-
import { CapTab, CapCustomCard, CapButton,
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get, pick } from 'lodash';
|
|
15
15
|
import Helmet from 'react-helmet';
|
|
16
16
|
|
|
@@ -47,6 +47,9 @@ import {
|
|
|
47
47
|
NORMALIZED_CHANNEL_ALIASES,
|
|
48
48
|
SMS,
|
|
49
49
|
} from "../CreativesContainer/constants";
|
|
50
|
+
import { MFEEventBus } from '@capillarytech/cap-ui-utils';
|
|
51
|
+
import { isMFEMode } from '../../utils/mfeDetect';
|
|
52
|
+
import appConfig from '../../app-config';
|
|
50
53
|
|
|
51
54
|
const { CapCustomCardList } = CapCustomCard;
|
|
52
55
|
|
|
@@ -54,6 +57,7 @@ const StyledCapTab = withStyles(CapTab, CapTabStyle);
|
|
|
54
57
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
55
58
|
constructor(props) {
|
|
56
59
|
super(props);
|
|
60
|
+
this.lcpReported = false;
|
|
57
61
|
let defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
|
|
58
62
|
if (defaultChannel === LOYALTY) {
|
|
59
63
|
defaultChannel = 'sms';
|
|
@@ -222,6 +226,23 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
|
|
229
|
+
componentDidUpdate(prevProps) {
|
|
230
|
+
if (
|
|
231
|
+
isMFEMode() &&
|
|
232
|
+
!this.lcpReported &&
|
|
233
|
+
!this.props.Templates.getAllTemplatesInProgress &&
|
|
234
|
+
prevProps.Templates.getAllTemplatesInProgress
|
|
235
|
+
) {
|
|
236
|
+
this.lcpReported = true;
|
|
237
|
+
MFEEventBus.emit('mfe:segment', {
|
|
238
|
+
action: 'stop',
|
|
239
|
+
appId: appConfig.appName,
|
|
240
|
+
type: 'lcp',
|
|
241
|
+
timestamp: performance.now(),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
225
246
|
componentWillReceiveProps(nextProps) {
|
|
226
247
|
if (this.props.channel !== nextProps.channel) {
|
|
227
248
|
const panes = this.setChannelContent(nextProps.channel, this.state.panes);
|
|
@@ -422,14 +443,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
422
443
|
/>
|
|
423
444
|
)}
|
|
424
445
|
<section className="component-wrapper">
|
|
425
|
-
{isFullMode && (
|
|
426
|
-
<CapHeader
|
|
427
|
-
title={<FormattedMessage {...messages.creatives} />}
|
|
428
|
-
{...(!useLocalTemplates && {
|
|
429
|
-
description: <FormattedMessage {...messages.creativesDesc} />,
|
|
430
|
-
})}
|
|
431
|
-
/>
|
|
432
|
-
)}
|
|
433
446
|
{hideChannelTabsForLocalSms ? (
|
|
434
447
|
<section className="templates-v2-local-sms-pane">{activeLocalPane?.content}</section>
|
|
435
448
|
) : (
|
|
@@ -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 = [
|