@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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import {bindActionCreators} from "redux";
|
|
11
|
+
import { bindActionCreators, compose } from "redux";
|
|
12
12
|
import { connect } from 'react-redux';
|
|
13
13
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -25,6 +25,13 @@ import {makeSelectTemplates} from "../../Templates/selectors";
|
|
|
25
25
|
import messages from './messages';
|
|
26
26
|
import './_mobilePushCreate.scss';
|
|
27
27
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
|
+
import injectSaga from "../../../utils/injectSaga";
|
|
29
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
30
|
+
import reducer from './reducer';
|
|
31
|
+
import { editMPushSaga } from './sagas';
|
|
32
|
+
import { templateSaga } from '../../Templates/sagas';
|
|
33
|
+
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
34
|
+
|
|
28
35
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
36
|
|
|
30
37
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -1779,7 +1786,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1779
1786
|
temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
1780
1787
|
}
|
|
1781
1788
|
_.forEach(col.supportedEvents, (event) => {
|
|
1782
|
-
console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
|
|
1783
1789
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
1784
1790
|
});
|
|
1785
1791
|
return true;
|
|
@@ -2573,4 +2579,15 @@ function mapDispatchToProps(dispatch) {
|
|
|
2573
2579
|
};
|
|
2574
2580
|
}
|
|
2575
2581
|
|
|
2576
|
-
|
|
2582
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
2583
|
+
const withReducer = injectReducer({ key: 'mobileEdit', reducer });
|
|
2584
|
+
const withSaga = injectSaga({ key: 'mobileEdit', saga: editMPushSaga });
|
|
2585
|
+
const withTemplatesSaga = injectSaga({ key: 'templates', saga: templateSaga });
|
|
2586
|
+
|
|
2587
|
+
export default compose(
|
|
2588
|
+
UserIsAuthenticated,
|
|
2589
|
+
withReducer,
|
|
2590
|
+
withSaga,
|
|
2591
|
+
withTemplatesSaga,
|
|
2592
|
+
withConnect,
|
|
2593
|
+
)(injectIntl(Edit));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
3
2
|
// import { schema, normalize } from 'normalizr';
|
|
4
3
|
import * as Api from '../../../services/api';
|
|
5
4
|
import * as types from './constants';
|
|
@@ -78,36 +77,36 @@ export function* fetchWeCrmAccounts(action) {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
function* watchFetchWeCrmAccounts() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
81
|
+
|
|
82
|
+
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
function* watchEditTemplate() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
87
|
+
|
|
88
|
+
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
function* watchGetTemplateDetails() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
93
|
+
|
|
94
|
+
|
|
96
95
|
}
|
|
97
96
|
function* watchUploadAsset() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
98
|
+
|
|
99
|
+
|
|
101
100
|
}
|
|
102
101
|
function* watchGetIosCtas() {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
|
|
103
|
+
|
|
104
|
+
|
|
106
105
|
}
|
|
107
106
|
function* watchMobilepushTemplatesList() {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
yield takeLatest(types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST, getMobilepushTemplatesList);
|
|
108
|
+
|
|
109
|
+
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
// All sagas to be loaded
|
|
@@ -116,3 +115,14 @@ export default [
|
|
|
116
115
|
watchUploadAsset,
|
|
117
116
|
watchGetIosCtas,
|
|
118
117
|
];
|
|
118
|
+
|
|
119
|
+
export function* editMPushSaga() {
|
|
120
|
+
yield all([
|
|
121
|
+
watchEditTemplate(),
|
|
122
|
+
watchGetTemplateDetails(),
|
|
123
|
+
watchFetchWeCrmAccounts(),
|
|
124
|
+
watchMobilepushTemplatesList(),
|
|
125
|
+
watchUploadAsset(),
|
|
126
|
+
watchGetIosCtas(),
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
@@ -12,7 +12,7 @@ import { Row, Col, Spin } from 'antd';
|
|
|
12
12
|
import { injectIntl, intlShape } from 'react-intl';
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import _ from 'lodash';
|
|
15
|
-
import { bindActionCreators } from 'redux';
|
|
15
|
+
import { bindActionCreators, compose} from 'redux';
|
|
16
16
|
import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
|
|
17
17
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
18
18
|
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
@@ -23,6 +23,10 @@ import messages from './messages';
|
|
|
23
23
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
24
24
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
25
25
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
|
+
import injectSaga from '../../../utils/injectSaga';
|
|
27
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
28
|
+
import reducer from './reducer';
|
|
29
|
+
import { createSmsSaga } from './sagas';
|
|
26
30
|
|
|
27
31
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
28
32
|
constructor(props) {
|
|
@@ -1471,4 +1475,13 @@ function mapDispatchToProps(dispatch) {
|
|
|
1471
1475
|
};
|
|
1472
1476
|
}
|
|
1473
1477
|
|
|
1474
|
-
|
|
1478
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
1479
|
+
const withReducer = injectReducer({ key: 'create', reducer });
|
|
1480
|
+
const withCreateSmsSaga = injectSaga({ key: 'create', saga: createSmsSaga });
|
|
1481
|
+
|
|
1482
|
+
export default compose(
|
|
1483
|
+
UserIsAuthenticated,
|
|
1484
|
+
withCreateSmsSaga,
|
|
1485
|
+
withReducer,
|
|
1486
|
+
withConnect,
|
|
1487
|
+
)(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';
|
|
@@ -25,12 +23,16 @@ export function* createTemplate(template) {
|
|
|
25
23
|
|
|
26
24
|
function* watchCreateTemplate() {
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
yield take(LOCATION_CHANGE);
|
|
30
|
-
yield cancel(watcher);
|
|
26
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
// All sagas to be loaded
|
|
34
30
|
export default [
|
|
35
31
|
watchCreateTemplate,
|
|
36
32
|
];
|
|
33
|
+
|
|
34
|
+
export function* createSmsSaga() {
|
|
35
|
+
yield all([
|
|
36
|
+
watchCreateTemplate(),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
@@ -13,7 +13,7 @@ import { Row, Col, Spin } from 'antd';
|
|
|
13
13
|
import { injectIntl, intlShape } from 'react-intl';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
15
15
|
import _ from 'lodash';
|
|
16
|
-
import { bindActionCreators } from 'redux';
|
|
16
|
+
import { bindActionCreators, compose } from 'redux';
|
|
17
17
|
import { makeSelectEdit, makeSelectEditResponse, makeSelectTemplateDetailsResponse } from './selectors';
|
|
18
18
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
19
19
|
import { UserIsAuthenticated } from '../../../utils/authWrapper';
|
|
@@ -24,7 +24,10 @@ import '../Create/_smsCreate.scss';
|
|
|
24
24
|
import messages from './messages';
|
|
25
25
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
26
26
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
|
-
|
|
27
|
+
import injectSaga from '../../../utils/injectSaga';
|
|
28
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
29
|
+
import reducer from './reducer';
|
|
30
|
+
import { editSmsSaga } from './sagas';
|
|
28
31
|
export class Edit extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
29
32
|
constructor(props) {
|
|
30
33
|
super(props);
|
|
@@ -1456,4 +1459,13 @@ function mapDispatchToProps(dispatch) {
|
|
|
1456
1459
|
};
|
|
1457
1460
|
}
|
|
1458
1461
|
|
|
1459
|
-
|
|
1462
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
1463
|
+
const withReducer = injectReducer({ key: 'edit', reducer });
|
|
1464
|
+
const withEditSmsSaga = injectSaga({ key: 'edit', saga: editSmsSaga });
|
|
1465
|
+
|
|
1466
|
+
export default compose(
|
|
1467
|
+
UserIsAuthenticated,
|
|
1468
|
+
withEditSmsSaga,
|
|
1469
|
+
withReducer,
|
|
1470
|
+
withConnect,
|
|
1471
|
+
)(injectIntl(Edit));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
3
2
|
// import { schema, normalize } from 'normalizr';
|
|
4
3
|
import * as Api from '../../../services/api';
|
|
5
4
|
import * as types from './constants';
|
|
@@ -35,18 +34,25 @@ export function* getTemplateDetails(id) {
|
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
function* watchEditTemplate() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
yield takeLatest(types.EDIT_TEMPLATE_REQUEST, editTemplate);
|
|
38
|
+
|
|
39
|
+
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
function* watchGetTemplateDetails() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
44
|
+
|
|
45
|
+
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// All sagas to be loaded
|
|
50
49
|
export default [
|
|
51
50
|
watchEditTemplate, watchGetTemplateDetails,
|
|
52
51
|
];
|
|
52
|
+
|
|
53
|
+
export function* editSmsSaga() {
|
|
54
|
+
yield all([
|
|
55
|
+
watchEditTemplate(),
|
|
56
|
+
watchGetTemplateDetails(),
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
@@ -5,3 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export const DEFAULT_ACTION = 'app/TagList/DEFAULT_ACTION';
|
|
8
|
+
|
|
9
|
+
export const JAPANESE_HELP_TEXT = 'ヘルプ :トークンの定義';
|
|
10
|
+
|
|
11
|
+
export const TAG_TRANSLATION_DOC = 'https://docs.capillarytech.com/docs/tags-translation';
|
|
12
|
+
|
|
13
|
+
export const GET_TRANSLATION_MAPPED = {
|
|
14
|
+
'en': 'en-US',
|
|
15
|
+
'zh-cn': 'zh',
|
|
16
|
+
'zh': 'zh',
|
|
17
|
+
'en-US': 'en-US',
|
|
18
|
+
'ja-JP': 'ja-JP',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const JAPANESE_HIDE_DATE_TAGS = [
|
|
22
|
+
"mm/dd/yyyy",
|
|
23
|
+
"dd/mm/yyyy",
|
|
24
|
+
"mm/dd/yy",
|
|
25
|
+
"dd Mon yyyy",
|
|
26
|
+
"Day, Mon dd, yy",
|
|
27
|
+
"dd.mm.yy",
|
|
28
|
+
"dd Mon",
|
|
29
|
+
"dd/m/yyyy",
|
|
30
|
+
];
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
|
|
9
9
|
export function getAllTemplates(channel, queryParams) {
|
|
10
|
-
|
|
11
10
|
return {
|
|
12
11
|
type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
|
|
13
12
|
};
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export function deleteTemplate(channel, id) {
|
|
29
|
-
|
|
30
28
|
return {
|
|
31
29
|
type: types.DELETE_TEMPLATE_REQUEST, channel, id,
|
|
32
30
|
};
|
|
@@ -45,7 +43,6 @@
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
export function setWeChatAccount(weChatAccount) {
|
|
48
|
-
|
|
49
46
|
return {
|
|
50
47
|
type: types.SET_WECHAT_ACCOUNT,
|
|
51
48
|
weChatAccount,
|
|
@@ -80,7 +77,6 @@
|
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
export function getTemplateDetails(id, channel) {
|
|
83
|
-
|
|
84
80
|
return {
|
|
85
81
|
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
86
82
|
id,
|
|
@@ -95,7 +91,6 @@
|
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
export function resetUploadData() {
|
|
98
|
-
|
|
99
94
|
return {
|
|
100
95
|
type: types.RESET_UPLOAD_DATA,
|
|
101
96
|
};
|
|
@@ -13,7 +13,7 @@ import { injectIntl, intlShape } from 'react-intl';
|
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import moment from "moment";
|
|
15
15
|
import _ from 'lodash';
|
|
16
|
-
import { bindActionCreators } from 'redux';
|
|
16
|
+
import { bindActionCreators, compose } from 'redux';
|
|
17
17
|
import { Row, Select, Spin, Dropdown, Col, Breadcrumb, Menu, Modal} from 'antd';
|
|
18
18
|
import { CapInput, CapButton, CapPopover, CapSelect } from '@capillarytech/cap-react-ui-library/';
|
|
19
19
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
@@ -44,6 +44,18 @@ import SlideBox from '../../components/SlideBox';
|
|
|
44
44
|
import Pagination from '../../components/Pagination';
|
|
45
45
|
import EmailPreview from '../../components/EmailPreview';
|
|
46
46
|
import WechatRichmediaTemplatePreview from '../../components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
47
|
+
import { EMAIL } from '../../v2Containers/App/constants';
|
|
48
|
+
import injectSaga from '../../utils/injectSaga';
|
|
49
|
+
import injectReducer from '../../utils/injectReducer';
|
|
50
|
+
import { templateSaga } from './sagas';
|
|
51
|
+
import { createSmsSaga } from '../Sms/Create/sagas';
|
|
52
|
+
import { editSmsSaga } from '../Sms/Edit/sagas';
|
|
53
|
+
import { emailSaga } from '../Email/sagas';
|
|
54
|
+
import reducer from './reducer';
|
|
55
|
+
import mobilePushCreateReducer from '../MobilePush/Create/reducer';
|
|
56
|
+
import lineCreateReducer from '../Line/Create/reducer';
|
|
57
|
+
import { ebillSaga } from '../Ebill/sagas';
|
|
58
|
+
import { lineCreateSaga } from '../Line/Create/sagas';
|
|
47
59
|
|
|
48
60
|
const MenuItem = Menu.Item;
|
|
49
61
|
const Option = Select.Option;
|
|
@@ -232,7 +244,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
232
244
|
this.getAllTemplates({params});
|
|
233
245
|
});
|
|
234
246
|
}
|
|
235
|
-
} else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id ||
|
|
247
|
+
} else if (this.state.channel.toLowerCase() === 'mobilepush' && (nextProps.location.query.account_id || nextProps.location.query.source_account_id)) {
|
|
236
248
|
_.forEach(nextProps.Templates.weCrmAccounts, (account) => {
|
|
237
249
|
if ((nextProps.location.query.account_id && account.id === Number(nextProps.location.query.account_id)) || (nextProps.location.query.source_account_id && account.sourceAccountIdentifier && account.sourceAccountIdentifier === nextProps.location.query.source_account_id)) {
|
|
238
250
|
selectedAccount = account;
|
|
@@ -308,9 +320,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
308
320
|
if (!nextProps.Templates.sendingFile && !_.isEqual(this.props.Templates.sendingFile, nextProps.Templates.sendingFile) && !nextProps.Templates.errorSendingFile) {
|
|
309
321
|
|
|
310
322
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
311
|
-
const isLanguageSupport = (
|
|
312
|
-
const isEdmSupport = (
|
|
313
|
-
const type =
|
|
323
|
+
const isLanguageSupport = searchParams.get('isLanguageSupport') ? searchParams.get('isLanguageSupport') : true;
|
|
324
|
+
const isEdmSupport = (searchParams.get('isEdmSupport') !== "false") || false;
|
|
325
|
+
const type = searchParams.get('type');
|
|
314
326
|
if (this.isEnabledInLibraryModule("callCreateFromProps")) {
|
|
315
327
|
this.props.createNew();
|
|
316
328
|
return;
|
|
@@ -456,7 +468,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
456
468
|
};
|
|
457
469
|
parent.postMessage(JSON.stringify(response), '*');
|
|
458
470
|
}
|
|
459
|
-
|
|
471
|
+
|
|
460
472
|
skipTemplateSelection = (e) => {
|
|
461
473
|
|
|
462
474
|
const type = this.props.location.query.type;
|
|
@@ -538,7 +550,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
538
550
|
const fileExtension = files[0].name.split('.').pop();
|
|
539
551
|
const supportedZipFormats = ['zip'];
|
|
540
552
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
541
|
-
const isLanguageSupport =
|
|
553
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport ? this.props.location.query.isLanguageSupport : true;
|
|
542
554
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
543
555
|
|
|
544
556
|
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
@@ -756,7 +768,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
756
768
|
|
|
757
769
|
menuOnClickEvent(ev) {
|
|
758
770
|
let type = this.props.location.query.type;
|
|
759
|
-
// const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
760
771
|
const channel = this.state.channel.toLowerCase();
|
|
761
772
|
switch (channel) {
|
|
762
773
|
case 'wechat':
|
|
@@ -866,7 +877,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
866
877
|
duplicateTemplate(template) {
|
|
867
878
|
|
|
868
879
|
const duplicateObj = _.cloneDeep(template);
|
|
869
|
-
duplicateObj.name =
|
|
880
|
+
duplicateObj.name = `${this.props.intl.formatMessage(messages.copyOf)} ${template.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
|
|
870
881
|
delete duplicateObj._id;
|
|
871
882
|
if (this.state.channel.toLowerCase() === "sms") {
|
|
872
883
|
this.props.smsActions.createTemplate(duplicateObj);
|
|
@@ -899,9 +910,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
899
910
|
handleEdmDefaultTemplateSelection = (isSelected, id) => {
|
|
900
911
|
if (isSelected) {
|
|
901
912
|
const data = _.find(this.props.Templates.cmsTemplates, {_id: id});
|
|
902
|
-
const type = this.props.location.query.type
|
|
913
|
+
const type = this.props.location.query.type
|
|
903
914
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
904
|
-
const isLanguageSupport =
|
|
915
|
+
const isLanguageSupport = this.props.location.query.isLanguageSupport ? this.props.location.query.isLanguageSupport : true;
|
|
905
916
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
906
917
|
let getQuery = '';
|
|
907
918
|
|
|
@@ -984,7 +995,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
984
995
|
templateInfo.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
985
996
|
} else if (this.state.channel.toLowerCase() === "email") {
|
|
986
997
|
|
|
987
|
-
this.props.actions.getTemplateDetails(template._id);
|
|
998
|
+
this.props.actions.getTemplateDetails(template._id, EMAIL);
|
|
988
999
|
} else if (this.state.channel.toLowerCase() === 'ebill') {
|
|
989
1000
|
this.props.actions.getTemplateDetails(template._id);
|
|
990
1001
|
}
|
|
@@ -1613,7 +1624,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1613
1624
|
location={this.props.location}
|
|
1614
1625
|
>
|
|
1615
1626
|
</PreviewSideBar>
|
|
1616
|
-
|
|
1617
1627
|
}
|
|
1618
1628
|
{(this.state.channel.toLowerCase() === 'ebill' || this.state.channel.toLowerCase() === 'email') && htmlPreviewContent && <EmailPreview
|
|
1619
1629
|
header={previewHeader}
|
|
@@ -1688,4 +1698,27 @@ function mapDispatchToProps(dispatch) {
|
|
|
1688
1698
|
};
|
|
1689
1699
|
}
|
|
1690
1700
|
|
|
1691
|
-
|
|
1701
|
+
const withSaga = injectSaga({ key: 'templates', saga: templateSaga });
|
|
1702
|
+
const withCreateSmsSaga = injectSaga({ key: 'create', saga: createSmsSaga });
|
|
1703
|
+
const withEditSmsSaga = injectSaga({ key: 'edit', saga: editSmsSaga });
|
|
1704
|
+
const withEmailSaga = injectSaga({ key: 'email', saga: emailSaga });
|
|
1705
|
+
const withEbillSaga = injectSaga({ key: 'ebill', saga: ebillSaga });
|
|
1706
|
+
const withLineCreateSaga = injectSaga({ key: 'line', saga: lineCreateSaga });
|
|
1707
|
+
const withReducer = injectReducer({ key: 'templates', reducer });
|
|
1708
|
+
const withMPushCreateReducer = injectReducer({ key: 'mobileCreate', reducer: mobilePushCreateReducer });
|
|
1709
|
+
const withLineCreateReducer = injectReducer({ key: 'lineTemplates', reducer: lineCreateReducer});
|
|
1710
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
1711
|
+
|
|
1712
|
+
export default compose(
|
|
1713
|
+
UserIsAuthenticated,
|
|
1714
|
+
withSaga,
|
|
1715
|
+
withCreateSmsSaga,
|
|
1716
|
+
withEditSmsSaga,
|
|
1717
|
+
withEmailSaga,
|
|
1718
|
+
withEbillSaga,
|
|
1719
|
+
withLineCreateSaga,
|
|
1720
|
+
withReducer,
|
|
1721
|
+
withMPushCreateReducer,
|
|
1722
|
+
withLineCreateReducer,
|
|
1723
|
+
withConnect,
|
|
1724
|
+
)(injectIntl(Templates));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { call, put, takeLatest, take, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { call, put, takeLatest, take, cancel, all } from 'redux-saga/effects';
|
|
3
2
|
// import { schema, normalize } from 'normalizr';
|
|
4
3
|
import * as Api from '../../services/api';
|
|
5
4
|
import * as types from './constants';
|
|
@@ -122,46 +121,32 @@ export function* getTemplateDetails(id, channel) {
|
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
function* watchGetAllTemplates() {
|
|
125
|
-
|
|
126
|
-
yield take(LOCATION_CHANGE);
|
|
127
|
-
yield cancel(watcher);
|
|
124
|
+
yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
function* watchDeleteTemplate() {
|
|
131
|
-
|
|
132
|
-
yield take(LOCATION_CHANGE);
|
|
133
|
-
yield cancel(watcher);
|
|
128
|
+
yield takeLatest(types.DELETE_TEMPLATE_REQUEST, deleteTemplate);
|
|
134
129
|
}
|
|
135
130
|
|
|
136
131
|
function* watchGetUserList() {
|
|
137
|
-
|
|
138
|
-
yield take(LOCATION_CHANGE);
|
|
139
|
-
yield cancel(watcher);
|
|
132
|
+
yield takeLatest(types.GET_USER_LIST_REQUEST, fetchUserList);
|
|
140
133
|
}
|
|
141
134
|
|
|
142
135
|
function* watchFetchWeCrmAccounts() {
|
|
143
136
|
|
|
144
|
-
|
|
145
|
-
yield take(LOCATION_CHANGE);
|
|
146
|
-
yield cancel(watcher);
|
|
137
|
+
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
147
138
|
}
|
|
148
139
|
|
|
149
140
|
function* watchSendingFile() {
|
|
150
|
-
|
|
151
|
-
yield take(LOCATION_CHANGE);
|
|
152
|
-
yield cancel(watcher);
|
|
141
|
+
yield takeLatest(types.SEND_ZIPPED_FILE_REQUEST, sendZippedFile);
|
|
153
142
|
}
|
|
154
143
|
|
|
155
144
|
function* watchGetEdmDefaultTemplates() {
|
|
156
|
-
|
|
157
|
-
yield take(LOCATION_CHANGE);
|
|
158
|
-
yield cancel(watcher);
|
|
145
|
+
yield takeLatest(types.GET_EDM_DEAFULT_TEMPLATES_REQUEST, getEdmTemplates);
|
|
159
146
|
}
|
|
160
147
|
|
|
161
148
|
function* watchGetTemplateDetails() {
|
|
162
|
-
|
|
163
|
-
yield take(LOCATION_CHANGE);
|
|
164
|
-
yield cancel(watcher);
|
|
149
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
165
150
|
}
|
|
166
151
|
|
|
167
152
|
// All sagas to be loaded
|
|
@@ -174,3 +159,15 @@ export default [
|
|
|
174
159
|
watchGetEdmDefaultTemplates,
|
|
175
160
|
watchGetTemplateDetails,
|
|
176
161
|
];
|
|
162
|
+
|
|
163
|
+
export function* templateSaga() {
|
|
164
|
+
yield all([
|
|
165
|
+
watchGetAllTemplates(),
|
|
166
|
+
watchDeleteTemplate(),
|
|
167
|
+
watchGetUserList(),
|
|
168
|
+
watchFetchWeCrmAccounts(),
|
|
169
|
+
watchSendingFile(),
|
|
170
|
+
watchGetEdmDefaultTemplates(),
|
|
171
|
+
watchGetTemplateDetails(),
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
@@ -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 { injectIntl, intlShape } from 'react-intl';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -28,6 +28,12 @@ import * as templateActions from '../../Templates/actions';
|
|
|
28
28
|
// import SlideBox from '../../components/SlideBox';
|
|
29
29
|
// import PageHeader from '../../components/PageHeader';
|
|
30
30
|
import './_mapTemplates.scss';
|
|
31
|
+
import injectSaga from '../../../utils/injectSaga';
|
|
32
|
+
import injectReducer from '../../../utils/injectReducer';
|
|
33
|
+
import reducer from './reducer';
|
|
34
|
+
import { mapTemplatesSaga } from './sagas';
|
|
35
|
+
import { templateSaga } from '../../Templates/sagas';
|
|
36
|
+
|
|
31
37
|
// const Option = Select.Option;
|
|
32
38
|
const URL = "URL";
|
|
33
39
|
const MINI_PROGRAM = "Mini-Program";
|
|
@@ -1589,4 +1595,15 @@ function mapDispatchToProps(dispatch) {
|
|
|
1589
1595
|
};
|
|
1590
1596
|
}
|
|
1591
1597
|
|
|
1592
|
-
|
|
1598
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
1599
|
+
const withReducer = injectReducer({ key: 'weChat', reducer });
|
|
1600
|
+
const withSaga = injectSaga({ key: 'weChat', saga: mapTemplatesSaga });
|
|
1601
|
+
const withTemplateSaga = injectSaga({ key: 'template', saga: templateSaga });
|
|
1602
|
+
|
|
1603
|
+
export default compose(
|
|
1604
|
+
UserIsAuthenticated,
|
|
1605
|
+
withReducer,
|
|
1606
|
+
withSaga,
|
|
1607
|
+
withTemplateSaga,
|
|
1608
|
+
withConnect,
|
|
1609
|
+
)(injectIntl(MapTemplates));
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { take, call, put, takeLatest, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
1
|
+
import { take, call, put, takeLatest, cancel, all } from 'redux-saga/effects';
|
|
3
2
|
import * as Api from '../../../services/api';
|
|
4
3
|
import * as types from './constants';
|
|
5
4
|
|
|
6
5
|
export function* getDefaultWeChatTemplates(params) {
|
|
7
6
|
try {
|
|
8
|
-
|
|
9
|
-
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
10
|
-
yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS, data: result.response.unMapped, templateData: result.response.mapped});
|
|
7
|
+
|
|
8
|
+
const result = yield call(Api.getAllTemplates, { channel: params.channel, queryParams: params.queryParams });
|
|
9
|
+
yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS, data: result.response.unMapped, templateData: result.response.mapped });
|
|
11
10
|
} catch (error) {
|
|
12
11
|
yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_FAILURE, error });
|
|
13
12
|
}
|
|
@@ -54,27 +53,19 @@ export function* getTemplateDetails(id) {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
function* watchGetDefaultWechatTemplates() {
|
|
57
|
-
|
|
58
|
-
yield take(LOCATION_CHANGE);
|
|
59
|
-
yield cancel(watcher);
|
|
56
|
+
yield takeLatest(types.GET_WECHAT_DEFAULT_TEMPLATES_REQUEST, getDefaultWeChatTemplates);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
function* watchCreateTemplate() {
|
|
63
|
-
|
|
64
|
-
yield take(LOCATION_CHANGE);
|
|
65
|
-
yield cancel(watcher);
|
|
60
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
function* watchFetchWeCrmAccounts() {
|
|
69
|
-
|
|
70
|
-
yield take(LOCATION_CHANGE);
|
|
71
|
-
yield cancel(watcher);
|
|
64
|
+
yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
|
|
72
65
|
}
|
|
73
66
|
|
|
74
67
|
function* watchGetTemplateDetails() {
|
|
75
|
-
|
|
76
|
-
yield take(LOCATION_CHANGE);
|
|
77
|
-
yield cancel(watcher);
|
|
68
|
+
yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
|
|
78
69
|
}
|
|
79
70
|
|
|
80
71
|
// All sagas to be loaded
|
|
@@ -84,3 +75,12 @@ export default [
|
|
|
84
75
|
watchFetchWeCrmAccounts,
|
|
85
76
|
watchGetTemplateDetails,
|
|
86
77
|
];
|
|
78
|
+
|
|
79
|
+
export function* mapTemplatesSaga() {
|
|
80
|
+
yield all([
|
|
81
|
+
watchGetDefaultWechatTemplates(),
|
|
82
|
+
watchCreateTemplate(),
|
|
83
|
+
watchFetchWeCrmAccounts(),
|
|
84
|
+
watchGetTemplateDetails(),
|
|
85
|
+
]);
|
|
86
|
+
}
|