@capillarytech/creatives-library 7.10.9 → 7.10.11
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/config/app.js +1 -0
- package/package.json +2 -3
- package/utils/common.js +7 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -4
- package/v2Containers/CreativesContainer/index.js +53 -8
- package/v2Containers/SmsTrai/Create/constants.js +32 -37
- package/v2Containers/SmsTrai/Create/index.js +95 -45
- package/v2Containers/SmsTrai/Create/messages.js +20 -17
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +3996 -875
- package/v2Containers/SmsTrai/Create/tests/index.test.js +10 -0
- package/v2Containers/SmsTrai/Create/tests/mockData.js +2 -2
- package/v2Containers/SmsTrai/Edit/index.js +249 -103
- package/v2Containers/SmsTrai/Edit/messages.js +14 -1
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +12487 -810
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +8 -1
- package/v2Containers/SmsWrapper/index.js +14 -10
- package/v2Containers/Templates/index.js +13 -6
- package/v2Containers/TemplatesV2/index.js +2 -1
|
@@ -20,6 +20,7 @@ describe('Creatives SmsTraiEdit test/>', () => {
|
|
|
20
20
|
const fetchSchemaForEntity = jest.fn();
|
|
21
21
|
const formatMessage = jest.fn();
|
|
22
22
|
const handleClose = jest.fn();
|
|
23
|
+
const getFormSubscriptionData = jest.fn();
|
|
23
24
|
const params = {
|
|
24
25
|
id: mockData.templateDetails._id,
|
|
25
26
|
};
|
|
@@ -37,17 +38,23 @@ describe('Creatives SmsTraiEdit test/>', () => {
|
|
|
37
38
|
}}
|
|
38
39
|
globalActions={{ fetchSchemaForEntity }}
|
|
39
40
|
handleClose={handleClose}
|
|
41
|
+
getFormSubscriptionData={getFormSubscriptionData}
|
|
40
42
|
params={params}
|
|
41
43
|
templateDetails={templateDetails}
|
|
42
44
|
location={location}
|
|
43
45
|
intl={{ formatMessage }}
|
|
46
|
+
isFullMode={true}
|
|
44
47
|
/>
|
|
45
48
|
</Provider>,
|
|
46
49
|
);
|
|
47
50
|
});
|
|
48
51
|
it('should render', () => {
|
|
52
|
+
const event = { target: { value: "test1", id: "1" } };
|
|
49
53
|
expect(renderedComponent).toMatchSnapshot();
|
|
50
|
-
|
|
54
|
+
renderedComponent.find("TextArea").at(0).props().onChange(event);
|
|
55
|
+
renderedComponent.update();
|
|
56
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
57
|
+
})
|
|
51
58
|
it('should save', () => {
|
|
52
59
|
renderedComponent.find('button.create-msg').props().onClick();
|
|
53
60
|
renderedComponent.update();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import SmsCreate from '../Sms/Create';
|
|
9
|
-
import {
|
|
9
|
+
import { isTraiDLTEnable } from '../../utils/common';
|
|
10
10
|
import SmsEdit from '../Sms/Edit';
|
|
11
11
|
import SmsTraiCreate from '../SmsTrai/Create';
|
|
12
12
|
import SmsTraiEdit from '../SmsTrai/Edit';
|
|
@@ -26,7 +26,9 @@ const SmsWrapper = (props) => {
|
|
|
26
26
|
onPreviewContentClicked,
|
|
27
27
|
onTestContentClicked,
|
|
28
28
|
onCreateComplete,
|
|
29
|
-
handleClose
|
|
29
|
+
handleClose,
|
|
30
|
+
smsRegister,
|
|
31
|
+
onShowTemplates,
|
|
30
32
|
} = props;
|
|
31
33
|
|
|
32
34
|
const smsProps = {
|
|
@@ -43,13 +45,15 @@ const SmsWrapper = (props) => {
|
|
|
43
45
|
onPreviewContentClicked,
|
|
44
46
|
onTestContentClicked,
|
|
45
47
|
};
|
|
46
|
-
const
|
|
48
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
47
49
|
return <>
|
|
48
50
|
{
|
|
49
|
-
isCreateSms && (
|
|
51
|
+
isCreateSms && (isTraiDlt ?
|
|
50
52
|
<SmsTraiCreate
|
|
51
53
|
isComponent
|
|
52
|
-
{...smsProps}
|
|
54
|
+
{...smsProps}
|
|
55
|
+
onShowTemplates={onShowTemplates}
|
|
56
|
+
/> :
|
|
53
57
|
<SmsCreate
|
|
54
58
|
isComponent {
|
|
55
59
|
...smsProps
|
|
@@ -57,16 +61,16 @@ const SmsWrapper = (props) => {
|
|
|
57
61
|
/>
|
|
58
62
|
)
|
|
59
63
|
}
|
|
60
|
-
{isEditSms && (
|
|
64
|
+
{isEditSms && (isTraiDlt ?
|
|
61
65
|
<SmsTraiEdit
|
|
62
66
|
{...smsProps}
|
|
63
67
|
params={{id: templateData._id}}
|
|
64
68
|
templateData={templateData}
|
|
65
69
|
handleClose={handleClose}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
/> : <SmsEdit
|
|
71
|
+
{...smsProps}
|
|
72
|
+
params={{id: templateData._id}}
|
|
73
|
+
templateData={templateData}
|
|
70
74
|
/>
|
|
71
75
|
)}
|
|
72
76
|
</>;
|
|
@@ -155,7 +155,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
155
155
|
this.prepareMobilePushPreviewData = this.prepareMobilePushPreviewData.bind(this);
|
|
156
156
|
this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
componentWillMount() {
|
|
160
160
|
if (this.state.channel === '') {
|
|
161
161
|
let channel = '';
|
|
@@ -208,6 +208,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
checkDLTfeatureEnable() {
|
|
212
|
+
const {smsRegister, isFullMode} = this.props;
|
|
213
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
214
|
+
return isTraiDlt;
|
|
215
|
+
}
|
|
216
|
+
|
|
211
217
|
componentDidMount() {
|
|
212
218
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
213
219
|
this.setLocale();
|
|
@@ -223,7 +229,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
223
229
|
queryParams.page = this.state.page;
|
|
224
230
|
queryParams.perPage = this.state.perPageLimit;
|
|
225
231
|
const channel = this.state.channel;
|
|
226
|
-
const isTraiDltFeature =
|
|
232
|
+
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
227
233
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
228
234
|
queryParams.traiEnable = true;
|
|
229
235
|
}
|
|
@@ -586,7 +592,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
586
592
|
if (activeMode === ACCOUNT_SELECTION_MODE) {
|
|
587
593
|
this.setTemplatesMode();
|
|
588
594
|
}
|
|
589
|
-
const isTraiDltFeature =
|
|
595
|
+
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
590
596
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
591
597
|
queryParams.traiEnable = true;
|
|
592
598
|
}
|
|
@@ -628,7 +634,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
628
634
|
}
|
|
629
635
|
}
|
|
630
636
|
}
|
|
631
|
-
|
|
637
|
+
|
|
632
638
|
this.setState({page, templatesCount}, () => {
|
|
633
639
|
queryParams.page = page;
|
|
634
640
|
queryParams.perPage = this.state.perPageLimit;
|
|
@@ -670,7 +676,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
670
676
|
}
|
|
671
677
|
if (currentChannel === SMS) {
|
|
672
678
|
filteredTemplates = this.filterSMSTemplates(templates);
|
|
673
|
-
isTraiDltFeature =
|
|
679
|
+
isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
674
680
|
}
|
|
675
681
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
676
682
|
const templateData =
|
|
@@ -2054,7 +2060,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2054
2060
|
const isfilterContentVisisble = true;
|
|
2055
2061
|
const isWechatEmbedded = !this.props.isFullMode && channel.toUpperCase() === WECHAT;
|
|
2056
2062
|
const channelLowerCase = (channel || '').toLowerCase();
|
|
2057
|
-
const isTraiDltFeature =
|
|
2063
|
+
const isTraiDltFeature = this.checkDLTfeatureEnable();
|
|
2058
2064
|
const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH].includes(this.state.channel.toUpperCase())) && <div className="action-container">
|
|
2059
2065
|
{isfilterContentVisisble && <CapInput.Search
|
|
2060
2066
|
className="search-text"
|
|
@@ -2271,6 +2277,7 @@ Templates.propTypes = {
|
|
|
2271
2277
|
router: PropTypes.object,
|
|
2272
2278
|
viberActions: PropTypes.object,
|
|
2273
2279
|
facebookActions: PropTypes.object,
|
|
2280
|
+
smsRegister: PropTypes.any,
|
|
2274
2281
|
};
|
|
2275
2282
|
|
|
2276
2283
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -199,7 +199,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
199
199
|
getTemplatesComponent(channel) {
|
|
200
200
|
// const templates = this.props.Templates[`${channel}Templates`];
|
|
201
201
|
let query = {};
|
|
202
|
-
const {isFullMode, messageStrategy} = this.props;
|
|
202
|
+
const {isFullMode, messageStrategy, smsRegister} = this.props;
|
|
203
203
|
if (!isFullMode) {
|
|
204
204
|
query = {type: 'embedded', module: 'library'};
|
|
205
205
|
switch (channel) {
|
|
@@ -232,6 +232,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
232
232
|
renderNewCardGrid={this.getTemplateDataForGrid}
|
|
233
233
|
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
234
234
|
messageStrategy={this.props.messageStrategy}
|
|
235
|
+
smsRegister={smsRegister}
|
|
235
236
|
/>);
|
|
236
237
|
}
|
|
237
238
|
}
|