@capillarytech/creatives-library 8.0.44 → 8.0.45
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/containers/Cap/sagas.js +15 -10
- package/containers/Cap/tests/saga.test.js +10 -9
- package/containers/Ebill/sagas.js +3 -1
- package/containers/Email/sagas.js +3 -1
- package/containers/Line/Create/sagas.js +3 -2
- package/containers/Line/Edit/sagas.js +1 -1
- package/containers/MobilePush/Create/sagas.js +3 -1
- package/containers/MobilePush/Edit/sagas.js +3 -1
- package/containers/Sms/Create/sagas.js +3 -1
- package/containers/Sms/Edit/sagas.js +3 -1
- package/containers/Templates/sagas.js +3 -1
- package/containers/WeChat/MapTemplates/sagas.js +3 -1
- package/hoc/withCreatives.js +2 -3
- package/package.json +1 -1
- package/services/api.js +18 -22
- package/styles/containers/login/_loginPage.scss +2 -1
- package/v2Components/Ckeditor/index.js +2 -4
- package/v2Components/NavigationBar/index.js +5 -7
- package/v2Containers/Assets/Gallery/sagas.js +1 -1
- package/v2Containers/BeeEditor/sagas.js +2 -2
- package/v2Containers/CallTask/sagas.js +1 -1
- package/v2Containers/Cap/index.js +7 -0
- package/v2Containers/Cap/sagas.js +9 -5
- package/v2Containers/CapFacebookPreview/sagas.js +4 -2
- package/v2Containers/CreativesContainer/index.js +155 -111
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +5 -5
- package/v2Containers/Email/sagas.js +4 -2
- package/v2Containers/FTP/sagas.js +4 -2
- package/v2Containers/Facebook/sagas.js +7 -3
- package/v2Containers/InApp/sagas.js +3 -1
- package/v2Containers/InApp/tests/sagas.test.js +2 -2
- package/v2Containers/LanguageProvider/sagas.js +3 -1
- package/v2Containers/Line/Container/index.js +3 -10
- package/v2Containers/Line/Container/sagas.js +3 -1
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Create/sagas.js +3 -1
- package/v2Containers/MobilePush/Edit/sagas.js +15 -27
- package/v2Containers/Rcs/sagas.js +3 -1
- package/v2Containers/Sms/Create/sagas.js +3 -1
- package/v2Containers/Sms/Edit/index.js +0 -1
- package/v2Containers/Sms/Edit/sagas.js +8 -9
- package/v2Containers/SmsTrai/Create/sagas.js +3 -1
- package/v2Containers/Templates/actions.js +3 -1
- package/v2Containers/Templates/index.js +5 -0
- package/v2Containers/Templates/reducer.js +6 -6
- package/v2Containers/Templates/sagas.js +9 -27
- package/v2Containers/TemplatesV2/index.js +0 -8
- package/v2Containers/Viber/sagas.js +3 -2
- package/v2Containers/WeChat/MapTemplates/sagas.js +14 -23
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +3 -1
- package/v2Containers/Whatsapp/sagas.js +3 -1
- package/v2Containers/Zalo/index.js +0 -4
- package/v2Containers/Zalo/saga.js +1 -1
|
@@ -85,7 +85,7 @@ exports[`Test SlideBoxContent container Should render correct component for line
|
|
|
85
85
|
}
|
|
86
86
|
viberBrandName=""
|
|
87
87
|
/>
|
|
88
|
-
<
|
|
88
|
+
<Connect(Connect(UserIsAuthenticated(InjectIntl(CreativesCommon))))
|
|
89
89
|
location={
|
|
90
90
|
Object {
|
|
91
91
|
"pathname": "/sms/edit",
|
|
@@ -283,7 +283,7 @@ exports[`Test SlideBoxContent container Should render correct component for line
|
|
|
283
283
|
}
|
|
284
284
|
viberBrandName=""
|
|
285
285
|
/>
|
|
286
|
-
<
|
|
286
|
+
<Connect(Connect(UserIsAuthenticated(InjectIntl(CreativesCommon))))
|
|
287
287
|
location={
|
|
288
288
|
Object {
|
|
289
289
|
"pathname": "/sms/edit",
|
|
@@ -453,7 +453,7 @@ exports[`Test SlideBoxContent container Should render correct component for line
|
|
|
453
453
|
}
|
|
454
454
|
viberBrandName=""
|
|
455
455
|
/>
|
|
456
|
-
<
|
|
456
|
+
<Connect(Connect(UserIsAuthenticated(InjectIntl(CreativesCommon))))
|
|
457
457
|
location={
|
|
458
458
|
Object {
|
|
459
459
|
"pathname": "/sms/edit",
|
|
@@ -637,7 +637,7 @@ exports[`Test SlideBoxContent container Should render correct component for rcs
|
|
|
637
637
|
|
|
638
638
|
exports[`Test SlideBoxContent container Should render correct component for rcs channel templates mode 1`] = `
|
|
639
639
|
<SlideBoxContent__CreativesWrapper>
|
|
640
|
-
<Connect(UserIsAuthenticated(
|
|
640
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
|
|
641
641
|
FTPMode="create"
|
|
642
642
|
channel="rcs"
|
|
643
643
|
location={
|
|
@@ -1027,7 +1027,7 @@ Click {{3}} to unsubscribe",
|
|
|
1027
1027
|
|
|
1028
1028
|
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel templates mode 1`] = `
|
|
1029
1029
|
<SlideBoxContent__CreativesWrapper>
|
|
1030
|
-
<Connect(UserIsAuthenticated(
|
|
1030
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
|
|
1031
1031
|
FTPMode="create"
|
|
1032
1032
|
channel="whatsapp"
|
|
1033
1033
|
location={
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, takeEvery, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
import * as Api from '../../services/api';
|
|
3
5
|
import * as types from './constants';
|
|
4
6
|
import { transformEmailTemplates, storeS3FileSizeDetails } from '../../utils/cdnTransformation';
|
|
@@ -157,4 +159,4 @@ export function* v2EmailDuplicateTemplateSaga() {
|
|
|
157
159
|
yield all([
|
|
158
160
|
watchDuplicateTemplate(),
|
|
159
161
|
]);
|
|
160
|
-
}
|
|
162
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
import * as Api from '../../services/api';
|
|
3
5
|
import * as types from './constants';
|
|
4
6
|
|
|
@@ -28,4 +30,4 @@ export function* v2FTPSagas() {
|
|
|
28
30
|
yield all([
|
|
29
31
|
watchGetFTPServers(),
|
|
30
32
|
]);
|
|
31
|
-
}
|
|
33
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
import * as Api from '../../services/api';
|
|
3
5
|
import {
|
|
4
6
|
GET_MARKETING_OBJECTIVES,
|
|
@@ -121,7 +123,9 @@ export function* editTemplate({ template, callback }) {
|
|
|
121
123
|
if (callback) {
|
|
122
124
|
callback(result.response);
|
|
123
125
|
}
|
|
124
|
-
yield put({
|
|
126
|
+
yield put({
|
|
127
|
+
type: EDIT_FACEBOOK_AD_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg,
|
|
128
|
+
});
|
|
125
129
|
} catch (error) {
|
|
126
130
|
yield put({ type: EDIT_FACEBOOK_AD_TEMPLATE_FAILURE, error, errorMsg });
|
|
127
131
|
if (callback) {
|
|
@@ -194,4 +198,4 @@ export function* v2FacebookSagas() {
|
|
|
194
198
|
watchCreateTemplate(),
|
|
195
199
|
watchGetOrgOUs(),
|
|
196
200
|
]);
|
|
197
|
-
}
|
|
201
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
call,
|
|
2
|
+
call, put, takeLatest,
|
|
3
3
|
} from 'redux-saga/effects';
|
|
4
4
|
import { createMockTask } from 'redux-saga/utils';
|
|
5
|
+
import { expectSaga } from 'redux-saga-test-plan';
|
|
5
6
|
import * as sagas from '../sagas';
|
|
6
7
|
import * as Api from '../../../services/api';
|
|
7
8
|
import * as types from '../constants';
|
|
@@ -9,7 +10,6 @@ import { INAPP } from '../../CreativesContainer/constants';
|
|
|
9
10
|
import {
|
|
10
11
|
v2InAppSagas,
|
|
11
12
|
} from "../sagas";
|
|
12
|
-
import { expectSaga } from 'redux-saga-test-plan';
|
|
13
13
|
|
|
14
14
|
describe('test for uploadInAppAsset function', () => {
|
|
15
15
|
it('should dispatch UPLOAD_INAPP_ASSET_SUCCESS action with asset data, status code, and template type', () => {
|
|
@@ -7,7 +7,7 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
7
7
|
import style from './style';
|
|
8
8
|
import withStyles from '../../../hoc/withStyles';
|
|
9
9
|
import './_lineCreate.scss';
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
12
12
|
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
13
13
|
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
@@ -35,8 +35,6 @@ import withCreatives from '../../../hoc/withCreatives';
|
|
|
35
35
|
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
36
36
|
import { LINE } from '../../CreativesContainer/constants';
|
|
37
37
|
import * as commonUtil from '../../../utils/common';
|
|
38
|
-
import injectReducer from '../../../utils/injectReducer';
|
|
39
|
-
import v2LineContainerReducer from './reducer';
|
|
40
38
|
|
|
41
39
|
const { stopTimer } = GA.timeTracker;
|
|
42
40
|
|
|
@@ -880,17 +878,12 @@ function mapDispatchToProps(dispatch) {
|
|
|
880
878
|
return {
|
|
881
879
|
actions: bindActionCreators(compActions, dispatch),
|
|
882
880
|
templateActions: bindActionCreators(templateActionsConfig, dispatch),
|
|
883
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
884
881
|
};
|
|
885
882
|
}
|
|
886
883
|
|
|
887
|
-
const withReducer = injectReducer({ key: 'lineCreate', reducer: v2LineContainerReducer });
|
|
888
|
-
|
|
889
884
|
export default withCreatives({
|
|
890
|
-
WrappedComponent: withStyles(LineContainer, style),
|
|
885
|
+
WrappedComponent: injectIntl(withStyles(LineContainer, style)),
|
|
891
886
|
mapStateToProps,
|
|
892
887
|
mapDispatchToProps,
|
|
893
888
|
userAuth: true,
|
|
894
|
-
|
|
895
|
-
});
|
|
896
|
-
|
|
889
|
+
});
|
|
@@ -1920,7 +1920,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
1922
|
const withReducer = injectReducer({ key: 'mobileCreate', reducer: v2MobilePushCreateReducer });
|
|
1923
|
-
const withSaga = injectSaga({ key: '
|
|
1923
|
+
const withSaga = injectSaga({ key: 'mobilePushDuplicateTemplate', saga: v2MobilePushWatchDuplicateTemplateSaga});
|
|
1924
1924
|
|
|
1925
1925
|
export default withCreatives({
|
|
1926
1926
|
WrappedComponent: Create,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
// import { schema, normalize } from 'normalizr';
|
|
3
5
|
import * as Api from '../../../services/api';
|
|
4
6
|
import * as types from './constants';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
// import { schema, normalize } from 'normalizr';
|
|
3
5
|
import * as Api from '../../../services/api';
|
|
4
6
|
import * as types from './constants';
|
|
@@ -7,14 +9,15 @@ import * as types from './constants';
|
|
|
7
9
|
export function* editTemplate(template) {
|
|
8
10
|
let errorMsg;
|
|
9
11
|
try {
|
|
10
|
-
|
|
11
12
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
12
|
-
|
|
13
|
+
|
|
13
14
|
if (result.message || result.status.code === 500) {
|
|
14
15
|
errorMsg = result.message;
|
|
15
16
|
}
|
|
16
|
-
yield put({
|
|
17
|
-
|
|
17
|
+
yield put( {
|
|
18
|
+
type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg,
|
|
19
|
+
});
|
|
20
|
+
yield call(template.callback, { templateId: result?.response?.templateId._id });
|
|
18
21
|
} catch (error) {
|
|
19
22
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
20
23
|
}
|
|
@@ -22,7 +25,6 @@ export function* editTemplate(template) {
|
|
|
22
25
|
|
|
23
26
|
export function* getTemplateDetails(id) {
|
|
24
27
|
try {
|
|
25
|
-
|
|
26
28
|
const result = yield call(Api.getTemplateDetails, id);
|
|
27
29
|
// const sidebar = result.response.sidebar;
|
|
28
30
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -49,7 +51,6 @@ export function* getIosCtas(licenseCode) {
|
|
|
49
51
|
|
|
50
52
|
export function* getMobilepushTemplatesList(params) {
|
|
51
53
|
try {
|
|
52
|
-
|
|
53
54
|
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
54
55
|
yield put({ type: types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
55
56
|
} catch (error) {
|
|
@@ -58,52 +59,39 @@ export function* getMobilepushTemplatesList(params) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export function* fetchWeCrmAccounts(action) {
|
|
61
|
-
|
|
62
62
|
try {
|
|
63
63
|
const result = yield call(Api.fetchWeCrmAccounts, action.source);
|
|
64
64
|
yield put({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
type: types.GET_WECRM_ACCOUNTS_SUCCESS,
|
|
66
|
+
data: result.response,
|
|
67
|
+
});
|
|
68
68
|
} catch (error) {
|
|
69
69
|
yield put({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
type: types.GET_WECRM_ACCOUNTS_FAILURE,
|
|
71
|
+
data: error,
|
|
72
|
+
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function* watchFetchWeCrmAccounts() {
|
|
77
77
|
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
78
|
-
|
|
79
|
-
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
function* watchEditTemplate() {
|
|
83
81
|
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
84
|
-
|
|
85
|
-
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
function* watchGetTemplateDetails() {
|
|
89
85
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
90
|
-
|
|
91
|
-
|
|
92
86
|
}
|
|
93
87
|
function* watchUploadAsset() {
|
|
94
88
|
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
95
|
-
|
|
96
|
-
|
|
97
89
|
}
|
|
98
90
|
function* watchGetIosCtas() {
|
|
99
91
|
yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
|
|
100
|
-
|
|
101
|
-
|
|
102
92
|
}
|
|
103
93
|
function* watchMobilepushTemplatesList() {
|
|
104
94
|
yield takeLatest(types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST, getMobilepushTemplatesList);
|
|
105
|
-
|
|
106
|
-
|
|
107
95
|
}
|
|
108
96
|
|
|
109
97
|
// All sagas to be loaded
|
|
@@ -122,4 +110,4 @@ export function* v2MobilePushEditSagas() {
|
|
|
122
110
|
watchUploadAsset(),
|
|
123
111
|
watchGetIosCtas(),
|
|
124
112
|
]);
|
|
125
|
-
}
|
|
113
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
// import { schema, normalize } from 'normalizr';
|
|
3
5
|
import * as Api from '../../../services/api';
|
|
4
6
|
import * as types from './constants';
|
|
@@ -924,7 +924,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
924
924
|
const formData = _.cloneDeep(this.state.formData);
|
|
925
925
|
editData.name = formData['template-name'];
|
|
926
926
|
editData.versions.base = formData.base;
|
|
927
|
-
|
|
928
927
|
this.props.actions.editTemplate(editData, this.onUpdateTemplateComplete);
|
|
929
928
|
}
|
|
930
929
|
isSmsLoading = () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
3
4
|
import * as Api from '../../../services/api';
|
|
4
5
|
import * as types from './constants';
|
|
5
6
|
|
|
@@ -13,8 +14,10 @@ export function* editTemplate(template) {
|
|
|
13
14
|
errorMsg = result.message;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
yield put({
|
|
17
|
-
|
|
17
|
+
yield put({
|
|
18
|
+
type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg
|
|
19
|
+
});
|
|
20
|
+
yield template.onUpdateTemplateComplete(result.response, errorMsg);
|
|
18
21
|
} catch (error) {
|
|
19
22
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
20
23
|
}
|
|
@@ -33,14 +36,10 @@ export function* getTemplateDetails(id) {
|
|
|
33
36
|
|
|
34
37
|
function* watchEditTemplate() {
|
|
35
38
|
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
36
|
-
|
|
37
|
-
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function* watchGetTemplateDetails() {
|
|
41
42
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
42
|
-
|
|
43
|
-
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
// All sagas to be loaded
|
|
@@ -53,4 +52,4 @@ export function* v2SmsEditSagas() {
|
|
|
53
52
|
watchEditTemplate(),
|
|
54
53
|
watchGetTemplateDetails(),
|
|
55
54
|
]);
|
|
56
|
-
}
|
|
55
|
+
}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as types from './constants';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
LINE, WHATSAPP, RCS, ZALO,
|
|
10
|
+
} from '../CreativesContainer/constants';
|
|
9
11
|
|
|
10
12
|
export function getAllTemplates(channel, queryParams, intlCopyOf = '') {
|
|
11
13
|
return {
|
|
@@ -136,6 +136,9 @@ import { MAPP_SDK } from '../InApp/constants';
|
|
|
136
136
|
import injectReducer from '../../utils/injectReducer';
|
|
137
137
|
import v2TemplateReducer from './reducer';
|
|
138
138
|
import { compose } from 'redux';
|
|
139
|
+
import { v2TemplateSaga } from './sagas';
|
|
140
|
+
import injectSaga from '../../utils/injectSaga';
|
|
141
|
+
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
139
142
|
|
|
140
143
|
const { timeTracker } = GA;
|
|
141
144
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -3234,9 +3237,11 @@ function mapDispatchToProps(dispatch) {
|
|
|
3234
3237
|
|
|
3235
3238
|
const withReducer = injectReducer({ key: 'templates', reducer: v2TemplateReducer });
|
|
3236
3239
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
3240
|
+
const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga, mode: DAEMON });
|
|
3237
3241
|
|
|
3238
3242
|
export default compose(
|
|
3239
3243
|
UserIsAuthenticated,
|
|
3244
|
+
withSaga,
|
|
3240
3245
|
withReducer,
|
|
3241
3246
|
withConnect,
|
|
3242
3247
|
)(injectIntl(Templates));
|
|
@@ -170,12 +170,12 @@ function templatesReducer(state = initialState, action) {
|
|
|
170
170
|
return state.set('fetchedOrgLevelCampaignSettings', false);
|
|
171
171
|
case types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS:
|
|
172
172
|
return state.set('fetchedOrgLevelCampaignSettings', true).set(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
'campaignSettings',
|
|
174
|
+
fromJS({
|
|
175
|
+
...state.get('campaignSettings'),
|
|
176
|
+
...(action.result || {}).entity,
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
179
|
case types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE:
|
|
180
180
|
return state.set('fetchedOrgLevelCampaignSettings', false);
|
|
181
181
|
case types.GET_SENDER_DETAILS_REQUEST:
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
2
4
|
import get from 'lodash/get';
|
|
3
5
|
// import { schema, normalize } from 'normalizr';
|
|
4
6
|
import * as Api from '../../services/api';
|
|
@@ -9,7 +11,7 @@ import { COPY_OF } from '../../containers/App/constants';
|
|
|
9
11
|
export function* getAllTemplates(channel, queryParams) {
|
|
10
12
|
try {
|
|
11
13
|
const result = yield call(Api.getAllTemplates, channel, queryParams);
|
|
12
|
-
const channelTemplates = (channel.channel === 'wechat') ? {templates: [...result.response.mapped, ...result.response.richmedia]} : result.response;
|
|
14
|
+
const channelTemplates = (channel.channel === 'wechat') ? { templates: [...result.response.mapped, ...result.response.richmedia] } : result.response;
|
|
13
15
|
// const sidebar = result.response.sidebar;
|
|
14
16
|
if (channel.channel === 'wechat' && channel.queryParams && channel.queryParams.sortBy && channel.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
|
|
15
17
|
channelTemplates.templates.sort((a, b) => {
|
|
@@ -105,13 +107,9 @@ export function* watchGetOrgLevelCampaignSettings() {
|
|
|
105
107
|
types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST,
|
|
106
108
|
getOrgLevelCampaignSettings,
|
|
107
109
|
);
|
|
108
|
-
const store = yield select();
|
|
109
|
-
if (!store.getIn(['router', 'location', 'pathname']).includes('/settings/')) {
|
|
110
|
-
|
|
111
|
-
}
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
export function* sendZippedFile({selectedFile, errorHandler, successHandler}) {
|
|
112
|
+
export function* sendZippedFile({ selectedFile, errorHandler, successHandler }) {
|
|
115
113
|
let errorMessage = "";
|
|
116
114
|
try {
|
|
117
115
|
const result = yield call(Api.sendZippedFile, selectedFile);
|
|
@@ -119,7 +117,7 @@ export function* sendZippedFile({selectedFile, errorHandler, successHandler}) {
|
|
|
119
117
|
errorMessage = result.message;
|
|
120
118
|
yield errorHandler(errorMessage);
|
|
121
119
|
}
|
|
122
|
-
|
|
120
|
+
|
|
123
121
|
yield put({
|
|
124
122
|
type: types.SEND_ZIPPED_FILE_SUCCESS,
|
|
125
123
|
selectedTemplate: decodeURIComponent(result.response.metaEntity.htmlContent),
|
|
@@ -181,50 +179,34 @@ export function* getSenderDetails({
|
|
|
181
179
|
|
|
182
180
|
export function* watchGetAllTemplates() {
|
|
183
181
|
yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
|
|
184
|
-
|
|
185
|
-
|
|
186
182
|
}
|
|
187
183
|
|
|
188
184
|
export function* watchDeleteTemplate() {
|
|
189
185
|
yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
|
|
190
|
-
|
|
191
|
-
|
|
192
186
|
}
|
|
193
187
|
|
|
194
188
|
export function* watchGetUserList() {
|
|
195
189
|
yield takeLatest(types.GET_USER_LIST_REQUEST, fetchUserList);
|
|
196
|
-
|
|
197
|
-
|
|
198
190
|
}
|
|
199
191
|
|
|
200
192
|
export function* watchFetchWeCrmAccounts() {
|
|
201
193
|
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
202
|
-
|
|
203
|
-
|
|
204
194
|
}
|
|
205
195
|
|
|
206
196
|
export function* watchSendingFile() {
|
|
207
197
|
yield takeLatest(types.SEND_ZIPPED_FILE_REQUEST, sendZippedFile);
|
|
208
|
-
|
|
209
|
-
|
|
210
198
|
}
|
|
211
199
|
|
|
212
200
|
export function* watchGetDefaultBeeTemplates() {
|
|
213
201
|
yield takeLatest(types.GET_DEAFULT_BEE_TEMPLATES_REQUEST, getDefaultBeeTemplates);
|
|
214
|
-
|
|
215
|
-
|
|
216
202
|
}
|
|
217
203
|
|
|
218
204
|
export function* watchGetTemplateDetails() {
|
|
219
205
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
220
|
-
|
|
221
|
-
|
|
222
206
|
}
|
|
223
207
|
|
|
224
208
|
export function* watchGetSenderDetails() {
|
|
225
209
|
yield takeLatest(types.GET_SENDER_DETAILS_REQUEST, getSenderDetails);
|
|
226
|
-
|
|
227
|
-
|
|
228
210
|
}
|
|
229
211
|
|
|
230
212
|
export function* watchGetCdnTransformationConfig() {
|
|
@@ -253,11 +235,11 @@ export function* v2TemplateSaga() {
|
|
|
253
235
|
watchGetAllTemplates(),
|
|
254
236
|
watchDeleteTemplate(),
|
|
255
237
|
watchGetUserList(),
|
|
256
|
-
watchFetchWeCrmAccounts(),
|
|
257
238
|
watchGetTemplateDetails(),
|
|
258
239
|
watchGetOrgLevelCampaignSettings(),
|
|
259
|
-
watchGetSenderDetails(),
|
|
260
240
|
watchGetCdnTransformationConfig(),
|
|
241
|
+
watchFetchWeCrmAccounts(),
|
|
242
|
+
watchGetSenderDetails(),
|
|
261
243
|
]);
|
|
262
244
|
}
|
|
263
245
|
|
|
@@ -266,4 +248,4 @@ export function* v2TemplateSagaWatchGetDefaultBeeTemplates() {
|
|
|
266
248
|
watchSendingFile(),
|
|
267
249
|
watchGetDefaultBeeTemplates(),
|
|
268
250
|
]);
|
|
269
|
-
}
|
|
251
|
+
}
|
|
@@ -34,11 +34,7 @@ import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCA
|
|
|
34
34
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
35
35
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
36
36
|
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
37
|
-
import injectSaga from '../../utils/injectSaga';
|
|
38
|
-
import injectReducer from '../../utils/injectReducer';
|
|
39
37
|
|
|
40
|
-
import reducer from '../Templates/reducer';
|
|
41
|
-
import { v2TemplateSaga } from '../Templates/sagas';
|
|
42
38
|
|
|
43
39
|
const {CapCustomCardList} = CapCustomCard;
|
|
44
40
|
|
|
@@ -392,12 +388,8 @@ function mapDispatchToProps(dispatch) {
|
|
|
392
388
|
|
|
393
389
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
394
390
|
|
|
395
|
-
const withReducer = injectReducer({ key: 'templates', reducer });
|
|
396
|
-
const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga });
|
|
397
391
|
|
|
398
392
|
export default compose(
|
|
399
393
|
UserIsAuthenticated,
|
|
400
|
-
withSaga,
|
|
401
|
-
withReducer,
|
|
402
394
|
withConnect,
|
|
403
395
|
)(injectIntl(withStyles(TemplatesV2, styles)));
|