@capillarytech/creatives-library 8.0.43-alpha.1 → 8.0.44
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 +5 -5
- package/containers/Cap/tests/saga.test.js +4 -2
- package/containers/Ebill/sagas.js +1 -3
- package/containers/Email/sagas.js +1 -3
- package/containers/Line/Create/sagas.js +2 -3
- package/containers/Line/Edit/sagas.js +1 -1
- package/containers/MobilePush/Create/sagas.js +1 -3
- package/containers/MobilePush/Edit/sagas.js +1 -3
- package/containers/Sms/Create/sagas.js +1 -3
- package/containers/Sms/Edit/sagas.js +1 -3
- package/containers/Templates/sagas.js +1 -3
- package/containers/WeChat/MapTemplates/sagas.js +1 -3
- package/package.json +1 -1
- package/services/api.js +22 -18
- package/styles/containers/login/_loginPage.scss +1 -2
- package/v2Components/Ckeditor/index.js +5 -2
- 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/sagas.js +6 -8
- package/v2Containers/CapFacebookPreview/sagas.js +2 -4
- package/v2Containers/CreativesContainer/index.js +1 -1
- package/v2Containers/Email/sagas.js +2 -4
- package/v2Containers/FTP/sagas.js +2 -4
- package/v2Containers/Facebook/index.js +1 -1
- package/v2Containers/Facebook/sagas.js +3 -7
- package/v2Containers/InApp/sagas.js +1 -3
- package/v2Containers/InApp/tests/sagas.test.js +2 -2
- package/v2Containers/LanguageProvider/sagas.js +1 -3
- package/v2Containers/Line/Container/sagas.js +1 -3
- package/v2Containers/MobilePush/Create/sagas.js +1 -3
- package/v2Containers/MobilePush/Edit/sagas.js +2 -3
- package/v2Containers/Rcs/sagas.js +1 -3
- package/v2Containers/Sms/Create/actions.js +0 -1
- package/v2Containers/Sms/Create/sagas.js +1 -3
- package/v2Containers/Sms/Edit/actions.js +0 -1
- package/v2Containers/Sms/Edit/index.js +1 -3
- package/v2Containers/Sms/Edit/sagas.js +9 -8
- package/v2Containers/SmsTrai/Create/sagas.js +1 -3
- package/v2Containers/Templates/actions.js +1 -5
- package/v2Containers/Templates/index.js +0 -8
- package/v2Containers/Templates/reducer.js +0 -7
- package/v2Containers/Templates/sagas.js +25 -7
- package/v2Containers/TemplatesV2/index.js +8 -4
- package/v2Containers/Viber/sagas.js +2 -3
- package/v2Containers/WeChat/MapTemplates/sagas.js +1 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +1 -3
- package/v2Containers/Whatsapp/sagas.js +1 -3
- package/v2Containers/Zalo/saga.js +1 -1
package/containers/Cap/sagas.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fork, take, call, put, cancelled, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { fork, take, call, put, cancelled, cancel, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
import { getRedirectionUrl } from '@capillarytech/cap-ui-utils/utils/logoutUtil';
|
|
5
3
|
// import { normalize } from 'normalizr';
|
|
6
4
|
import * as Api from '../../services/api';
|
|
7
5
|
import * as LocalStorage from '../../services/localStorageApi';
|
|
8
6
|
import * as types from './constants';
|
|
7
|
+
import config from '../../config/app';
|
|
9
8
|
// import {makeSelectOrgId} from './selectors';
|
|
10
9
|
|
|
11
10
|
export function* authorize(user) {
|
|
@@ -39,11 +38,12 @@ function* switchOrg({orgID}) {
|
|
|
39
38
|
export function* loginFlow() {
|
|
40
39
|
let condition = true;
|
|
41
40
|
while (condition) {
|
|
42
|
-
const {user} = yield take(types.LOGIN_REQUEST);
|
|
43
|
-
yield fork(authorize, user);
|
|
41
|
+
const { user } = yield take(types.LOGIN_REQUEST);
|
|
42
|
+
const task = yield fork(authorize, user);
|
|
44
43
|
const action = yield take([types.LOGOUT_REQUEST, types.LOGIN_FAILURE]);
|
|
45
44
|
if (action.type === types.LOGOUT_REQUEST) {
|
|
46
45
|
condition = false;
|
|
46
|
+
yield cancel(task);
|
|
47
47
|
}
|
|
48
48
|
// yield call(LocalStorage.clearItem, 'token');
|
|
49
49
|
// yield call(LocalStorage.clearItem, 'orgID');
|
|
@@ -24,15 +24,17 @@ describe('loginFlow', () => {
|
|
|
24
24
|
it('should handle the login flow', () => {
|
|
25
25
|
const generator = loginFlow();
|
|
26
26
|
const user = { username: 'testuser', password: 'password123' };
|
|
27
|
+
let task;
|
|
27
28
|
|
|
28
29
|
// First iteration
|
|
29
30
|
expect(generator.next().value).toEqual(take(LOGIN_REQUEST));
|
|
30
31
|
expect(generator.next({ user }).value).toEqual(fork(authorize, user));
|
|
31
|
-
|
|
32
|
+
task = generator.next().value; // Assign the task value
|
|
32
33
|
try{
|
|
34
|
+
const logoutAction = { type: LOGOUT_REQUEST };
|
|
33
35
|
const failureAction = { type: LOGIN_FAILURE };
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
expect(generator.next(logoutAction).value).toEqual(cancel(task));
|
|
36
38
|
|
|
37
39
|
// When LOGIN_FAILURE action is dispatched
|
|
38
40
|
expect(generator.next(failureAction).value).toEqual(take(LOGIN_REQUEST));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { call, put, takeLatest } from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
2
|
// import { schema, normalize } from 'normalizr';
|
|
3
3
|
import * as Api from '../../../services/api';
|
|
4
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../services/api';
|
|
6
4
|
import * as types from './constants';
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -266,25 +266,29 @@ export const createChannelWiseTemplate = ({ channel, template }) => {
|
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
|
|
269
|
-
export const getTemplateDetails =
|
|
269
|
+
export const getTemplateDetails = ({id, channel}) => {
|
|
270
270
|
const url = `${API_ENDPOINT}/templates/v1/${id}/${channel ? channel.toUpperCase() : SMS}`;
|
|
271
|
-
const compressedTemplatesData =
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
272
|
+
return compressedTemplatesData.then((data) => {
|
|
273
|
+
const { response = '' } = data || {};
|
|
274
|
+
const decompressData = decompressJsonObject(response);
|
|
275
|
+
if (channel?.toUpperCase() === EMAIL) {
|
|
276
|
+
return { ...data, response: addBaseToTemplate(decompressData) };
|
|
277
|
+
}
|
|
278
|
+
return { ...data, response: decompressData };
|
|
279
|
+
});
|
|
278
280
|
};
|
|
279
281
|
|
|
280
|
-
export const getAllTemplates =
|
|
282
|
+
export const getAllTemplates = ({channel, queryParams = {}}) => {
|
|
281
283
|
const url = getUrlWithQueryParams({
|
|
282
284
|
url: `${API_ENDPOINT}/templates/v1/${channel}?`,
|
|
283
285
|
queryParams,
|
|
284
286
|
});
|
|
285
|
-
const compressedTemplatesData =
|
|
286
|
-
|
|
287
|
-
|
|
287
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
288
|
+
return compressedTemplatesData.then((data) => {
|
|
289
|
+
const { response = '' } = data || {};
|
|
290
|
+
return { ...data, response: decompressJsonObject(response)};
|
|
291
|
+
});
|
|
288
292
|
};
|
|
289
293
|
|
|
290
294
|
export const deleteTemplate = ({channel, id}) => {
|
|
@@ -531,13 +535,13 @@ export const getS3UrlFileSizes = (data) => {
|
|
|
531
535
|
return request(url, getAPICallObject('POST', data));
|
|
532
536
|
};
|
|
533
537
|
|
|
534
|
-
export const getTemplateInfoById =
|
|
535
|
-
id, username, oa_id, token, host,
|
|
536
|
-
}) => {
|
|
538
|
+
export const getTemplateInfoById = ({id, username, oa_id, token, host}) => {
|
|
537
539
|
const url = `${API_ENDPOINT}/templates/v1/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}&host=${host}`;
|
|
538
|
-
const compressedTemplatesData =
|
|
539
|
-
|
|
540
|
-
|
|
540
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
541
|
+
return compressedTemplatesData.then((data) => {
|
|
542
|
+
const { response = '' } = data || {};
|
|
543
|
+
return { ...data, response: decompressJsonObject(response)};
|
|
544
|
+
});
|
|
541
545
|
};
|
|
542
546
|
|
|
543
547
|
export const getMetaTags = ({previewUrl}) => {
|
|
@@ -17,9 +17,11 @@ import { request,getAPICallObject } from '../../services/api';
|
|
|
17
17
|
import './style.scss';
|
|
18
18
|
// import messages from './messages';
|
|
19
19
|
const loadScript = require('load-script');
|
|
20
|
-
const hostName = window.location.origin.includes('localhost') ? 'https://nightly.intouch.capillarytech.com' : window.location.origin;
|
|
21
|
-
const defaultScriptUrl = `${hostName}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
22
20
|
|
|
21
|
+
const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
22
|
+
//const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
|
|
23
|
+
/*Uncomment the above line to use CKEDITOR in local
|
|
24
|
+
*/
|
|
23
25
|
const user = localStorage.getItem('user');
|
|
24
26
|
let locale = 'en';
|
|
25
27
|
if (user && JSON.parse(user).lang) {
|
|
@@ -73,6 +75,7 @@ const CKEditorConfig = {
|
|
|
73
75
|
['Font', 'FontSize'],
|
|
74
76
|
['TextColor', 'BGColor'],
|
|
75
77
|
],
|
|
78
|
+
removePlugins: 'magicline',
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
const weChatCKEditorConfig = {
|
|
@@ -27,11 +27,11 @@ function* watchCreateCustomRow() {
|
|
|
27
27
|
// All sagas to be loaded
|
|
28
28
|
export default [
|
|
29
29
|
watchCreateCustomRow,
|
|
30
|
-
watchForMediaGeneration
|
|
30
|
+
watchForMediaGeneration
|
|
31
31
|
];
|
|
32
32
|
|
|
33
33
|
export function* v2BeeEditionSagas() {
|
|
34
34
|
yield all([
|
|
35
35
|
watchCreateCustomRow(),
|
|
36
36
|
]);
|
|
37
|
-
}
|
|
37
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
take, call, put, cancelled, takeLatest, all,
|
|
3
|
-
fork,
|
|
4
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { fork, take, call, put, cancelled, cancel, takeLatest, all } from 'redux-saga/effects';
|
|
5
2
|
// import { normalize } from 'normalizr';
|
|
6
3
|
import * as Api from '../../services/api';
|
|
7
4
|
import * as LocalStorage from '../../services/localStorageApi';
|
|
@@ -12,7 +9,7 @@ import {
|
|
|
12
9
|
getTopbarMenuDataValue,
|
|
13
10
|
getLoyaltyTopbarMenuDataValue,
|
|
14
11
|
LOYALTY,
|
|
15
|
-
} from
|
|
12
|
+
} from '../../v2Containers/App/constants';
|
|
16
13
|
// import {makeSelectOrgId} from './selectors';
|
|
17
14
|
|
|
18
15
|
export function* authorize(user) {
|
|
@@ -46,11 +43,12 @@ export function* switchOrg({orgID}) {
|
|
|
46
43
|
export function* loginFlow() {
|
|
47
44
|
let condition = true;
|
|
48
45
|
while (condition) {
|
|
49
|
-
const {user} = yield take(types.LOGIN_REQUEST);
|
|
50
|
-
yield fork(authorize, user);
|
|
46
|
+
const { user } = yield take(types.LOGIN_REQUEST);
|
|
47
|
+
const task = yield fork(authorize, user);
|
|
51
48
|
const action = yield take([types.LOGOUT_REQUEST_V2, types.LOGIN_FAILURE]);
|
|
52
49
|
if (action.type === types.LOGOUT_REQUEST_V2) {
|
|
53
50
|
condition = false;
|
|
51
|
+
yield cancel(task);
|
|
54
52
|
}
|
|
55
53
|
// yield call(LocalStorage.clearItem, 'token');
|
|
56
54
|
// yield call(LocalStorage.clearItem, 'orgID');
|
|
@@ -262,7 +260,7 @@ export function* capSagaForFetchSchemaForEntity() {
|
|
|
262
260
|
yield all([
|
|
263
261
|
watchFetchSchemaForEntity(),
|
|
264
262
|
watchLiquidEntity(),
|
|
265
|
-
])
|
|
263
|
+
])
|
|
266
264
|
}
|
|
267
265
|
|
|
268
266
|
export function* v2CapSagas() {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, call, put, takeLatest, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
import * as Api from '../../services/api';
|
|
5
3
|
import * as type from './constants';
|
|
6
4
|
|
|
@@ -41,4 +39,4 @@ export function* v2CapFacebookPreviewSagas() {
|
|
|
41
39
|
yield all([
|
|
42
40
|
watchImageFacebookPreview(),
|
|
43
41
|
]);
|
|
44
|
-
}
|
|
42
|
+
}
|
|
@@ -1403,6 +1403,6 @@ function mapDispatchToProps(dispatch) {
|
|
|
1403
1403
|
const withConnect = connect(mapStatesToProps, mapDispatchToProps);
|
|
1404
1404
|
const withReducer = injectReducer({ key: 'creativesContainer', reducer: creativesContainerReducer });
|
|
1405
1405
|
const withSaga = injectSaga({ key: 'cap', saga: capSagaForFetchSchemaForEntity });
|
|
1406
|
-
const withDefaultTempSaga = injectSaga({ key: '
|
|
1406
|
+
const withDefaultTempSaga = injectSaga({ key: 'templates', saga: v2TemplateSagaWatchGetDefaultBeeTemplates });
|
|
1407
1407
|
|
|
1408
1408
|
export default compose(withSaga, withDefaultTempSaga, withReducer, withConnect)(injectIntl(Creatives));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, takeEvery, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, takeEvery, all } from 'redux-saga/effects';
|
|
4
2
|
import * as Api from '../../services/api';
|
|
5
3
|
import * as types from './constants';
|
|
6
4
|
import { transformEmailTemplates, storeS3FileSizeDetails } from '../../utils/cdnTransformation';
|
|
@@ -159,4 +157,4 @@ export function* v2EmailDuplicateTemplateSaga() {
|
|
|
159
157
|
yield all([
|
|
160
158
|
watchDuplicateTemplate(),
|
|
161
159
|
]);
|
|
162
|
-
}
|
|
160
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
import * as Api from '../../services/api';
|
|
5
3
|
import * as types from './constants';
|
|
6
4
|
|
|
@@ -30,4 +28,4 @@ export function* v2FTPSagas() {
|
|
|
30
28
|
yield all([
|
|
31
29
|
watchGetFTPServers(),
|
|
32
30
|
]);
|
|
33
|
-
}
|
|
31
|
+
}
|
|
@@ -477,6 +477,6 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
477
477
|
|
|
478
478
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
479
479
|
const withReducer = injectReducer({ key: 'facebook', reducer: v2FacebookReducer });
|
|
480
|
-
const withSaga = injectSaga({ key: '
|
|
480
|
+
const withSaga = injectSaga({ key: 'gallery', saga: v2GallerySagas });
|
|
481
481
|
|
|
482
482
|
export default compose(withSaga, withReducer, withConnect)(injectIntl(withStyles(Facebook, styles)));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, call, put, takeLatest, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
import * as Api from '../../services/api';
|
|
5
3
|
import {
|
|
6
4
|
GET_MARKETING_OBJECTIVES,
|
|
@@ -123,9 +121,7 @@ export function* editTemplate({ template, callback }) {
|
|
|
123
121
|
if (callback) {
|
|
124
122
|
callback(result.response);
|
|
125
123
|
}
|
|
126
|
-
yield put({
|
|
127
|
-
type: EDIT_FACEBOOK_AD_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg,
|
|
128
|
-
});
|
|
124
|
+
yield put({ type: EDIT_FACEBOOK_AD_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
129
125
|
} catch (error) {
|
|
130
126
|
yield put({ type: EDIT_FACEBOOK_AD_TEMPLATE_FAILURE, error, errorMsg });
|
|
131
127
|
if (callback) {
|
|
@@ -198,4 +194,4 @@ export function* v2FacebookSagas() {
|
|
|
198
194
|
watchCreateTemplate(),
|
|
199
195
|
watchGetOrgOUs(),
|
|
200
196
|
]);
|
|
201
|
-
}
|
|
197
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
call, put, takeLatest,
|
|
2
|
+
call, cancel, put, takeLatest,
|
|
3
3
|
} from 'redux-saga/effects';
|
|
4
4
|
import { createMockTask } from 'redux-saga/utils';
|
|
5
|
-
import { expectSaga } from 'redux-saga-test-plan';
|
|
6
5
|
import * as sagas from '../sagas';
|
|
7
6
|
import * as Api from '../../../services/api';
|
|
8
7
|
import * as types from '../constants';
|
|
@@ -10,6 +9,7 @@ import { INAPP } from '../../CreativesContainer/constants';
|
|
|
10
9
|
import {
|
|
11
10
|
v2InAppSagas,
|
|
12
11
|
} 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', () => {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -51,6 +49,7 @@ export function* getIosCtas(licenseCode) {
|
|
|
51
49
|
|
|
52
50
|
export function* getMobilepushTemplatesList(params) {
|
|
53
51
|
try {
|
|
52
|
+
|
|
54
53
|
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
55
54
|
yield put({ type: types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
56
55
|
} catch (error) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -201,7 +201,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
201
201
|
const content = _.get(this.state, `formData[0]['sms-editor']`);
|
|
202
202
|
const unicodeEnabled = _.get(this.state, `formData[0]['unicode-validity']`);
|
|
203
203
|
const smsDetails = updateCharCount(content || "", unicodeEnabled || false);
|
|
204
|
-
console.log('***onTemplateContentChange***', content, unicodeEnabled, smsDetails);
|
|
205
204
|
if (this.smsCount.current) {
|
|
206
205
|
this.smsCount.current.innerText = `${smsDetails.parts}${this.props.intl.formatMessage(messages.sms)} (${smsDetails.chars_used} ${this.props.intl.formatMessage(messages.characters)})`;
|
|
207
206
|
}
|
|
@@ -925,8 +924,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
925
924
|
const formData = _.cloneDeep(this.state.formData);
|
|
926
925
|
editData.name = formData['template-name'];
|
|
927
926
|
editData.versions.base = formData.base;
|
|
928
|
-
|
|
929
|
-
console.log('***saveFormData***', formData);
|
|
927
|
+
|
|
930
928
|
this.props.actions.editTemplate(editData, this.onUpdateTemplateComplete);
|
|
931
929
|
}
|
|
932
930
|
isSmsLoading = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
2
|
+
// import { schema, normalize } from 'normalizr';
|
|
4
3
|
import * as Api from '../../../services/api';
|
|
5
4
|
import * as types from './constants';
|
|
6
5
|
|
|
@@ -14,10 +13,8 @@ export function* editTemplate(template) {
|
|
|
14
13
|
errorMsg = result.message;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
yield put({
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
yield template.onUpdateTemplateComplete(result.response, errorMsg);
|
|
16
|
+
yield put({ type: types.EDIT_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
17
|
+
yield template.onUpdateTemplateComplete(result.response,errorMsg);
|
|
21
18
|
} catch (error) {
|
|
22
19
|
yield put({ type: types.EDIT_TEMPLATE_FAILURE, error, errorMsg });
|
|
23
20
|
}
|
|
@@ -36,10 +33,14 @@ export function* getTemplateDetails(id) {
|
|
|
36
33
|
|
|
37
34
|
function* watchEditTemplate() {
|
|
38
35
|
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
36
|
+
|
|
37
|
+
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
function* watchGetTemplateDetails() {
|
|
42
41
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
42
|
+
|
|
43
|
+
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
// All sagas to be loaded
|
|
@@ -52,4 +53,4 @@ export function* v2SmsEditSagas() {
|
|
|
52
53
|
watchEditTemplate(),
|
|
53
54
|
watchGetTemplateDetails(),
|
|
54
55
|
]);
|
|
55
|
-
}
|
|
56
|
+
}
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as types from './constants';
|
|
8
|
-
import {
|
|
9
|
-
LINE, WHATSAPP, RCS, ZALO,
|
|
10
|
-
} from '../CreativesContainer/constants';
|
|
8
|
+
import { LINE, WHATSAPP, RCS, ZALO } from '../CreativesContainer/constants';
|
|
11
9
|
|
|
12
10
|
export function getAllTemplates(channel, queryParams, intlCopyOf = '') {
|
|
13
|
-
console.log('*********getAllTemplates*********Action', channel, queryParams, intlCopyOf);
|
|
14
11
|
return {
|
|
15
12
|
type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams, intlCopyOf,
|
|
16
13
|
};
|
|
@@ -29,7 +26,6 @@ export function resetAccount() {
|
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
export function deleteTemplate(channel, id) {
|
|
32
|
-
console.log('*********deleteTemplate*********Action', channel, id);
|
|
33
29
|
return {
|
|
34
30
|
type: types.DELETE_TEMPLATE_REQUEST, channel, id,
|
|
35
31
|
};
|
|
@@ -136,8 +136,6 @@ 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 '@capillarytech/vulcan-react-sdk/utils';
|
|
141
139
|
|
|
142
140
|
const { timeTracker } = GA;
|
|
143
141
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -360,7 +358,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
360
358
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
361
359
|
queryParams.traiEnable = true;
|
|
362
360
|
}
|
|
363
|
-
console.log('***queryParams***361', queryParams, channel);
|
|
364
361
|
this.props.actions.getAllTemplates(channel, queryParams,`${formatMessage(globalMessages.copyOf)}`);
|
|
365
362
|
}
|
|
366
363
|
|
|
@@ -426,7 +423,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
426
423
|
if (['mobilepush', INAPP_LOWERCASE].includes((this.state.channel).toLowerCase()) && !isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
427
424
|
params.accountId = nextProps.Templates.selectedWeChatAccount.id;
|
|
428
425
|
}
|
|
429
|
-
console.log('***params***427', params);
|
|
430
426
|
this.getAllTemplates({params}, true);
|
|
431
427
|
}
|
|
432
428
|
});
|
|
@@ -583,7 +579,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
583
579
|
if (!nextProps.Templates.deleteTemplateInProgress && !isEqual(nextProps.Templates.deleteTemplateInProgress, this.props.Templates.deleteTemplateInProgress) &&
|
|
584
580
|
nextProps.Templates.deleteResponse) {
|
|
585
581
|
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages['Template deleted successfully'])}`;
|
|
586
|
-
console.log('***message***582', message);
|
|
587
582
|
CapNotification.success({key: 'deleteSucess', message});
|
|
588
583
|
this.getAllTemplates({params, resetPage: true});
|
|
589
584
|
}
|
|
@@ -1899,7 +1894,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1899
1894
|
};
|
|
1900
1895
|
|
|
1901
1896
|
deleteTemplate(template) {
|
|
1902
|
-
console.log('***deleteTemplate-->1898', template);
|
|
1903
1897
|
this.props.actions.deleteTemplate(this.state.channel.toUpperCase(), template._id);
|
|
1904
1898
|
this.setState({actionTemplate: {}});
|
|
1905
1899
|
}
|
|
@@ -3240,11 +3234,9 @@ function mapDispatchToProps(dispatch) {
|
|
|
3240
3234
|
|
|
3241
3235
|
const withReducer = injectReducer({ key: 'templates', reducer: v2TemplateReducer });
|
|
3242
3236
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
3243
|
-
const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga });
|
|
3244
3237
|
|
|
3245
3238
|
export default compose(
|
|
3246
3239
|
UserIsAuthenticated,
|
|
3247
|
-
withSaga,
|
|
3248
3240
|
withReducer,
|
|
3249
3241
|
withConnect,
|
|
3250
3242
|
)(injectIntl(Templates));
|
|
@@ -29,33 +29,26 @@ function templatesReducer(state = initialState, action) {
|
|
|
29
29
|
case types.DEFAULT_ACTION:
|
|
30
30
|
return state;
|
|
31
31
|
case types.GET_ALL_TEMPLATES_REQUEST:
|
|
32
|
-
console.log('***Reducer***Request', action);
|
|
33
32
|
return state.set('getAllTemplatesInProgress', true).set('templateError', {});
|
|
34
33
|
case types.GET_ALL_TEMPLATES_SUCCESS:
|
|
35
34
|
if (action.isReset) {
|
|
36
|
-
console.log('***Reducer***Success36', action);
|
|
37
35
|
return state.set('getAllTemplatesInProgress', false)
|
|
38
36
|
.set('templates', action.data ? action.data.templates : [])
|
|
39
37
|
.set('isSearch', action.data ? action.data.search : false)
|
|
40
38
|
.set('weCRMtemplates', action.weCRMTemplate ? action.weCRMTemplate : []).set('templateError', {});
|
|
41
39
|
}
|
|
42
|
-
console.log('***Reducer***Success42', action);
|
|
43
40
|
return state.set('getAllTemplatesInProgress', false)
|
|
44
41
|
.set('templates', action.data ? state.get('templates').concat(action.data.templates) : [])
|
|
45
42
|
.set('isSearch', action.data ? action.data.search : false)
|
|
46
43
|
.set('weCRMtemplates', action.weCRMTemplate ? state.get('weCRMtemplates').concat(action.weCRMTemplate) : []);
|
|
47
44
|
case types.GET_ALL_TEMPLATES_FAILURE:
|
|
48
|
-
console.log('***Reducer***Failure', action);
|
|
49
45
|
return state.set('getAllTemplatesInProgress', false).set('templateError', action.error);
|
|
50
46
|
case types.DELETE_TEMPLATE_REQUEST:
|
|
51
|
-
console.log('***Reducer***Request', action);
|
|
52
47
|
return state.set('deleteTemplateInProgress', true);
|
|
53
48
|
case types.DELETE_TEMPLATE_SUCCESS:
|
|
54
|
-
console.log('***Reducer***Success', action);
|
|
55
49
|
return state.set('deleteTemplateInProgress', false)
|
|
56
50
|
.set('deleteResponse', action.data);
|
|
57
51
|
case types.DELETE_TEMPLATE_FAILURE:
|
|
58
|
-
console.log('***Reducer***Failure', action);
|
|
59
52
|
return state.set('deleteTemplateInProgress', false);
|
|
60
53
|
case types.GET_USER_LIST_REQUEST:
|
|
61
54
|
return state
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { call, put, takeLatest, select, all } from 'redux-saga/effects';
|
|
4
2
|
import get from 'lodash/get';
|
|
5
3
|
// import { schema, normalize } from 'normalizr';
|
|
6
4
|
import * as Api from '../../services/api';
|
|
@@ -11,7 +9,7 @@ import { COPY_OF } from '../../containers/App/constants';
|
|
|
11
9
|
export function* getAllTemplates(channel, queryParams) {
|
|
12
10
|
try {
|
|
13
11
|
const result = yield call(Api.getAllTemplates, channel, queryParams);
|
|
14
|
-
const channelTemplates = (channel.channel === 'wechat') ? {
|
|
12
|
+
const channelTemplates = (channel.channel === 'wechat') ? {templates: [...result.response.mapped, ...result.response.richmedia]} : result.response;
|
|
15
13
|
// const sidebar = result.response.sidebar;
|
|
16
14
|
if (channel.channel === 'wechat' && channel.queryParams && channel.queryParams.sortBy && channel.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
|
|
17
15
|
channelTemplates.templates.sort((a, b) => {
|
|
@@ -107,9 +105,13 @@ export function* watchGetOrgLevelCampaignSettings() {
|
|
|
107
105
|
types.GET_ORG_LEVEL_CAMPAIGN_SETTINGS_REQUEST,
|
|
108
106
|
getOrgLevelCampaignSettings,
|
|
109
107
|
);
|
|
108
|
+
const store = yield select();
|
|
109
|
+
if (!store.getIn(['router', 'location', 'pathname']).includes('/settings/')) {
|
|
110
|
+
|
|
111
|
+
}
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
export function* sendZippedFile({
|
|
114
|
+
export function* sendZippedFile({selectedFile, errorHandler, successHandler}) {
|
|
113
115
|
let errorMessage = "";
|
|
114
116
|
try {
|
|
115
117
|
const result = yield call(Api.sendZippedFile, selectedFile);
|
|
@@ -117,7 +119,7 @@ export function* sendZippedFile({ selectedFile, errorHandler, successHandler })
|
|
|
117
119
|
errorMessage = result.message;
|
|
118
120
|
yield errorHandler(errorMessage);
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
|
|
121
123
|
yield put({
|
|
122
124
|
type: types.SEND_ZIPPED_FILE_SUCCESS,
|
|
123
125
|
selectedTemplate: decodeURIComponent(result.response.metaEntity.htmlContent),
|
|
@@ -179,34 +181,50 @@ export function* getSenderDetails({
|
|
|
179
181
|
|
|
180
182
|
export function* watchGetAllTemplates() {
|
|
181
183
|
yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
|
|
184
|
+
|
|
185
|
+
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
export function* watchDeleteTemplate() {
|
|
185
189
|
yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
|
|
190
|
+
|
|
191
|
+
|
|
186
192
|
}
|
|
187
193
|
|
|
188
194
|
export function* watchGetUserList() {
|
|
189
195
|
yield takeLatest(types.GET_USER_LIST_REQUEST, fetchUserList);
|
|
196
|
+
|
|
197
|
+
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
export function* watchFetchWeCrmAccounts() {
|
|
193
201
|
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
202
|
+
|
|
203
|
+
|
|
194
204
|
}
|
|
195
205
|
|
|
196
206
|
export function* watchSendingFile() {
|
|
197
207
|
yield takeLatest(types.SEND_ZIPPED_FILE_REQUEST, sendZippedFile);
|
|
208
|
+
|
|
209
|
+
|
|
198
210
|
}
|
|
199
211
|
|
|
200
212
|
export function* watchGetDefaultBeeTemplates() {
|
|
201
213
|
yield takeLatest(types.GET_DEAFULT_BEE_TEMPLATES_REQUEST, getDefaultBeeTemplates);
|
|
214
|
+
|
|
215
|
+
|
|
202
216
|
}
|
|
203
217
|
|
|
204
218
|
export function* watchGetTemplateDetails() {
|
|
205
219
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
220
|
+
|
|
221
|
+
|
|
206
222
|
}
|
|
207
223
|
|
|
208
224
|
export function* watchGetSenderDetails() {
|
|
209
225
|
yield takeLatest(types.GET_SENDER_DETAILS_REQUEST, getSenderDetails);
|
|
226
|
+
|
|
227
|
+
|
|
210
228
|
}
|
|
211
229
|
|
|
212
230
|
export function* watchGetCdnTransformationConfig() {
|
|
@@ -248,4 +266,4 @@ export function* v2TemplateSagaWatchGetDefaultBeeTemplates() {
|
|
|
248
266
|
watchSendingFile(),
|
|
249
267
|
watchGetDefaultBeeTemplates(),
|
|
250
268
|
]);
|
|
251
|
-
}
|
|
269
|
+
}
|
|
@@ -34,7 +34,11 @@ 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';
|
|
37
39
|
|
|
40
|
+
import reducer from '../Templates/reducer';
|
|
41
|
+
import { v2TemplateSaga } from '../Templates/sagas';
|
|
38
42
|
|
|
39
43
|
const {CapCustomCardList} = CapCustomCard;
|
|
40
44
|
|
|
@@ -388,12 +392,12 @@ function mapDispatchToProps(dispatch) {
|
|
|
388
392
|
|
|
389
393
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
390
394
|
|
|
391
|
-
|
|
392
|
-
|
|
395
|
+
const withReducer = injectReducer({ key: 'templates', reducer });
|
|
396
|
+
const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga });
|
|
393
397
|
|
|
394
398
|
export default compose(
|
|
395
399
|
UserIsAuthenticated,
|
|
396
|
-
|
|
397
|
-
|
|
400
|
+
withSaga,
|
|
401
|
+
withReducer,
|
|
398
402
|
withConnect,
|
|
399
403
|
)(injectIntl(withStyles(TemplatesV2, styles)));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
call, put, takeLatest, all,
|
|
3
|
-
} from 'redux-saga/effects';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
import orderBy from 'lodash/orderBy';
|
|
5
3
|
import moment from 'moment';
|
|
6
4
|
import * as Api from '../../../../services/api';
|