@capillarytech/creatives-library 9.0.36 → 9.0.37-alpha.0
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/translations/en.json +2 -2
- 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/utils/permissions.js +59 -0
- package/utils/rcsPayloadUtils.js +5 -2
- package/utils/tests/permissions.test.js +116 -0
- package/utils/tests/rcsPayloadUtils.test.js +54 -2
- package/v2Components/AccessForbidden/_accessForbidden.scss +14 -0
- package/v2Components/AccessForbidden/index.js +5 -3
- package/v2Components/AccessForbidden/messages.js +3 -2
- package/v2Components/CapActionButton/constants.js +1 -0
- package/v2Components/CapActionButton/index.js +77 -9
- package/v2Components/CapActionButton/index.scss +13 -0
- package/v2Components/CapActionButton/messages.js +13 -0
- package/v2Components/CapActionButton/tests/index.test.js +32 -1
- package/v2Components/CommonTestAndPreview/index.js +44 -15
- package/v2Components/CommonTestAndPreview/tests/index.test.js +78 -0
- package/v2Components/CommonTestAndPreview/utils.js +34 -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/v2Components/NoPermissionWrapper/_noPermissionWrapper.scss +12 -0
- package/v2Components/NoPermissionWrapper/index.js +26 -0
- package/v2Components/SmsFallback/index.js +6 -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/constants.js +1 -0
- package/v2Containers/Cap/index.js +62 -29
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/CreativesContainer/index.js +11 -8
- package/v2Containers/CreativesContainer/tests/index.test.js +53 -0
- 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/components/CarouselCard.js +5 -0
- package/v2Containers/Rcs/components/CarouselCardButtons.js +20 -0
- package/v2Containers/Rcs/index.js +154 -79
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +55 -4
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +404 -118
- package/v2Containers/Rcs/tests/carouselUtils.test.js +13 -17
- package/v2Containers/Rcs/tests/index.test.js +141 -6
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +110 -0
- package/v2Containers/Rcs/tests/utils.test.js +36 -0
- package/v2Containers/Rcs/utils.js +16 -4
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/SmsTrai/Edit/index.js +35 -24
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +18 -18
- package/v2Containers/Templates/ChannelTypeIllustration.js +10 -1
- package/v2Containers/Templates/_templates.scss +7 -1
- package/v2Containers/Templates/index.js +141 -99
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +7 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +173 -115
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +8 -3
- package/v2Containers/TemplatesV2/index.js +38 -14
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +268 -268
|
@@ -3,7 +3,7 @@ import { injectIntl } from 'react-intl';
|
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
import cloneDeep from 'lodash/cloneDeep';
|
|
5
5
|
import { BrowserRouter as Router } from 'react-router-dom';
|
|
6
|
-
import { render, screen } from '../../../utils/test-utils';
|
|
6
|
+
import { render, screen, waitFor } from '../../../utils/test-utils';
|
|
7
7
|
|
|
8
8
|
import { NavigationBar } from '../index';
|
|
9
9
|
import * as mockdata from './mockData';
|
|
@@ -30,7 +30,7 @@ const renderComponent = (props) => {
|
|
|
30
30
|
describe('NavigationBar', () => {
|
|
31
31
|
const props = {
|
|
32
32
|
topbarMenuData: [{}],
|
|
33
|
-
history
|
|
33
|
+
history,
|
|
34
34
|
userData,
|
|
35
35
|
loggedIn: true,
|
|
36
36
|
isCreativesAccessible: true,
|
|
@@ -42,52 +42,72 @@ describe('NavigationBar', () => {
|
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
// CapNavigationSPA shows a loader overlay until its internal
|
|
46
|
+
// getNavigationConfigApi call settles, so nav content (icons, dividers,
|
|
47
|
+
// product labels) only mounts after that resolves — queries must wait for it.
|
|
48
|
+
|
|
49
|
+
// cap-ui-library's CapNavigationSPA bump changed how `topbarIcons` is
|
|
50
|
+
// consumed: it's now only read to find a `question-circle` icon's click
|
|
51
|
+
// handler for the built-in Help button. Custom icon entries (the "aira"
|
|
52
|
+
// doc-bot icon NavigationBar pushes via getTopbarIcons) are no longer
|
|
53
|
+
// rendered at all, so this feature no longer has any DOM to assert on.
|
|
54
|
+
it.skip('Show aria documentation bot icon if showDocumentationBot is true', async () => {
|
|
46
55
|
renderComponent(props);
|
|
47
|
-
const ariaBotIcon = screen.
|
|
56
|
+
const ariaBotIcon = await screen.findByLabelText('open-aira');
|
|
48
57
|
expect(ariaBotIcon).toBeInTheDocument();
|
|
49
58
|
});
|
|
50
59
|
|
|
51
|
-
it('Should not show aria documentation bot icon if showDocumentationBot is false', () => {
|
|
60
|
+
it('Should not show aria documentation bot icon if showDocumentationBot is false', async () => {
|
|
52
61
|
const updatedProps = cloneDeep(props);
|
|
53
62
|
delete updatedProps.userData.currentOrgDetails.accessibleFeatures;
|
|
54
63
|
renderComponent(updatedProps);
|
|
64
|
+
await screen.findByLabelText('Help');
|
|
55
65
|
const ariaBotIcon = screen.queryByLabelText('open-aira');
|
|
56
|
-
expect(ariaBotIcon).toBeInTheDocument();
|
|
66
|
+
expect(ariaBotIcon).not.toBeInTheDocument();
|
|
57
67
|
});
|
|
58
|
-
|
|
59
|
-
it('Should contains top vertical', () => {
|
|
68
|
+
|
|
69
|
+
it('Should contains top vertical', async () => {
|
|
60
70
|
const updatedProps = {...props} ;
|
|
61
71
|
delete updatedProps.userData.currentOrgDetails.accessibleFeatures;
|
|
62
72
|
renderComponent(updatedProps);
|
|
63
|
-
// cap-ui-library v6 renders the vertical divider with `.cap-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
// cap-ui-library v6 renders the vertical divider with `.cap-navigation-spa-topbar__divider`
|
|
74
|
+
await waitFor(() => {
|
|
75
|
+
expect(document.querySelector('.cap-navigation-spa-topbar__divider')).toBeInTheDocument();
|
|
76
|
+
});
|
|
66
77
|
});
|
|
67
|
-
|
|
78
|
+
|
|
79
|
+
// `selectedProduct` only renders (via CapSecondaryTopBar) when
|
|
80
|
+
// `showSecondaryTopBar` is passed — NavigationBar never passes it, so the
|
|
81
|
+
// "Loyalty+" label has no DOM to assert on under current props.
|
|
82
|
+
it.skip('Should have loyalty product selected', async () => {
|
|
68
83
|
const updatedProps = {...props};
|
|
69
84
|
updatedProps.location.pathname = '/creatives/ui/v2/loyalty';
|
|
70
85
|
renderComponent(updatedProps);
|
|
71
|
-
const loyaltyProduct = screen.
|
|
86
|
+
const loyaltyProduct = await screen.findByText('Loyalty+');
|
|
72
87
|
expect(loyaltyProduct).toBeInTheDocument();
|
|
73
88
|
});
|
|
74
89
|
|
|
75
90
|
// Regression: AntD v3 -> v6 migration (CAP-183930) dropped the settings (gear)
|
|
76
91
|
// icon from the top nav. These tests ensure the gear keeps rendering.
|
|
77
|
-
it('Should render the settings (gear) icon in the top nav bar', () => {
|
|
92
|
+
it('Should render the settings (gear) icon in the top nav bar', async () => {
|
|
78
93
|
const updatedProps = cloneDeep(props);
|
|
79
94
|
updatedProps.location.pathname = '/creatives/ui/v2';
|
|
80
95
|
updatedProps.settingsUrl = '/campaigns/ui/creatives/settings/message';
|
|
81
96
|
renderComponent(updatedProps);
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
await waitFor(() => {
|
|
98
|
+
expect(document.querySelector('.cap-icon-v2-settings')).toBeInTheDocument();
|
|
99
|
+
});
|
|
84
100
|
});
|
|
85
101
|
|
|
86
|
-
|
|
102
|
+
// Same `topbarIcons` regression as the aira icon above: the custom settings
|
|
103
|
+
// icon config (with className `navigation-setting-icon`) NavigationBar
|
|
104
|
+
// builds for the loyalty route is never rendered by the current library.
|
|
105
|
+
it.skip('Should render the settings (gear) icon for the loyalty product', async () => {
|
|
87
106
|
const updatedProps = cloneDeep(props);
|
|
88
107
|
updatedProps.location.pathname = '/creatives/ui/v2/loyalty';
|
|
89
108
|
renderComponent(updatedProps);
|
|
90
|
-
|
|
91
|
-
|
|
109
|
+
await waitFor(() => {
|
|
110
|
+
expect(document.querySelector('.cap-icon-v2-settings.navigation-setting-icon')).toBeInTheDocument();
|
|
111
|
+
});
|
|
92
112
|
});
|
|
93
113
|
});
|
|
@@ -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;
|
|
@@ -747,11 +747,17 @@ export function SmsFallback({
|
|
|
747
747
|
const base = uploadedTemplate.versions?.base || {};
|
|
748
748
|
const content = base.template_message || base['sms-editor'] || '';
|
|
749
749
|
const templateName = uploadedTemplate.name || base.template_name || '';
|
|
750
|
+
// DLT-registered sender IDs for this newly-created template — same field
|
|
751
|
+
// buildFallbackDataFromTemplate reads. Without it, Test & Preview's delivery-settings
|
|
752
|
+
// filter sees an empty registeredSenderIds and falls back to showing every sender.
|
|
753
|
+
const registeredSenderIds = Array.isArray(base.header) ? base.header : [];
|
|
750
754
|
if (content || templateName) {
|
|
751
755
|
onChange({
|
|
756
|
+
smsTemplateId: base.template_id || uploadedTemplate._id || '',
|
|
752
757
|
templateName,
|
|
753
758
|
content,
|
|
754
759
|
templateContent: content,
|
|
760
|
+
registeredSenderIds,
|
|
755
761
|
unicodeValidity: typeof base['unicode-validity'] === JS_TYPE_BOOLEAN
|
|
756
762
|
? base['unicode-validity']
|
|
757
763
|
: true,
|
|
@@ -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
|
)
|
|
@@ -56,6 +56,7 @@ export const SUCCESS = 'SUCCESS';
|
|
|
56
56
|
export const FAILURE = 'FAILURE';
|
|
57
57
|
|
|
58
58
|
export const ENABLE_PRODUCT_SUPPORT_VIDEOS = 'ENABLE_PRODUCT_SUPPORT_VIDEOS';
|
|
59
|
+
export const ENABLE_NEW_LEFT_NAVIGATION = 'ENABLE_NEW_LEFT_NAVIGATION';
|
|
59
60
|
export const DEFAULT = 'default';
|
|
60
61
|
export const DEFAULT_MODULE = 'creatives';
|
|
61
62
|
|
|
@@ -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';
|
|
@@ -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
|
|
|
@@ -112,18 +115,25 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
112
115
|
const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
113
116
|
this.props.actions.getUserData((userData, currentOrgDetails = {}) => { //taking currentOrgDetails as we are not getting this data in this.props.Global props.
|
|
114
117
|
const { accessibleFeatures = [] } = currentOrgDetails;
|
|
115
|
-
if (
|
|
118
|
+
if (
|
|
119
|
+
!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW) &&
|
|
120
|
+
!userData.accessiblePermissions.includes(CREATIVE_VIEW)
|
|
121
|
+
) {
|
|
116
122
|
this.setState({ isCreativesAccessible: false });
|
|
117
123
|
}
|
|
118
124
|
const userGtmData = this.getUserGtmData();
|
|
119
125
|
this.setDimensionData(userGtmData);
|
|
120
126
|
gtm.push({ ...userGtmData, event: 'userAuthenticated' });
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
// In MFE mode the host already initialized auth (window.capAuth is set with
|
|
128
|
+
// the full superset); skip so we don't clobber it with the basic shape.
|
|
129
|
+
if (!window.capAuth) {
|
|
130
|
+
Auth.initialize({
|
|
131
|
+
permissions: userData.accessiblePermissions,
|
|
132
|
+
isCapUser: userData.isCapUser,
|
|
133
|
+
roles: Object.keys(userData.accessRoles),
|
|
134
|
+
accessibleFeatures,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
127
137
|
});
|
|
128
138
|
this.props.actions.getTopbarMenuData(parentModule);
|
|
129
139
|
if (this.props.Global.orgID !== undefined) {
|
|
@@ -500,6 +510,8 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
500
510
|
const type = this.props.location.query.type;
|
|
501
511
|
const toastMessages = this.props.Global.messages;
|
|
502
512
|
const { isCreativesAccessible, showOrgChangeModal, showRefreshModal } = this.state;
|
|
513
|
+
const { accessibleFeatures = [] } = currentOrgDetails;
|
|
514
|
+
const isLatestLeftNavigationEnabled = accessibleFeatures.includes(ENABLE_NEW_LEFT_NAVIGATION);
|
|
503
515
|
return (
|
|
504
516
|
<CapWrapper>
|
|
505
517
|
{ this.props.loader.localeLoading || this.props.Global.fetching_userdata ?
|
|
@@ -537,26 +549,47 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
537
549
|
campaignOrgV2Status={currentOrgDetails.org_campaign_v2_status}
|
|
538
550
|
handleLeftNavBarExpanded={this.handleLeftNavBarExpanded}
|
|
539
551
|
leftNavbarExpandedProp={this.state.leftNavbarExpanded}
|
|
540
|
-
/>) : ''}
|
|
541
|
-
<MainWrapper className="main">
|
|
542
552
|
|
|
543
|
-
<ContentWrapper
|
|
544
|
-
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
545
|
-
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
546
553
|
>
|
|
547
|
-
<
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
554
|
+
<MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
|
|
555
|
+
<ContentWrapper
|
|
556
|
+
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
557
|
+
isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
|
|
558
|
+
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
559
|
+
>
|
|
560
|
+
<Switch>
|
|
561
|
+
{componentRoutes.map(routeProps => {
|
|
562
|
+
return (
|
|
563
|
+
<RenderRoute
|
|
564
|
+
{...routeProps}
|
|
565
|
+
key={routeProps.path}
|
|
566
|
+
isLoggedIn={isLoggedIn}
|
|
567
|
+
/>
|
|
568
|
+
)}
|
|
569
|
+
)}
|
|
570
|
+
</Switch>
|
|
571
|
+
</ContentWrapper>
|
|
572
|
+
</MainWrapper>
|
|
573
|
+
</NavigationBar>) : (
|
|
574
|
+
<MainWrapper isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled} className="main">
|
|
575
|
+
<ContentWrapper
|
|
576
|
+
className={`main-content ${this.state.leftNavbarExpanded ? "contet-width-collapse" : "content-width-expanded"}`}
|
|
577
|
+
isLatestLeftNavigationEnabled={isLatestLeftNavigationEnabled}
|
|
578
|
+
leftNavbarExpanded={this.state.leftNavbarExpanded}
|
|
579
|
+
>
|
|
580
|
+
<Switch>
|
|
581
|
+
{componentRoutes.map(routeProps => {
|
|
582
|
+
return (
|
|
583
|
+
<RenderRoute
|
|
584
|
+
{...routeProps}
|
|
585
|
+
key={routeProps.path}
|
|
586
|
+
isLoggedIn={isLoggedIn}
|
|
587
|
+
/>
|
|
588
|
+
)}
|
|
555
589
|
)}
|
|
556
|
-
|
|
557
|
-
</
|
|
558
|
-
</
|
|
559
|
-
</MainWrapper>
|
|
590
|
+
</Switch>
|
|
591
|
+
</ContentWrapper>
|
|
592
|
+
</MainWrapper>)}
|
|
560
593
|
</div>
|
|
561
594
|
{(toastMessages && toastMessages.length > 0) &&
|
|
562
595
|
toastMessages.map((message) => {
|
|
@@ -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",
|
|
@@ -90,8 +90,8 @@ import {
|
|
|
90
90
|
import {EXTERNAL_URL, SITE_URL, WEBPUSH_MEDIA_TYPES} from '../WebPush/constants';
|
|
91
91
|
import { IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
92
92
|
import { RCS_STATUSES, contentType as RCS_CONTENT_TYPE, EMBEDDED } from '../Rcs/constants';
|
|
93
|
-
import { mapRcsCardContentForConsumerWithResolvedTags } from '../Rcs/utils';
|
|
94
93
|
import { pickRcsCardVarMappedEntries } from '../Rcs/rcsLibraryHydrationUtils';
|
|
94
|
+
import { mapRcsCardContentForConsumerWithResolvedTags } from '../Rcs/utils';
|
|
95
95
|
import { RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from '../../v2Components/CommonTestAndPreview/constants';
|
|
96
96
|
import { CREATIVE } from '../Facebook/constants';
|
|
97
97
|
import { LOYALTY } from '../App/constants';
|
|
@@ -1442,13 +1442,21 @@ export class Creatives extends React.Component {
|
|
|
1442
1442
|
cardSettings = {},
|
|
1443
1443
|
accountId = "",
|
|
1444
1444
|
} = get(versions, 'base.content.RCS.rcsContent', {});
|
|
1445
|
-
const rootRcsCardVarMappedFromSubmit = get(template, 'value.rcsCardVarMapped');
|
|
1446
1445
|
const firstCardFromSubmit = Array.isArray(cardContentFromSubmit)
|
|
1447
1446
|
? cardContentFromSubmit[0]
|
|
1448
1447
|
: null;
|
|
1448
|
+
const cardVarMappedFromFirstRcsCard =
|
|
1449
|
+
firstCardFromSubmit?.cardVarMapped != null
|
|
1450
|
+
&& typeof firstCardFromSubmit.cardVarMapped === 'object'
|
|
1451
|
+
? pickRcsCardVarMappedEntries(firstCardFromSubmit.cardVarMapped)
|
|
1452
|
+
: null;
|
|
1453
|
+
// Campaigns/consumers should see the literal tag (e.g. `{{first_name}}`) in title/description,
|
|
1454
|
+
// not the internal numeric slot placeholder (`{{1}}`) — that slot scheme is only meaningful
|
|
1455
|
+
// to this editor's own reopen/hydration (see getFormData, which persists raw cardContentFromSubmit
|
|
1456
|
+
// separately for that round-trip and is unaffected by this).
|
|
1449
1457
|
const cardContent = mapRcsCardContentForConsumerWithResolvedTags(
|
|
1450
1458
|
cardContentFromSubmit,
|
|
1451
|
-
|
|
1459
|
+
cardVarMappedFromFirstRcsCard,
|
|
1452
1460
|
isFullModeForRcsConsumerPayload,
|
|
1453
1461
|
);
|
|
1454
1462
|
const rcsContent = {
|
|
@@ -1457,11 +1465,6 @@ export class Creatives extends React.Component {
|
|
|
1457
1465
|
cardSettings,
|
|
1458
1466
|
cardContent,
|
|
1459
1467
|
};
|
|
1460
|
-
const cardVarMappedFromFirstRcsCard =
|
|
1461
|
-
firstCardFromSubmit?.cardVarMapped != null
|
|
1462
|
-
&& typeof firstCardFromSubmit.cardVarMapped === 'object'
|
|
1463
|
-
? pickRcsCardVarMappedEntries(firstCardFromSubmit.cardVarMapped)
|
|
1464
|
-
: null;
|
|
1465
1468
|
const includeRootRcsCardVarMappedOnConsumerPayload =
|
|
1466
1469
|
cardVarMappedFromFirstRcsCard
|
|
1467
1470
|
&& Object.keys(cardVarMappedFromFirstRcsCard).length > 0
|
|
@@ -267,6 +267,59 @@ describe('Test SlideBoxContent container', () => {
|
|
|
267
267
|
expect(instance.state.templateData.rcsCardVarMapped).toEqual(cardVarMapped);
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
+
it('RCS getCreativesData sends the literal tag (not the numeric slot) in title/description to consumers', async () => {
|
|
271
|
+
renderedComponent = shallowWithIntl(
|
|
272
|
+
<Creatives
|
|
273
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
274
|
+
Templates={rcsTemplates}
|
|
275
|
+
channel="RCS"
|
|
276
|
+
slidBoxContent="editTemplate"
|
|
277
|
+
templateData={rcsEditTemplateData}
|
|
278
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
279
|
+
getCreativesData={getCreativesData}
|
|
280
|
+
isFullMode={false}
|
|
281
|
+
templateActions={{
|
|
282
|
+
getCdnTransformationConfig,
|
|
283
|
+
}}
|
|
284
|
+
/>,
|
|
285
|
+
);
|
|
286
|
+
renderedComponent.instance().onEditTemplate();
|
|
287
|
+
|
|
288
|
+
const mockValue = {
|
|
289
|
+
validity: true,
|
|
290
|
+
value: {
|
|
291
|
+
name: 'rcs_creative_name',
|
|
292
|
+
type: 'RCS',
|
|
293
|
+
versions: {
|
|
294
|
+
base: {
|
|
295
|
+
content: {
|
|
296
|
+
RCS: {
|
|
297
|
+
rcsContent: {
|
|
298
|
+
contentType: 'RICHCARD',
|
|
299
|
+
cardType: 'STANDALONE',
|
|
300
|
+
cardSettings: {},
|
|
301
|
+
cardContent: [{
|
|
302
|
+
title: 'Hi {{1}}',
|
|
303
|
+
description: 'Visit {{2}}',
|
|
304
|
+
cardVarMapped: { 1: '{{first_name}}', 2: '{{loyalty_points}}' },
|
|
305
|
+
}],
|
|
306
|
+
},
|
|
307
|
+
smsFallBackContent: {},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
renderedComponent.instance().getFormData(mockValue);
|
|
316
|
+
await tick();
|
|
317
|
+
|
|
318
|
+
const sentCardContent = getCreativesData.mock.calls[0][0].rcsContent.cardContent[0];
|
|
319
|
+
expect(sentCardContent.title).toBe('Hi {{first_name}}');
|
|
320
|
+
expect(sentCardContent.description).toBe('Visit {{loyalty_points}}');
|
|
321
|
+
});
|
|
322
|
+
|
|
270
323
|
it('Text getCreatives data for rcs, data from creatives done to campaigns', async () => {
|
|
271
324
|
renderFunction('SMS', 'editTemplate', smsTemplates, smsEditTemplateData );
|
|
272
325
|
renderedComponent.instance().onEditTemplate();
|
|
@@ -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",
|