@capillarytech/creatives-library 9.0.35 → 9.0.36-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/package.json +1 -1
- package/translations/en.json +2 -2
- package/utils/permissions.js +59 -0
- package/utils/tests/permissions.test.js +116 -0
- package/v2Components/AccessForbidden/_accessForbidden.scss +14 -0
- package/v2Components/AccessForbidden/index.js +5 -3
- package/v2Components/AccessForbidden/messages.js +3 -2
- 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/NoPermissionWrapper/_noPermissionWrapper.scss +12 -0
- package/v2Components/NoPermissionWrapper/index.js +26 -0
- package/v2Containers/App/constants.js +5 -0
- package/v2Containers/Assets/Gallery/_gallery.scss +6 -0
- package/v2Containers/Assets/Gallery/index.js +34 -10
- package/v2Containers/Cap/index.js +5 -2
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +6 -6
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +32 -32
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +36 -36
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +118 -118
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
- package/v2Containers/Templates/ChannelTypeIllustration.js +13 -2
- package/v2Containers/Templates/_templates.scss +201 -0
- package/v2Containers/Templates/index.js +244 -110
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +1 -1
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +174 -121
- package/v2Containers/TemplatesV2/index.js +16 -5
- 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/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
|
@@ -200,6 +200,370 @@ describe('ViberPreviewContent', () => {
|
|
|
200
200
|
|
|
201
201
|
expect(screen.getByText('Click Here')).toBeTruthy();
|
|
202
202
|
});
|
|
203
|
+
|
|
204
|
+
it('should not render button when buttonText has only whitespace', () => {
|
|
205
|
+
const props = {
|
|
206
|
+
...defaultProps,
|
|
207
|
+
content: {
|
|
208
|
+
viberPreviewContent: {
|
|
209
|
+
messageContent: 'Message',
|
|
210
|
+
buttonText: ' ',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const { container } = render(
|
|
216
|
+
<TestWrapper>
|
|
217
|
+
<ComponentToRender {...props} />
|
|
218
|
+
</TestWrapper>
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
expect(container.querySelector('.viber-button-base')).toBeFalsy();
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe('Carousel Content', () => {
|
|
226
|
+
it('should render no content when carousel is selected but cards are empty', () => {
|
|
227
|
+
const props = {
|
|
228
|
+
...defaultProps,
|
|
229
|
+
content: {
|
|
230
|
+
viberPreviewContent: {
|
|
231
|
+
type: 'CAROUSEL',
|
|
232
|
+
cards: [
|
|
233
|
+
{
|
|
234
|
+
text: '',
|
|
235
|
+
mediaUrl: '',
|
|
236
|
+
buttons: [
|
|
237
|
+
{ title: '', action: '' },
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
text: ' ',
|
|
242
|
+
mediaUrl: ' ',
|
|
243
|
+
buttons: [
|
|
244
|
+
{ title: ' ', action: 'https://example.com/2' },
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
render(
|
|
253
|
+
<TestWrapper>
|
|
254
|
+
<ComponentToRender {...props} />
|
|
255
|
+
</TestWrapper>
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
expect(screen.getByText('No content available')).toBeTruthy();
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('should render carousel cards when type is CAROUSEL', () => {
|
|
262
|
+
const props = {
|
|
263
|
+
...defaultProps,
|
|
264
|
+
content: {
|
|
265
|
+
viberPreviewContent: {
|
|
266
|
+
type: 'CAROUSEL',
|
|
267
|
+
cards: [
|
|
268
|
+
{
|
|
269
|
+
text: 'Card 1 text',
|
|
270
|
+
mediaUrl: 'https://image.url/card1.jpg',
|
|
271
|
+
buttons: [
|
|
272
|
+
{ title: 'Button 1', action: 'https://example.com/1' },
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
text: 'Card 2 text',
|
|
277
|
+
mediaUrl: 'https://image.url/card2.jpg',
|
|
278
|
+
buttons: [
|
|
279
|
+
{ title: 'Button 2', action: 'https://example.com/2' },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
render(
|
|
288
|
+
<TestWrapper>
|
|
289
|
+
<ComponentToRender {...props} />
|
|
290
|
+
</TestWrapper>
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
expect(screen.getByText('Card 1 text')).toBeTruthy();
|
|
294
|
+
expect(screen.getByText('Card 2 text')).toBeTruthy();
|
|
295
|
+
expect(screen.getByText('Button 1')).toBeTruthy();
|
|
296
|
+
expect(screen.getByText('Button 2')).toBeTruthy();
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it('should not render empty carousel button placeholder', () => {
|
|
300
|
+
const props = {
|
|
301
|
+
...defaultProps,
|
|
302
|
+
content: {
|
|
303
|
+
viberPreviewContent: {
|
|
304
|
+
type: 'CAROUSEL',
|
|
305
|
+
cards: [
|
|
306
|
+
{
|
|
307
|
+
text: 'Card 1 text',
|
|
308
|
+
mediaUrl: 'https://image.url/card1.jpg',
|
|
309
|
+
buttons: [
|
|
310
|
+
{ title: '', action: 'https://example.com/1' },
|
|
311
|
+
{ title: ' ', action: 'https://example.com/2' },
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const { container } = render(
|
|
320
|
+
<TestWrapper>
|
|
321
|
+
<ComponentToRender {...props} />
|
|
322
|
+
</TestWrapper>
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
expect(container.querySelector('.viber-carousel-preview-button')).toBeNull();
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it('should show carousel shell when showCarouselEditorPreview is true even if cards are empty', () => {
|
|
329
|
+
const props = {
|
|
330
|
+
...defaultProps,
|
|
331
|
+
content: {
|
|
332
|
+
viberPreviewContent: {
|
|
333
|
+
type: 'CAROUSEL',
|
|
334
|
+
showCarouselEditorPreview: true,
|
|
335
|
+
cards: [
|
|
336
|
+
{ text: '', mediaUrl: '', buttons: [{ title: '', action: '' }] },
|
|
337
|
+
{ text: '', mediaUrl: '', buttons: [{ title: '', action: '' }] },
|
|
338
|
+
],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const { container } = render(
|
|
344
|
+
<TestWrapper>
|
|
345
|
+
<ComponentToRender {...props} />
|
|
346
|
+
</TestWrapper>
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
expect(screen.queryByText('No content available')).toBeNull();
|
|
350
|
+
expect(container.querySelector('.viber-carousel-preview-scroll')).toBeTruthy();
|
|
351
|
+
expect(container.querySelector('.viber-carousel-message-box-placeholder')).toBeTruthy();
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it('should render carousel message text in message box when type is CAROUSEL', () => {
|
|
355
|
+
const props = {
|
|
356
|
+
...defaultProps,
|
|
357
|
+
content: {
|
|
358
|
+
viberPreviewContent: {
|
|
359
|
+
type: 'CAROUSEL',
|
|
360
|
+
messageContent: 'Carousel intro copy',
|
|
361
|
+
cards: [
|
|
362
|
+
{
|
|
363
|
+
text: 'Card text',
|
|
364
|
+
mediaUrl: 'https://image.url/c.jpg',
|
|
365
|
+
buttons: [{ title: 'Go', action: 'https://example.com' }],
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const { container } = render(
|
|
373
|
+
<TestWrapper>
|
|
374
|
+
<ComponentToRender {...props} />
|
|
375
|
+
</TestWrapper>
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
expect(container.querySelector('.viber-carousel-message-box-text')).toHaveTextContent('Carousel intro copy');
|
|
379
|
+
expect(screen.queryByText('Carousel intro copy')).toBeTruthy();
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('should hide account icon when carousel is shown', () => {
|
|
383
|
+
const props = {
|
|
384
|
+
...defaultProps,
|
|
385
|
+
content: {
|
|
386
|
+
viberPreviewContent: {
|
|
387
|
+
type: 'CAROUSEL',
|
|
388
|
+
cards: [
|
|
389
|
+
{
|
|
390
|
+
text: 'Carousel card line',
|
|
391
|
+
mediaUrl: '',
|
|
392
|
+
buttons: [{ title: 'Open link', action: 'https://x.com' }],
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
const { container } = render(
|
|
400
|
+
<TestWrapper>
|
|
401
|
+
<ComponentToRender {...props} />
|
|
402
|
+
</TestWrapper>
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
expect(container.querySelector('.viber-account-icon')).toBeNull();
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('should use image placeholder when carousel card mediaUrl is whitespace only', () => {
|
|
409
|
+
const props = {
|
|
410
|
+
...defaultProps,
|
|
411
|
+
content: {
|
|
412
|
+
viberPreviewContent: {
|
|
413
|
+
type: 'CAROUSEL',
|
|
414
|
+
cards: [
|
|
415
|
+
{
|
|
416
|
+
text: 'Only text',
|
|
417
|
+
mediaUrl: ' ',
|
|
418
|
+
buttons: [{ title: 'Btn', action: 'https://example.com' }],
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const { container } = render(
|
|
426
|
+
<TestWrapper>
|
|
427
|
+
<ComponentToRender {...props} />
|
|
428
|
+
</TestWrapper>
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
expect(container.querySelector('.viber-carousel-preview-image-placeholder')).toBeTruthy();
|
|
432
|
+
expect(container.querySelector('.viber-carousel-preview-image')).toBeNull();
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it('should render at most two carousel buttons per card', () => {
|
|
436
|
+
const props = {
|
|
437
|
+
...defaultProps,
|
|
438
|
+
content: {
|
|
439
|
+
viberPreviewContent: {
|
|
440
|
+
type: 'CAROUSEL',
|
|
441
|
+
cards: [
|
|
442
|
+
{
|
|
443
|
+
text: 'Card',
|
|
444
|
+
mediaUrl: 'https://image.url/c.jpg',
|
|
445
|
+
buttons: [
|
|
446
|
+
{ title: 'One', action: 'https://a.com' },
|
|
447
|
+
{ title: 'Two', action: 'https://b.com' },
|
|
448
|
+
{ title: 'Three', action: 'https://c.com' },
|
|
449
|
+
],
|
|
450
|
+
},
|
|
451
|
+
],
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
const { container } = render(
|
|
457
|
+
<TestWrapper>
|
|
458
|
+
<ComponentToRender {...props} />
|
|
459
|
+
</TestWrapper>
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
expect(container.querySelectorAll('.viber-carousel-preview-button')).toHaveLength(2);
|
|
463
|
+
expect(screen.getByText('One')).toBeTruthy();
|
|
464
|
+
expect(screen.getByText('Two')).toBeTruthy();
|
|
465
|
+
expect(screen.queryByText('Three')).toBeNull();
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
it('should apply secondary class to second carousel button', () => {
|
|
469
|
+
const props = {
|
|
470
|
+
...defaultProps,
|
|
471
|
+
content: {
|
|
472
|
+
viberPreviewContent: {
|
|
473
|
+
type: 'CAROUSEL',
|
|
474
|
+
cards: [
|
|
475
|
+
{
|
|
476
|
+
text: 'Card',
|
|
477
|
+
mediaUrl: 'https://image.url/c.jpg',
|
|
478
|
+
buttons: [
|
|
479
|
+
{ title: 'Primary', action: 'https://a.com' },
|
|
480
|
+
{ title: 'Secondary', action: 'https://b.com' },
|
|
481
|
+
],
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
const { container } = render(
|
|
489
|
+
<TestWrapper>
|
|
490
|
+
<ComponentToRender {...props} />
|
|
491
|
+
</TestWrapper>
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
const buttons = container.querySelectorAll('.viber-carousel-preview-button');
|
|
495
|
+
expect(buttons[0].className).toContain('viber-carousel-preview-button');
|
|
496
|
+
expect(buttons[0].className).not.toContain('viber-carousel-preview-button-secondary');
|
|
497
|
+
expect(buttons[1].className).toContain('viber-carousel-preview-button-secondary');
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
it('should show carousel when only a button title is present on a card', () => {
|
|
501
|
+
const props = {
|
|
502
|
+
...defaultProps,
|
|
503
|
+
content: {
|
|
504
|
+
viberPreviewContent: {
|
|
505
|
+
type: 'CAROUSEL',
|
|
506
|
+
cards: [
|
|
507
|
+
{
|
|
508
|
+
text: '',
|
|
509
|
+
mediaUrl: '',
|
|
510
|
+
buttons: [{ title: 'Tap me', action: 'https://example.com' }],
|
|
511
|
+
},
|
|
512
|
+
],
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
render(
|
|
518
|
+
<TestWrapper>
|
|
519
|
+
<ComponentToRender {...props} />
|
|
520
|
+
</TestWrapper>
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
expect(screen.getByText('Tap me')).toBeTruthy();
|
|
524
|
+
expect(screen.queryByText('No content available')).toBeNull();
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('should show one placeholder card when editor preview and cards array is empty', () => {
|
|
528
|
+
const props = {
|
|
529
|
+
...defaultProps,
|
|
530
|
+
content: {
|
|
531
|
+
viberPreviewContent: {
|
|
532
|
+
type: 'CAROUSEL',
|
|
533
|
+
showCarouselEditorPreview: true,
|
|
534
|
+
cards: [],
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
const { container } = render(
|
|
540
|
+
<TestWrapper>
|
|
541
|
+
<ComponentToRender {...props} />
|
|
542
|
+
</TestWrapper>
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
expect(container.querySelectorAll('.viber-carousel-preview-card')).toHaveLength(1);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('should show no content when CAROUSEL has empty cards and no editor preview flag', () => {
|
|
549
|
+
const props = {
|
|
550
|
+
...defaultProps,
|
|
551
|
+
content: {
|
|
552
|
+
viberPreviewContent: {
|
|
553
|
+
type: 'CAROUSEL',
|
|
554
|
+
cards: [],
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
render(
|
|
560
|
+
<TestWrapper>
|
|
561
|
+
<ComponentToRender {...props} />
|
|
562
|
+
</TestWrapper>
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
expect(screen.getByText('No content available')).toBeTruthy();
|
|
566
|
+
});
|
|
203
567
|
});
|
|
204
568
|
|
|
205
569
|
describe('Account and Brand Name', () => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Dim + block interaction for a control the user lacks permission for.
|
|
2
|
+
// The wrapper keeps pointer events (so the CapTooltip still shows on hover) while the
|
|
3
|
+
// inner control is dimmed and non-interactive.
|
|
4
|
+
.rbac-no-permission {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
cursor: not-allowed;
|
|
7
|
+
|
|
8
|
+
> * {
|
|
9
|
+
opacity: 0.4;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
4
|
+
import globalMessages from '../../v2Containers/Cap/messages';
|
|
5
|
+
import './_noPermissionWrapper.scss';
|
|
6
|
+
|
|
7
|
+
// Wraps a single control and, when the user is not `allowed`, dims it + blocks
|
|
8
|
+
// interaction (via CSS) and shows a permission tooltip on hover. Uses CapTooltip
|
|
9
|
+
// instead of hand-rolled positioning/portals.
|
|
10
|
+
const NoPermissionWrapper = ({ allowed, children, message }) => {
|
|
11
|
+
const child = React.Children.only(children);
|
|
12
|
+
|
|
13
|
+
if (allowed || child.props.disabled) {
|
|
14
|
+
return child;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<CapTooltip
|
|
19
|
+
title={message || <FormattedMessage {...globalMessages.noPermissionAction} />}
|
|
20
|
+
>
|
|
21
|
+
<span className="rbac-no-permission">{child}</span>
|
|
22
|
+
</CapTooltip>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default NoPermissionWrapper;
|
|
@@ -97,6 +97,11 @@ export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
|
97
97
|
export const NO_COMMUNICATION = 'NO_COMMUNICATION';
|
|
98
98
|
export const FTP = 'FTP';
|
|
99
99
|
export const CREATIVES_UI_VIEW = 'CREATIVES_UI_VIEW';
|
|
100
|
+
// VAPT RBAC granular Creatives permissions (module creatives/ui)
|
|
101
|
+
export const CREATIVE_VIEW = 'CREATIVE_VIEW';
|
|
102
|
+
export const CREATIVE_CREATE = 'CREATIVE_CREATE';
|
|
103
|
+
export const CREATIVE_EDIT = 'CREATIVE_EDIT';
|
|
104
|
+
export const CREATIVE_DELETE = 'CREATIVE_DELETE';
|
|
100
105
|
|
|
101
106
|
export const APPLY_NOW = <FormattedMessage {...globalMessages.applyNow} />;
|
|
102
107
|
export const NO_CALL_TO_ACTION = <FormattedMessage {...globalMessages.noCallToAction} />;
|
|
@@ -13,10 +13,12 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import moment from "moment";
|
|
15
15
|
import _ from "lodash";
|
|
16
|
-
import { CapHeading, CapHeader, CapInput, CapButton, CapIcon, CapDropdown, CapMenu, CapCustomCard, CapSlideBox, CapLabel, CapIllustration, CapNotification,} from '@capillarytech/cap-ui-library';
|
|
16
|
+
import { CapHeading, CapHeader, CapInput, CapButton, CapIcon, CapDropdown, CapMenu, CapCustomCard, CapSlideBox, CapLabel, CapIllustration, CapNotification, CapTooltip,} from '@capillarytech/cap-ui-library';
|
|
17
|
+
import NoPermissionWrapper from '../../../v2Components/NoPermissionWrapper';
|
|
17
18
|
import { Popover } from 'antd';
|
|
18
19
|
import makeSelectGallery from './selectors';
|
|
19
20
|
import messages from './messages';
|
|
21
|
+
import globalMessages from '../../Cap/messages';
|
|
20
22
|
import * as actions from './actions';
|
|
21
23
|
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
22
24
|
import * as globalActions from '../../Cap/actions';
|
|
@@ -307,9 +309,18 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
307
309
|
<div className="more-icon-wrapper">
|
|
308
310
|
<Popover
|
|
309
311
|
placement="leftTop"
|
|
310
|
-
content={<div
|
|
311
|
-
<
|
|
312
|
-
|
|
312
|
+
content={<div>
|
|
313
|
+
<p
|
|
314
|
+
className={this.props.canDelete === false ? 'rbac-disabled' : ''}
|
|
315
|
+
onClick={() => { if (this.props.canDelete !== false) this.deleteAsset(asset); }}
|
|
316
|
+
>
|
|
317
|
+
{this.props.canDelete === false ? (
|
|
318
|
+
<CapTooltip title={<FormattedMessage {...globalMessages.noPermissionAction} />}><span><FormattedMessage {...messages.delete} /></span></CapTooltip>
|
|
319
|
+
) : (
|
|
320
|
+
<FormattedMessage {...messages.delete} />
|
|
321
|
+
)}
|
|
322
|
+
</p>
|
|
323
|
+
</div>} trigger="click">
|
|
313
324
|
<i className="material-icons creative-icons">more_vert</i>
|
|
314
325
|
</Popover>
|
|
315
326
|
</div>
|
|
@@ -345,8 +356,15 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
345
356
|
<CapDropdown
|
|
346
357
|
overlay={
|
|
347
358
|
<CapMenu>
|
|
348
|
-
<CapMenu.Item
|
|
349
|
-
|
|
359
|
+
<CapMenu.Item
|
|
360
|
+
className={`delete-gallery ${this.props.canDelete === false ? 'rbac-disabled' : ''}`.trim()}
|
|
361
|
+
onClick={() => { if (this.props.canDelete !== false) this.deleteAsset(template); }}
|
|
362
|
+
>
|
|
363
|
+
{this.props.canDelete === false ? (
|
|
364
|
+
<CapTooltip title={<FormattedMessage {...globalMessages.noPermissionAction} />}><span><FormattedMessage {...messages.delete} /></span></CapTooltip>
|
|
365
|
+
) : (
|
|
366
|
+
<FormattedMessage {...messages.delete} />
|
|
367
|
+
)}
|
|
350
368
|
</CapMenu.Item>
|
|
351
369
|
</CapMenu>
|
|
352
370
|
}
|
|
@@ -382,7 +400,11 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
382
400
|
_.isEmpty(templates) &&
|
|
383
401
|
_.isEmpty(searchText) &&
|
|
384
402
|
!searchLoader &&
|
|
385
|
-
<CapIllustration
|
|
403
|
+
<CapIllustration
|
|
404
|
+
{...this.getIllustrationProps}
|
|
405
|
+
disabled={this.props.canCreate === false}
|
|
406
|
+
buttonTooltip={this.props.canCreate === false ? this.props.intl.formatMessage(globalMessages.noPermissionAction) : undefined}
|
|
407
|
+
/>
|
|
386
408
|
)}
|
|
387
409
|
</div>
|
|
388
410
|
}
|
|
@@ -458,9 +480,11 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
|
|
|
458
480
|
<div style={{ textAlign: 'right', marginTop: '16px', width: '50%'}}>
|
|
459
481
|
<form encType="multipart/form-data" id="myForm">
|
|
460
482
|
<input style={{ display: 'none'}} id="fileName" type="file" onClick={(e) => {e.target.value=null}} onChange={(e) => this.uploadImages(e, {files: e.target.files})} accept="image/*" multiple/>
|
|
461
|
-
<
|
|
462
|
-
<
|
|
463
|
-
|
|
483
|
+
<NoPermissionWrapper allowed={this.props.canCreate !== false}>
|
|
484
|
+
<CapButton className="upload-image-gallery" type={this.props.location.query.type !== 'embedded' ? 'primary' : 'secondary'} onClick={(e) => this.openFileDialog(e)} style={{float: 'right'}}>
|
|
485
|
+
<FormattedMessage {...messages.upload} />
|
|
486
|
+
</CapButton>
|
|
487
|
+
</NoPermissionWrapper>
|
|
464
488
|
</form>
|
|
465
489
|
</div>
|
|
466
490
|
)
|
|
@@ -19,7 +19,7 @@ import * as appActions from '../App/actions';
|
|
|
19
19
|
import config from '../../config/app';
|
|
20
20
|
import NavigationBar from '../../v2Components/NavigationBar';
|
|
21
21
|
import { engagePlusPublicPath, publicPath } from '../../config/path';
|
|
22
|
-
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW, FAILURE } from '../App/constants';
|
|
22
|
+
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW, CREATIVE_VIEW, FAILURE } from '../App/constants';
|
|
23
23
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
24
24
|
import CapSupportVideosWrapper from '@capillarytech/cap-ui-library/CapSupportVideosWrapper';
|
|
25
25
|
import { replaceDynamicAndCompare } from '@capillarytech/cap-ui-library/CapSupportVideosWrapper/utils';
|
|
@@ -115,7 +115,10 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
115
115
|
const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
116
116
|
this.props.actions.getUserData((userData, currentOrgDetails = {}) => { //taking currentOrgDetails as we are not getting this data in this.props.Global props.
|
|
117
117
|
const { accessibleFeatures = [] } = currentOrgDetails;
|
|
118
|
-
if (
|
|
118
|
+
if (
|
|
119
|
+
!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW) &&
|
|
120
|
+
!userData.accessiblePermissions.includes(CREATIVE_VIEW)
|
|
121
|
+
) {
|
|
119
122
|
this.setState({ isCreativesAccessible: false });
|
|
120
123
|
}
|
|
121
124
|
const userGtmData = this.getUserGtmData();
|
|
@@ -209,5 +209,9 @@ export default defineMessages({
|
|
|
209
209
|
id: 'creatives.componentsV2.autofill',
|
|
210
210
|
defaultMessage: 'Autofill',
|
|
211
211
|
},
|
|
212
|
+
noPermissionAction: {
|
|
213
|
+
id: 'creatives.componentsV2.noPermissionAction',
|
|
214
|
+
defaultMessage: "You don't have permission to perform this action.",
|
|
215
|
+
},
|
|
212
216
|
});
|
|
213
217
|
|
|
@@ -141,8 +141,8 @@ exports[`<Cap /> should render correct component 1`] = `
|
|
|
141
141
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
142
142
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
143
143
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
144
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
145
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
144
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
145
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
146
146
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
147
147
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
148
148
|
"creatives.components.CapTagList.Ok": "Ok",
|
|
@@ -87,8 +87,8 @@ exports[`Creatives line image carousel test/> should render 1`] = `
|
|
|
87
87
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
88
88
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
89
89
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
90
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
91
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
90
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
91
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
92
92
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
93
93
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
94
94
|
"creatives.components.CapTagList.Ok": "Ok",
|
|
@@ -4228,8 +4228,8 @@ exports[`Creatives line image carousel test/> should render 2`] = `
|
|
|
4228
4228
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
4229
4229
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
4230
4230
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
4231
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
4232
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
4231
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
4232
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
4233
4233
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
4234
4234
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
4235
4235
|
"creatives.components.CapTagList.Ok": "Ok",
|
|
@@ -8508,8 +8508,8 @@ exports[`Creatives line image carousel test/> should render 3`] = `
|
|
|
8508
8508
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
8509
8509
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
8510
8510
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
8511
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
8512
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
8511
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
8512
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
8513
8513
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
8514
8514
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
8515
8515
|
"creatives.components.CapTagList.Ok": "Ok",
|
|
@@ -87,8 +87,8 @@ exports[`line wrapper test/> should render line component new 1`] = `
|
|
|
87
87
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
88
88
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
89
89
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
90
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
91
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
90
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
91
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
92
92
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
93
93
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
94
94
|
"creatives.components.CapTagList.Ok": "Ok",
|
|
@@ -15138,8 +15138,8 @@ exports[`line wrapper test/> should render line component old 1`] = `
|
|
|
15138
15138
|
"app.v2containers.SmsTrai.Edit.traiEditTitle": "Message",
|
|
15139
15139
|
"app.v2containers.SmsTrai.Edit.unicodeLabel": "Allow unicode characters",
|
|
15140
15140
|
"app.v2containers.SmsTrai.Edit.unsupportedTagsValidationError": "Unsupported tags: {unsupportedTags}. Please remove them from this message.",
|
|
15141
|
-
"creatives.components.AccessForbidden.forbiddenDesc": "
|
|
15142
|
-
"creatives.components.AccessForbidden.forbiddenHeader": "
|
|
15141
|
+
"creatives.components.AccessForbidden.forbiddenDesc": "Please contact your organisation administrator to request access.",
|
|
15142
|
+
"creatives.components.AccessForbidden.forbiddenHeader": "You don't have permission to view this page.",
|
|
15143
15143
|
"creatives.components.BreadCrumbs.header": "This is the BreadCrumbs component !",
|
|
15144
15144
|
"creatives.components.CapTagList.Cancel": "Cancel",
|
|
15145
15145
|
"creatives.components.CapTagList.Ok": "Ok",
|