@capillarytech/creatives-library 8.0.146 → 8.0.147
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/constants/unified.js +189 -0
- package/index.js +4 -2
- package/package.json +1 -1
- package/routes.js +136 -202
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +1 -0
- package/tests/i18n.test.js +1 -1
- package/utils/authWrapper.js +1 -1
- package/utils/common.js +2 -2
- package/utils/tagValidations.js +1 -1
- package/utils/tests/authWrapper.test.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +1 -1
- package/v2Components/CapTagList/index.js +9 -14
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Components/TestAndPreviewSlidebox/tests/PreviewSection.test.js +98 -0
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +5 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +25 -0
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +1 -1
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/components/BreadCrumbs/index.js +0 -65
- package/components/BreadCrumbs/messages.js +0 -13
- package/components/CapTagList/index.js +0 -235
- package/components/CapTagList/messages.js +0 -45
- package/components/Card/_customCard.scss +0 -40
- package/components/Card/index.js +0 -78
- package/components/Card/tests/__snapshots__/index.test.js.snap +0 -22
- package/components/Card/tests/index.test.js +0 -20
- package/components/CardGrid/index.js +0 -71
- package/components/Ckeditor/index.js +0 -238
- package/components/Ckeditor/messages.js +0 -13
- package/components/Ckeditor/style.scss +0 -3
- package/components/Component/index.js +0 -29
- package/components/CustomPopOver/index.js +0 -81
- package/components/CustomPopOver/messages.js +0 -17
- package/components/DateFilter/index.js +0 -349
- package/components/DateFilter/messages.js +0 -57
- package/components/DateRange/index.js +0 -114
- package/components/DateRange/messages.js +0 -25
- package/components/Edmeditor/index.js +0 -65
- package/components/Edmeditor/messages.js +0 -13
- package/components/EmailPreview/_emailPreview.scss +0 -119
- package/components/EmailPreview/assets/images/iPad.svg +0 -10
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +0 -107
- package/components/EmailPreview/messages.js +0 -33
- package/components/Footer/index.js +0 -27
- package/components/Footer/messages.js +0 -13
- package/components/FormBuilder/_formBuilder.scss +0 -83
- package/components/FormBuilder/index.js +0 -3279
- package/components/FormBuilder/messages.js +0 -61
- package/components/Header/index.js +0 -44
- package/components/Header/messages.js +0 -29
- package/components/ImagePreview/_imagePreview.scss +0 -63
- package/components/ImagePreview/index.js +0 -52
- package/components/ImagePreview/messages.js +0 -17
- package/components/PageHeader/_pageHeader.scss +0 -22
- package/components/PageHeader/index.js +0 -37
- package/components/PageHeader/messages.js +0 -13
- package/components/Pagination/_pagination.scss +0 -5
- package/components/Pagination/index.js +0 -49
- package/components/PreviewSideBar/_previewsidebar.scss +0 -28
- package/components/PreviewSideBar/index.js +0 -152
- package/components/PreviewSideBar/messages.js +0 -41
- package/components/Sidebar/_sidebar.scss +0 -115
- package/components/Sidebar/index.js +0 -214
- package/components/Sidebar/messages.js +0 -21
- package/components/SlideBox/_slideBox.scss +0 -63
- package/components/SlideBox/index.js +0 -47
- package/components/SlideBox/tests/index.test.js +0 -103
- package/components/SmsEditor/index.js +0 -55
- package/components/SmsTest/index.js +0 -117
- package/components/SmsTest/messages.js +0 -21
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -42
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +0 -141
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -21
- package/components/TemplatePreview/_templatePreview.scss +0 -642
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +0 -45
- package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +0 -135
- package/components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
- package/components/TemplatePreview/assets/images/user-icon.svg +0 -19
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +0 -78
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
- package/components/TemplatePreview/index.js +0 -617
- package/components/TemplatePreview/messages.js +0 -78
- package/components/Toastr/index.js +0 -60
- package/components/Toastr/messages.js +0 -13
- package/components/ToastrMessage/index.js +0 -113
- package/components/ToastrMessage/messages.js +0 -17
- package/components/TopBar/_topbar.scss +0 -46
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +0 -113
- package/components/TopBar/messages.js +0 -29
- package/containers/App/actions.js +0 -7
- package/containers/App/constants.js +0 -114
- package/containers/App/index.js +0 -52
- package/containers/App/reducer.js +0 -19
- package/containers/App/sagas.js +0 -31
- package/containers/App/selectors.js +0 -25
- package/containers/App/test/saga.test.js +0 -11
- package/containers/Assets/Gallery/_gallery.scss +0 -126
- package/containers/Assets/Gallery/actions.js +0 -37
- package/containers/Assets/Gallery/constants.js +0 -23
- package/containers/Assets/Gallery/index.js +0 -473
- package/containers/Assets/Gallery/messages.js +0 -93
- package/containers/Assets/Gallery/reducer.js +0 -81
- package/containers/Assets/Gallery/sagas.js +0 -80
- package/containers/Assets/Gallery/selectors.js +0 -25
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -9
- package/containers/Assets/Gallery/tests/actions.test.js +0 -25
- package/containers/Assets/Gallery/tests/reducer.test.js +0 -96
- package/containers/Assets/Gallery/tests/saga.test.js +0 -157
- package/containers/Cap/actions.js +0 -66
- package/containers/Cap/constants.js +0 -25
- package/containers/Cap/index.js +0 -402
- package/containers/Cap/messages.js +0 -75
- package/containers/Cap/reducer.js +0 -113
- package/containers/Cap/sagas.js +0 -159
- package/containers/Cap/selectors.js +0 -75
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +0 -2270
- package/containers/Cap/tests/index.test.js +0 -22
- package/containers/Cap/tests/saga.test.js +0 -284
- package/containers/Dashboard/actions.js +0 -15
- package/containers/Dashboard/constants.js +0 -7
- package/containers/Dashboard/index.js +0 -76
- package/containers/Dashboard/messages.js +0 -13
- package/containers/Dashboard/reducer.js +0 -21
- package/containers/Dashboard/sagas.js +0 -17
- package/containers/Dashboard/selectors.js +0 -25
- package/containers/Dashboard/test/saga.test.js +0 -9
- package/containers/Ebill/_ebill.scss +0 -5
- package/containers/Ebill/actions.js +0 -43
- package/containers/Ebill/constants.js +0 -20
- package/containers/Ebill/index.js +0 -1278
- package/containers/Ebill/messages.js +0 -77
- package/containers/Ebill/reducer.js +0 -72
- package/containers/Ebill/sagas.js +0 -74
- package/containers/Ebill/selectors.js +0 -25
- package/containers/Ebill/test/saga.test.js +0 -11
- package/containers/Email/_email.scss +0 -141
- package/containers/Email/actions.js +0 -81
- package/containers/Email/constants.js +0 -36
- package/containers/Email/index.js +0 -3325
- package/containers/Email/messages.js +0 -289
- package/containers/Email/reducer.js +0 -142
- package/containers/Email/sagas.js +0 -135
- package/containers/Email/selectors.js +0 -31
- package/containers/Email/test/saga.test.js +0 -671
- package/containers/LanguageProvider/actions.js +0 -17
- package/containers/LanguageProvider/constants.js +0 -8
- package/containers/LanguageProvider/index.js +0 -80
- package/containers/LanguageProvider/reducer.js +0 -30
- package/containers/LanguageProvider/selectors.js +0 -20
- package/containers/LanguageProvider/tests/actions.test.js +0 -19
- package/containers/LanguageProvider/tests/index.test.js +0 -78
- package/containers/LanguageProvider/tests/reducer.test.js +0 -20
- package/containers/LanguageProvider/tests/selectors.test.js +0 -15
- package/containers/Line/Create/_lineCreate.scss +0 -54
- package/containers/Line/Create/actions.js +0 -90
- package/containers/Line/Create/constants.js +0 -39
- package/containers/Line/Create/index.js +0 -836
- package/containers/Line/Create/messages.js +0 -189
- package/containers/Line/Create/reducer.js +0 -99
- package/containers/Line/Create/sagas.js +0 -121
- package/containers/Line/Create/selectors.js +0 -36
- package/containers/Line/Create/tests/saga.test.js +0 -202
- package/containers/Line/Edit/_lineEdit.scss +0 -35
- package/containers/Line/Edit/actions.js +0 -79
- package/containers/Line/Edit/constants.js +0 -27
- package/containers/Line/Edit/index.js +0 -1050
- package/containers/Line/Edit/messages.js +0 -177
- package/containers/Line/Edit/reducer.js +0 -83
- package/containers/Line/Edit/sagas.js +0 -80
- package/containers/Line/Edit/selectors.js +0 -29
- package/containers/Line/Edit/test/saga.test.js +0 -160
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +0 -62
- package/containers/Login/components/LoginForm/messages.js +0 -33
- package/containers/Login/index.js +0 -130
- package/containers/Login/messages.js +0 -25
- package/containers/Login/selectors.js +0 -25
- package/containers/MobilePush/Create/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Create/actions.js +0 -46
- package/containers/MobilePush/Create/constants.js +0 -23
- package/containers/MobilePush/Create/index.js +0 -2303
- package/containers/MobilePush/Create/messages.js +0 -269
- package/containers/MobilePush/Create/reducer.js +0 -70
- package/containers/MobilePush/Create/sagas.js +0 -74
- package/containers/MobilePush/Create/selectors.js +0 -28
- package/containers/MobilePush/Create/test/saga.test.js +0 -19
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Edit/actions.js +0 -91
- package/containers/MobilePush/Edit/constants.js +0 -35
- package/containers/MobilePush/Edit/index.js +0 -2601
- package/containers/MobilePush/Edit/messages.js +0 -266
- package/containers/MobilePush/Edit/reducer.js +0 -112
- package/containers/MobilePush/Edit/sagas.js +0 -126
- package/containers/MobilePush/Edit/selectors.js +0 -29
- package/containers/MobilePush/Edit/tests/saga.test.js +0 -255
- package/containers/NotFoundPage/index.js +0 -25
- package/containers/NotFoundPage/messages.js +0 -13
- package/containers/NotFoundPage/tests/index.test.js +0 -17
- package/containers/Sms/Create/_smsCreate.scss +0 -42
- package/containers/Sms/Create/actions.js +0 -27
- package/containers/Sms/Create/constants.js +0 -16
- package/containers/Sms/Create/index.js +0 -1488
- package/containers/Sms/Create/messages.js +0 -109
- package/containers/Sms/Create/reducer.js +0 -41
- package/containers/Sms/Create/sagas.js +0 -40
- package/containers/Sms/Create/selectors.js +0 -28
- package/containers/Sms/Create/test/saga.test.js +0 -11
- package/containers/Sms/Edit/actions.js +0 -40
- package/containers/Sms/Edit/constants.js +0 -17
- package/containers/Sms/Edit/index.js +0 -1472
- package/containers/Sms/Edit/messages.js +0 -105
- package/containers/Sms/Edit/reducer.js +0 -50
- package/containers/Sms/Edit/sagas.js +0 -60
- package/containers/Sms/Edit/selectors.js +0 -32
- package/containers/Sms/Edit/test/saga.test.js +0 -13
- package/containers/TagList/_tagList.scss +0 -8
- package/containers/TagList/actions.js +0 -15
- package/containers/TagList/constants.js +0 -32
- package/containers/TagList/index.js +0 -236
- package/containers/TagList/messages.js +0 -13
- package/containers/TagList/reducer.js +0 -23
- package/containers/TagList/sagas.js +0 -11
- package/containers/TagList/selectors.js +0 -25
- package/containers/Templates/_templates.scss +0 -333
- package/containers/Templates/actions.js +0 -103
- package/containers/Templates/constants.js +0 -60
- package/containers/Templates/index.js +0 -1756
- package/containers/Templates/messages.js +0 -337
- package/containers/Templates/reducer.js +0 -142
- package/containers/Templates/sagas.js +0 -163
- package/containers/Templates/selectors.js +0 -28
- package/containers/Templates/test/saga.test.js +0 -241
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +0 -8
- package/containers/WeChat/MapTemplates/actions.js +0 -52
- package/containers/WeChat/MapTemplates/constants.js +0 -28
- package/containers/WeChat/MapTemplates/index.js +0 -1610
- package/containers/WeChat/MapTemplates/messages.js +0 -157
- package/containers/WeChat/MapTemplates/reducer.js +0 -74
- package/containers/WeChat/MapTemplates/sagas.js +0 -84
- package/containers/WeChat/MapTemplates/selectors.js +0 -25
- package/containers/WeChat/MapTemplates/test/saga.test.js +0 -155
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -57
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +0 -15
- package/containers/WeChat/RichmediaTemplates/Create/index.js +0 -1071
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -165
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +0 -60
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +0 -497
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +0 -51
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +0 -37
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +0 -20
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +0 -136
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +0 -28
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +0 -30
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +0 -12
- package/containers/WeChat/RichmediaTemplates/View/actions.js +0 -15
- package/containers/WeChat/RichmediaTemplates/View/constants.js +0 -7
- package/containers/WeChat/RichmediaTemplates/View/index.js +0 -47
- package/containers/WeChat/RichmediaTemplates/View/messages.js +0 -21
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +0 -23
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +0 -11
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +0 -25
- package/utils/asyncInjectors.js +0 -78
- package/utils/callNativeEvent.js +0 -16
- package/utils/checkStore.js +0 -21
- package/utils/customAuthWrapper.js +0 -62
- package/utils/customConnectedAuthWrapper.js +0 -26
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { injectIntl } from 'react-intl';
|
|
3
|
-
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
4
|
-
import {Cap} from '../index';
|
|
5
|
-
import * as actions from '../actions';
|
|
6
|
-
|
|
7
|
-
describe('<Cap />', () => {
|
|
8
|
-
const push = jest.fn();
|
|
9
|
-
const componentProps = {
|
|
10
|
-
actions,
|
|
11
|
-
history: {
|
|
12
|
-
push,
|
|
13
|
-
},
|
|
14
|
-
orgTimezone: 'Asia/Kolkata',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
it('should render its children', () => {
|
|
18
|
-
const Component = injectIntl(Cap);
|
|
19
|
-
const renderedComponent = shallowWithIntl(<Component {...componentProps} />);
|
|
20
|
-
expect(renderedComponent).toMatchSnapshot();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { expectSaga } from 'redux-saga-test-plan';
|
|
2
|
-
import { throwError } from 'redux-saga-test-plan/providers';
|
|
3
|
-
import * as matchers from 'redux-saga-test-plan/matchers';
|
|
4
|
-
import {
|
|
5
|
-
take, fork, cancel, takeLatest,
|
|
6
|
-
} from 'redux-saga/effects';
|
|
7
|
-
import {
|
|
8
|
-
authorize, loginFlow, logoutFlow, watchForLogoutFlow, capSaga,
|
|
9
|
-
fetchSchemaForEntity,
|
|
10
|
-
fetchUserInfo,
|
|
11
|
-
} from '../sagas';
|
|
12
|
-
import * as api from '../../../services/api';
|
|
13
|
-
import {
|
|
14
|
-
LOGIN_REQUEST,
|
|
15
|
-
LOGIN_FAILURE,
|
|
16
|
-
LOGOUT_REQUEST,
|
|
17
|
-
LOGOUT_SUCCESS,
|
|
18
|
-
LOGOUT_FAILURE,
|
|
19
|
-
GET_SCHEMA_FOR_ENTITY_SUCCESS,
|
|
20
|
-
GET_SCHEMA_FOR_ENTITY_FAILURE,
|
|
21
|
-
GET_USER_DATA_SUCCESS,
|
|
22
|
-
GET_USER_DATA_FAILURE,
|
|
23
|
-
} from '../constants';
|
|
24
|
-
|
|
25
|
-
const error = new Error('error');
|
|
26
|
-
|
|
27
|
-
describe('fetchUserInfo Saga', () => {
|
|
28
|
-
it('should handle success scenario', () => {
|
|
29
|
-
const mockCallback = jest.fn();
|
|
30
|
-
const mockApiResponse = {
|
|
31
|
-
user: { id: 1, name: 'Test User' },
|
|
32
|
-
currentOrgDetails: {
|
|
33
|
-
basic_details: {
|
|
34
|
-
base_language: '',
|
|
35
|
-
supported_languages: [],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
currentOrgId: '123',
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const expectedUserData = { id: 1, name: 'Test User' };
|
|
42
|
-
const updatedOrgDetails = {
|
|
43
|
-
basic_details: {
|
|
44
|
-
base_language: 'en',
|
|
45
|
-
supported_languages: [
|
|
46
|
-
{
|
|
47
|
-
lang_id: 69,
|
|
48
|
-
language: 'English',
|
|
49
|
-
iso_code: 'en',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return expectSaga(fetchUserInfo, { callback: mockCallback })
|
|
56
|
-
.provide([
|
|
57
|
-
[matchers.call.fn(api.getUserData), mockApiResponse],
|
|
58
|
-
])
|
|
59
|
-
.call(api.getUserData)
|
|
60
|
-
.put({
|
|
61
|
-
type: GET_USER_DATA_SUCCESS,
|
|
62
|
-
userData: expectedUserData,
|
|
63
|
-
currentOrgId: '123',
|
|
64
|
-
currentOrgDetails: {
|
|
65
|
-
...mockApiResponse.currentOrgDetails,
|
|
66
|
-
basic_details: {
|
|
67
|
-
...updatedOrgDetails.basic_details,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
.run();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should handle failure scenario', () => {
|
|
75
|
-
const mockCallback = jest.fn();
|
|
76
|
-
const mockError = new Error('Some error');
|
|
77
|
-
|
|
78
|
-
return expectSaga(fetchUserInfo, { callback: mockCallback })
|
|
79
|
-
.provide([
|
|
80
|
-
[matchers.call.fn(api.getUserData), throwError(mockError)],
|
|
81
|
-
])
|
|
82
|
-
.call(api.getUserData)
|
|
83
|
-
.put({
|
|
84
|
-
type: GET_USER_DATA_FAILURE,
|
|
85
|
-
error: mockError,
|
|
86
|
-
})
|
|
87
|
-
.run();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('capSaga', () => {
|
|
92
|
-
it("should initialize all capSaga-related watcher sagas without error", () => {
|
|
93
|
-
return expectSaga(capSaga).run();
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe('loginFlow', () => {
|
|
98
|
-
it('should handle the login flow', () => {
|
|
99
|
-
const generator = loginFlow();
|
|
100
|
-
const user = { username: 'testuser', password: 'password123' };
|
|
101
|
-
let task;
|
|
102
|
-
// First iteration
|
|
103
|
-
expect(generator.next().value).toEqual(take(LOGIN_REQUEST));
|
|
104
|
-
expect(generator.next({ user }).value).toEqual(fork(authorize, user));
|
|
105
|
-
task = generator.next().value; // Assign the task value
|
|
106
|
-
try {
|
|
107
|
-
const failureAction = { type: LOGIN_FAILURE };
|
|
108
|
-
|
|
109
|
-
expect(generator.next(logoutAction).value).toEqual(cancel(task));
|
|
110
|
-
|
|
111
|
-
// When LOGIN_FAILURE action is dispatched
|
|
112
|
-
expect(generator.next(failureAction).value).toEqual(take(LOGIN_REQUEST));
|
|
113
|
-
expect(generator.next().value).toEqual(fork(authorize, user));
|
|
114
|
-
expect(generator.next().done).toBe(true);
|
|
115
|
-
} catch {}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
describe('logoutFlow [Unit Test]', () => {
|
|
119
|
-
describe('logoutFlow saga', () => {
|
|
120
|
-
it('handle valid response from api', async () => {
|
|
121
|
-
expectSaga(logoutFlow)
|
|
122
|
-
.provide([
|
|
123
|
-
[
|
|
124
|
-
matchers.call.fn(api.logout),
|
|
125
|
-
{
|
|
126
|
-
success: true,
|
|
127
|
-
message: 'message',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
])
|
|
131
|
-
.put({
|
|
132
|
-
type: LOGOUT_SUCCESS,
|
|
133
|
-
result: 'message',
|
|
134
|
-
})
|
|
135
|
-
.run();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('handle invalid response from api', async () => {
|
|
139
|
-
expectSaga(logoutFlow)
|
|
140
|
-
.provide([
|
|
141
|
-
[
|
|
142
|
-
matchers.call.fn(api.logout),
|
|
143
|
-
{
|
|
144
|
-
success: false,
|
|
145
|
-
message: 'message',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
])
|
|
149
|
-
.run();
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('handle error response from api', async () => {
|
|
153
|
-
expectSaga(logoutFlow)
|
|
154
|
-
.provide([
|
|
155
|
-
[
|
|
156
|
-
matchers.call.fn(api.logout),
|
|
157
|
-
{
|
|
158
|
-
success: false,
|
|
159
|
-
error,
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
])
|
|
163
|
-
.put({
|
|
164
|
-
type: LOGOUT_FAILURE,
|
|
165
|
-
error,
|
|
166
|
-
})
|
|
167
|
-
.run();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('handles error thrown from api', async () => {
|
|
171
|
-
expectSaga(logoutFlow)
|
|
172
|
-
.provide([[matchers.call.fn(api.logout), throwError(error)]])
|
|
173
|
-
.put({
|
|
174
|
-
type: LOGOUT_FAILURE,
|
|
175
|
-
error,
|
|
176
|
-
})
|
|
177
|
-
.run();
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
describe('watchForLogoutFlow saga', () => {
|
|
182
|
-
const generator = watchForLogoutFlow();
|
|
183
|
-
it('should call watchers functions', async () => {
|
|
184
|
-
expect(generator.next().value).toEqual(
|
|
185
|
-
takeLatest(LOGOUT_REQUEST, logoutFlow),
|
|
186
|
-
);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe("fetchSchemaForEntity", () => {
|
|
192
|
-
it("handle success response from fetchSchemaForEntity", () => {
|
|
193
|
-
expectSaga(fetchSchemaForEntity, {
|
|
194
|
-
queryParams: {
|
|
195
|
-
type: 'tags'
|
|
196
|
-
},
|
|
197
|
-
})
|
|
198
|
-
.provide([
|
|
199
|
-
[
|
|
200
|
-
matchers.call.fn(api.fetchSchemaForEntity),
|
|
201
|
-
{
|
|
202
|
-
success: true,
|
|
203
|
-
response: {},
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
])
|
|
207
|
-
.put({
|
|
208
|
-
type: GET_SCHEMA_FOR_ENTITY_SUCCESS,
|
|
209
|
-
data: {},
|
|
210
|
-
statusCode: '',
|
|
211
|
-
entityType: 'tags'
|
|
212
|
-
})
|
|
213
|
-
.run();
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it("handle success response from fetchSchemaForEntity when metaEntities available", () => {
|
|
217
|
-
expectSaga(fetchSchemaForEntity, {
|
|
218
|
-
queryParams: {
|
|
219
|
-
type: 'tags'
|
|
220
|
-
},
|
|
221
|
-
})
|
|
222
|
-
.provide([
|
|
223
|
-
[
|
|
224
|
-
matchers.call.fn(api.fetchSchemaForEntity),
|
|
225
|
-
{
|
|
226
|
-
response: {
|
|
227
|
-
metaEntities: []
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
])
|
|
232
|
-
.put({
|
|
233
|
-
type: GET_SCHEMA_FOR_ENTITY_SUCCESS,
|
|
234
|
-
data: {
|
|
235
|
-
metaEntities: []
|
|
236
|
-
},
|
|
237
|
-
statusCode: '',
|
|
238
|
-
entityType: 'tags'
|
|
239
|
-
})
|
|
240
|
-
.run();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("handle when response and query params are empty from fetchSchemaForEntity when metaEntities available", () => {
|
|
244
|
-
expectSaga(fetchSchemaForEntity, {})
|
|
245
|
-
.provide([
|
|
246
|
-
[
|
|
247
|
-
matchers.call.fn(api.fetchSchemaForEntity),
|
|
248
|
-
{
|
|
249
|
-
success: true
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
])
|
|
253
|
-
.put({
|
|
254
|
-
type: GET_SCHEMA_FOR_ENTITY_SUCCESS,
|
|
255
|
-
data: {},
|
|
256
|
-
statusCode: '',
|
|
257
|
-
entityType: ''
|
|
258
|
-
})
|
|
259
|
-
.run();
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it("handle error response from fetchSchemaForEntity", () => {
|
|
263
|
-
expectSaga(fetchSchemaForEntity, {
|
|
264
|
-
queryParams: {
|
|
265
|
-
type: 'tags'
|
|
266
|
-
},
|
|
267
|
-
})
|
|
268
|
-
.provide([
|
|
269
|
-
[
|
|
270
|
-
matchers.call.fn(api.fetchSchemaForEntity),
|
|
271
|
-
{
|
|
272
|
-
success: false,
|
|
273
|
-
response: {},
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
])
|
|
277
|
-
.put({
|
|
278
|
-
type: GET_SCHEMA_FOR_ENTITY_FAILURE,
|
|
279
|
-
error: 'Error in fetching tags'
|
|
280
|
-
})
|
|
281
|
-
.run();
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { connect } from 'react-redux';
|
|
4
|
-
import Helmet from 'react-helmet';
|
|
5
|
-
import { bindActionCreators, compose } from 'redux';
|
|
6
|
-
import { FormattedMessage } from 'react-intl';
|
|
7
|
-
import { createStructuredSelector } from 'reselect';
|
|
8
|
-
import injectSaga from 'utils/injectSaga';
|
|
9
|
-
import injectReducer from 'utils/injectReducer';
|
|
10
|
-
import makeSelectDashboard from './selectors';
|
|
11
|
-
import makeSelectApp from '../App/selectors';
|
|
12
|
-
import messages from './messages';
|
|
13
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
14
|
-
import * as actions from './actions';
|
|
15
|
-
import PageHeader from '../../components/PageHeader';
|
|
16
|
-
import BreadCrumbs from '../../components/BreadCrumbs/index';
|
|
17
|
-
import { dashboardSaga } from './sagas';
|
|
18
|
-
import reducer from './reducer';
|
|
19
|
-
export class Dashboard extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
20
|
-
componentWillMount() {
|
|
21
|
-
this.props.router.push({
|
|
22
|
-
pathname: `/sms`,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
return (
|
|
27
|
-
<div>
|
|
28
|
-
<FormattedMessage {...messages.header}>
|
|
29
|
-
{message => (
|
|
30
|
-
<Helmet
|
|
31
|
-
title={message}
|
|
32
|
-
meta={[
|
|
33
|
-
{
|
|
34
|
-
name: 'description',
|
|
35
|
-
content: <FormattedMessage {...messages.header} />,
|
|
36
|
-
},
|
|
37
|
-
]}
|
|
38
|
-
/>
|
|
39
|
-
)}
|
|
40
|
-
</FormattedMessage>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
Dashboard.propTypes = {
|
|
47
|
-
router: PropTypes.object,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const mapStateToProps = createStructuredSelector({
|
|
51
|
-
App: makeSelectApp(),
|
|
52
|
-
Dashboard: makeSelectDashboard(),
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function mapDispatchToProps(dispatch) {
|
|
57
|
-
return {
|
|
58
|
-
actions: bindActionCreators(actions, dispatch),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const withConnect = connect(
|
|
64
|
-
mapStateToProps,
|
|
65
|
-
mapDispatchToProps,
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const withSaga = injectSaga({ key: 'dashboard', saga: dashboardSaga });
|
|
69
|
-
const withReducer = injectReducer({ key: 'dashboard', reducer });
|
|
70
|
-
|
|
71
|
-
export default compose(
|
|
72
|
-
UserIsAuthenticated,
|
|
73
|
-
withSaga,
|
|
74
|
-
withReducer,
|
|
75
|
-
withConnect,
|
|
76
|
-
)(Dashboard);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Dashboard Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the Dashboard component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.containers.Dashboard.header',
|
|
11
|
-
defaultMessage: 'Dashboard',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Dashboard reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import { DEFAULT_ACTION } from './constants';
|
|
9
|
-
|
|
10
|
-
const initialState = fromJS({});
|
|
11
|
-
|
|
12
|
-
function dashboardReducer(state = initialState, action) {
|
|
13
|
-
switch (action.type) {
|
|
14
|
-
case DEFAULT_ACTION:
|
|
15
|
-
return state;
|
|
16
|
-
default:
|
|
17
|
-
return state;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default dashboardReducer;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { all } from 'redux-saga/effects';
|
|
2
|
-
|
|
3
|
-
// Individual exports for testing
|
|
4
|
-
export function* defaultSaga() {
|
|
5
|
-
// See example in containers/HomePage/sagas.js
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// All sagas to be loaded
|
|
9
|
-
export default [
|
|
10
|
-
defaultSaga,
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
export function* dashboardSaga() {
|
|
14
|
-
yield all([
|
|
15
|
-
defaultSaga(),
|
|
16
|
-
])
|
|
17
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the dashboard state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectDashboardDomain = () => (state) => state.get('cap');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by Dashboard
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectDashboard = () => createSelector(
|
|
18
|
-
selectDashboardDomain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectDashboard;
|
|
23
|
-
export {
|
|
24
|
-
selectDashboardDomain,
|
|
25
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { expectSaga } from "redux-saga-test-plan";
|
|
2
|
-
|
|
3
|
-
import { dashboardSaga } from "../sagas";
|
|
4
|
-
|
|
5
|
-
describe("dashboardSaga Combined", () => {
|
|
6
|
-
test.concurrent("should initialize all dashboardSaga-related watcher sagas without error", () => {
|
|
7
|
-
return expectSaga(dashboardSaga).run();
|
|
8
|
-
});
|
|
9
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Ebill actions
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as types from './constants';
|
|
8
|
-
|
|
9
|
-
export function createTemplate(template) {
|
|
10
|
-
return {
|
|
11
|
-
type: types.CREATE_TEMPLATE_REQUEST,
|
|
12
|
-
template,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function getTemplateDetails(id, channel) {
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
20
|
-
id,
|
|
21
|
-
channel,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getCmsData(cmsType, projectId) {
|
|
26
|
-
return {
|
|
27
|
-
type: types.GET_CMS_EDITOR_DATA_REQUEST,
|
|
28
|
-
cmsType,
|
|
29
|
-
projectId,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function clearCRUDResponse() {
|
|
34
|
-
return {
|
|
35
|
-
type: types.CLEAR_EBILL_CRUD_RESPONSE_REQUEST,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function clearStoreValues() {
|
|
40
|
-
return {
|
|
41
|
-
type: types.CLEAR_ALL_VALUES,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Ebill constants
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const CREATE_TEMPLATE_REQUEST = 'app/containers/Ebill/CREATE_TEMPLATE_REQUEST';
|
|
8
|
-
export const CREATE_TEMPLATE_SUCCESS = 'app/containers/Ebill/CREATE_TEMPLATE_SUCCESS';
|
|
9
|
-
export const CREATE_TEMPLATE_FAILURE = 'app/containers/Ebill/CREATE_TEMPLATE_FAILURE';
|
|
10
|
-
|
|
11
|
-
export const GET_TEMPLATE_DETAILS_REQUEST = 'app/containers/Ebill/GET_TEMPLATE_DETAILS_REQUEST';
|
|
12
|
-
export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/containers/Ebill/GET_TEMPLATE_DETAILS_SUCCESS';
|
|
13
|
-
export const GET_TEMPLATE_DETAILS_FAILURE = 'app/containers/Ebill/GET_TEMPLATE_DETAILS_FAILURE';
|
|
14
|
-
|
|
15
|
-
export const GET_CMS_EDITOR_DATA_REQUEST = 'app/containers/Ebill/GET_CMS_EDITOR_DATA_REQUEST';
|
|
16
|
-
export const GET_CMS_EDITOR_DATA_SUCCESS = 'app/containers/Ebill/GET_CMS_EDITOR_DATA_SUCCESS';
|
|
17
|
-
export const GET_CMS_EDITOR_DATA_FAILURE = 'app/containers/Ebill/GET_CMS_EDITOR_DATA_FAILURE';
|
|
18
|
-
|
|
19
|
-
export const CLEAR_EBILL_CRUD_RESPONSE_REQUEST = 'app/containers/Ebill/CLEAR_EBILL_CRUD_RESPONSE_REQUEST';
|
|
20
|
-
export const CLEAR_ALL_VALUES = "app/containers/Ebill/CLEAR_ALL_VALUES";
|