cap-creatives-ui 8.0.73 → 8.0.120
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/.husky/_/husky.sh +32 -0
- package/.husky/pre-commit +4 -0
- package/app/components/TemplatePreview/_templatePreview.scss +3 -0
- package/app/components/TemplatePreview/index.js +2 -0
- package/app/containers/App/test/saga.test.js +1 -1
- package/app/containers/Assets/Gallery/sagas.js +2 -2
- package/app/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/app/containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/app/containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/app/containers/Assets/Gallery/tests/saga.test.js +50 -54
- package/app/containers/Dashboard/test/saga.test.js +1 -1
- package/app/containers/Ebill/test/saga.test.js +1 -1
- package/app/containers/Email/index.js +0 -3
- package/app/containers/Email/sagas.js +14 -28
- package/app/containers/Email/test/saga.test.js +506 -113
- package/app/containers/LanguageProvider/tests/actions.test.js +1 -1
- package/app/containers/LanguageProvider/tests/reducer.test.js +2 -2
- package/app/containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/app/containers/Line/Create/tests/saga.test.js +2 -9
- package/app/containers/Line/Edit/test/saga.test.js +10 -14
- package/app/containers/MobilePush/Create/test/saga.test.js +2 -2
- package/app/containers/MobilePush/Edit/tests/saga.test.js +14 -14
- package/app/containers/Sms/Create/test/saga.test.js +4 -5
- package/app/containers/Sms/Edit/test/saga.test.js +1 -1
- package/app/containers/Templates/constants.js +6 -0
- package/app/containers/Templates/index.js +44 -24
- package/app/containers/Templates/test/saga.test.js +14 -17
- package/app/containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/app/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/app/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/app/initialState.js +1 -0
- package/app/services/api.js +46 -22
- package/app/services/tests/api.test.js +122 -2
- package/app/styles/containers/reports/_reportPage.scss +128 -0
- package/app/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -9
- package/app/utils/cdnTransformation.js +1 -1
- package/app/utils/commonUtils.js +416 -12
- package/app/utils/tagValidations.js +51 -11
- package/app/utils/tests/__snapshots__/cdnTransformation.test.js.snap +9 -9
- package/app/utils/tests/authWrapper.test.js +2 -2
- package/app/utils/tests/cdnTransformation.mockdata.js +27 -28
- package/app/utils/tests/cdnTransformation.test.js +16 -15
- package/app/utils/tests/commonUtil.test.js +625 -84
- package/app/utils/tests/tagValidations.test.js +170 -3
- package/app/utils/tests/transformerUtils.test.js +2127 -0
- package/app/utils/transformerUtils.js +421 -0
- package/app/v2Components/CapImageUpload/index.js +13 -10
- package/app/v2Components/CapTagList/index.js +2 -7
- package/app/v2Components/CapTagList/messages.js +3 -3
- package/app/v2Components/CapVideoUpload/index.js +12 -9
- package/app/v2Components/CapVideoUpload/tests/index.test.js +1 -1
- package/app/v2Components/CapWhatsappCTA/constants.js +1 -0
- package/app/v2Components/CapWhatsappCTA/index.js +31 -18
- package/app/v2Components/CapWhatsappCTA/messages.js +4 -0
- package/app/v2Components/CapWhatsappCTA/tests/index.test.js +1 -2
- package/app/v2Components/CapWhatsappCarouselButton/constant.js +56 -0
- package/app/v2Components/CapWhatsappCarouselButton/index.js +446 -0
- package/app/v2Components/CapWhatsappCarouselButton/index.scss +39 -0
- package/app/v2Components/CapWhatsappCarouselButton/tests/index.test.js +237 -0
- package/app/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +125 -0
- package/app/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +147 -0
- package/app/v2Components/ErrorInfoNote/index.js +115 -47
- package/app/v2Components/ErrorInfoNote/messages.js +25 -0
- package/app/v2Components/ErrorInfoNote/style.scss +14 -1
- package/app/v2Components/ErrorInfoNote/utils.js +50 -0
- package/app/v2Components/ErrorInfoNote/utils.test.js +189 -0
- package/app/v2Components/FormBuilder/constants.js +8 -0
- package/app/v2Components/FormBuilder/index.js +207 -121
- package/app/v2Components/FormBuilder/messages.js +1 -1
- package/app/v2Components/MarketingObjective/test/index.test.js +1 -1
- package/app/v2Components/NavigationBar/tests/saga.test.js +2 -3
- package/app/v2Components/TemplatePreview/_templatePreview.scss +23 -0
- package/app/v2Components/TemplatePreview/assets/images/empty_image_preview.svg +4 -0
- package/app/v2Components/TemplatePreview/assets/images/empty_video_preview.svg +4 -0
- package/app/v2Components/TemplatePreview/index.js +162 -105
- package/app/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +6 -6
- package/app/v2Components/mockdata.js +2 -2
- package/app/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/app/v2Containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/app/v2Containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/app/v2Containers/Assets/Gallery/tests/saga.test.js +2 -2
- package/app/v2Containers/BeeEditor/test/saga.test.js +1 -1
- package/app/v2Containers/CallTask/test/saga.test.js +1 -1
- package/app/v2Containers/Cap/actions.js +8 -0
- package/app/v2Containers/Cap/constants.js +4 -0
- package/app/v2Containers/Cap/index.js +1 -1
- package/app/v2Containers/Cap/reducer.js +10 -4
- package/app/v2Containers/Cap/sagas.js +32 -3
- package/app/v2Containers/Cap/selectors.js +6 -0
- package/app/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
- package/app/v2Containers/Cap/tests/actions.test.js +1 -1
- package/app/v2Containers/Cap/tests/reducer.test.js +11 -11
- package/app/v2Containers/Cap/tests/saga.test.js +103 -2
- package/app/v2Containers/Cap/tests/selectors.test.js +3 -3
- package/app/v2Containers/CapFacebookPreview/tests/saga.test.js +1 -1
- package/app/v2Containers/CreativesContainer/SlideBoxContent.js +34 -4
- package/app/v2Containers/CreativesContainer/SlideBoxFooter.js +3 -1
- package/app/v2Containers/CreativesContainer/constants.js +17 -1
- package/app/v2Containers/CreativesContainer/index.js +198 -28
- package/app/v2Containers/CreativesContainer/messages.js +4 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +3 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +46 -3
- package/app/v2Containers/CreativesContainer/tests/index.test.js +3 -0
- package/app/v2Containers/Ebill/index.js +3 -3
- package/app/v2Containers/Ebill/test/saga.test.js +1 -1
- package/app/v2Containers/Email/index.js +8 -8
- package/app/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +4 -4
- package/app/v2Containers/Email/tests/actions.test.js +1 -1
- package/app/v2Containers/Email/tests/reducer.test.js +2 -2
- package/app/v2Containers/EmailWrapper/components/EmailWrapperView.js +192 -0
- package/app/v2Containers/EmailWrapper/constants.js +11 -1
- package/app/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +343 -0
- package/app/v2Containers/EmailWrapper/index.js +117 -295
- package/app/v2Containers/EmailWrapper/mockdata/mockdata.js +119 -0
- package/app/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +214 -0
- package/app/v2Containers/EmailWrapper/tests/index.test.js +101 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +601 -0
- package/app/v2Containers/FTP/test/saga.test.js +1 -1
- package/app/v2Containers/Facebook/test/saga.test.js +7 -7
- package/app/v2Containers/InApp/index.js +131 -51
- package/app/v2Containers/InApp/tests/action.test.js +7 -7
- package/app/v2Containers/InApp/tests/index.test.js +2 -4
- package/app/v2Containers/InApp/tests/reducer.test.js +175 -89
- package/app/v2Containers/InApp/tests/sagas.test.js +1 -1
- package/app/v2Containers/InApp/tests/utils.test.js +85 -0
- package/app/v2Containers/InApp/utils.js +57 -0
- package/app/v2Containers/InApp/utils.test.js +70 -0
- package/app/v2Containers/LanguageProvider/tests/actions.test.js +1 -1
- package/app/v2Containers/LanguageProvider/tests/reducer.test.js +3 -3
- package/app/v2Containers/LanguageProvider/tests/saga.test.js +2 -2
- package/app/v2Containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/app/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +3 -3
- package/app/v2Containers/Line/Container/Sticker/tests/mockData.js +103 -0
- package/app/v2Containers/Line/Container/Sticker/tests/utils.test.js +37 -0
- package/app/v2Containers/Line/Container/Sticker/utils.js +21 -10
- package/app/v2Containers/MobilePush/Create/index.js +25 -20
- package/app/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/app/v2Containers/MobilePush/Edit/actions.js +7 -4
- package/app/v2Containers/MobilePush/Edit/index.js +92 -53
- package/app/v2Containers/MobilePush/Edit/test/saga.test.js +14 -14
- package/app/v2Containers/MobilepushWrapper/index.js +2 -0
- package/app/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +682 -248
- package/app/v2Containers/Rcs/tests/saga.test.js +1 -1
- package/app/v2Containers/Sms/Create/index.js +1 -0
- package/app/v2Containers/Sms/Create/test/saga.test.js +1 -1
- package/app/v2Containers/Sms/Edit/index.js +3 -0
- package/app/v2Containers/Sms/Edit/test/saga.test.js +5 -5
- package/app/v2Containers/SmsTrai/Create/tests/saga.test.js +1 -1
- package/app/v2Containers/SmsTrai/Create/tests/selectors.test.js +1 -1
- package/app/v2Containers/SmsTrai/Edit/index.js +49 -10
- package/app/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +112 -36
- package/app/v2Containers/SmsTrai/Edit/tests/index.test.js +1 -3
- package/app/v2Containers/SmsWrapper/index.js +5 -1
- package/app/v2Containers/TagList/index.js +21 -16
- package/app/v2Containers/TagList/tests/TagList.test.js +1 -3
- package/app/v2Containers/TagList/tests/utils.test.js +3 -3
- package/app/v2Containers/Templates/_templates.scss +47 -0
- package/app/v2Containers/Templates/index.js +55 -5
- package/app/v2Containers/Templates/sagas.js +1 -1
- package/app/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +177 -156
- package/app/v2Containers/Templates/tests/actions.test.js +1 -1
- package/app/v2Containers/Templates/tests/reducer.test.js +8 -8
- package/app/v2Containers/Templates/tests/sagas.test.js +2 -4
- package/app/v2Containers/TemplatesV2/index.js +8 -1
- package/app/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/app/v2Containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/app/v2Containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/app/v2Containers/Whatsapp/constants.js +89 -1
- package/app/v2Containers/Whatsapp/index.js +752 -201
- package/app/v2Containers/Whatsapp/index.scss +52 -1
- package/app/v2Containers/Whatsapp/messages.js +38 -2
- package/app/v2Containers/Whatsapp/styles.scss +5 -0
- package/app/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +85870 -91059
- package/app/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -9
- package/app/v2Containers/Whatsapp/tests/actions.test.js +3 -3
- package/app/v2Containers/Whatsapp/tests/index.test.js +88 -0
- package/app/v2Containers/Whatsapp/tests/mockData.js +3 -7
- package/app/v2Containers/Whatsapp/tests/reducer.test.js +32 -36
- package/app/v2Containers/Whatsapp/tests/utils.test.js +186 -9
- package/app/v2Containers/Whatsapp/utils.js +52 -0
- package/app/v2Containers/Zalo/index.js +52 -17
- package/app/v2Containers/Zalo/index.scss +8 -0
- package/app/v2Containers/Zalo/messages.js +4 -0
- package/app/v2Containers/Zalo/tests/actions.test.js +3 -3
- package/app/v2Containers/Zalo/tests/reducer.test.js +72 -42
- package/app/v2Containers/mockdata.js +5 -0
- package/email-link-behavior-explanation.md +114 -0
- package/package.json +7 -4
- package/scripts/find-slowest-tests.js +112 -0
- package/version +15 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
if [ -z "$husky_skip_init" ]; then
|
|
3
|
+
debug () {
|
|
4
|
+
if [ "$HUSKY_DEBUG" = "1" ]; then
|
|
5
|
+
echo "husky (debug) - $1"
|
|
6
|
+
fi
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
readonly hook_name="$(basename -- "$0")"
|
|
10
|
+
debug "starting $hook_name..."
|
|
11
|
+
|
|
12
|
+
if [ "$HUSKY" = "0" ]; then
|
|
13
|
+
debug "HUSKY env variable is set to 0, skipping hook"
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if [ -f ~/.huskyrc ]; then
|
|
18
|
+
debug "sourcing ~/.huskyrc"
|
|
19
|
+
. ~/.huskyrc
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
readonly husky_skip_init=1
|
|
23
|
+
export husky_skip_init
|
|
24
|
+
sh -e "$0" "$@"
|
|
25
|
+
exitCode="$?"
|
|
26
|
+
|
|
27
|
+
if [ $exitCode != 0 ]; then
|
|
28
|
+
echo "husky - $hook_name hook exited with code $exitCode (error)"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
exit $exitCode
|
|
32
|
+
fi
|
|
@@ -464,6 +464,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
464
464
|
>
|
|
465
465
|
<CapImage
|
|
466
466
|
src={previewImageUrl}
|
|
467
|
+
className="line-image-preview"
|
|
467
468
|
alt="brand-name"
|
|
468
469
|
rest={{
|
|
469
470
|
style: {
|
|
@@ -495,6 +496,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
495
496
|
>
|
|
496
497
|
<CapImage
|
|
497
498
|
src={baseUrl ? `${baseUrl}/1040` : lineImgPlaceholder}
|
|
499
|
+
className="line-image-preview"
|
|
498
500
|
alt="brand-name"
|
|
499
501
|
rest={{
|
|
500
502
|
style: {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../sagas";
|
|
6
6
|
|
|
7
7
|
describe("appSaga Combined", () => {
|
|
8
|
-
|
|
8
|
+
test.concurrent("should initialize all appSaga-related watcher sagas without error", () => {
|
|
9
9
|
return expectSaga(appSaga).run();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -2,9 +2,9 @@ import { call, put, takeLatest, all } from 'redux-saga/effects';
|
|
|
2
2
|
import * as Api from '../../../services/api';
|
|
3
3
|
import * as types from './constants';
|
|
4
4
|
|
|
5
|
-
export function* getAllAssets(assetType, queryParams) {
|
|
5
|
+
export function* getAllAssets({assetType , queryParams}) {
|
|
6
6
|
try {
|
|
7
|
-
const result = yield call(Api.getAllAssets, assetType, queryParams);
|
|
7
|
+
const result = yield call(Api.getAllAssets, {assetType, queryParams});
|
|
8
8
|
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: queryParams.page === 1 });
|
|
9
9
|
} catch (error) {
|
|
10
10
|
yield put({ type: types.GET_ALL_ASSETS_FAILURE, error });
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
1
|
import * as actions from '../actions';
|
|
3
2
|
import * as types from '../constants';
|
|
4
3
|
|
|
5
4
|
describe('Gallery actions', () => {
|
|
6
5
|
describe('uploadAsset', () => {
|
|
7
|
-
|
|
6
|
+
test.concurrent('has a type of UPLOAD_ASSET_REQUEST', () => {
|
|
8
7
|
const expected = {
|
|
9
8
|
type: types.UPLOAD_ASSET_REQUEST,
|
|
10
9
|
file: 'test',
|
|
@@ -15,7 +14,7 @@ describe('Gallery actions', () => {
|
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
describe('getAllAssets', () => {
|
|
18
|
-
|
|
17
|
+
test.concurrent('has a type of GET_ALL_ASSETS_REQUEST', () => {
|
|
19
18
|
const expected = {
|
|
20
19
|
type: types.GET_ALL_ASSETS_REQUEST,
|
|
21
20
|
assetType: 'IMAGE',
|
|
@@ -6,7 +6,7 @@ import * as actions from '../actions';
|
|
|
6
6
|
|
|
7
7
|
describe('galleryReducer', () => {
|
|
8
8
|
describe('Initial State should match snapshot', () => {
|
|
9
|
-
it('returns the initial state', () => {
|
|
9
|
+
it.concurrent('returns the initial state', () => {
|
|
10
10
|
expect(galleryReducer(undefined, {})).toMatchSnapshot();
|
|
11
11
|
});
|
|
12
12
|
});
|
|
@@ -50,14 +50,14 @@ describe('galleryReducer', () => {
|
|
|
50
50
|
error: 'Some error Occurred',
|
|
51
51
|
};
|
|
52
52
|
const stateOnFailure = galleryReducer(initialState, failureAction);
|
|
53
|
-
it('should set fetching_schedule_message to true on request', () => {
|
|
53
|
+
it.concurrent('should set fetching_schedule_message to true on request', () => {
|
|
54
54
|
expect(stateOnRequest.toJS()).toEqual({ assetList: [], fetchingAllAssets: true, fetchAllAssetSuccess: false });
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
it('should set assetList from response on success', () => {
|
|
57
|
+
it.concurrent('should set assetList from response on success', () => {
|
|
58
58
|
expect(stateOnSuccess.toJS()).toEqual(successStateExpected);
|
|
59
59
|
});
|
|
60
|
-
it('should set fetching_schedule_message to false on GET_ALL_ASSETS_FAILURE', () => {
|
|
60
|
+
it.concurrent('should set fetching_schedule_message to false on GET_ALL_ASSETS_FAILURE', () => {
|
|
61
61
|
expect(stateOnFailure.toJS()).toEqual({assetList: [], fetchingAllAssets: false, fetchAllAssetSuccess: false});
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -82,14 +82,14 @@ describe('galleryReducer', () => {
|
|
|
82
82
|
error: 'Some error Occurred',
|
|
83
83
|
};
|
|
84
84
|
const stateOnFailure = galleryReducer(initialState, failureAction);
|
|
85
|
-
it('should set assetUploading to true and uploadAssetSuccess to false on request', () => {
|
|
85
|
+
it.concurrent('should set assetUploading to true and uploadAssetSuccess to false on request', () => {
|
|
86
86
|
expect(stateOnRequest.toJS()).toEqual({ uploadAssetSuccess: false, assetUploading: true });
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
it('should set assetUploading to false and uploadAssetSuccess to true on success', () => {
|
|
89
|
+
it.concurrent('should set assetUploading to false and uploadAssetSuccess to true on success', () => {
|
|
90
90
|
expect(stateOnSuccess.toJS()).toEqual(successStateExpected);
|
|
91
91
|
});
|
|
92
|
-
it('should set assetUploading to false and uploadAssetSuccess to false on UPLOAD_ASSET_FAILURE', () => {
|
|
92
|
+
it.concurrent('should set assetUploading to false and uploadAssetSuccess to false on UPLOAD_ASSET_FAILURE', () => {
|
|
93
93
|
expect(stateOnFailure.toJS()).toEqual({ uploadAssetSuccess: false, assetUploading: false });
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
import { expectSaga } from 'redux-saga-test-plan';
|
|
2
|
-
import { call
|
|
2
|
+
import { call } from 'redux-saga/effects';
|
|
3
3
|
import { throwError } from 'redux-saga-test-plan/providers';
|
|
4
|
-
import * as Api from '../../../../services/api';
|
|
5
|
-
import * as types from '../constants';
|
|
6
|
-
import * as sagas from '../sagas';
|
|
7
|
-
import {gallerySaga} from '../sagas';
|
|
4
|
+
import * as Api from '../../../../services/api';
|
|
5
|
+
import * as types from '../constants';
|
|
6
|
+
import * as sagas from '../sagas';
|
|
8
7
|
|
|
9
8
|
describe('Asset and User Management Sagas', () => {
|
|
9
|
+
jest.setTimeout(1000);
|
|
10
|
+
|
|
10
11
|
describe('getAllAssets Saga', () => {
|
|
12
|
+
const mockAssets = [{ id: 1, url: 'http://example.com/asset.jpg' }];
|
|
13
|
+
const mockError = new Error('Fetch failed');
|
|
11
14
|
const assetType = 'image';
|
|
12
15
|
const queryParams = { page: 1 };
|
|
13
16
|
|
|
14
|
-
it('handles fetching all assets successfully', () => {
|
|
15
|
-
const
|
|
16
|
-
response:
|
|
17
|
+
it.concurrent('handles fetching all assets successfully', () => {
|
|
18
|
+
const result = {
|
|
19
|
+
response: { data: { data: mockAssets } },
|
|
17
20
|
};
|
|
18
|
-
|
|
19
|
-
return expectSaga(sagas.getAllAssets, assetType, queryParams)
|
|
21
|
+
return expectSaga(sagas.getAllAssets, { assetType, queryParams })
|
|
20
22
|
.provide([
|
|
21
|
-
[call(Api.getAllAssets, assetType, queryParams),
|
|
23
|
+
[call(Api.getAllAssets, { assetType, queryParams }), result],
|
|
22
24
|
])
|
|
23
25
|
.put({
|
|
24
|
-
type:
|
|
25
|
-
data:
|
|
26
|
-
isReset: true
|
|
26
|
+
type: 'app/Gallery/GET_ALL_ASSETS_SUCCESS',
|
|
27
|
+
data: { data: { data: mockAssets } },
|
|
28
|
+
isReset: true,
|
|
27
29
|
})
|
|
28
|
-
.run();
|
|
30
|
+
.run(500);
|
|
29
31
|
});
|
|
30
32
|
|
|
31
|
-
it('handles failure in fetching all assets', () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
error
|
|
41
|
-
})
|
|
42
|
-
.run();
|
|
43
|
-
});
|
|
33
|
+
it.concurrent('handles failure in fetching all assets', () => expectSaga(sagas.getAllAssets, { assetType, queryParams })
|
|
34
|
+
.provide([
|
|
35
|
+
[call(Api.getAllAssets, { assetType, queryParams }), throwError(mockError)],
|
|
36
|
+
])
|
|
37
|
+
.put({
|
|
38
|
+
type: 'app/Gallery/GET_ALL_ASSETS_FAILURE',
|
|
39
|
+
error: mockError,
|
|
40
|
+
})
|
|
41
|
+
.run(500));
|
|
44
42
|
});
|
|
45
43
|
|
|
46
44
|
describe('uploadAsset Saga', () => {
|
|
@@ -48,34 +46,34 @@ describe('Asset and User Management Sagas', () => {
|
|
|
48
46
|
const assetType = 'image';
|
|
49
47
|
const fileParams = { param1: 'value1' };
|
|
50
48
|
|
|
51
|
-
it('handles successful asset upload', () => {
|
|
49
|
+
it.concurrent('handles successful asset upload', () => {
|
|
52
50
|
const fakeResponse = {
|
|
53
51
|
response: { asset: { id: 1, url: 'http://example.com/asset.jpg' } },
|
|
54
|
-
status: { code: 200 }
|
|
52
|
+
status: { code: 200 },
|
|
55
53
|
};
|
|
56
54
|
|
|
57
55
|
return expectSaga(sagas.uploadAsset, file, assetType, fileParams)
|
|
58
56
|
.provide([
|
|
59
|
-
[call(Api.uploadFile, file, assetType, fileParams), fakeResponse]
|
|
57
|
+
[call(Api.uploadFile, file, assetType, fileParams), fakeResponse],
|
|
60
58
|
])
|
|
61
59
|
.put({
|
|
62
60
|
type: types.UPLOAD_ASSET_SUCCESS,
|
|
63
61
|
data: fakeResponse.response.asset,
|
|
64
|
-
statusCode: 200
|
|
62
|
+
statusCode: 200,
|
|
65
63
|
})
|
|
66
64
|
.run();
|
|
67
65
|
});
|
|
68
66
|
|
|
69
|
-
it('handles failure in asset upload', () => {
|
|
67
|
+
it.concurrent('handles failure in asset upload', () => {
|
|
70
68
|
const error = new Error('Failed to upload asset');
|
|
71
69
|
|
|
72
70
|
return expectSaga(sagas.uploadAsset, file, assetType, fileParams)
|
|
73
71
|
.provide([
|
|
74
|
-
[call(Api.uploadFile, file, assetType, fileParams), throwError(error)]
|
|
72
|
+
[call(Api.uploadFile, file, assetType, fileParams), throwError(error)],
|
|
75
73
|
])
|
|
76
74
|
.put({
|
|
77
75
|
type: types.UPLOAD_ASSET_FAILURE,
|
|
78
|
-
error
|
|
76
|
+
error,
|
|
79
77
|
})
|
|
80
78
|
.run();
|
|
81
79
|
});
|
|
@@ -85,23 +83,23 @@ describe('Asset and User Management Sagas', () => {
|
|
|
85
83
|
const assetId = '123';
|
|
86
84
|
const assetType = 'image';
|
|
87
85
|
|
|
88
|
-
it('handles deleting an asset successfully', () => {
|
|
86
|
+
it.concurrent('handles deleting an asset successfully', () => {
|
|
89
87
|
const fakeResponse = {
|
|
90
|
-
response: 'Asset deleted successfully'
|
|
88
|
+
response: 'Asset deleted successfully',
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
return expectSaga(sagas.deleteAssetById, assetId, assetType)
|
|
94
92
|
.provide([
|
|
95
|
-
[call(Api.deleteAssetById, assetId, assetType), fakeResponse]
|
|
93
|
+
[call(Api.deleteAssetById, assetId, assetType), fakeResponse],
|
|
96
94
|
])
|
|
97
95
|
.put({
|
|
98
96
|
type: types.DELETE_ASSET_SUCCESS,
|
|
99
|
-
data: fakeResponse.response
|
|
97
|
+
data: fakeResponse.response,
|
|
100
98
|
})
|
|
101
99
|
.run();
|
|
102
100
|
});
|
|
103
101
|
|
|
104
|
-
it('handles failure in deleting an asset', () => {
|
|
102
|
+
it.concurrent('handles failure in deleting an asset', () => {
|
|
105
103
|
const error = new Error('Deletion failed');
|
|
106
104
|
|
|
107
105
|
return expectSaga(sagas.deleteAssetById, assetId, assetType)
|
|
@@ -110,41 +108,41 @@ describe('Asset and User Management Sagas', () => {
|
|
|
110
108
|
])
|
|
111
109
|
.put({
|
|
112
110
|
type: types.DELETE_ASSET_FAILURE,
|
|
113
|
-
error
|
|
111
|
+
error,
|
|
114
112
|
})
|
|
115
113
|
.run();
|
|
116
114
|
});
|
|
117
115
|
});
|
|
118
116
|
|
|
119
117
|
describe('fetchUserList Saga', () => {
|
|
120
|
-
it('handles fetching user list successfully', () => {
|
|
118
|
+
it.concurrent('handles fetching user list successfully', () => {
|
|
121
119
|
const fakeResponse = {
|
|
122
120
|
data: {
|
|
123
|
-
result: [{ id: 1, name: 'User One' }]
|
|
124
|
-
}
|
|
121
|
+
result: [{ id: 1, name: 'User One' }],
|
|
122
|
+
},
|
|
125
123
|
};
|
|
126
124
|
|
|
127
125
|
return expectSaga(sagas.fetchUserList)
|
|
128
126
|
.provide([
|
|
129
|
-
[call(Api.getUserList), fakeResponse]
|
|
127
|
+
[call(Api.getUserList), fakeResponse],
|
|
130
128
|
])
|
|
131
129
|
.put({
|
|
132
130
|
type: types.GET_USER_LIST_SUCCESS,
|
|
133
|
-
data: fakeResponse.data.result
|
|
131
|
+
data: fakeResponse.data.result,
|
|
134
132
|
})
|
|
135
133
|
.run();
|
|
136
134
|
});
|
|
137
135
|
|
|
138
|
-
it('handles failure in fetching user list', () => {
|
|
136
|
+
it.concurrent('handles failure in fetching user list', () => {
|
|
139
137
|
const error = new Error('Fetch failed');
|
|
140
138
|
|
|
141
139
|
return expectSaga(sagas.fetchUserList)
|
|
142
140
|
.provide([
|
|
143
|
-
[call(Api.getUserList), throwError(error)]
|
|
141
|
+
[call(Api.getUserList), throwError(error)],
|
|
144
142
|
])
|
|
145
143
|
.put({
|
|
146
144
|
type: types.GET_USER_LIST_FAILURE,
|
|
147
|
-
data: error
|
|
145
|
+
data: error,
|
|
148
146
|
})
|
|
149
147
|
.run();
|
|
150
148
|
});
|
|
@@ -153,9 +151,7 @@ describe('Asset and User Management Sagas', () => {
|
|
|
153
151
|
|
|
154
152
|
// Test combined saga
|
|
155
153
|
describe('Combined gallerySaga', () => {
|
|
156
|
-
it('should initialize all gallery-related watcher sagas without error', () =>
|
|
157
|
-
|
|
158
|
-
.run();
|
|
159
|
-
});
|
|
154
|
+
it.concurrent('should initialize all gallery-related watcher sagas without error', () => expectSaga(sagas.gallerySaga)
|
|
155
|
+
.run());
|
|
160
156
|
});
|
|
161
|
-
});
|
|
157
|
+
});
|
|
@@ -3,7 +3,7 @@ import { expectSaga } from "redux-saga-test-plan";
|
|
|
3
3
|
import { dashboardSaga } from "../sagas";
|
|
4
4
|
|
|
5
5
|
describe("dashboardSaga Combined", () => {
|
|
6
|
-
|
|
6
|
+
test.concurrent("should initialize all dashboardSaga-related watcher sagas without error", () => {
|
|
7
7
|
return expectSaga(dashboardSaga).run();
|
|
8
8
|
});
|
|
9
9
|
});
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "../sagas";
|
|
6
6
|
|
|
7
7
|
describe("ebillSaga Combined", () => {
|
|
8
|
-
|
|
8
|
+
test.concurrent("should initialize all ebill-related watcher sagas without error", () => {
|
|
9
9
|
return expectSaga(ebillSaga).run();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -1199,13 +1199,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1199
1199
|
}
|
|
1200
1200
|
|
|
1201
1201
|
getValidationData = () => {
|
|
1202
|
-
|
|
1203
1202
|
const that = this;
|
|
1204
1203
|
const formData = _.cloneDeep(this.state.formData);
|
|
1205
1204
|
_.forEach(formData, (val, index) => {
|
|
1206
1205
|
if (!isNaN(index)) {
|
|
1207
1206
|
_.forEach(val.selectedLanguages, (language) => {
|
|
1208
|
-
|
|
1209
1207
|
if (val[language].is_drag_drop) {
|
|
1210
1208
|
that.props.actions.getCmsData('edm', val[language].drag_drop_id, language);
|
|
1211
1209
|
}
|
|
@@ -3005,7 +3003,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3005
3003
|
});
|
|
3006
3004
|
|
|
3007
3005
|
// if (saveCount === 0) {
|
|
3008
|
-
|
|
3009
3006
|
this.props.actions.createTemplate(obj);
|
|
3010
3007
|
// } else {
|
|
3011
3008
|
// this.setState({saveObj: obj, targetSaveCount: saveCount, mode: "save", saveEdmDataMode: 'save'}, () => {
|
|
@@ -8,12 +8,13 @@ import * as types from './constants';
|
|
|
8
8
|
export function* createTemplate(template) {
|
|
9
9
|
let errorMsg;
|
|
10
10
|
try {
|
|
11
|
-
|
|
12
11
|
const result = yield call(Api.createEmailTemplate, template);
|
|
13
12
|
if (result.message || result.status.code === 500) {
|
|
14
13
|
errorMsg = result.message;
|
|
15
14
|
}
|
|
16
|
-
yield put({
|
|
15
|
+
yield put({
|
|
16
|
+
type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg,
|
|
17
|
+
});
|
|
17
18
|
} catch (error) {
|
|
18
19
|
yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
19
20
|
}
|
|
@@ -22,12 +23,13 @@ export function* createTemplate(template) {
|
|
|
22
23
|
export function* duplicateTemplate(id, channel) {
|
|
23
24
|
let errorMsg;
|
|
24
25
|
try {
|
|
25
|
-
|
|
26
|
-
const result = yield call(Api.duplicateTemplate, id, channel );
|
|
26
|
+
const result = yield call(Api.duplicateTemplate, id, channel);
|
|
27
27
|
if (result.message || result.status.code === 500) {
|
|
28
28
|
errorMsg = result.message;
|
|
29
29
|
}
|
|
30
|
-
yield put({
|
|
30
|
+
yield put({
|
|
31
|
+
type: types.DUPLICATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg,
|
|
32
|
+
});
|
|
31
33
|
} catch (error) {
|
|
32
34
|
yield put({ type: types.DUPLICATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
33
35
|
}
|
|
@@ -35,7 +37,6 @@ export function* duplicateTemplate(id, channel) {
|
|
|
35
37
|
|
|
36
38
|
export function* getTemplateDetails(id) {
|
|
37
39
|
try {
|
|
38
|
-
|
|
39
40
|
const result = yield call(Api.getTemplateDetails, id);
|
|
40
41
|
// const sidebar = result.response.sidebar;
|
|
41
42
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -44,30 +45,29 @@ export function* getTemplateDetails(id) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export function* getAllAssets(assetType, queryParams) {
|
|
48
|
+
export function* getAllAssets({ assetType, queryParams }) {
|
|
48
49
|
try {
|
|
49
|
-
const result = yield call(Api.getAllAssets, assetType, queryParams);
|
|
50
|
+
const result = yield call(Api.getAllAssets, { assetType, queryParams });
|
|
50
51
|
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: queryParams.page === 1 });
|
|
51
52
|
} catch (error) {
|
|
52
53
|
yield put({ type: types.GET_ALL_ASSETS_FAILURE, error });
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
export function* getCmsSetting({
|
|
57
|
+
export function* getCmsSetting({
|
|
58
|
+
cmsType, projectId, cmsMode, langId, isEdmSupport,
|
|
59
|
+
}) {
|
|
57
60
|
try {
|
|
58
|
-
|
|
59
61
|
const result = yield call(Api.getCmsTemplateSettings, cmsType, projectId, cmsMode, langId, isEdmSupport);
|
|
60
|
-
|
|
61
62
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
|
|
62
63
|
} catch (error) {
|
|
63
64
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error });
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
export function* getCmsData({cmsType, projectId, langId}) {
|
|
68
|
+
export function* getCmsData({ cmsType, projectId, langId }) {
|
|
68
69
|
try {
|
|
69
70
|
const result = yield call(Api.getCmsTemplateData, cmsType, projectId, langId);
|
|
70
|
-
|
|
71
71
|
yield put({ type: types.GET_CMS_EDITOR_DATA_SUCCESS, data: result.data.response.data, langId: result.data.response.langId });
|
|
72
72
|
} catch (error) {
|
|
73
73
|
yield put({ type: types.GET_CMS_EDITOR_DATA_FAILURE, error });
|
|
@@ -85,44 +85,30 @@ export function* uploadAsset(file, assetType, fileParams) {
|
|
|
85
85
|
|
|
86
86
|
function* watchCreateTemplate() {
|
|
87
87
|
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
88
|
-
|
|
89
|
-
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
function* watchGetTemplateDetails() {
|
|
93
91
|
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
94
|
-
|
|
95
|
-
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
function* watchGetAllAssets() {
|
|
99
95
|
yield takeLatest(types.GET_ALL_ASSETS_REQUEST, getAllAssets);
|
|
100
|
-
|
|
101
|
-
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
function* watchGetCmsSetting() {
|
|
105
99
|
yield takeEvery(types.GET_CMS_EDITOR_DETAILS_REQUEST, getCmsSetting);
|
|
106
|
-
|
|
107
|
-
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
function* watchGetCmsData() {
|
|
111
103
|
yield takeEvery(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
|
|
112
|
-
|
|
113
|
-
|
|
114
104
|
}
|
|
115
105
|
|
|
116
106
|
function* watchUploadAsset() {
|
|
117
107
|
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
118
|
-
|
|
119
|
-
|
|
120
108
|
}
|
|
121
109
|
|
|
122
110
|
function* watchDuplicateTemplate() {
|
|
123
111
|
yield takeLatest(types.DUPLICATE_TEMPLATE_REQUEST, duplicateTemplate);
|
|
124
|
-
|
|
125
|
-
|
|
126
112
|
}
|
|
127
113
|
|
|
128
114
|
// All sagas to be loaded
|
|
@@ -146,4 +132,4 @@ export function* emailSaga() {
|
|
|
146
132
|
watchUploadAsset(),
|
|
147
133
|
watchDuplicateTemplate(),
|
|
148
134
|
]);
|
|
149
|
-
}
|
|
135
|
+
}
|