@capillarytech/creatives-library 7.9.14 → 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/containers/App/constants.js +2 -1
- 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 +6 -1
- package/v2Containers/Cap/index.js +9 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +10 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -1
- package/v2Containers/CreativesContainer/messages.js +4 -0
- 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 +88 -11
- package/v2Containers/Templates/messages.js +16 -0
package/assets/group.png
ADDED
|
Binary file
|
|
@@ -2,4 +2,5 @@ export const GET_SIDEBAR_REQUEST = 'app/App/GET_SIDEBAR_REQUEST';
|
|
|
2
2
|
export const GET_SIDEBAR_SUCCESS = 'app/App/GET_SIDEBAR_SUCCESS';
|
|
3
3
|
export const GET_SIDEBAR_FAILURE = 'app/App/GET_SIDEBAR_FAILURE';
|
|
4
4
|
|
|
5
|
-
export const STORE2DOOR_PLUS_ENABLED = 'STORE2DOOR_PLUS_ENABLED';
|
|
5
|
+
export const STORE2DOOR_PLUS_ENABLED = 'STORE2DOOR_PLUS_ENABLED';
|
|
6
|
+
export const TRAI_DLT = 'TRAI_DLT';
|
package/index.js
CHANGED
|
@@ -83,6 +83,10 @@ import CreativesContainer from './v2Containers/CreativesContainer';
|
|
|
83
83
|
import CreativesContainerReducer from './v2Containers/CreativesContainer/reducer';
|
|
84
84
|
import { updateCharCount } from './utils/smsCharCountV2';
|
|
85
85
|
|
|
86
|
+
import SmsTraiCreate from './v2Containers/SmsTrai/Create';
|
|
87
|
+
import SmsTraiCreateReducer from './v2Containers/SmsTrai/Create/reducer';
|
|
88
|
+
import SmsTraiCreateSaga from './v2Containers/SmsTrai/Create/sagas';
|
|
89
|
+
|
|
86
90
|
export {default as Ebill} from './v2Containers/Ebill';
|
|
87
91
|
export {default as EbillReducer} from './v2Containers/Ebill/reducer';
|
|
88
92
|
export {default as EbillSaga} from './v2Containers/Ebill/sagas';
|
|
@@ -106,6 +110,7 @@ const TemplatesV2Container = {TemplatesV2, templateReducer, templateSaga};
|
|
|
106
110
|
const FacebookContainer = {Facebook, facebookReducer, facebookSaga};
|
|
107
111
|
const ViberContainer = {Viber, viberReducer, viberSaga};
|
|
108
112
|
const FacebookPreviewContainer = { FacebookPreview, facebookPreviewReducer, facebookPreviewSaga };
|
|
113
|
+
const SmsTraiContainer = {SmsTraiCreate, SmsTraiCreateReducer, SmsTraiCreateSaga};
|
|
109
114
|
|
|
110
115
|
const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
|
|
111
116
|
const FTPContainer = {FTP, FTPReducer, FTPSagas};
|
|
@@ -151,4 +156,5 @@ export { CapContainer,
|
|
|
151
156
|
FTPContainer,
|
|
152
157
|
ViberContainer,
|
|
153
158
|
FacebookPreviewContainer,
|
|
159
|
+
SmsTraiContainer,
|
|
154
160
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "7.9.
|
|
4
|
+
"version": "7.9.15",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "LicenseRef-LICENSE",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@babel/polyfill": "7.4.3",
|
|
16
15
|
"@bugsnag/js": "^7.2.1",
|
|
17
16
|
"@bugsnag/plugin-react": "^7.2.1",
|
|
18
17
|
"@capillarytech/cap-ui-utils": "1.4.0",
|
|
@@ -24,7 +23,9 @@
|
|
|
24
23
|
"jquery": "^3.3.1",
|
|
25
24
|
"load-script": "^1.0.0",
|
|
26
25
|
"normalizr": "^3.2.3",
|
|
26
|
+
"papaparse": "^5.3.1",
|
|
27
27
|
"react-datepicker": "^0.46.0",
|
|
28
|
+
"react-dropzone": "^11.3.4",
|
|
28
29
|
"react-router": "^3.2.0",
|
|
29
30
|
"react-router-dom": "^4.2.2",
|
|
30
31
|
"redux": "3.6.0",
|
package/routes.js
CHANGED
|
@@ -639,6 +639,8 @@ export default function createRoutes(store) {
|
|
|
639
639
|
import('v2Containers/Viber/reducer'),
|
|
640
640
|
import('v2Containers/CapFacebookPreview/sagas'),
|
|
641
641
|
import('v2Containers/CapFacebookPreview/reducer'),
|
|
642
|
+
import('v2Containers/SmsTrai/Create/sagas'),
|
|
643
|
+
import('v2Containers/SmsTrai/Create/reducer'),
|
|
642
644
|
]);
|
|
643
645
|
|
|
644
646
|
const renderRoute = loadModule(cb);
|
|
@@ -661,6 +663,7 @@ export default function createRoutes(store) {
|
|
|
661
663
|
lineCreateSagas, lineCreateReducer,
|
|
662
664
|
viberSagas, viberReducer,
|
|
663
665
|
capFacebookPreviewSagas, capFacebookPreviewReducer,
|
|
666
|
+
smsTraiSagas, smsTraiReducer,
|
|
664
667
|
]) => {
|
|
665
668
|
injectReducer('templates', reducer.default);
|
|
666
669
|
injectReducer('cap', capReducer.default);
|
|
@@ -679,6 +682,7 @@ export default function createRoutes(store) {
|
|
|
679
682
|
injectReducer('lineCreate', lineCreateReducer.default);
|
|
680
683
|
injectReducer('viber', viberReducer.default);
|
|
681
684
|
injectReducer('facebookPreview', capFacebookPreviewReducer.default);
|
|
685
|
+
injectReducer('smsTrai', smsTraiReducer.default);
|
|
682
686
|
injectSagas(gallerySagas.default);
|
|
683
687
|
injectSagas(sagas.default);
|
|
684
688
|
injectSagas(capSagas.default);
|
|
@@ -696,6 +700,7 @@ export default function createRoutes(store) {
|
|
|
696
700
|
injectSagas(lineCreateSagas.default);
|
|
697
701
|
injectSagas(viberSagas.default);
|
|
698
702
|
injectSagas(capFacebookPreviewSagas.default);
|
|
703
|
+
injectSagas(smsTraiSagas.default);
|
|
699
704
|
renderRoute(component);
|
|
700
705
|
});
|
|
701
706
|
importModules.catch(errorLoading);
|
package/services/api.js
CHANGED
|
@@ -40,7 +40,7 @@ function getUrlWithQueryParams({url, queryParams}) {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
return updatedUrl;
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
44
|
|
|
45
45
|
// const loginUrl = (process.env.NODE_ENV === 'production') ?
|
|
46
46
|
// config.production.login_url : config.development.login_url;
|
|
@@ -81,7 +81,7 @@ function checkStatus(response) {
|
|
|
81
81
|
description: `API Error ${requestCallerName} returned ${status}`,
|
|
82
82
|
fatal: true,
|
|
83
83
|
apiError: true,
|
|
84
|
-
statusCode: status
|
|
84
|
+
statusCode: status,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
if ((status >= 200 && status < 300) || [500, 409, 413].includes(response.status)) {
|
|
@@ -99,7 +99,7 @@ function request(url, options) {
|
|
|
99
99
|
try {
|
|
100
100
|
requestCallerName = getCallerName();
|
|
101
101
|
} catch (e) {
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
}
|
|
104
104
|
const fetchUrl = url.indexOf('?') !== -1 ? `${url}&time=${Date.now()}` : `${url}?time=${Date.now()}`;
|
|
105
105
|
return fetch(fetchUrl, options)
|
|
@@ -197,36 +197,31 @@ export const getSidebar = () => {
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
export const getUserData = () => {
|
|
200
|
-
const url = `${API_AUTH_ENDPOINT}/user`;
|
|
200
|
+
const url = `${API_AUTH_ENDPOINT}/user?include_features=1`;
|
|
201
201
|
return request(url, getAPICallObject('GET'));
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
export const createTemplate = ({template}) => {
|
|
205
|
-
|
|
206
205
|
const url = `${API_ENDPOINT}/templates/SMS`;
|
|
207
206
|
return request(url, getAPICallObject('POST', template));
|
|
208
207
|
};
|
|
209
208
|
|
|
210
209
|
export const editTemplate = ({template}) => {
|
|
211
|
-
|
|
212
210
|
const url = `${API_ENDPOINT}/templates/SMS`;
|
|
213
211
|
return request(url, getAPICallObject('POST', template));
|
|
214
212
|
};
|
|
215
213
|
|
|
216
214
|
export const createWeChatTemplate = ({template}) => {
|
|
217
|
-
|
|
218
215
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|
|
219
216
|
return request(url, getAPICallObject('POST', template));
|
|
220
217
|
};
|
|
221
218
|
|
|
222
219
|
export const createMobilePushTemplate = ({template}) => {
|
|
223
|
-
|
|
224
220
|
const url = `${API_ENDPOINT}/templates/MOBILEPUSH`;
|
|
225
221
|
return request(url, getAPICallObject('POST', template));
|
|
226
222
|
};
|
|
227
223
|
|
|
228
224
|
export const duplicateTemplate = ({id, channel}) => {
|
|
229
|
-
|
|
230
225
|
const url = `${API_ENDPOINT}/templates/duplicate/${id}/${channel}`;
|
|
231
226
|
return request(url, getAPICallObject('GET'));
|
|
232
227
|
};
|
|
@@ -237,25 +232,21 @@ export const getFTPServers = () => {
|
|
|
237
232
|
};
|
|
238
233
|
|
|
239
234
|
export const editWeChatTemplate = ({template}) => {
|
|
240
|
-
|
|
241
235
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|
|
242
236
|
return request(url, getAPICallObject('POST', template));
|
|
243
237
|
};
|
|
244
238
|
|
|
245
239
|
export const createEmailTemplate = ({template}) => {
|
|
246
|
-
|
|
247
240
|
const url = `${API_ENDPOINT}/templates/EMAIL`;
|
|
248
241
|
return request(url, getAPICallObject('POST', template));
|
|
249
242
|
};
|
|
250
243
|
|
|
251
244
|
export const createEbillTemplate = ({template}) => {
|
|
252
|
-
|
|
253
245
|
const url = `${API_ENDPOINT}/templates/EBILL`;
|
|
254
246
|
return request(url, getAPICallObject('POST', template));
|
|
255
247
|
};
|
|
256
248
|
|
|
257
249
|
export const getTemplateDetails = ({id, channel}) => {
|
|
258
|
-
|
|
259
250
|
const url = `${API_ENDPOINT}/templates/${id}/${channel ? channel.toUpperCase() : 'SMS'}`;
|
|
260
251
|
return request(url, getAPICallObject('GET'));
|
|
261
252
|
};
|
|
@@ -367,7 +358,6 @@ export const getCmsData = (cmsType, projectId, langId) => {
|
|
|
367
358
|
};
|
|
368
359
|
|
|
369
360
|
export const getEdmTemplates = () => {
|
|
370
|
-
|
|
371
361
|
const url = `${API_ENDPOINT}/templates/email/default`;
|
|
372
362
|
return request(url, getAPICallObject('GET'));
|
|
373
363
|
};
|
|
@@ -380,7 +370,6 @@ export const getDefaultBeeTemplates = () => {
|
|
|
380
370
|
// All about line
|
|
381
371
|
|
|
382
372
|
export const createLineTemplate = ({template}) => {
|
|
383
|
-
|
|
384
373
|
const url = `${API_ENDPOINT}/templates/LINE`;
|
|
385
374
|
return request(url, getAPICallObject('POST', template));
|
|
386
375
|
};
|
|
@@ -449,3 +438,8 @@ export const getFacebookVideoId = ({videoUrl, accessToken, actId, pageAccessToke
|
|
|
449
438
|
const url = `${API_ENDPOINT}/facebook/getFacebookVideoId`;
|
|
450
439
|
return request(url, getAPICallObject('POST', {videoUrl, accessToken, actId, pageAccessToken, pageId}));
|
|
451
440
|
};
|
|
441
|
+
|
|
442
|
+
export const createBulkSMSTemplate = ({templates}) => {
|
|
443
|
+
const url = `${API_ENDPOINT}/templates/bulk/sms`;
|
|
444
|
+
return request(url, getAPICallObject('POST', templates));
|
|
445
|
+
};
|
package/utils/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Auth } from '@capillarytech/cap-ui-utils';
|
|
3
|
-
import { STORE2DOOR_PLUS_ENABLED } from '../containers/App/constants';
|
|
3
|
+
import { STORE2DOOR_PLUS_ENABLED, TRAI_DLT } from '../containers/App/constants';
|
|
4
4
|
|
|
5
5
|
export function getUserNameById(userId, allUserList) {
|
|
6
6
|
let userName = "";
|
|
@@ -38,6 +38,11 @@ export const hasStore2DoorFeature = Auth.hasFeatureAccess.bind(
|
|
|
38
38
|
STORE2DOOR_PLUS_ENABLED,
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
+
export const hasTraiDltFeature = Auth.hasFeatureAccess.bind(
|
|
42
|
+
null,
|
|
43
|
+
TRAI_DLT,
|
|
44
|
+
);
|
|
45
|
+
|
|
41
46
|
export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = [], disableTagsDetails = {}}) {
|
|
42
47
|
console.log('populating tags', (tagsList || []).length);
|
|
43
48
|
const mainTags = {};
|
|
@@ -9,7 +9,7 @@ import { createStructuredSelector } from 'reselect';
|
|
|
9
9
|
import _ from 'lodash';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
// import 'moment/locale/zh-cn';
|
|
12
|
-
import { GA, multipleOrgSwitch, utilsSessionStorageApi } from '@capillarytech/cap-ui-utils';
|
|
12
|
+
import { GA, multipleOrgSwitch, utilsSessionStorageApi, Auth } from '@capillarytech/cap-ui-utils';
|
|
13
13
|
import { injectIntl, FormattedMessage, intlShape, FormattedHTMLMessage } from 'react-intl';
|
|
14
14
|
import messages from './messages';
|
|
15
15
|
import { makeSelectAuthenticated, makeSelectUser } from './selectors';
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
ORG_CHANGED,
|
|
29
29
|
} from './constants';
|
|
30
30
|
import './_cap.scss';
|
|
31
|
-
|
|
32
31
|
const gtm = window.dataLayer || [];
|
|
33
32
|
const {
|
|
34
33
|
logNewTab,
|
|
@@ -75,12 +74,20 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
75
74
|
const { pathname } = this.props.location;
|
|
76
75
|
const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
|
|
77
76
|
this.props.actions.getUserData((userData) => {
|
|
77
|
+
const { currentOrgDetails } = this.props.Global || {};
|
|
78
|
+
const { accessibleFeatures = [] } = currentOrgDetails || {};
|
|
78
79
|
if (!userData.accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
79
80
|
this.setState({ isCreativesAccessible: false });
|
|
80
81
|
}
|
|
81
82
|
const userGtmData = this.getUserGtmData();
|
|
82
83
|
this.setDimensionData(userGtmData);
|
|
83
84
|
gtm.push({...userGtmData, event: 'userAuthenticated'});
|
|
85
|
+
Auth.initialize({
|
|
86
|
+
permissions: userData.accessiblePermissions,
|
|
87
|
+
isCapUser: userData.isCapUser,
|
|
88
|
+
roles: Object.keys(userData.accessRoles),
|
|
89
|
+
accessibleFeatures,
|
|
90
|
+
});
|
|
84
91
|
});
|
|
85
92
|
this.props.actions.getTopbarMenuData(parentModule);
|
|
86
93
|
if (this.props.Global.orgID !== undefined) {
|
|
@@ -5,8 +5,8 @@ import get from 'lodash/get';
|
|
|
5
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
import TemplatesV2 from '../TemplatesV2';
|
|
7
7
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
8
|
-
import
|
|
9
|
-
import SmsEdit from '../Sms/Edit';
|
|
8
|
+
import SmsWrapper from '../SmsWrapper';
|
|
9
|
+
// import SmsEdit from '../Sms/Edit';
|
|
10
10
|
import Email from '../Email';
|
|
11
11
|
import EmailWrapper from '../EmailWrapper';
|
|
12
12
|
import MobilepushWrapper from '../MobilepushWrapper';
|
|
@@ -394,8 +394,9 @@ function SlideBoxContent(props) {
|
|
|
394
394
|
/>
|
|
395
395
|
}
|
|
396
396
|
{isEditSms && (
|
|
397
|
-
<
|
|
397
|
+
<SmsWrapper
|
|
398
398
|
setIsLoadingContent={setIsLoadingContent}
|
|
399
|
+
isEditSms={isEditSms}
|
|
399
400
|
location={creativesLocationProps}
|
|
400
401
|
isFullMode={isFullMode}
|
|
401
402
|
route={{ name: 'sms' }}
|
|
@@ -408,6 +409,8 @@ function SlideBoxContent(props) {
|
|
|
408
409
|
selectedOfferDetails={selectedOfferDetails}
|
|
409
410
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
410
411
|
onTestContentClicked={onTestContentClicked}
|
|
412
|
+
handleClose={handleClose}
|
|
413
|
+
onCreateComplete={onCreateComplete}
|
|
411
414
|
/>
|
|
412
415
|
)}
|
|
413
416
|
{isEditFTP && (
|
|
@@ -440,10 +443,11 @@ function SlideBoxContent(props) {
|
|
|
440
443
|
/>
|
|
441
444
|
}
|
|
442
445
|
{isCreateSms && (
|
|
443
|
-
<
|
|
446
|
+
<SmsWrapper
|
|
444
447
|
setIsLoadingContent={setIsLoadingContent}
|
|
445
448
|
location={creativesLocationProps}
|
|
446
449
|
route={{ name: 'sms' }}
|
|
450
|
+
isCreateSms={isCreateSms}
|
|
447
451
|
isComponent
|
|
448
452
|
isGetFormData={isGetFormData}
|
|
449
453
|
getFormSubscriptionData={getFormData}
|
|
@@ -453,8 +457,10 @@ function SlideBoxContent(props) {
|
|
|
453
457
|
selectedOfferDetails={selectedOfferDetails}
|
|
454
458
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
455
459
|
onTestContentClicked={onTestContentClicked}
|
|
460
|
+
onCreateComplete={onCreateComplete}
|
|
456
461
|
/>
|
|
457
462
|
)}
|
|
463
|
+
|
|
458
464
|
{isEmailCreate && (
|
|
459
465
|
<EmailWrapper
|
|
460
466
|
key="creatives-email-wrapper"
|
|
@@ -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} />
|
|
@@ -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';
|