@capillarytech/creatives-library 7.18.0-beta.0 → 8.0.0
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/app.js +27 -54
- package/assets/Line_Preview_English.svg +24 -0
- package/assets/Line_Preview_Japanese.svg +24 -0
- package/components/CapTagList/index.js +2 -2
- package/components/CapTagList/messages.js +8 -0
- package/components/Ckeditor/index.js +4 -2
- package/components/Ckeditor/style.scss +3 -0
- package/components/FormBuilder/_formBuilder.scss +4 -16
- package/components/FormBuilder/index.js +4 -3
- package/components/FormBuilder/messages.js +4 -0
- package/components/Sidebar/index.js +4 -4
- package/config/path.js +1 -1
- package/containers/App/constants.js +95 -0
- package/containers/App/index.js +52 -0
- package/containers/App/sagas.js +8 -3
- package/containers/Assets/Gallery/index.js +17 -3
- package/containers/Assets/Gallery/messages.js +4 -0
- package/containers/Assets/Gallery/sagas.js +14 -14
- package/containers/Cap/index.js +84 -50
- package/containers/Cap/sagas.js +20 -12
- package/containers/Cap/selectors.js +13 -13
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +1 -1
- package/containers/Cap/tests/saga.test.js +81 -1
- package/containers/Dashboard/index.js +34 -17
- package/containers/Dashboard/sagas.js +7 -1
- package/containers/Ebill/index.js +16 -3
- package/containers/Ebill/sagas.js +18 -11
- package/containers/Email/index.js +20 -3
- package/containers/Email/sagas.js +34 -23
- package/containers/LanguageProvider/index.js +49 -31
- package/containers/LanguageProvider/tests/index.test.js +5 -3
- package/containers/Line/Create/index.js +15 -2
- package/containers/Line/Create/sagas.js +26 -17
- package/containers/Line/Edit/sagas.js +12 -13
- package/containers/Login/index.js +36 -11
- package/containers/MobilePush/Create/index.js +17 -2
- package/containers/MobilePush/Create/sagas.js +18 -12
- package/containers/MobilePush/Edit/index.js +20 -3
- package/containers/MobilePush/Edit/sagas.js +30 -20
- package/containers/Sms/Create/index.js +15 -2
- package/containers/Sms/Create/sagas.js +8 -6
- package/containers/Sms/Edit/index.js +15 -3
- package/containers/Sms/Edit/sagas.js +14 -8
- package/containers/TagList/constants.js +23 -0
- package/containers/Templates/actions.js +0 -5
- package/containers/Templates/index.js +47 -14
- package/containers/Templates/sagas.js +20 -23
- package/containers/WeChat/MapTemplates/index.js +19 -2
- package/containers/WeChat/MapTemplates/sagas.js +17 -17
- package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -2
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +11 -8
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +21 -2
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
- package/entry.js +2 -0
- package/global-styles.js +2 -2
- package/gtm/eventDefinitionsMap.js +1 -1
- package/helpers/intl-enzym-test-helpers.js +1 -1
- package/hoc/withReactRouterV3Compatibility.js +66 -0
- package/index.js +12 -0
- package/initialReducer.js +32 -0
- package/initialState.js +1 -0
- package/mfe-exposed-components.js +8 -0
- package/package.json +16 -11
- package/routes.js +206 -749
- package/services/api.js +62 -17
- package/services/tests/api.test.js +248 -1
- package/styles/components/navigation/_leftnav.scss +13 -0
- package/styles/containers/layout/_layoutPage.scss +14 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +21 -16
- package/tests/store.test.js +5 -3
- package/translations/en.json +1 -9
- package/translations/ja-JP.json +0 -8
- package/translations/zh.json +0 -8
- package/utils/authWrapper.js +43 -17
- package/utils/cdnTransformation.js +73 -44
- package/utils/checkStore.js +21 -0
- package/utils/common.js +198 -8
- package/utils/commonUtils.js +17 -1
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/history.js +8 -0
- package/utils/injectReducer.js +2 -0
- package/utils/injectSaga.js +2 -0
- package/utils/tagValidations.js +2 -2
- package/utils/tests/cdnTransformation.test.js +6 -4
- package/utils/tests/common.mockdata.js +623 -0
- package/utils/tests/common.test.js +273 -0
- package/utils/tests/commonUtil.test.js +79 -0
- package/v2Components/CapDeviceContent/index.js +330 -0
- package/v2Components/CapDeviceContent/index.scss +115 -0
- package/v2Components/CapDeviceContent/messages.js +94 -0
- package/v2Components/CapDeviceContent/tests/index.test.js +89 -0
- package/v2Components/CapImageUpload/constants.js +6 -0
- package/v2Components/CapImageUpload/index.js +23 -15
- package/v2Components/CapImageUpload/index.scss +6 -0
- package/v2Components/CapImageUpload/messages.js +7 -7
- package/v2Components/CapInAppCTA/constants.js +25 -0
- package/v2Components/CapInAppCTA/index.js +279 -0
- package/v2Components/CapInAppCTA/index.scss +99 -0
- package/v2Components/CapInAppCTA/messages.js +85 -0
- package/v2Components/CapTagList/index.js +149 -26
- package/v2Components/CapTagList/messages.js +12 -0
- package/v2Components/CapTagList/style.scss +26 -0
- package/v2Components/CapVideoUpload/constants.js +6 -0
- package/v2Components/CapVideoUpload/index.js +48 -22
- package/v2Components/CapVideoUpload/index.scss +4 -2
- package/v2Components/CapVideoUpload/messages.js +10 -6
- package/v2Components/CapWhatsappQuickReply/index.js +255 -0
- package/v2Components/CapWhatsappQuickReply/index.scss +54 -0
- package/v2Components/CapWhatsappQuickReply/messages.js +32 -0
- package/v2Components/Ckeditor/index.js +56 -22
- package/v2Components/Ckeditor/style.scss +3 -0
- package/v2Components/Ckeditor/tests/index.test.js +44 -0
- package/v2Components/CmsTemplatesComponent/index.js +1 -0
- package/v2Components/CmsTemplatesComponent/messages.js +4 -0
- package/v2Components/EmailMobilePreview/index.js +4 -2
- package/v2Components/EmailPreviewV2/index.js +6 -4
- package/v2Components/EmailPreviewV2/tests/__snapshots__/index.test.js.snap +0 -3
- package/v2Components/FormBuilder/_formBuilder.scss +1 -0
- package/v2Components/FormBuilder/constants.js +1 -1
- package/v2Components/FormBuilder/index.js +111 -29
- package/v2Components/FormBuilder/messages.js +4 -0
- package/v2Components/FormBuilder/tests/index.test.js +5 -2
- package/v2Components/MobilePushPreviewV2/index.js +57 -22
- package/v2Components/NavigationBar/constants.js +1 -0
- package/v2Components/NavigationBar/index.js +84 -113
- package/v2Components/NavigationBar/messages.js +8 -0
- package/v2Components/NavigationBar/style.js +9 -0
- package/v2Components/NavigationBar/tests/index.test.js +32 -9
- package/v2Components/NavigationBar/tests/mockData.js +1 -0
- package/v2Components/NewCallTask/tests/index.test.js +5 -3
- package/v2Components/Pagination/index.js +2 -1
- package/v2Components/RenderRoute/RenderRoute.js +11 -0
- package/v2Components/RenderRoute/index.js +1 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +535 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +6 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +18 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +7 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +13 -0
- package/v2Components/TemplatePreview/index.js +745 -362
- package/v2Components/TemplatePreview/messages.js +8 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -14
- package/v2Components/TemplatePreview/tests/index.test.js +9 -0
- package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +8 -1
- package/v2Containers/App/constants.js +12 -6
- package/v2Containers/App/sagas.js +0 -1
- package/v2Containers/Assets/Gallery/index.js +1 -0
- package/v2Containers/Assets/Gallery/sagas.js +15 -14
- package/v2Containers/BeeEditor/index.js +3 -1
- package/v2Containers/BeeEditor/sagas.js +8 -5
- package/v2Containers/CallTask/sagas.js +7 -1
- package/v2Containers/Cap/actions.js +4 -0
- package/v2Containers/Cap/constants.js +20 -1
- package/v2Containers/Cap/index.js +116 -17
- package/v2Containers/Cap/messages.js +8 -0
- package/v2Containers/Cap/reducer.js +18 -3
- package/v2Containers/Cap/sagas.js +64 -9
- package/v2Containers/Cap/selectors.js +27 -13
- package/v2Containers/Cap/tests/Cap.test.js +164 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -1
- package/v2Containers/Cap/tests/actions.test.js +11 -0
- package/v2Containers/Cap/tests/reducer.test.js +59 -0
- package/v2Containers/Cap/tests/saga.test.js +181 -2
- package/v2Containers/Cap/tests/selectors.test.js +42 -18
- package/v2Containers/CapFacebookPreview/sagas.js +7 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +86 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +4 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +30 -14
- package/v2Containers/CreativesContainer/constants.js +5 -0
- package/v2Containers/CreativesContainer/index.js +157 -38
- package/v2Containers/CreativesContainer/index.scss +12 -0
- package/v2Containers/CreativesContainer/messages.js +33 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +11 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +5 -2
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +7 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +227 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +73 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +80 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +16 -0
- package/v2Containers/Ebill/sagas.js +3 -10
- package/v2Containers/Email/index.js +38 -19
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/Email/sagas.js +22 -26
- package/v2Containers/EmailWrapper/index.js +18 -8
- package/v2Containers/FTP/index.js +2 -2
- package/v2Containers/FTP/sagas.js +3 -4
- package/v2Containers/Facebook/sagas.js +26 -17
- package/v2Containers/InApp/actions.js +64 -0
- package/v2Containers/InApp/constants.js +160 -0
- package/v2Containers/InApp/index.js +792 -0
- package/v2Containers/InApp/index.scss +50 -0
- package/v2Containers/InApp/messages.js +114 -0
- package/v2Containers/InApp/reducer.js +109 -0
- package/v2Containers/InApp/sagas.js +151 -0
- package/v2Containers/InApp/selectors.js +12 -0
- package/v2Containers/InApp/tests/action.test.js +53 -0
- package/v2Containers/InApp/tests/index.test.js +165 -0
- package/v2Containers/InApp/tests/mockData.js +898 -0
- package/v2Containers/InApp/tests/reducer.test.js +177 -0
- package/v2Containers/InApp/tests/sagas.test.js +391 -0
- package/v2Containers/InApp/utils.js +12 -0
- package/v2Containers/LanguageProvider/index.js +17 -5
- package/v2Containers/LanguageProvider/reducer.js +3 -2
- package/v2Containers/LanguageProvider/sagas.js +7 -8
- package/v2Containers/LanguageProvider/selectors.js +2 -1
- package/v2Containers/LanguageProvider/tests/index.test.js +5 -2
- package/v2Containers/LanguageProvider/tests/reducer.test.js +6 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +28 -16
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +5 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +5 -3
- package/v2Containers/Line/Container/ImageMap/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +16 -1
- package/v2Containers/Line/Container/Video/index.js +2 -1
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +18134 -107
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +5 -3
- package/v2Containers/Line/Container/Wrapper/utils.js +1 -1
- package/v2Containers/Line/Container/index.js +4 -0
- package/v2Containers/Line/Container/sagas.js +30 -20
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +123 -81
- package/v2Containers/Line/Container/tests/index.test.js +5 -2
- package/v2Containers/Login/index.js +1 -2
- package/v2Containers/MobilePush/Create/index.js +40 -17
- package/v2Containers/MobilePush/Create/sagas.js +18 -12
- package/v2Containers/MobilePush/Edit/index.js +16 -7
- package/v2Containers/MobilePush/Edit/sagas.js +30 -20
- package/v2Containers/MobilepushWrapper/index.js +3 -0
- package/v2Containers/Rcs/sagas.js +14 -14
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +123 -87
- package/v2Containers/Rcs/tests/index.test.js +5 -3
- package/v2Containers/Sms/Create/sagas.js +10 -6
- package/v2Containers/Sms/Edit/sagas.js +14 -8
- package/v2Containers/SmsTrai/Create/sagas.js +9 -10
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +12 -8
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +5 -3
- package/v2Containers/TagList/_tagList.scss +18 -0
- package/v2Containers/TagList/index.js +81 -42
- package/v2Containers/TagList/tests/TagList.test.js +6 -7
- package/v2Containers/TagList/tests/mockdata.js +10 -166
- package/v2Containers/TagList/tests/utils.test.js +17 -0
- package/v2Containers/TagList/utils.js +15 -0
- package/v2Containers/Templates/_templates.scss +60 -5
- package/v2Containers/Templates/actions.js +6 -5
- package/v2Containers/Templates/constants.js +2 -1
- package/v2Containers/Templates/index.js +576 -181
- package/v2Containers/Templates/messages.js +52 -8
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/Templates/sagas.js +54 -38
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +669 -43
- package/v2Containers/Templates/tests/actions.test.js +19 -0
- package/v2Containers/Templates/tests/index.test.js +53 -1
- package/v2Containers/Templates/tests/mockData.js +45 -1
- package/v2Containers/Templates/tests/reducer.test.js +50 -0
- package/v2Containers/Templates/tests/sagas.test.js +116 -3
- package/v2Containers/Templates/tests/selector.test.js +17 -0
- package/v2Containers/TemplatesV2/index.js +180 -8
- package/v2Containers/TemplatesV2/messages.js +8 -0
- package/v2Containers/TemplatesV2/tests/index.test.js +104 -0
- package/v2Containers/TemplatesV2/tests/mockData.js +685 -0
- package/v2Containers/Viber/constants.js +58 -0
- package/v2Containers/Viber/index.js +404 -421
- package/v2Containers/Viber/index.scss +107 -0
- package/v2Containers/Viber/messages.js +70 -2
- package/v2Containers/Viber/sagas.js +22 -14
- package/v2Containers/Viber/style.js +20 -0
- package/v2Containers/Viber/tests/index.test.js +299 -0
- package/v2Containers/Viber/tests/mockData.js +134 -0
- package/v2Containers/WeChat/MapTemplates/sagas.js +22 -14
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +12 -11
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
- package/v2Containers/Whatsapp/actions.js +16 -0
- package/v2Containers/Whatsapp/constants.js +24 -0
- package/v2Containers/Whatsapp/index.js +892 -222
- package/v2Containers/Whatsapp/index.scss +91 -1
- package/v2Containers/Whatsapp/messages.js +98 -1
- package/v2Containers/Whatsapp/reducer.js +19 -0
- package/v2Containers/Whatsapp/sagas.js +67 -12
- package/v2Containers/Whatsapp/styles.scss +35 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34983 -24886
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +12 -0
- package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
- package/v2Containers/Whatsapp/tests/index.test.js +17 -4
- package/v2Containers/Whatsapp/tests/mockData.js +77 -0
- package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
- package/v2Containers/Whatsapp/tests/saga.test.js +201 -0
- package/v2Containers/Whatsapp/tests/utils.test.js +18 -0
- package/v2Containers/Whatsapp/utils.js +65 -4
- package/v2Containers/Zalo/actions.js +24 -0
- package/v2Containers/Zalo/constants.js +59 -0
- package/v2Containers/Zalo/index.js +548 -0
- package/v2Containers/Zalo/index.scss +75 -0
- package/v2Containers/Zalo/messages.js +86 -0
- package/v2Containers/Zalo/reducer.js +63 -0
- package/v2Containers/Zalo/saga.js +45 -0
- package/v2Containers/Zalo/selectors.js +19 -0
- package/v2Containers/Zalo/tests/actions.test.js +26 -0
- package/v2Containers/Zalo/tests/index.test.js +149 -0
- package/v2Containers/Zalo/tests/mockData.js +11527 -0
- package/v2Containers/Zalo/tests/reducer.test.js +96 -0
- package/v2Containers/Zalo/tests/saga.test.js +118 -0
- package/v2Containers/Zalo/tests/selector.test.js +51 -0
- package/v2Containers/mockdata.js +1531 -680
- package/containers/TestPage/constants.js +0 -7
- package/containers/TestPage/index.js +0 -31
- package/containers/TestPage/messages.js +0 -13
- package/containers/TestPage/reducer.js +0 -21
- package/containers/TestPage/sagas.js +0 -11
- package/containers/Testv2/actions.js +0 -15
- package/containers/Testv2/constants.js +0 -7
- package/containers/Testv2/index.js +0 -47
- package/containers/Testv2/messages.js +0 -21
- package/containers/Testv2/reducer.js +0 -23
- package/containers/Testv2/sagas.js +0 -11
- package/containers/Testv2/selectors.js +0 -25
- package/reducers.js +0 -73
- package/store.js +0 -61
- package/utils/tests/asyncInjectors.test.js +0 -173
- package/v2Containers/TestPage/constants.js +0 -7
- package/v2Containers/TestPage/index.js +0 -31
- package/v2Containers/TestPage/messages.js +0 -13
- package/v2Containers/TestPage/reducer.js +0 -21
- package/v2Containers/TestPage/sagas.js +0 -11
- package/v2Containers/Testv2/actions.js +0 -15
- package/v2Containers/Testv2/constants.js +0 -7
- package/v2Containers/Testv2/index.js +0 -47
- package/v2Containers/Testv2/messages.js +0 -21
- package/v2Containers/Testv2/reducer.js +0 -23
- package/v2Containers/Testv2/sagas.js +0 -11
- package/v2Containers/Testv2/selectors.js +0 -25
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
3
2
|
import * as Api from '../../services/api';
|
|
4
3
|
import * as types from './constants';
|
|
5
4
|
|
|
@@ -40,21 +39,21 @@ export function* getCmsData({cmsType, projectId}) {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
function* watchCreateTemplate() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
43
|
+
|
|
44
|
+
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
function* watchGetTemplateDetails() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
49
|
+
|
|
50
|
+
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
function* watchGetCmsData() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
yield takeLatest(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
|
|
55
|
+
|
|
56
|
+
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
// All sagas to be loaded
|
|
@@ -63,3 +62,11 @@ export default [
|
|
|
63
62
|
watchGetTemplateDetails,
|
|
64
63
|
watchGetCmsData,
|
|
65
64
|
];
|
|
65
|
+
|
|
66
|
+
export function* ebillSaga() {
|
|
67
|
+
yield all([
|
|
68
|
+
watchCreateTemplate(),
|
|
69
|
+
watchGetTemplateDetails(),
|
|
70
|
+
watchGetCmsData(),
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
-
import { bindActionCreators } from 'redux';
|
|
11
|
+
import { bindActionCreators, compose } from 'redux';
|
|
12
12
|
import Helmet from 'react-helmet';
|
|
13
13
|
import { Row, Col, Spin, Breadcrumb, Popover, Modal, Select } from 'antd';
|
|
14
14
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
@@ -32,6 +32,12 @@ import EmailPreview from '../../components/EmailPreview';
|
|
|
32
32
|
import ImagePreview from '../../components/ImagePreview';
|
|
33
33
|
import CardGrid from '../../components/CardGrid';
|
|
34
34
|
import Pagination from '../../components/Pagination';
|
|
35
|
+
import injectSaga from '../../utils/injectSaga';
|
|
36
|
+
import injectReducer from '../../utils/injectReducer';
|
|
37
|
+
import reducer from './reducer';
|
|
38
|
+
import { emailSaga } from './sagas';
|
|
39
|
+
import { templateSaga } from '../Templates/sagas';
|
|
40
|
+
|
|
35
41
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
36
42
|
|
|
37
43
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -3104,7 +3110,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3104
3110
|
<CapInput
|
|
3105
3111
|
className="search-text"
|
|
3106
3112
|
style={{width: '210px'}}
|
|
3107
|
-
placeholder=
|
|
3113
|
+
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
3108
3114
|
prefix={<i className="material-icons" style={{color: '#707070', fontSize: '16px'}}>search</i>}
|
|
3109
3115
|
value={this.state.searchText}
|
|
3110
3116
|
onChange={(e) => this.searchAsset(e.target.value)}
|
|
@@ -3307,4 +3313,15 @@ function mapDispatchToProps(dispatch) {
|
|
|
3307
3313
|
};
|
|
3308
3314
|
}
|
|
3309
3315
|
|
|
3310
|
-
|
|
3316
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
3317
|
+
const withReducer = injectReducer({ key: 'email', reducer });
|
|
3318
|
+
const withSaga = injectSaga({ key: 'email', saga: emailSaga });
|
|
3319
|
+
const withTemplateSaga = injectSaga({ key: 'templates', saga: templateSaga });
|
|
3320
|
+
|
|
3321
|
+
export default compose(
|
|
3322
|
+
UserIsAuthenticated,
|
|
3323
|
+
withReducer,
|
|
3324
|
+
withSaga,
|
|
3325
|
+
withTemplateSaga,
|
|
3326
|
+
withConnect,
|
|
3327
|
+
)(injectIntl(Email));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { take, cancel, call, put, takeLatest, takeEvery } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, takeEvery, all } from 'redux-saga/effects';
|
|
3
2
|
import * as Api from '../../services/api';
|
|
4
3
|
import * as types from './constants';
|
|
5
4
|
|
|
@@ -83,45 +82,45 @@ export function* uploadAsset(file, assetType, fileParams) {
|
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
function* watchCreateTemplate() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
86
|
+
|
|
87
|
+
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
function* watchGetTemplateDetails() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
92
|
+
|
|
93
|
+
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
function* watchGetAllAssets() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
yield takeLatest(types.GET_ALL_ASSETS_REQUEST, getAllAssets);
|
|
98
|
+
|
|
99
|
+
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
function* watchGetCmsSetting() {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
yield takeEvery(types.GET_CMS_EDITOR_DETAILS_REQUEST, getCmsSetting);
|
|
104
|
+
|
|
105
|
+
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
function* watchGetCmsData() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
yield takeEvery(types.GET_CMS_EDITOR_DATA_REQUEST, getCmsData);
|
|
110
|
+
|
|
111
|
+
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
function* watchUploadAsset() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
116
|
+
|
|
117
|
+
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
function* watchDuplicateTemplate() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
yield takeLatest(types.DUPLICATE_TEMPLATE_REQUEST, duplicateTemplate);
|
|
122
|
+
|
|
123
|
+
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
// All sagas to be loaded
|
|
@@ -134,3 +133,15 @@ export default [
|
|
|
134
133
|
watchUploadAsset,
|
|
135
134
|
watchDuplicateTemplate,
|
|
136
135
|
];
|
|
136
|
+
|
|
137
|
+
export function* emailSaga() {
|
|
138
|
+
yield all([
|
|
139
|
+
watchCreateTemplate(),
|
|
140
|
+
watchGetTemplateDetails(),
|
|
141
|
+
watchGetAllAssets(),
|
|
142
|
+
watchGetCmsSetting(),
|
|
143
|
+
watchGetCmsData(),
|
|
144
|
+
watchUploadAsset(),
|
|
145
|
+
watchDuplicateTemplate(),
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
@@ -6,37 +6,50 @@
|
|
|
6
6
|
* IntlProvider component and i18n messages (loaded from `app/translations`)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
|
|
11
9
|
import React from 'react';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import zhCN from 'antd/es/locale-provider/zh_CN';
|
|
15
|
-
import jaJP from 'antd/es/locale-provider/ja_JP';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import moment from 'moment';
|
|
16
12
|
import { connect } from 'react-redux';
|
|
17
|
-
import { createSelector } from 'reselect';
|
|
18
13
|
import { IntlProvider } from 'react-intl';
|
|
19
|
-
import
|
|
14
|
+
import { createStructuredSelector } from 'reselect';
|
|
15
|
+
import { bindActionCreators } from 'redux';
|
|
16
|
+
import { DEFAULT_LOCALE } from '../Cap/constants';
|
|
20
17
|
import { makeSelectLocale } from './selectors';
|
|
18
|
+
import makeSelectApp from '../App/selectors';
|
|
19
|
+
import * as appActions from '../App/actions';
|
|
20
|
+
import { getLocale } from '../../utils/ApiCaller';
|
|
21
|
+
export class LanguageProvider extends React.PureComponent {
|
|
22
|
+
// eslint-disable-line react/prefer-stateless-function
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
const jlocale = getLocale() || DEFAULT_LOCALE;
|
|
26
|
+
const locale = this.getReversedMappedLocale(jlocale);
|
|
27
|
+
this.props.actions.getLocizMessage(locale);
|
|
28
|
+
moment.locale(jlocale);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getReversedMappedLocale = locale => {
|
|
32
|
+
const map = {
|
|
33
|
+
en: 'en-US',
|
|
34
|
+
'zh-cn': 'zh',
|
|
35
|
+
hi: 'hi',
|
|
36
|
+
vi: 'vi',
|
|
37
|
+
tr: 'tr',
|
|
38
|
+
'ja-JP': 'ja-JP',
|
|
30
39
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
return map[locale];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
const { messagesData } = this.props.messages;
|
|
34
45
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
<IntlProvider
|
|
47
|
+
locale={this.props.locale}
|
|
48
|
+
key={this.props.locale}
|
|
49
|
+
messages={messagesData}
|
|
50
|
+
>
|
|
51
|
+
{React.Children.only(this.props.children)}
|
|
52
|
+
</IntlProvider>
|
|
40
53
|
);
|
|
41
54
|
}
|
|
42
55
|
}
|
|
@@ -45,18 +58,23 @@ LanguageProvider.propTypes = {
|
|
|
45
58
|
locale: PropTypes.string,
|
|
46
59
|
messages: PropTypes.object,
|
|
47
60
|
children: PropTypes.element.isRequired,
|
|
61
|
+
actions: PropTypes.object,
|
|
48
62
|
};
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
makeSelectLocale(),
|
|
53
|
-
|
|
54
|
-
);
|
|
64
|
+
const mapStateToProps = createStructuredSelector({
|
|
65
|
+
messages: makeSelectApp(),
|
|
66
|
+
locale: makeSelectLocale(),
|
|
67
|
+
});
|
|
55
68
|
|
|
56
69
|
function mapDispatchToProps(dispatch) {
|
|
57
70
|
return {
|
|
58
|
-
dispatch,
|
|
71
|
+
actions: bindActionCreators(appActions, dispatch),
|
|
59
72
|
};
|
|
60
73
|
}
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
const withConnect = connect(
|
|
76
|
+
mapStateToProps,
|
|
77
|
+
mapDispatchToProps,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export default withConnect(LanguageProvider);
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { shallow, mount } from 'enzyme';
|
|
3
3
|
import { FormattedMessage, defineMessages } from 'react-intl';
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
|
-
import {
|
|
5
|
+
import { createBrowserHistory } from 'history';
|
|
6
6
|
|
|
7
7
|
import ConnectedLanguageProvider, { LanguageProvider } from '../index';
|
|
8
|
-
import configureStore from '
|
|
8
|
+
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
9
|
+
import { initialReducer } from '../../../initialReducer';
|
|
9
10
|
|
|
10
11
|
import { translationMessages } from '../../../i18n';
|
|
11
12
|
|
|
@@ -36,9 +37,10 @@ describe('<LanguageProvider />', () => {
|
|
|
36
37
|
|
|
37
38
|
describe('<ConnectedLanguageProvider />', () => {
|
|
38
39
|
let store;
|
|
40
|
+
let browserHistory = createBrowserHistory();
|
|
39
41
|
|
|
40
42
|
beforeAll(() => {
|
|
41
|
-
store = configureStore({}, browserHistory);
|
|
43
|
+
store = configureStore({}, initialReducer, browserHistory);
|
|
42
44
|
});
|
|
43
45
|
|
|
44
46
|
it('should render the default language messages', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import {connect} from 'react-redux';
|
|
4
|
-
import { bindActionCreators } from 'redux';
|
|
4
|
+
import { bindActionCreators, compose } from 'redux';
|
|
5
5
|
import { injectIntl, intlShape } from 'react-intl';
|
|
6
6
|
import { createStructuredSelector } from 'reselect';
|
|
7
7
|
import { Row, Col, Spin, Breadcrumb } from 'antd';
|
|
@@ -17,6 +17,10 @@ import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
|
17
17
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
18
18
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
19
19
|
import './_lineCreate.scss';
|
|
20
|
+
import injectSaga from '../../../utils/injectSaga';
|
|
21
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
22
|
+
import reducer from './reducer';
|
|
23
|
+
import { lineCreateSaga } from './sagas';
|
|
20
24
|
|
|
21
25
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
22
26
|
|
|
@@ -819,4 +823,13 @@ function mapDispatchToProps(dispatch) {
|
|
|
819
823
|
};
|
|
820
824
|
}
|
|
821
825
|
|
|
822
|
-
|
|
826
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
827
|
+
const withReducer = injectReducer({ key: 'line', reducer });
|
|
828
|
+
const withSaga = injectSaga({ key: 'line', saga: lineCreateSaga});
|
|
829
|
+
|
|
830
|
+
export default compose(
|
|
831
|
+
UserIsAuthenticated,
|
|
832
|
+
withReducer,
|
|
833
|
+
withSaga,
|
|
834
|
+
withConnect,
|
|
835
|
+
)(injectIntl(Line));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Line Sagas
|
|
2
2
|
|
|
3
|
-
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
4
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
5
4
|
import * as Api from '../../../services/api';
|
|
6
5
|
import * as types from './constants';
|
|
7
6
|
|
|
@@ -30,15 +29,15 @@ export function* uploadAsset(file, assetType, fileParams) {
|
|
|
30
29
|
|
|
31
30
|
function* watchCreateTemplate() {
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
33
|
+
|
|
34
|
+
|
|
36
35
|
}
|
|
37
36
|
function* watchUploadAsset() {
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
39
|
+
|
|
40
|
+
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
// edit
|
|
@@ -80,21 +79,21 @@ export function* getLineTemplatesList(params) {
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
function* watchEditTemplate() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
83
|
+
|
|
84
|
+
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
function* watchGetTemplateDetails() {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
89
|
+
|
|
90
|
+
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
function* watchLineTemplatesList() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
|
|
95
|
+
|
|
96
|
+
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
// All sagas to be loaded
|
|
@@ -105,3 +104,13 @@ export default [
|
|
|
105
104
|
watchGetTemplateDetails,
|
|
106
105
|
watchLineTemplatesList,
|
|
107
106
|
];
|
|
107
|
+
|
|
108
|
+
export function* lineCreateSaga() {
|
|
109
|
+
yield all([
|
|
110
|
+
watchCreateTemplate(),
|
|
111
|
+
watchUploadAsset(),
|
|
112
|
+
watchEditTemplate(),
|
|
113
|
+
watchGetTemplateDetails(),
|
|
114
|
+
watchLineTemplatesList(),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
2
|
// import { schema, normalize } from 'normalizr';
|
|
4
3
|
import * as Api from '../../../services/api';
|
|
5
4
|
import * as types from './constants';
|
|
@@ -51,27 +50,27 @@ export function* getLineTemplatesList(params) {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
function* watchEditTemplate() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
54
|
+
|
|
55
|
+
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
function* watchGetTemplateDetails() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
60
|
+
|
|
61
|
+
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
function* watchUploadAsset() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
66
|
+
|
|
67
|
+
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
function* watchLineTemplatesList() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
yield takeLatest(types.GET_LINE_TEMPLATES_LIST_REQUEST, getLineTemplatesList);
|
|
72
|
+
|
|
73
|
+
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
// All sagas to be loaded
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
|
+
import { withRouter } from 'react-router-dom';
|
|
4
5
|
import Helmet from 'react-helmet';
|
|
5
6
|
import { FormattedMessage } from 'react-intl';
|
|
6
|
-
import { routerActions } from 'react-router
|
|
7
|
+
import { routerActions } from 'connected-react-router';
|
|
7
8
|
import { Row, Col } from 'antd';
|
|
8
|
-
import { bindActionCreators } from 'redux';
|
|
9
|
+
import { compose, bindActionCreators } from 'redux';
|
|
9
10
|
import { createStructuredSelector } from 'reselect';
|
|
10
11
|
import makeSelectLogin from './selectors';
|
|
11
12
|
import messages from './messages';
|
|
12
13
|
import config from '../../config/app';
|
|
13
14
|
import LoginForm from './components/LoginForm';
|
|
14
15
|
import * as actions from '../../containers/Cap/actions';
|
|
16
|
+
import { capSaga } from '../Cap/sagas';
|
|
17
|
+
import injectSaga from '../../utils/injectSaga';
|
|
15
18
|
import { UserIsNotAuthenticated } from '../../utils/authWrapper';
|
|
16
19
|
import loaderGif from '../../assets/loading_img.gif';
|
|
17
20
|
const logo = require('./assets/images/capillary_logo.png');
|
|
@@ -27,15 +30,25 @@ export class Login extends React.Component { // eslint-disable-line react/prefer
|
|
|
27
30
|
|
|
28
31
|
componentWillMount() {
|
|
29
32
|
const isAuthenticated = this.props.Login.token !== '';
|
|
30
|
-
const replace = this.props
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
+
const { replace } = this.props;
|
|
34
|
+
if (
|
|
35
|
+
this.props.Login.login_progress === false &&
|
|
36
|
+
this.props.Login.fetching_userdata === false &&
|
|
37
|
+
isAuthenticated
|
|
38
|
+
) {
|
|
39
|
+
replace(
|
|
40
|
+
process.env.NODE_ENV === 'production'
|
|
41
|
+
? config.production.dashboard_url
|
|
42
|
+
: config.development.dashboard_url,
|
|
43
|
+
);
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
componentWillReceiveProps(nextProps) {
|
|
37
|
-
const isAuthenticated =
|
|
38
|
-
|
|
48
|
+
const isAuthenticated =
|
|
49
|
+
nextProps.Login.token !== undefined && nextProps.Login.token !== '';
|
|
50
|
+
const wasAuthenticated =
|
|
51
|
+
this.props.Login.token !== undefined && this.props.Login.token !== '';
|
|
39
52
|
if (this.props.Login && this.props.Login.isError) {
|
|
40
53
|
this.setState({ isLoginError: true });
|
|
41
54
|
} else {
|
|
@@ -43,10 +56,14 @@ export class Login extends React.Component { // eslint-disable-line react/prefer
|
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
if (!wasAuthenticated && isAuthenticated) {
|
|
46
|
-
let redirectUrl =
|
|
47
|
-
|
|
59
|
+
let redirectUrl =
|
|
60
|
+
process.env.NODE_ENV === 'production'
|
|
61
|
+
? config.production.dashboard_url
|
|
62
|
+
: config.development.dashboard_url;
|
|
63
|
+
if (this.props.location.query.redirect)
|
|
64
|
+
redirectUrl = this.props.location.query.redirect;
|
|
48
65
|
this.props.router.push({ pathname: redirectUrl, state: {} });
|
|
49
|
-
this.props.router.go(
|
|
66
|
+
this.props.router.go(); // reload the page
|
|
50
67
|
}
|
|
51
68
|
}
|
|
52
69
|
|
|
@@ -103,4 +120,12 @@ function mapDispatchToProps(dispatch) {
|
|
|
103
120
|
};
|
|
104
121
|
}
|
|
105
122
|
|
|
106
|
-
|
|
123
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
124
|
+
|
|
125
|
+
const withSaga = injectSaga({ key: 'Login', saga: capSaga });
|
|
126
|
+
export default compose(
|
|
127
|
+
UserIsNotAuthenticated,
|
|
128
|
+
withRouter,
|
|
129
|
+
withSaga,
|
|
130
|
+
withConnect,
|
|
131
|
+
)(Login);
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
|
-
import { bindActionCreators } from 'redux';
|
|
11
|
+
import { bindActionCreators, compose } from 'redux';
|
|
12
12
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -22,6 +22,12 @@ import * as actions from './actions';
|
|
|
22
22
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
23
23
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
24
24
|
import messages from './messages';
|
|
25
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
26
|
+
import injectSaga from '../../../utils/injectSaga';
|
|
27
|
+
import reducer from './reducer';
|
|
28
|
+
import { createMPushSaga } from './sagas';
|
|
29
|
+
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
30
|
+
|
|
25
31
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
26
32
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
27
33
|
constructor(props) {
|
|
@@ -2277,4 +2283,13 @@ function mapDispatchToProps(dispatch) {
|
|
|
2277
2283
|
};
|
|
2278
2284
|
}
|
|
2279
2285
|
|
|
2280
|
-
|
|
2286
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
2287
|
+
const withReducer = injectReducer({ key: 'mobileCreate', reducer });
|
|
2288
|
+
const withSaga = injectSaga({ key: 'mobileCreate', saga: createMPushSaga });
|
|
2289
|
+
|
|
2290
|
+
export default compose(
|
|
2291
|
+
UserIsAuthenticated,
|
|
2292
|
+
withReducer,
|
|
2293
|
+
withSaga,
|
|
2294
|
+
withConnect,
|
|
2295
|
+
)(injectIntl(Create));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
// import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { take, cancel, call, put, takeLatest, all } from 'redux-saga/effects';
|
|
4
2
|
// import { schema, normalize } from 'normalizr';
|
|
5
3
|
import * as Api from '../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
@@ -38,19 +36,19 @@ export function* getIosCtas(licenseCode) {
|
|
|
38
36
|
|
|
39
37
|
function* watchCreateTemplate() {
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
40
|
+
|
|
41
|
+
|
|
44
42
|
}
|
|
45
43
|
function* watchUploadAsset() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
45
|
+
|
|
46
|
+
|
|
49
47
|
}
|
|
50
48
|
function* watchGetIosCtas() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
|
|
50
|
+
|
|
51
|
+
|
|
54
52
|
}
|
|
55
53
|
// All sagas to be loaded
|
|
56
54
|
export default [
|
|
@@ -58,3 +56,11 @@ export default [
|
|
|
58
56
|
watchUploadAsset,
|
|
59
57
|
watchGetIosCtas,
|
|
60
58
|
];
|
|
59
|
+
|
|
60
|
+
export function* createMPushSaga() {
|
|
61
|
+
yield all([
|
|
62
|
+
watchCreateTemplate(),
|
|
63
|
+
watchUploadAsset(),
|
|
64
|
+
watchGetIosCtas(),
|
|
65
|
+
]);
|
|
66
|
+
}
|