@capillarytech/creatives-library 8.0.345 → 8.0.347
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/package.json +1 -1
- package/utils/tests/v2Common.test.js +46 -1
- package/utils/v2common.js +18 -0
- package/v2Containers/Email/reducer.js +12 -3
- package/v2Containers/Email/sagas.js +9 -4
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +4 -0
- package/v2Containers/Email/tests/reducer.test.js +47 -0
- package/v2Containers/Email/tests/sagas.test.js +146 -6
- package/v2Containers/Templates/_templates.scss +53 -4
- package/v2Containers/Templates/actions.js +16 -8
- package/v2Containers/Templates/index.js +187 -123
- package/v2Containers/Templates/messages.js +20 -0
- package/v2Containers/Templates/reducer.js +26 -11
- package/v2Containers/Templates/sagas.js +13 -37
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +45 -0
- package/v2Containers/Templates/tests/sagas.test.js +142 -66
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { getObjFromQueryParams, buildTemplateNameDescription } from '../v2common';
|
|
3
4
|
|
|
4
5
|
describe('Test v2common container', () => {
|
|
5
6
|
it('test getObjFromQueryParams', () => {
|
|
@@ -9,3 +10,47 @@ describe('Test v2common container', () => {
|
|
|
9
10
|
});
|
|
10
11
|
});
|
|
11
12
|
});
|
|
13
|
+
|
|
14
|
+
describe('buildTemplateNameDescription', () => {
|
|
15
|
+
it('returns undefined when templateName is empty string', () => {
|
|
16
|
+
expect(buildTemplateNameDescription('Template name', '')).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('returns undefined when templateName is null', () => {
|
|
20
|
+
expect(buildTemplateNameDescription('Template name', null)).toBeUndefined();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('returns undefined when templateName is undefined', () => {
|
|
24
|
+
expect(buildTemplateNameDescription('Template name', undefined)).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('renders a span wrapper when templateName is provided', () => {
|
|
28
|
+
const result = buildTemplateNameDescription('Template name', 'Welcome 01');
|
|
29
|
+
const wrapper = shallow(result);
|
|
30
|
+
expect(wrapper.type()).toBe('span');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('renders label text in the first CapLabelInline with correct class', () => {
|
|
34
|
+
const result = buildTemplateNameDescription('Template name', 'Welcome 01');
|
|
35
|
+
const wrapper = shallow(result);
|
|
36
|
+
const firstLabel = wrapper.childAt(0);
|
|
37
|
+
expect(firstLabel.prop('className')).toBe('notification-template-label');
|
|
38
|
+
expect(firstLabel.prop('children')).toBe('Template name');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('renders template name in the second CapLabelInline with correct class', () => {
|
|
42
|
+
const result = buildTemplateNameDescription('Template name', 'Welcome 01');
|
|
43
|
+
const wrapper = shallow(result);
|
|
44
|
+
const secondLabel = wrapper.childAt(1);
|
|
45
|
+
expect(secondLabel.prop('className')).toBe('notification-template-name');
|
|
46
|
+
expect(secondLabel.prop('children')).toBe('Welcome 01');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('both CapLabelInline elements have type="label1"', () => {
|
|
50
|
+
const result = buildTemplateNameDescription('Template name', 'Welcome 01');
|
|
51
|
+
const wrapper = shallow(result);
|
|
52
|
+
wrapper.children().forEach((node) => {
|
|
53
|
+
expect(node.prop('type')).toBe('label1');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
package/utils/v2common.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds a JSX description for template archive/unarchive notifications.
|
|
6
|
+
* @param {string} labelText - Localised label (e.g. "Template name ")
|
|
7
|
+
* @param {string} templateName - The template name to display
|
|
8
|
+
*/
|
|
9
|
+
export const buildTemplateNameDescription = (labelText, templateName) => (
|
|
10
|
+
templateName
|
|
11
|
+
? (
|
|
12
|
+
<span>
|
|
13
|
+
<CapLabel.CapLabelInline type="label1" className="notification-template-label">{labelText}</CapLabel.CapLabelInline>
|
|
14
|
+
<CapLabel.CapLabelInline type="label1" className="notification-template-name">{templateName}</CapLabel.CapLabelInline>
|
|
15
|
+
</span>
|
|
16
|
+
)
|
|
17
|
+
: undefined
|
|
18
|
+
);
|
|
1
19
|
|
|
2
20
|
// returns query items as obj when query string is passed
|
|
3
21
|
/**
|
|
@@ -12,6 +12,8 @@ const initialState = fromJS({
|
|
|
12
12
|
createTemplateInProgress: false,
|
|
13
13
|
createResponse: {},
|
|
14
14
|
isBeeEnabled: null,
|
|
15
|
+
fetchingCmsAccounts: false,
|
|
16
|
+
cmsAccountsLoaded: false,
|
|
15
17
|
});
|
|
16
18
|
|
|
17
19
|
function emailReducer(state = initialState, action) {
|
|
@@ -85,6 +87,7 @@ function emailReducer(state = initialState, action) {
|
|
|
85
87
|
case types.GET_CMS_EDITOR_DETAILS_SUCCESS:
|
|
86
88
|
return state
|
|
87
89
|
.set('fetchingCmsSettings', false)
|
|
90
|
+
.set('isBeeEnabled', action.isBeeEnabled)
|
|
88
91
|
.set('CmsSettings', fromJS(action.settings));
|
|
89
92
|
case types.GET_CMS_EDITOR_DETAILS_FAILURE:
|
|
90
93
|
return state
|
|
@@ -110,13 +113,19 @@ function emailReducer(state = initialState, action) {
|
|
|
110
113
|
.set('fetchingCmsDataFailed', true);
|
|
111
114
|
case types.GET_CMS_ACCOUNTS_REQUEST:
|
|
112
115
|
return state
|
|
113
|
-
.set('isBeeEnabled', false)
|
|
116
|
+
.set('isBeeEnabled', false)
|
|
117
|
+
.set('fetchingCmsAccounts', true)
|
|
118
|
+
.set('cmsAccountsLoaded', false);
|
|
114
119
|
case types.GET_CMS_ACCOUNTS_SUCCESS:
|
|
115
120
|
return state
|
|
116
|
-
.set('isBeeEnabled', action.isBeeEnabled)
|
|
121
|
+
.set('isBeeEnabled', action.isBeeEnabled)
|
|
122
|
+
.set('fetchingCmsAccounts', false)
|
|
123
|
+
.set('cmsAccountsLoaded', true);
|
|
117
124
|
case types.GET_CMS_ACCOUNTS_FAILURE:
|
|
118
125
|
return state
|
|
119
|
-
.set('isBeeEnabled', false)
|
|
126
|
+
.set('isBeeEnabled', false)
|
|
127
|
+
.set('fetchingCmsAccounts', false)
|
|
128
|
+
.set('cmsAccountsLoaded', true);
|
|
120
129
|
case types.CLEAR_EMAIL_CRUD_RESPONSE_REQUEST:
|
|
121
130
|
return state
|
|
122
131
|
.set('createResponse', fromJS({}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
call, put, takeLatest, takeEvery, all,
|
|
2
|
+
call, put, takeLatest, takeEvery, all, select, take,
|
|
3
3
|
} from 'redux-saga/effects';
|
|
4
4
|
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
5
5
|
import * as Api from '../../services/api';
|
|
@@ -103,14 +103,19 @@ export function* getAllAssets(assetType, queryParams) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export function* getCmsSetting({
|
|
106
|
-
cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable,
|
|
106
|
+
cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable: isBEEAppEnableFromAction,
|
|
107
107
|
}) {
|
|
108
108
|
try {
|
|
109
|
+
const emailState = yield select((state) => state.get('email'));
|
|
110
|
+
if (!emailState.get('cmsAccountsLoaded') && emailState.get('fetchingCmsAccounts')) {
|
|
111
|
+
yield take([types.GET_CMS_ACCOUNTS_SUCCESS, types.GET_CMS_ACCOUNTS_FAILURE]);
|
|
112
|
+
}
|
|
113
|
+
const updatedState = yield select((state) => state.get('email'));
|
|
114
|
+
const isBEEAppEnable = updatedState.get('isBeeEnabled') ?? isBEEAppEnableFromAction;
|
|
109
115
|
const result = yield call(Api.getCmsTemplateSettingsV2, cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable);
|
|
110
116
|
const cmsAccountDetail = result.data?.response.cmsDetails || {};
|
|
111
117
|
const isBeeEnabled = cmsAccountDetail?.type === cmsType;
|
|
112
|
-
yield put({ type: types.
|
|
113
|
-
yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
|
|
118
|
+
yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: cmsAccountDetail, isBeeEnabled });
|
|
114
119
|
} catch (error) {
|
|
115
120
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error });
|
|
116
121
|
}
|
|
@@ -5,6 +5,8 @@ Immutable.Map {
|
|
|
5
5
|
"createTemplateInProgress": false,
|
|
6
6
|
"createResponse": Immutable.Map {},
|
|
7
7
|
"isBeeEnabled": null,
|
|
8
|
+
"fetchingCmsAccounts": false,
|
|
9
|
+
"cmsAccountsLoaded": false,
|
|
8
10
|
}
|
|
9
11
|
`;
|
|
10
12
|
|
|
@@ -13,5 +15,7 @@ Immutable.Map {
|
|
|
13
15
|
"createTemplateInProgress": true,
|
|
14
16
|
"createResponse": Immutable.Map {},
|
|
15
17
|
"isBeeEnabled": null,
|
|
18
|
+
"fetchingCmsAccounts": false,
|
|
19
|
+
"cmsAccountsLoaded": false,
|
|
16
20
|
}
|
|
17
21
|
`;
|
|
@@ -16,6 +16,53 @@ describe('emailReducer', () => {
|
|
|
16
16
|
expect(emailReducer(undefined, action)).toMatchSnapshot();
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
it.concurrent('it handles GET_CMS_EDITOR_DETAILS_SUCCESS action — sets isBeeEnabled true and CmsSettings', () => {
|
|
20
|
+
const initialState = fromJS({ isBeeEnabled: null, fetchingCmsSettings: true });
|
|
21
|
+
const action = {
|
|
22
|
+
type: types.GET_CMS_EDITOR_DETAILS_SUCCESS,
|
|
23
|
+
isBeeEnabled: true,
|
|
24
|
+
settings: { isDragDrop: true, editorType: 'bee' },
|
|
25
|
+
};
|
|
26
|
+
const result = emailReducer(initialState, action);
|
|
27
|
+
expect(result.get('fetchingCmsSettings')).toBe(false);
|
|
28
|
+
expect(result.get('isBeeEnabled')).toBe(true);
|
|
29
|
+
expect(result.getIn(['CmsSettings', 'isDragDrop'])).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it.concurrent('it handles GET_CMS_EDITOR_DETAILS_SUCCESS action — sets isBeeEnabled false', () => {
|
|
33
|
+
const initialState = fromJS({ isBeeEnabled: true, fetchingCmsSettings: true });
|
|
34
|
+
const action = {
|
|
35
|
+
type: types.GET_CMS_EDITOR_DETAILS_SUCCESS,
|
|
36
|
+
isBeeEnabled: false,
|
|
37
|
+
settings: {},
|
|
38
|
+
};
|
|
39
|
+
const result = emailReducer(initialState, action);
|
|
40
|
+
expect(result.get('fetchingCmsSettings')).toBe(false);
|
|
41
|
+
expect(result.get('isBeeEnabled')).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it.concurrent('it handles GET_CMS_EDITOR_DETAILS_SUCCESS action — overwrites stale isBeeEnabled from CLEAR_ALL_VALUES (null)', () => {
|
|
45
|
+
const initialState = fromJS({ isBeeEnabled: null, fetchingCmsSettings: true });
|
|
46
|
+
const action = {
|
|
47
|
+
type: types.GET_CMS_EDITOR_DETAILS_SUCCESS,
|
|
48
|
+
isBeeEnabled: true,
|
|
49
|
+
settings: { type: 'bee' },
|
|
50
|
+
};
|
|
51
|
+
const result = emailReducer(initialState, action);
|
|
52
|
+
expect(result.get('isBeeEnabled')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it.concurrent('it handles GET_CMS_EDITOR_DETAILS_SUCCESS action — sets CmsSettings to empty object when settings is {}', () => {
|
|
56
|
+
const initialState = fromJS({ CmsSettings: { old: 'data' } });
|
|
57
|
+
const action = {
|
|
58
|
+
type: types.GET_CMS_EDITOR_DETAILS_SUCCESS,
|
|
59
|
+
isBeeEnabled: false,
|
|
60
|
+
settings: {},
|
|
61
|
+
};
|
|
62
|
+
const result = emailReducer(initialState, action);
|
|
63
|
+
expect(result.get('CmsSettings').toJS()).toEqual({});
|
|
64
|
+
});
|
|
65
|
+
|
|
19
66
|
it.concurrent('it handles GET_CMS_ACCOUNTS_REQUEST action (line 111-113)', () => {
|
|
20
67
|
const initialState = fromJS({
|
|
21
68
|
isBeeEnabled: true, // Start with true to verify it gets set to false
|
|
@@ -3,6 +3,7 @@ import { expectSaga } from 'redux-saga-test-plan';
|
|
|
3
3
|
import { takeLatest } from 'redux-saga/effects';
|
|
4
4
|
import * as matchers from 'redux-saga-test-plan/matchers';
|
|
5
5
|
import { throwError } from 'redux-saga-test-plan/providers';
|
|
6
|
+
import { fromJS } from 'immutable';
|
|
6
7
|
import * as types from '../constants';
|
|
7
8
|
import * as sagas from '../sagas';
|
|
8
9
|
import { v2EmailDuplicateTemplateSaga, v2EmailSagas } from '../sagas';
|
|
@@ -709,10 +710,14 @@ describe('getCmsSetting saga', () => {
|
|
|
709
710
|
|
|
710
711
|
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
711
712
|
.provide([
|
|
713
|
+
{
|
|
714
|
+
select(effect, next) {
|
|
715
|
+
return fromJS({ cmsAccountsLoaded: true, isBeeEnabled: true });
|
|
716
|
+
},
|
|
717
|
+
},
|
|
712
718
|
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
713
719
|
])
|
|
714
|
-
.put({ type: types.
|
|
715
|
-
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails })
|
|
720
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails, isBeeEnabled: true })
|
|
716
721
|
.run();
|
|
717
722
|
});
|
|
718
723
|
|
|
@@ -727,10 +732,14 @@ describe('getCmsSetting saga', () => {
|
|
|
727
732
|
|
|
728
733
|
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
729
734
|
.provide([
|
|
735
|
+
{
|
|
736
|
+
select(effect, next) {
|
|
737
|
+
return fromJS({ cmsAccountsLoaded: true, isBeeEnabled: false });
|
|
738
|
+
},
|
|
739
|
+
},
|
|
730
740
|
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
731
741
|
])
|
|
732
|
-
.put({ type: types.
|
|
733
|
-
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails })
|
|
742
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails, isBeeEnabled: false })
|
|
734
743
|
.run();
|
|
735
744
|
});
|
|
736
745
|
|
|
@@ -743,10 +752,14 @@ describe('getCmsSetting saga', () => {
|
|
|
743
752
|
|
|
744
753
|
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
745
754
|
.provide([
|
|
755
|
+
{
|
|
756
|
+
select(effect, next) {
|
|
757
|
+
return fromJS({ cmsAccountsLoaded: true, isBeeEnabled: false });
|
|
758
|
+
},
|
|
759
|
+
},
|
|
746
760
|
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
747
761
|
])
|
|
748
|
-
.put({ type: types.
|
|
749
|
-
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: undefined })
|
|
762
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: {}, isBeeEnabled: false })
|
|
750
763
|
.run();
|
|
751
764
|
});
|
|
752
765
|
|
|
@@ -755,11 +768,138 @@ describe('getCmsSetting saga', () => {
|
|
|
755
768
|
|
|
756
769
|
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
757
770
|
.provide([
|
|
771
|
+
{
|
|
772
|
+
select(effect, next) {
|
|
773
|
+
return fromJS({ cmsAccountsLoaded: true, isBeeEnabled: true });
|
|
774
|
+
},
|
|
775
|
+
},
|
|
758
776
|
[matchers.call.fn(Api.getCmsTemplateSettingsV2), throwError(fakeError)],
|
|
759
777
|
])
|
|
760
778
|
.put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error: fakeError })
|
|
761
779
|
.run();
|
|
762
780
|
});
|
|
781
|
+
|
|
782
|
+
it('should wait for accounts when fetchingCmsAccounts is true and cmsAccountsLoaded is false (accounts succeed)', () => {
|
|
783
|
+
const fakeResponse = {
|
|
784
|
+
data: { response: { cmsDetails: { type: 'bee', settings: {} } } },
|
|
785
|
+
};
|
|
786
|
+
let selectCallCount = 0;
|
|
787
|
+
|
|
788
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
789
|
+
.provide([
|
|
790
|
+
{
|
|
791
|
+
select(effect, next) {
|
|
792
|
+
selectCallCount += 1;
|
|
793
|
+
if (selectCallCount === 1) {
|
|
794
|
+
return fromJS({ cmsAccountsLoaded: false, fetchingCmsAccounts: true, isBeeEnabled: null });
|
|
795
|
+
}
|
|
796
|
+
return fromJS({ cmsAccountsLoaded: true, fetchingCmsAccounts: false, isBeeEnabled: true });
|
|
797
|
+
},
|
|
798
|
+
},
|
|
799
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
800
|
+
])
|
|
801
|
+
.dispatch({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled: true })
|
|
802
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { type: 'bee', settings: {} }, isBeeEnabled: true })
|
|
803
|
+
.run();
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
it('should wait for accounts when fetchingCmsAccounts is true and cmsAccountsLoaded is false (accounts fail)', () => {
|
|
807
|
+
const fakeResponse = {
|
|
808
|
+
data: { response: { cmsDetails: { type: 'ck', settings: {} } } },
|
|
809
|
+
};
|
|
810
|
+
let selectCallCount = 0;
|
|
811
|
+
|
|
812
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
813
|
+
.provide([
|
|
814
|
+
{
|
|
815
|
+
select(effect, next) {
|
|
816
|
+
selectCallCount += 1;
|
|
817
|
+
if (selectCallCount === 1) {
|
|
818
|
+
return fromJS({ cmsAccountsLoaded: false, fetchingCmsAccounts: true, isBeeEnabled: null });
|
|
819
|
+
}
|
|
820
|
+
return fromJS({ cmsAccountsLoaded: true, fetchingCmsAccounts: false, isBeeEnabled: false });
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
824
|
+
])
|
|
825
|
+
.dispatch({ type: types.GET_CMS_ACCOUNTS_FAILURE })
|
|
826
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { type: 'ck', settings: {} }, isBeeEnabled: false })
|
|
827
|
+
.run();
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
it('should skip wait and use isBEEAppEnableFromAction as fallback when cmsAccountsLoaded is false but fetchingCmsAccounts is false', () => {
|
|
831
|
+
const fakeResponse = {
|
|
832
|
+
data: { response: { cmsDetails: { type: 'bee', settings: {} } } },
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
return expectSaga(sagas.getCmsSetting, { ...basePayload, isBEEAppEnable: true })
|
|
836
|
+
.provide([
|
|
837
|
+
{
|
|
838
|
+
select(effect, next) {
|
|
839
|
+
return fromJS({ cmsAccountsLoaded: false, fetchingCmsAccounts: false, isBeeEnabled: null });
|
|
840
|
+
},
|
|
841
|
+
},
|
|
842
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
843
|
+
])
|
|
844
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { type: 'bee', settings: {} }, isBeeEnabled: true })
|
|
845
|
+
.run();
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
it('should use state isBeeEnabled (null) and fall back to isBEEAppEnableFromAction via ?? operator', () => {
|
|
849
|
+
const fakeResponse = {
|
|
850
|
+
data: { response: { cmsDetails: { type: 'bee', settings: {} } } },
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
return expectSaga(sagas.getCmsSetting, { ...basePayload, isBEEAppEnable: true })
|
|
854
|
+
.provide([
|
|
855
|
+
{
|
|
856
|
+
select(effect, next) {
|
|
857
|
+
return fromJS({ cmsAccountsLoaded: true, fetchingCmsAccounts: false, isBeeEnabled: null });
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
861
|
+
])
|
|
862
|
+
.call(Api.getCmsTemplateSettingsV2, basePayload.cmsType, basePayload.projectId, basePayload.cmsMode, basePayload.langId, basePayload.isEdmSupport, true)
|
|
863
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { type: 'bee', settings: {} }, isBeeEnabled: true })
|
|
864
|
+
.run();
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
it('should use state isBeeEnabled false over isBEEAppEnableFromAction true via ?? operator (false is not null/undefined)', () => {
|
|
868
|
+
const fakeResponse = {
|
|
869
|
+
data: { response: { cmsDetails: { type: 'bee', settings: {} } } },
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
return expectSaga(sagas.getCmsSetting, { ...basePayload, isBEEAppEnable: true })
|
|
873
|
+
.provide([
|
|
874
|
+
{
|
|
875
|
+
select(effect, next) {
|
|
876
|
+
return fromJS({ cmsAccountsLoaded: true, fetchingCmsAccounts: false, isBeeEnabled: false });
|
|
877
|
+
},
|
|
878
|
+
},
|
|
879
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
880
|
+
])
|
|
881
|
+
.call(Api.getCmsTemplateSettingsV2, basePayload.cmsType, basePayload.projectId, basePayload.cmsMode, basePayload.langId, basePayload.isEdmSupport, false)
|
|
882
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { type: 'bee', settings: {} }, isBeeEnabled: true })
|
|
883
|
+
.run();
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
it('should derive isBeeEnabled false when cmsDetails type is undefined', () => {
|
|
887
|
+
const fakeResponse = {
|
|
888
|
+
data: { response: { cmsDetails: { settings: {} } } },
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
892
|
+
.provide([
|
|
893
|
+
{
|
|
894
|
+
select(effect, next) {
|
|
895
|
+
return fromJS({ cmsAccountsLoaded: true, fetchingCmsAccounts: false, isBeeEnabled: true });
|
|
896
|
+
},
|
|
897
|
+
},
|
|
898
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
899
|
+
])
|
|
900
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: { settings: {} }, isBeeEnabled: false })
|
|
901
|
+
.run();
|
|
902
|
+
});
|
|
763
903
|
});
|
|
764
904
|
|
|
765
905
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
padding: unset;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
//removing current one as not required now in each row we'll have 3 cards for which css has been added
|
|
9
10
|
|
|
10
11
|
// 3 cards per row across all breakpoints
|
|
11
12
|
.creatives-templates-list {
|
|
@@ -24,6 +25,21 @@
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.creatives-templates-list {
|
|
28
|
+
position: relative;
|
|
29
|
+
|
|
30
|
+
.archive-listing-spinner {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 50%;
|
|
33
|
+
left: 50%;
|
|
34
|
+
transform: translate(-50%, -50%);
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: $CAP_SPACE_08;
|
|
38
|
+
background: $CAP_WHITE;
|
|
39
|
+
padding: $CAP_SPACE_08 $CAP_SPACE_16;
|
|
40
|
+
border-radius: $CAP_SPACE_08;
|
|
41
|
+
z-index: 10;
|
|
42
|
+
}
|
|
27
43
|
|
|
28
44
|
.delete-template-confirm {
|
|
29
45
|
.ant-modal-footer {
|
|
@@ -664,6 +680,11 @@
|
|
|
664
680
|
|
|
665
681
|
// Archive/Unarchive confirm modal overrides — scoped to avoid affecting other modals
|
|
666
682
|
.archive-confirm-modal {
|
|
683
|
+
.ant-modal-body {
|
|
684
|
+
padding: $CAP_SPACE_32 $CAP_SPACE_32 $CAP_SPACE_24;
|
|
685
|
+
margin-top: 8.571rem;
|
|
686
|
+
}
|
|
687
|
+
|
|
667
688
|
// Remove the left margin added when an icon is present
|
|
668
689
|
.ant-modal-confirm-body {
|
|
669
690
|
> .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content {
|
|
@@ -1127,7 +1148,7 @@
|
|
|
1127
1148
|
display: flex;
|
|
1128
1149
|
align-items: center;
|
|
1129
1150
|
justify-content: space-between;
|
|
1130
|
-
width:
|
|
1151
|
+
width: 102%;
|
|
1131
1152
|
}
|
|
1132
1153
|
|
|
1133
1154
|
.filter-row-content {
|
|
@@ -1139,6 +1160,7 @@
|
|
|
1139
1160
|
align-items: center;
|
|
1140
1161
|
gap: $CAP_SPACE_12;
|
|
1141
1162
|
flex-shrink: 0;
|
|
1163
|
+
margin-right: $CAP_SPACE_32;
|
|
1142
1164
|
}
|
|
1143
1165
|
|
|
1144
1166
|
.archived-mode-header {
|
|
@@ -1197,14 +1219,41 @@
|
|
|
1197
1219
|
}
|
|
1198
1220
|
|
|
1199
1221
|
.template-listing-more-btn {
|
|
1200
|
-
padding: 0
|
|
1222
|
+
padding: 0;
|
|
1223
|
+
margin-right: $CAP_SPACE_12;
|
|
1201
1224
|
min-width: auto;
|
|
1202
1225
|
}
|
|
1203
1226
|
|
|
1204
1227
|
.notification-template-label {
|
|
1205
|
-
color:
|
|
1228
|
+
color: $CAP_G04;
|
|
1206
1229
|
}
|
|
1207
1230
|
|
|
1208
1231
|
.notification-template-name {
|
|
1209
|
-
color:
|
|
1232
|
+
color: $CAP_G01;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
.template-card-title {
|
|
1236
|
+
display: flex;
|
|
1237
|
+
align-items: center;
|
|
1238
|
+
min-width: 0;
|
|
1239
|
+
|
|
1240
|
+
.cap-checkbox-v2 {
|
|
1241
|
+
flex-shrink: 0;
|
|
1242
|
+
margin-right: $CAP_SPACE_04;
|
|
1243
|
+
// Remove the empty label span's padding that antd Checkbox renders when no children are passed
|
|
1244
|
+
.ant-checkbox + span {
|
|
1245
|
+
padding-left: 0;
|
|
1246
|
+
padding-right: 0;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
.template-card-name {
|
|
1251
|
+
font-weight: 500;
|
|
1252
|
+
font-size: $FONT_SIZE_L;
|
|
1253
|
+
color: $CAP_G01;
|
|
1254
|
+
overflow: hidden;
|
|
1255
|
+
text-overflow: ellipsis;
|
|
1256
|
+
white-space: nowrap;
|
|
1257
|
+
min-width: 0;
|
|
1258
|
+
}
|
|
1210
1259
|
}
|
|
@@ -168,20 +168,28 @@ export function getCdnTransformationConfig() {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export function archiveTemplate(channel, id,
|
|
172
|
-
return {
|
|
171
|
+
export function archiveTemplate(channel, id, successMessage, description) {
|
|
172
|
+
return {
|
|
173
|
+
type: types.ARCHIVE_TEMPLATE_REQUEST, channel, id, successMessage, description
|
|
174
|
+
};
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
export function unarchiveTemplate(channel, id,
|
|
176
|
-
return {
|
|
177
|
+
export function unarchiveTemplate(channel, id, successMessage, description) {
|
|
178
|
+
return {
|
|
179
|
+
type: types.UNARCHIVE_TEMPLATE_REQUEST, channel, id, successMessage, description
|
|
180
|
+
};
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
export function bulkArchiveTemplates(channel, ids) {
|
|
180
|
-
return {
|
|
183
|
+
export function bulkArchiveTemplates(channel, ids, successMessage) {
|
|
184
|
+
return {
|
|
185
|
+
type: types.BULK_ARCHIVE_REQUEST, channel, ids, successMessage
|
|
186
|
+
};
|
|
181
187
|
}
|
|
182
188
|
|
|
183
|
-
export function bulkUnarchiveTemplates(channel, ids) {
|
|
184
|
-
return {
|
|
189
|
+
export function bulkUnarchiveTemplates(channel, ids, successMessage) {
|
|
190
|
+
return {
|
|
191
|
+
type: types.BULK_UNARCHIVE_REQUEST, channel, ids, successMessage
|
|
192
|
+
};
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
export function setArchiveFilter(filter) {
|