@capillarytech/creatives-library 7.10.8 → 7.10.10
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/app.js +4 -2
- package/package.json +1 -1
- package/routes.js +19 -0
- package/services/api.js +18 -5
- package/utils/common.js +7 -0
- package/v2Containers/App/constants.js +2 -0
- package/v2Containers/Cap/index.js +9 -4
- package/v2Containers/Cap/reducer.js +4 -1
- package/v2Containers/Cap/sagas.js +32 -21
- 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 +23 -21
- package/v2Containers/SmsTrai/Create/index.js +26 -18
- package/v2Containers/SmsTrai/Edit/index.js +200 -76
- package/v2Containers/SmsTrai/Edit/messages.js +14 -0
- package/v2Containers/SmsWrapper/index.js +14 -10
- package/v2Containers/Templates/index.js +12 -7
- package/v2Containers/TemplatesV2/index.js +2 -1
package/app.js
CHANGED
|
@@ -6,6 +6,7 @@ import createHistory from 'history/lib/createBrowserHistory';
|
|
|
6
6
|
import { applyRouterMiddleware, Router, useRouterHistory } from 'react-router';
|
|
7
7
|
import { syncHistoryWithStore } from 'react-router-redux';
|
|
8
8
|
import { useScroll } from 'react-router-scroll';
|
|
9
|
+
import CapSomethingWentWrong from '@capillarytech/cap-ui-library/CapSomethingWentWrong';
|
|
9
10
|
import Bugsnag from '@bugsnag/js';
|
|
10
11
|
import BugsnagPluginReact from '@bugsnag/plugin-react';
|
|
11
12
|
import CapV2 from 'v2Containers/Cap';
|
|
@@ -105,7 +106,8 @@ const rootRoute = {
|
|
|
105
106
|
if (
|
|
106
107
|
props.location.pathname === 'v2' ||
|
|
107
108
|
props.location.pathname === 'v2/' ||
|
|
108
|
-
props.location.pathname === 'v2/loyalty'
|
|
109
|
+
props.location.pathname === 'v2/loyalty' ||
|
|
110
|
+
props.location.pathname === 'v2/somethingwentwrong'
|
|
109
111
|
) {
|
|
110
112
|
return <CapV2 {...props} />;
|
|
111
113
|
}
|
|
@@ -114,7 +116,7 @@ const rootRoute = {
|
|
|
114
116
|
childRoutes: createRoutes(store),
|
|
115
117
|
};
|
|
116
118
|
|
|
117
|
-
const ErrorScreen = () => <
|
|
119
|
+
const ErrorScreen = () => <CapSomethingWentWrong url={`${pathConfig.publicPath}v2`} />
|
|
118
120
|
|
|
119
121
|
const render = (messages) => {
|
|
120
122
|
ReactDOM.render(
|
package/package.json
CHANGED
package/routes.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// They are all wrapped in the App component, which should contain the navbar etc
|
|
3
3
|
// See http://blog.mxstbr.com/2016/01/react-apps-with-pages for more information
|
|
4
4
|
// about the code splitting business
|
|
5
|
+
import React from 'react';
|
|
5
6
|
import { getAsyncInjectors } from 'utils/asyncInjectors';
|
|
7
|
+
import pathConfig from './config/path'
|
|
6
8
|
import * as rootSaga from 'containers/Cap/sagas';
|
|
7
9
|
import * as smsSagas from 'containers/Sms/Create/sagas';
|
|
8
10
|
import * as smsEditSagas from 'containers/Sms/Edit/sagas';
|
|
@@ -22,6 +24,13 @@ const loadModule = (cb) => (componentModule) => {
|
|
|
22
24
|
cb(null, componentModule.default);
|
|
23
25
|
};
|
|
24
26
|
|
|
27
|
+
const loadModuleWithProps = (cb) => (ComponentModule, props) => {
|
|
28
|
+
cb(
|
|
29
|
+
null,
|
|
30
|
+
() => <ComponentModule.default {...props} />
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
25
34
|
export default function createRoutes(store) {
|
|
26
35
|
// Create reusable async injectors using getAsyncInjectors factory
|
|
27
36
|
updateCharCount("", false); // calling here to get unsubscribeurl from api.
|
|
@@ -598,6 +607,16 @@ export default function createRoutes(store) {
|
|
|
598
607
|
|
|
599
608
|
importModules.catch(errorLoading);
|
|
600
609
|
},
|
|
610
|
+
}, {
|
|
611
|
+
path: '/v2/somethingwentwrong',
|
|
612
|
+
name: 'somethingwentwrong',
|
|
613
|
+
getComponent(nextState, cb) {
|
|
614
|
+
import('@capillarytech/cap-ui-library/CapSomethingWentWrong')
|
|
615
|
+
.then((Component) => {
|
|
616
|
+
loadModuleWithProps(cb)(Component, { url: `${pathConfig.publicPath}v2` });
|
|
617
|
+
})
|
|
618
|
+
.catch(errorLoading);
|
|
619
|
+
},
|
|
601
620
|
},
|
|
602
621
|
{
|
|
603
622
|
path: '/v2(/:channel)',
|
package/services/api.js
CHANGED
|
@@ -90,12 +90,18 @@ function checkStatus(response) {
|
|
|
90
90
|
const isLoginPage = window.location.pathname.indexOf('/login') !== -1;
|
|
91
91
|
if (!isLoginPage) redirectIfUnauthenticated(response);
|
|
92
92
|
|
|
93
|
-
const error = new Error(statusText);
|
|
93
|
+
const error = new Error({ statusText, status });
|
|
94
94
|
error.response = response;
|
|
95
|
+
error.isError = true;
|
|
96
|
+
error.status = status;
|
|
95
97
|
throw error;
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
function
|
|
100
|
+
function showSomethingwentWrong() {
|
|
101
|
+
window.history.pushState({}, '', `${pathConfig.publicPath}v2/somethingwentwrong`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function request(url, options, handleUnauthorizedStatus) {
|
|
99
105
|
try {
|
|
100
106
|
requestCallerName = getCallerName();
|
|
101
107
|
} catch (e) {
|
|
@@ -103,8 +109,14 @@ function request(url, options) {
|
|
|
103
109
|
}
|
|
104
110
|
const fetchUrl = url.indexOf('?') !== -1 ? `${url}&time=${Date.now()}` : `${url}?time=${Date.now()}`;
|
|
105
111
|
return fetch(fetchUrl, options)
|
|
106
|
-
.then(
|
|
107
|
-
|
|
112
|
+
.then(response => {
|
|
113
|
+
if (response.status === 403 && handleUnauthorizedStatus) {
|
|
114
|
+
showSomethingwentWrong();
|
|
115
|
+
}
|
|
116
|
+
return checkStatus(response);
|
|
117
|
+
})
|
|
118
|
+
.then(parseJSON)
|
|
119
|
+
.catch(error => error);
|
|
108
120
|
}
|
|
109
121
|
|
|
110
122
|
function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeaders = false) {
|
|
@@ -196,9 +208,10 @@ export const getSidebar = () => {
|
|
|
196
208
|
return response;
|
|
197
209
|
};
|
|
198
210
|
|
|
211
|
+
// if 403, show SWR page
|
|
199
212
|
export const getUserData = () => {
|
|
200
213
|
const url = `${API_AUTH_ENDPOINT}/user?include_features=1`;
|
|
201
|
-
return request(url, getAPICallObject('GET'));
|
|
214
|
+
return request(url, getAPICallObject('GET'), true);
|
|
202
215
|
};
|
|
203
216
|
|
|
204
217
|
export const createTemplate = ({template}) => {
|
package/utils/common.js
CHANGED
|
@@ -255,3 +255,10 @@ export const bytes2Size = (bytes, decimals = 2) => {
|
|
|
255
255
|
|
|
256
256
|
return `${Math.ceil((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
257
257
|
};
|
|
258
|
+
|
|
259
|
+
export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
260
|
+
const isTraiDltFeatureForOrg = hasTraiDltFeature();
|
|
261
|
+
const isTariEnableforLib = (!isFullMode && smsRegister === "DLT" ) || isFullMode;
|
|
262
|
+
const isTraiDltFeature = isTraiDltFeatureForOrg && isTariEnableforLib;
|
|
263
|
+
return isTraiDltFeature;
|
|
264
|
+
};
|
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Helmet from 'react-helmet';
|
|
4
4
|
import { connect } from 'react-redux';
|
|
5
|
-
import { CapNotification, CapModal, CapSnackBar } from '@capillarytech/cap-ui-library';
|
|
5
|
+
import { CapNotification, CapModal, CapSnackBar, CapSomethingWentWrong } from '@capillarytech/cap-ui-library';
|
|
6
6
|
import { bindActionCreators } from 'redux';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -18,8 +18,8 @@ import * as locationActions from '../LanguageProvider/actions';
|
|
|
18
18
|
import * as appActions from '../App/actions';
|
|
19
19
|
import config from '../../config/app';
|
|
20
20
|
import NavigationBar from '../../v2Components/NavigationBar';
|
|
21
|
-
import { engagePlusPublicPath } from '../../config/path';
|
|
22
|
-
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW } from '../App/constants';
|
|
21
|
+
import { engagePlusPublicPath, publicPath } from '../../config/path';
|
|
22
|
+
import { GTM_TRACKING_ID, CREATIVES_UI_VIEW, FAILURE } from '../App/constants';
|
|
23
23
|
import { makeSelectLocale } from '../../v2Containers/LanguageProvider/selectors';
|
|
24
24
|
import {
|
|
25
25
|
ORG_SETTINGS_URL,
|
|
@@ -415,7 +415,7 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
415
415
|
|
|
416
416
|
render() {
|
|
417
417
|
const { Global, location } = this.props;
|
|
418
|
-
const { topbarMenuData, isLoggedIn, currentOrgDetails } = Global;
|
|
418
|
+
const { topbarMenuData, isLoggedIn, currentOrgDetails = {}, getUserDataStatus, getUserDataCode } = Global;
|
|
419
419
|
const topbarMenuDataOptions = topbarMenuData && topbarMenuData.data ? topbarMenuData.data : [];
|
|
420
420
|
const type = this.props.location.query.type;
|
|
421
421
|
const toastMessages = this.props.Global.messages;
|
|
@@ -438,6 +438,11 @@ export class Cap extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
438
438
|
]}
|
|
439
439
|
/>
|
|
440
440
|
<div className="wrapper">
|
|
441
|
+
{
|
|
442
|
+
getUserDataStatus === FAILURE &&
|
|
443
|
+
getUserDataCode !== 401 &&
|
|
444
|
+
<CapSomethingWentWrong url={`${window.location.origin}${publicPath}v2`} />
|
|
445
|
+
}
|
|
441
446
|
{isLoggedIn && type !== 'embedded' ?
|
|
442
447
|
<NavigationBar
|
|
443
448
|
userData={Global}
|
|
@@ -5,6 +5,7 @@ import { fromJS } from 'immutable';
|
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
import * as types from './constants';
|
|
7
7
|
import initialState from '../../initialState';
|
|
8
|
+
import { FAILURE } from '../App/constants';
|
|
8
9
|
|
|
9
10
|
function capReducer(state = fromJS(initialState.cap), action) {
|
|
10
11
|
switch (action.type) {
|
|
@@ -73,7 +74,9 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
73
74
|
case types.GET_USER_DATA_FAILURE:
|
|
74
75
|
return state
|
|
75
76
|
.set('fetching_userdata', false)
|
|
76
|
-
.set('isLoggedIn', false)
|
|
77
|
+
.set('isLoggedIn', false)
|
|
78
|
+
.set('getUserDataStatus', FAILURE)
|
|
79
|
+
.set('getUserDataCode', action.status);
|
|
77
80
|
case types.GET_SCHEMA_FOR_ENTITY_REQUEST:
|
|
78
81
|
return state
|
|
79
82
|
.set('fetchingSchema', true);
|
|
@@ -77,27 +77,38 @@ function* logoutFlow() {
|
|
|
77
77
|
export function* fetchUserInfo(option) {
|
|
78
78
|
try {
|
|
79
79
|
const result = yield call(Api.getUserData);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
80
|
+
if (result?.isError || result?.status === 401) {
|
|
81
|
+
yield call(LocalStorage.clearItem, 'user');
|
|
82
|
+
yield put({
|
|
83
|
+
type: types.GET_USER_DATA_FAILURE,
|
|
84
|
+
error: result,
|
|
85
|
+
status: result?.status,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
else {
|
|
90
|
+
const userData = result.user;
|
|
91
|
+
// const orgId = yield select(makeSelectOrgId());
|
|
92
|
+
// yield put({type: types.GET_ORG_DETAILS_REQUEST, orgId});
|
|
93
|
+
const currentOrgDetails = result.currentOrgDetails;
|
|
94
|
+
if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.base_language && (currentOrgDetails.basic_details.base_language !== "" || currentOrgDetails.basic_details.base_language === null))) {
|
|
95
|
+
currentOrgDetails.basic_details.base_language = 'en';
|
|
96
|
+
}
|
|
97
|
+
if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.supported_languages && currentOrgDetails.basic_details.supported_languages.length > 0)) {
|
|
98
|
+
currentOrgDetails.basic_details.supported_languages = [
|
|
99
|
+
{
|
|
100
|
+
lang_id: 69,
|
|
101
|
+
language: "English",
|
|
102
|
+
iso_code: "en",
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
yield call(LocalStorage.saveItem, 'orgID', result.currentOrgId);
|
|
107
|
+
yield call(LocalStorage.saveItem, 'user', userData);
|
|
108
|
+
yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails});
|
|
109
|
+
if (option.callback) {
|
|
110
|
+
option.callback(userData);
|
|
111
|
+
}
|
|
101
112
|
}
|
|
102
113
|
} catch (error) {
|
|
103
114
|
yield call(LocalStorage.clearItem, 'user');
|
|
@@ -142,6 +142,7 @@ function SlideBoxContent(props) {
|
|
|
142
142
|
fbAdManager,
|
|
143
143
|
showDisabledFBInfo,
|
|
144
144
|
orgUnitId,
|
|
145
|
+
smsRegister,
|
|
145
146
|
} = props;
|
|
146
147
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
147
148
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -201,12 +202,18 @@ function SlideBoxContent(props) {
|
|
|
201
202
|
|
|
202
203
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
203
204
|
switch (templateDataObject.type.toUpperCase()) {
|
|
204
|
-
case constants.SMS:
|
|
205
|
-
|
|
205
|
+
case constants.SMS: {
|
|
206
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
207
|
+
const updatedSmsEditor = get(
|
|
208
|
+
templateDataObject,
|
|
209
|
+
`versions.base['updated-sms-editor']`,
|
|
210
|
+
'',
|
|
211
|
+
);
|
|
212
|
+
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
206
213
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
-
} else {
|
|
208
|
-
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
209
214
|
}
|
|
215
|
+
return updatedSmsEditor.join('');
|
|
216
|
+
}
|
|
210
217
|
case constants.LINE: {
|
|
211
218
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
212
219
|
const previewContent = [];
|
|
@@ -347,6 +354,7 @@ function SlideBoxContent(props) {
|
|
|
347
354
|
messageStrategy={messageStrategy}
|
|
348
355
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
349
356
|
orgUnitId={orgUnitId}
|
|
357
|
+
smsRegister={smsRegister}
|
|
350
358
|
/>
|
|
351
359
|
)}
|
|
352
360
|
{isPreview && (
|
|
@@ -416,6 +424,7 @@ function SlideBoxContent(props) {
|
|
|
416
424
|
onTestContentClicked={onTestContentClicked}
|
|
417
425
|
handleClose={handleClose}
|
|
418
426
|
onCreateComplete={onCreateComplete}
|
|
427
|
+
smsRegister={smsRegister}
|
|
419
428
|
/>
|
|
420
429
|
)}
|
|
421
430
|
{isEditFTP && (
|
|
@@ -463,6 +472,8 @@ function SlideBoxContent(props) {
|
|
|
463
472
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
464
473
|
onTestContentClicked={onTestContentClicked}
|
|
465
474
|
onCreateComplete={onCreateComplete}
|
|
475
|
+
smsRegister={smsRegister}
|
|
476
|
+
onShowTemplates={onShowTemplates}
|
|
466
477
|
/>
|
|
467
478
|
)}
|
|
468
479
|
|
|
@@ -716,5 +727,6 @@ SlideBoxContent.propTypes = {
|
|
|
716
727
|
fbAdManager: PropTypes.string,
|
|
717
728
|
showDisabledFBInfo: PropTypes.boolean,
|
|
718
729
|
orgUnitId: PropTypes.any,
|
|
730
|
+
smsRegister: PropTypes.any,
|
|
719
731
|
};
|
|
720
732
|
export default SlideBoxContent;
|
|
@@ -7,7 +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 {
|
|
10
|
+
import { isTraiDLTEnable } from '../../utils/common';
|
|
11
11
|
const PrefixWrapper = styled.div`
|
|
12
12
|
margin-right: 16px;
|
|
13
13
|
`;
|
|
@@ -25,11 +25,12 @@ function getChannelLabel(channel = '') {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
function SlideBoxHeader(props) {
|
|
28
|
-
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
28
|
+
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister } = props;
|
|
29
29
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
30
30
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
31
|
-
const
|
|
32
|
-
const showCreateTraiSMSHeader =
|
|
31
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
32
|
+
const showCreateTraiSMSHeader = isTraiDlt && channel.toLowerCase() === "sms";
|
|
33
|
+
|
|
33
34
|
return (
|
|
34
35
|
<div key="creatives-container-slidebox-header-content">
|
|
35
36
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -103,5 +104,6 @@ SlideBoxHeader.propTypes = {
|
|
|
103
104
|
channel: PropTypes.string,
|
|
104
105
|
shouldShowTemplateName: PropTypes.bool,
|
|
105
106
|
templateNameRenderProp: PropTypes.func,
|
|
107
|
+
smsRegister: PropTypes.any,
|
|
106
108
|
};
|
|
107
109
|
export default SlideBoxHeader;
|
|
@@ -156,7 +156,7 @@ class Creatives extends React.Component {
|
|
|
156
156
|
this.setState({ isGetFormData: false });
|
|
157
157
|
};
|
|
158
158
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
159
|
-
const {isFullMode, messageDetails = {}} = this.props;
|
|
159
|
+
const { isFullMode, messageDetails = {}, smsRegister } = this.props;
|
|
160
160
|
const { additionalProperties = {} } = messageDetails;
|
|
161
161
|
if (!isFullMode && templateData) { // for component mode
|
|
162
162
|
const {channel} = templateData;
|
|
@@ -170,9 +170,28 @@ class Creatives extends React.Component {
|
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
case constants.SMS: {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
174
|
+
let formData = {};
|
|
175
|
+
if (isTraiDlt) {
|
|
176
|
+
const {
|
|
177
|
+
template_id = '',
|
|
178
|
+
header = '',
|
|
179
|
+
template_name = '',
|
|
180
|
+
'sms-editor': smsEditor = '',
|
|
181
|
+
'var-mapped': varMapped = {},
|
|
182
|
+
} = templateData;
|
|
183
|
+
formData = {
|
|
184
|
+
template_id,
|
|
185
|
+
header,
|
|
186
|
+
template_name,
|
|
187
|
+
'sms-editor': smsEditor,
|
|
188
|
+
'var-mapped': varMapped,
|
|
189
|
+
};
|
|
190
|
+
} else {
|
|
191
|
+
formData = {
|
|
192
|
+
'sms-editor': templateData.messageBody,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
176
195
|
creativesTemplateData = {
|
|
177
196
|
type: channel,
|
|
178
197
|
name: "Campaign message SMS content",
|
|
@@ -286,14 +305,14 @@ class Creatives extends React.Component {
|
|
|
286
305
|
type: constants.FACEBOOK,
|
|
287
306
|
edit: true,
|
|
288
307
|
selectedFacebookAccount,
|
|
289
|
-
fbContentType
|
|
308
|
+
fbContentType,
|
|
290
309
|
};
|
|
291
310
|
} else {
|
|
292
311
|
creativesTemplateData = {
|
|
293
312
|
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
294
313
|
edit: true,
|
|
295
314
|
type: channel,
|
|
296
|
-
fbContentType: templateData.fbContentType
|
|
315
|
+
fbContentType: templateData.fbContentType,
|
|
297
316
|
};
|
|
298
317
|
}
|
|
299
318
|
break;
|
|
@@ -357,7 +376,31 @@ class Creatives extends React.Component {
|
|
|
357
376
|
switch (channel) {
|
|
358
377
|
case constants.SMS:
|
|
359
378
|
if (template.value.base) {
|
|
360
|
-
|
|
379
|
+
const smsBase = template.value.base || {};
|
|
380
|
+
const { isFullMode, smsRegister } = this.props;
|
|
381
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
382
|
+
const {
|
|
383
|
+
'updated-sms-editor': updatedSmsEditor,
|
|
384
|
+
'sms-editor': smsEditor,
|
|
385
|
+
} = smsBase;
|
|
386
|
+
if (!isTraiDlt) {
|
|
387
|
+
templateData.messageBody = smsEditor;
|
|
388
|
+
} else {
|
|
389
|
+
templateData.messageBody = updatedSmsEditor === "" ? smsEditor : updatedSmsEditor.join('');
|
|
390
|
+
const {
|
|
391
|
+
template_id,
|
|
392
|
+
template_name,
|
|
393
|
+
header,
|
|
394
|
+
'var-mapped': varMapped,
|
|
395
|
+
} = smsBase;
|
|
396
|
+
templateData.templateConfigs = {
|
|
397
|
+
templateId: template_id,
|
|
398
|
+
templateName: template_name,
|
|
399
|
+
template: smsEditor,
|
|
400
|
+
registeredSenderIds: header,
|
|
401
|
+
templateVariableMapping: varMapped,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
361
404
|
}
|
|
362
405
|
break;
|
|
363
406
|
case constants.EMAIL:
|
|
@@ -771,7 +814,7 @@ class Creatives extends React.Component {
|
|
|
771
814
|
}
|
|
772
815
|
render() {
|
|
773
816
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
774
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
817
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
775
818
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
776
819
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
777
820
|
return (
|
|
@@ -795,6 +838,7 @@ class Creatives extends React.Component {
|
|
|
795
838
|
weChatTemplateType={weChatTemplateType}
|
|
796
839
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
797
840
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
841
|
+
smsRegister={smsRegister}
|
|
798
842
|
/>}
|
|
799
843
|
content={
|
|
800
844
|
<SlideBoxContent
|
|
@@ -848,6 +892,7 @@ class Creatives extends React.Component {
|
|
|
848
892
|
handleClose={this.handleCloseSlideBox}
|
|
849
893
|
onFTPSubmit={getCreativesData}
|
|
850
894
|
editor={editor}
|
|
895
|
+
smsRegister={smsRegister}
|
|
851
896
|
messageStrategy={this.props.strategy}
|
|
852
897
|
orgUnitId={this.props.orgUnitId}
|
|
853
898
|
/>
|
|
@@ -13,20 +13,20 @@ export const TEMPLATE_ID = 'template id';
|
|
|
13
13
|
export const SMS = 'SMS';
|
|
14
14
|
|
|
15
15
|
export const MAPPED_SAVED_COLUMN = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'TEMPLATE
|
|
27
|
-
'TEMPLATE CONTENT':
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
'TEMPLATE ID': 'template_id',
|
|
17
|
+
'TEMPLATE REGISTRATION NUMBER': 'template_id',
|
|
18
|
+
'TEMPLATE NAME': 'template_name',
|
|
19
|
+
'TYPE': 'type',
|
|
20
|
+
'HEADER': 'header',
|
|
21
|
+
'SENDER ID': 'header',
|
|
22
|
+
'SENDERS': 'header',
|
|
23
|
+
'HEADER ID': 'header',
|
|
24
|
+
'HEADERS': 'header',
|
|
25
|
+
'CATEGORY': 'category',
|
|
26
|
+
'TEMPLATE MESSAGE': 'sms-editor',
|
|
27
|
+
'TEMPLATE CONTENT': 'sms-editor',
|
|
28
|
+
'CONSENT TYPE': 'consent-type',
|
|
29
|
+
'COMMUNICATION TYPE': 'consent-type',
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const HEADER_ALIASES = [
|
|
@@ -48,8 +48,7 @@ export const TEMPLATE_MESSAGE_ALIASES = [
|
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
export const MANDATORY_COLUMNS = [TEMPLATE_NAME, TYPE, APPROVAL_STATUS];
|
|
51
|
-
export const SAVED_COLUMNS = [TEMPLATE_NAME, TYPE,
|
|
52
|
-
|
|
51
|
+
export const SAVED_COLUMNS = [TEMPLATE_NAME, TYPE, 'category', 'consent type'];
|
|
53
52
|
|
|
54
53
|
export const SAMPLE_CSV_DATA = [
|
|
55
54
|
[
|
|
@@ -67,8 +66,11 @@ export const SAMPLE_CSV = 'Sample.csv';
|
|
|
67
66
|
export const CAPILLARY_REJECTION_REASON = 'CAPILLARY REJECTION REASON';
|
|
68
67
|
export const APPROVED = 'approved';
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export const CREATE_TRAI_SMS_TEMPLATE_SUCCESS =
|
|
73
|
-
|
|
74
|
-
export const
|
|
69
|
+
export const CREATE_TRAI_SMS_TEMPLATE_REQUEST =
|
|
70
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_REQUEST';
|
|
71
|
+
export const CREATE_TRAI_SMS_TEMPLATE_SUCCESS =
|
|
72
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_SUCCESS';
|
|
73
|
+
export const CREATE_TRAI_SMS_TEMPLATE_FAILURE =
|
|
74
|
+
'app/v2Containers/SmsTrai/Create/CREATE_TRAI_SMS_TEMPLATE_FAILURE';
|
|
75
|
+
export const CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST =
|
|
76
|
+
'app/v2Containers/SmsTrai/Create/CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST';
|