@capillarytech/creatives-library 7.9.13 → 7.9.15
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/assets/group.png +0 -0
- package/components/Card/index.js +1 -1
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +19 -7
- package/containers/App/constants.js +2 -1
- package/helpers/intl-enzym-test-helpers.js +40 -0
- package/index.js +6 -0
- package/package.json +3 -2
- package/routes.js +5 -0
- package/services/api.js +9 -15
- package/utils/common.js +17 -4
- package/v2Components/CapTagList/index.js +38 -9
- package/v2Components/CapTagList/messages.js +4 -0
- package/v2Containers/Cap/constants.js +2 -0
- package/v2Containers/Cap/index.js +9 -2
- package/v2Containers/Cap/reducer.js +5 -1
- package/v2Containers/Cap/selectors.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +10 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -1
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/FTP/index.js +14 -4
- package/v2Containers/Sms/Create/index.js +5 -6
- package/v2Containers/Sms/Edit/sagas.js +1 -1
- package/v2Containers/SmsTrai/Create/actions.js +25 -0
- package/v2Containers/SmsTrai/Create/constants.js +74 -0
- package/v2Containers/SmsTrai/Create/index.js +681 -0
- package/v2Containers/SmsTrai/Create/index.scss +92 -0
- package/v2Containers/SmsTrai/Create/messages.js +116 -0
- package/v2Containers/SmsTrai/Create/reducer.js +43 -0
- package/v2Containers/SmsTrai/Create/sagas.js +36 -0
- package/v2Containers/SmsTrai/Create/selectors.js +26 -0
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +10351 -0
- package/v2Containers/SmsTrai/Create/tests/index.test.js +77 -0
- package/v2Containers/SmsTrai/Create/tests/mockData.js +58 -0
- package/v2Containers/SmsTrai/Edit/constants.js +16 -0
- package/v2Containers/SmsTrai/Edit/index.js +483 -0
- package/v2Containers/SmsTrai/Edit/messages.js +58 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +16103 -0
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +61 -0
- package/v2Containers/SmsTrai/Edit/tests/mockData.js +36 -0
- package/v2Containers/SmsWrapper/index.js +75 -0
- package/v2Containers/SmsWrapper/tests/index.test.js +10 -0
- package/v2Containers/Templates/_templates.scss +2 -0
- package/v2Containers/Templates/index.js +89 -27
- package/v2Containers/Templates/messages.js +16 -0
|
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import messages from './messages';
|
|
8
8
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
9
9
|
import { NO_COMMUNICATION, FTP } from '../App/constants';
|
|
10
|
+
import { hasTraiDltFeature } from '../../utils/common';
|
|
10
11
|
const PrefixWrapper = styled.div`
|
|
11
12
|
margin-right: 16px;
|
|
12
13
|
`;
|
|
@@ -21,10 +22,14 @@ function getChannelLabel(channel = '') {
|
|
|
21
22
|
};
|
|
22
23
|
return labels[channel.toLowerCase()];
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
|
|
24
27
|
function SlideBoxHeader(props) {
|
|
25
28
|
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
26
29
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
27
30
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
31
|
+
const isTraiDltFeature = hasTraiDltFeature();
|
|
32
|
+
const showCreateTraiSMSHeader = isTraiDltFeature && channel.toLowerCase() === "sms";
|
|
28
33
|
return (
|
|
29
34
|
<div key="creatives-container-slidebox-header-content">
|
|
30
35
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -61,7 +66,7 @@ function SlideBoxHeader(props) {
|
|
|
61
66
|
)}
|
|
62
67
|
{!showTemplateNameHeader && slidBoxContent === 'createTemplate' && ( templateStep === 'modeSelection' || (templateStep === "createTemplateContent" && weChatTemplateType !== MAP_TEMPLATE) ) && (
|
|
63
68
|
<CapHeader
|
|
64
|
-
title={<FormattedMessage {...messages.createMessageContent} values={{channel: getChannelLabel(channel)}}/>}
|
|
69
|
+
title={<FormattedMessage {...(showCreateTraiSMSHeader ? messages.UploadSMStemplates : messages.createMessageContent)} values={{channel: getChannelLabel(channel)}}/>}
|
|
65
70
|
prefix={!isFullMode && showPrefix &&
|
|
66
71
|
<PrefixWrapper>
|
|
67
72
|
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
@@ -25,7 +25,7 @@ import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
|
|
|
25
25
|
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep, replace } from 'lodash';
|
|
26
26
|
import * as actions from './actions';
|
|
27
27
|
import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
|
|
28
|
-
import { setInjectedTags } from '../Cap/selectors';
|
|
28
|
+
import { makeSelectLoyaltyPromotionDisplay, setInjectedTags } from '../Cap/selectors';
|
|
29
29
|
import withCreatives from '../../hoc/withCreatives';
|
|
30
30
|
import messages from './messages';
|
|
31
31
|
import './_FTP.scss';
|
|
@@ -132,7 +132,11 @@ export class FTP extends React.Component {
|
|
|
132
132
|
) || !isEqual(injectedTags, thisInjectedTags)
|
|
133
133
|
) {
|
|
134
134
|
const tags = _.concat(
|
|
135
|
-
getTreeStructuredTags({
|
|
135
|
+
getTreeStructuredTags({
|
|
136
|
+
tagsList: ((metaEntities.tags || {}).standard || []),
|
|
137
|
+
offerDetails: selectedOfferDetails,
|
|
138
|
+
disableTagsDetails: this.props.disableTagsDetails,
|
|
139
|
+
}),
|
|
136
140
|
this.getTreeStructuredInjectedTags(injectedTags)
|
|
137
141
|
);
|
|
138
142
|
this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
|
|
@@ -491,9 +495,13 @@ export class FTP extends React.Component {
|
|
|
491
495
|
|
|
492
496
|
disableUsedColumns = () => {
|
|
493
497
|
const { headerTagList = [] } = this.state;
|
|
494
|
-
const { selectedOfferDetails = [], metaEntities = {}, injectedTags } = this.props;
|
|
498
|
+
const { selectedOfferDetails = [], metaEntities = {}, injectedTags, disableTagsDetails } = this.props;
|
|
495
499
|
const tags = _.concat(
|
|
496
|
-
getTreeStructuredTags({
|
|
500
|
+
getTreeStructuredTags({
|
|
501
|
+
tagsList: ((metaEntities.tags || {}).standard || []),
|
|
502
|
+
offerDetails: selectedOfferDetails,
|
|
503
|
+
disableTagsDetails,
|
|
504
|
+
}),
|
|
497
505
|
this.getTreeStructuredInjectedTags(injectedTags)
|
|
498
506
|
);
|
|
499
507
|
const clonnedTagsTree = cloneDeep(tags);
|
|
@@ -636,6 +644,7 @@ FTP.propTypes = {
|
|
|
636
644
|
contents: PropTypes.array,
|
|
637
645
|
metaEntities: PropTypes.object,
|
|
638
646
|
selectedOfferDetails: PropTypes.array,
|
|
647
|
+
disableTagsDetails: PropTypes.func,
|
|
639
648
|
};
|
|
640
649
|
|
|
641
650
|
|
|
@@ -650,6 +659,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
650
659
|
FTP: makeSelectFTP(),
|
|
651
660
|
metaEntities: makeSelectMetaEntities(),
|
|
652
661
|
injectedTags: setInjectedTags(),
|
|
662
|
+
disableTagsDetails: makeSelectLoyaltyPromotionDisplay(),
|
|
653
663
|
});
|
|
654
664
|
|
|
655
665
|
export default withCreatives({
|
|
@@ -203,13 +203,14 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
203
203
|
onTabChange(data) {
|
|
204
204
|
this.setState({currentTab: data});
|
|
205
205
|
}
|
|
206
|
+
|
|
206
207
|
onCreateTemplateComplete = (editResponse) => {
|
|
207
208
|
const timeTaken = GA.timeTracker.stopTimer(TRACK_CREATE_SMS, {
|
|
208
209
|
category: 'Creatives',
|
|
209
210
|
action: TRACK_CREATE_SMS,
|
|
210
211
|
});
|
|
211
212
|
const {
|
|
212
|
-
formData
|
|
213
|
+
formData,
|
|
213
214
|
} = this.state;
|
|
214
215
|
if (editResponse.templateId) {
|
|
215
216
|
gtmPush('creativeDetails', {
|
|
@@ -218,7 +219,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
218
219
|
channel: SMS,
|
|
219
220
|
timeTaken,
|
|
220
221
|
content: formData?.base?.['sms-editor'],
|
|
221
|
-
mode: CREATE
|
|
222
|
+
mode: CREATE,
|
|
222
223
|
});
|
|
223
224
|
this.resetSchema();
|
|
224
225
|
this.setState({
|
|
@@ -241,6 +242,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
}
|
|
245
|
+
|
|
244
246
|
getFormData(e, value) {
|
|
245
247
|
const formData = _.cloneDeep(this.state.formData);
|
|
246
248
|
let baseData = {};
|
|
@@ -764,11 +766,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
764
766
|
}
|
|
765
767
|
|
|
766
768
|
startTemplateCreation(data) {
|
|
767
|
-
|
|
768
769
|
if (data.edit) {
|
|
769
|
-
|
|
770
770
|
const ifUnicode = checkUnicode(data.content ? data.content : '');
|
|
771
|
-
|
|
771
|
+
|
|
772
772
|
const content = data.content;
|
|
773
773
|
const id = _.uniqueId();
|
|
774
774
|
const tempData = {
|
|
@@ -784,7 +784,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
784
784
|
this.setState({tabKey: ''});
|
|
785
785
|
});
|
|
786
786
|
} else {
|
|
787
|
-
|
|
788
787
|
this.setState({injectedTags: data.tags});
|
|
789
788
|
}
|
|
790
789
|
this.props.globalActions.setInjectedTags(data.tags);
|
|
@@ -15,7 +15,7 @@ export function* editTemplate(template) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
18
|
-
yield template.onUpdateTemplateComplete(result.response);
|
|
18
|
+
yield template.onUpdateTemplateComplete(result.response,errorMsg);
|
|
19
19
|
} catch (error) {
|
|
20
20
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
21
21
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* SmsTrai actions
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
CREATE_TRAI_SMS_TEMPLATE_REQUEST,
|
|
9
|
+
CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST,
|
|
10
|
+
} from './constants';
|
|
11
|
+
|
|
12
|
+
export function createSMSTRAITemplates(templates, callback) {
|
|
13
|
+
return {
|
|
14
|
+
type: CREATE_TRAI_SMS_TEMPLATE_REQUEST,
|
|
15
|
+
templates,
|
|
16
|
+
callback,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export function clearCreateResponse() {
|
|
22
|
+
return {
|
|
23
|
+
type: CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* SmsTrai constants
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_ACTION = 'app/SmsTrai/DEFAULT_ACTION';
|
|
8
|
+
export const APPROVAL_STATUS = 'approval status';
|
|
9
|
+
export const TEMPLATE_NAME = 'template name';
|
|
10
|
+
export const TYPE = 'type';
|
|
11
|
+
export const HEADER = 'header';
|
|
12
|
+
export const TEMPLATE_ID = 'template id';
|
|
13
|
+
export const SMS = 'SMS';
|
|
14
|
+
|
|
15
|
+
export const MAPPED_SAVED_COLUMN = {
|
|
16
|
+
"TEMPLATE ID": "template_id",
|
|
17
|
+
"TEMPLATE NAME": "template_name",
|
|
18
|
+
"TYPE": "type",
|
|
19
|
+
"HEADER": "header",
|
|
20
|
+
"CATEGORY": "category",
|
|
21
|
+
"TEMPLATE MESSAGE": "sms-editor",
|
|
22
|
+
'SENDER ID': "header",
|
|
23
|
+
'SENDERS': "header",
|
|
24
|
+
'HEADER ID': "header",
|
|
25
|
+
'HEADERS': "header",
|
|
26
|
+
'TEMPLATE REGISTRATION NUMBER': "template_id",
|
|
27
|
+
'TEMPLATE CONTENT': "template_name",
|
|
28
|
+
"COMMUNICATION TYPE": "consent-type",
|
|
29
|
+
"CONSENT TYPE": "consent-type",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const HEADER_ALIASES = [
|
|
33
|
+
HEADER,
|
|
34
|
+
'sender id',
|
|
35
|
+
'senders',
|
|
36
|
+
'header id',
|
|
37
|
+
'headers',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export const TEMPLATE_ID_ALIASES = [
|
|
41
|
+
'template id',
|
|
42
|
+
'template registration number',
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export const TEMPLATE_MESSAGE_ALIASES = [
|
|
46
|
+
'template message',
|
|
47
|
+
'template content',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export const MANDATORY_COLUMNS = [TEMPLATE_NAME, TYPE, APPROVAL_STATUS];
|
|
51
|
+
export const SAVED_COLUMNS = [TEMPLATE_NAME, TYPE, "category", "consent type"];
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export const SAMPLE_CSV_DATA = [
|
|
55
|
+
[
|
|
56
|
+
'TEMPLATE ID',
|
|
57
|
+
'TEMPLATE NAME',
|
|
58
|
+
'TYPE',
|
|
59
|
+
'HEADER',
|
|
60
|
+
'APPROVAL STATUS',
|
|
61
|
+
'TEMPLATE MESSAGE',
|
|
62
|
+
],
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
export const DOWNLOAD_ISSUES_CSV = 'Downloaded issues.csv';
|
|
66
|
+
export const SAMPLE_CSV = 'Sample.csv';
|
|
67
|
+
export const CAPILLARY_REJECTION_REASON = 'CAPILLARY REJECTION REASON';
|
|
68
|
+
export const APPROVED = 'approved';
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
export const CREATE_TRAI_SMS_TEMPLATE_REQUEST = 'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_REQUEST';
|
|
72
|
+
export const CREATE_TRAI_SMS_TEMPLATE_SUCCESS = 'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_SUCCESS';
|
|
73
|
+
export const CREATE_TRAI_SMS_TEMPLATE_FAILURE = 'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_FAILURE';
|
|
74
|
+
export const CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST = 'app/v2Containers/SmsTrai/Create/CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST';
|