@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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getAllTemplates } from "../actions";
|
|
2
|
+
import * as types from "../constants";
|
|
3
|
+
|
|
4
|
+
describe("Test zalo list actions", () => {
|
|
5
|
+
it("has a type of GET_ALL_TEMPLATES_REQUEST action", () => {
|
|
6
|
+
const channel = "Zalo";
|
|
7
|
+
const queryParams = {
|
|
8
|
+
page: 1,
|
|
9
|
+
perPage: 25,
|
|
10
|
+
};
|
|
11
|
+
const expected = {
|
|
12
|
+
type: types.GET_ALL_TEMPLATES_REQUEST,
|
|
13
|
+
channel,
|
|
14
|
+
intlCopyOf: "test",
|
|
15
|
+
queryParams,
|
|
16
|
+
};
|
|
17
|
+
expect(getAllTemplates(channel, queryParams, "test")).toEqual(expected);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -4,7 +4,7 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { Templates } from '../index';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
|
|
7
|
-
const { whatsappTemplates: TemplatesProp, getCreativesParamsOutput } = mockdata;
|
|
7
|
+
const { whatsappTemplates: TemplatesProp, getCreativesParamsOutput, zaloTemplates: ZaloTemplateProp } = mockdata;
|
|
8
8
|
|
|
9
9
|
jest.mock('../../CreativesContainer', () => ({
|
|
10
10
|
__esModule: true,
|
|
@@ -57,6 +57,36 @@ describe('Test Templates container', () => {
|
|
|
57
57
|
);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
const renderZaloFunction = (isFullMode) => {
|
|
61
|
+
renderedComponent = shallowWithIntl(
|
|
62
|
+
<Templates
|
|
63
|
+
route={{
|
|
64
|
+
name: 'Zalo',
|
|
65
|
+
}}
|
|
66
|
+
Templates={ZaloTemplateProp}
|
|
67
|
+
actions={{
|
|
68
|
+
getWeCrmAccounts,
|
|
69
|
+
setChannelAccount,
|
|
70
|
+
getAllTemplates,
|
|
71
|
+
getUserList,
|
|
72
|
+
getSenderDetails,
|
|
73
|
+
}}
|
|
74
|
+
location={{
|
|
75
|
+
pathname: '/Zalo',
|
|
76
|
+
query: {},
|
|
77
|
+
search: '',
|
|
78
|
+
}}
|
|
79
|
+
EmailCreate={{
|
|
80
|
+
duplicateTemplateInProgress: false,
|
|
81
|
+
}}
|
|
82
|
+
isFullMode={isFullMode}
|
|
83
|
+
intl={{
|
|
84
|
+
formatMessage: () => {},
|
|
85
|
+
}}
|
|
86
|
+
/>,
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
60
90
|
it('Should render correct component for whatsapp channel', () => {
|
|
61
91
|
renderFunction();
|
|
62
92
|
expect(renderedComponent).toMatchSnapshot();
|
|
@@ -97,6 +127,28 @@ describe('Test Templates container', () => {
|
|
|
97
127
|
getCreativesParamsOutput,
|
|
98
128
|
);
|
|
99
129
|
});
|
|
130
|
+
it('Should render correct component for zalo channel', () => {
|
|
131
|
+
renderZaloFunction();
|
|
132
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
133
|
+
});
|
|
134
|
+
it('Should render temlates when zalo templates are passed', () => {
|
|
135
|
+
renderZaloFunction();
|
|
136
|
+
renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
|
|
137
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
138
|
+
});
|
|
139
|
+
it('Should render temlates when Zalo templates are passed in full mode', () => {
|
|
140
|
+
renderZaloFunction(true);
|
|
141
|
+
renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
|
|
142
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
143
|
+
});
|
|
144
|
+
it('Should render illustration when no templates are passed', () => {
|
|
145
|
+
renderZaloFunction();
|
|
146
|
+
renderedComponent.setProps({
|
|
147
|
+
TemplatesList: [],
|
|
148
|
+
Templates: {},
|
|
149
|
+
});
|
|
150
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
151
|
+
});
|
|
100
152
|
|
|
101
153
|
const getFilterContainer = () => {
|
|
102
154
|
const FilterContainer = () =>
|
|
@@ -23,8 +23,52 @@ export const getCdnTransformationConfigSuccess = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
export const getAllTemplatesListSuccess = {
|
|
27
|
+
"name": "Test2 QR - Thông báo thanh toán thành công",
|
|
28
|
+
"versions": {
|
|
29
|
+
"base": {
|
|
30
|
+
"content": {
|
|
31
|
+
"ZALO": {
|
|
32
|
+
"templateId": "268531",
|
|
33
|
+
"templateName": "Test QR - Thông báo thanh toán thành công",
|
|
34
|
+
"listParams": [
|
|
35
|
+
{
|
|
36
|
+
"name": "danh_xung",
|
|
37
|
+
"require": true,
|
|
38
|
+
"type": "STRING",
|
|
39
|
+
"maxLength": 30,
|
|
40
|
+
"minLength": 0,
|
|
41
|
+
"acceptNull": false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "name",
|
|
45
|
+
"require": true,
|
|
46
|
+
"type": "STRING",
|
|
47
|
+
"maxLength": 30,
|
|
48
|
+
"minLength": 0,
|
|
49
|
+
"acceptNull": false,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
"previewUrl": "https://account.zalo.cloud/znspreview/-e0cMil4NU5WUUAVzP7T_g=="
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
"type": "ZALO",
|
|
58
|
+
response: {
|
|
59
|
+
templates: [{name: '1', id: '2'}],
|
|
60
|
+
},
|
|
61
|
+
intlCopyOf: 'test',
|
|
62
|
+
};
|
|
63
|
+
|
|
26
64
|
export const getCdnTransformationConfigFailure = {
|
|
27
65
|
"isError": true,
|
|
28
66
|
"message": "Resource Not Found",
|
|
29
67
|
"error": {}
|
|
30
|
-
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const getAllTemplatesListFailure = {
|
|
71
|
+
"isError": true,
|
|
72
|
+
"message": "Resource Not Found",
|
|
73
|
+
"error": {},
|
|
74
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import reducer, { initialState } from "../reducer";
|
|
2
|
+
import * as types from "../constants";
|
|
3
|
+
import * as mockData from "./mockData";
|
|
4
|
+
|
|
5
|
+
describe("test reducer", () => {
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
jest.clearAllMocks();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should return the initial state", () => {
|
|
11
|
+
expect(reducer(undefined, {})).toEqual(initialState);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should handle GET_ALL_TEMPLATES_REQUEST", () => {
|
|
15
|
+
const action = {
|
|
16
|
+
type: types.GET_ALL_TEMPLATES_REQUEST,
|
|
17
|
+
};
|
|
18
|
+
expect(reducer(initialState, action).toJS()).toEqual({
|
|
19
|
+
...initialState.toJS(),
|
|
20
|
+
getAllTemplatesInProgress: true,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should handle GET_ALL_TEMPLATES_SUCCESS", () => {
|
|
25
|
+
const action = {
|
|
26
|
+
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
27
|
+
data: mockData.getAllTemplatesListSuccess,
|
|
28
|
+
};
|
|
29
|
+
const expectedResult = {
|
|
30
|
+
...initialState.toJS(),
|
|
31
|
+
getAllTemplatesInProgress: false,
|
|
32
|
+
templateError: {},
|
|
33
|
+
weCRMtemplates: [],
|
|
34
|
+
templates: [undefined],
|
|
35
|
+
isSearch: undefined,
|
|
36
|
+
};
|
|
37
|
+
expect(reducer(initialState, action).toJS()).toEqual(expectedResult);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should handle GET_ALL_TEMPLATES_FAILURE", () => {
|
|
41
|
+
const action = {
|
|
42
|
+
type: types.GET_ALL_TEMPLATES_FAILURE,
|
|
43
|
+
};
|
|
44
|
+
expect(reducer(initialState, action).toJS()).toEqual({
|
|
45
|
+
...initialState.toJS(),
|
|
46
|
+
getAllTemplatesInProgress: false,
|
|
47
|
+
templateError: undefined,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expectSaga } from 'redux-saga-test-plan';
|
|
2
|
-
import { take, call, takeLatest, takeEvery } from 'redux-saga/effects';
|
|
2
|
+
import { take, call, takeLatest, takeEvery, put } from 'redux-saga/effects';
|
|
3
3
|
import * as matchers from 'redux-saga-test-plan/matchers';
|
|
4
4
|
import * as api from '../../../services/api';
|
|
5
5
|
import * as types from '../constants';
|
|
@@ -7,10 +7,15 @@ import * as cdnUtils from '../../../utils/cdnTransformation';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
getCdnTransformationConfig,
|
|
10
|
-
|
|
10
|
+
getAllTemplates,
|
|
11
|
+
watchGetCdnTransformationConfig,
|
|
12
|
+
watchGetAllTemplates,
|
|
13
|
+
getSenderDetails,
|
|
11
14
|
} from '../sagas';
|
|
12
15
|
|
|
13
16
|
import * as mockData from './mockData';
|
|
17
|
+
import { ZALO } from '../../CreativesContainer/constants';
|
|
18
|
+
import { VIET_GUYS } from '../../Zalo/constants';
|
|
14
19
|
|
|
15
20
|
describe('getCdnTransformationConfig saga', () => {
|
|
16
21
|
it("handle valid response from api", () => {
|
|
@@ -73,4 +78,112 @@ describe('watchForGetJourneyList saga', () => {
|
|
|
73
78
|
takeLatest(types.GET_CDN_TRANSFORMATION_CONFIG_REQUEST, getCdnTransformationConfig),
|
|
74
79
|
);
|
|
75
80
|
});
|
|
76
|
-
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('templateList saga', () => {
|
|
84
|
+
it('handle valid response from api', () => {
|
|
85
|
+
expectSaga(getAllTemplates, mockData.getAllTemplatesListSuccess)
|
|
86
|
+
.provide([
|
|
87
|
+
[
|
|
88
|
+
matchers.call.fn(api.getAllTemplates),
|
|
89
|
+
mockData.getAllTemplatesListSuccess,
|
|
90
|
+
],
|
|
91
|
+
]).put({
|
|
92
|
+
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
93
|
+
data: mockData.getAllTemplatesListSuccess,
|
|
94
|
+
weCRMTemplate: mockData.getAllTemplatesListSuccess,
|
|
95
|
+
isReset: mockData.getAllTemplatesListSuccess?.queryParams?.page === 1,
|
|
96
|
+
})
|
|
97
|
+
.run();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('handle valid response from api', () => {
|
|
101
|
+
mockData.getAllTemplatesListSuccess.intlCopyOf = '';
|
|
102
|
+
expectSaga(getAllTemplates, mockData.getAllTemplatesListSuccess)
|
|
103
|
+
.provide([
|
|
104
|
+
[
|
|
105
|
+
matchers.call.fn(api.getAllTemplates),
|
|
106
|
+
mockData.getAllTemplatesListSuccess,
|
|
107
|
+
],
|
|
108
|
+
]).put({
|
|
109
|
+
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
110
|
+
data: mockData.getAllTemplatesListSuccess,
|
|
111
|
+
weCRMTemplate: mockData.getAllTemplatesListSuccess,
|
|
112
|
+
isReset: mockData.getAllTemplatesListSuccess?.queryParams?.page === 1,
|
|
113
|
+
})
|
|
114
|
+
.run();
|
|
115
|
+
});
|
|
116
|
+
it('handles error thrown from api', () => {
|
|
117
|
+
expectSaga(getAllTemplates, mockData.getAllTemplatesListFailure)
|
|
118
|
+
.provide([
|
|
119
|
+
[
|
|
120
|
+
call(api.getAllTemplates),
|
|
121
|
+
mockData.getAllTemplatesListFailure,
|
|
122
|
+
],
|
|
123
|
+
])
|
|
124
|
+
.put({
|
|
125
|
+
type: types.GET_ALL_TEMPLATES_FAILURE,
|
|
126
|
+
res: mockData.getAllTemplatesListFailure,
|
|
127
|
+
})
|
|
128
|
+
.run();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe('watchForTemplates saga', () => {
|
|
133
|
+
const generator = watchGetAllTemplates();
|
|
134
|
+
it('should call watchers functions', () => {
|
|
135
|
+
expect(generator.next().value).toEqual(
|
|
136
|
+
takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates),
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('getSenderDetails Saga', () => {
|
|
142
|
+
const channel = 'someChannel';
|
|
143
|
+
const orgUnitId = 'someOrgUnitId';
|
|
144
|
+
const action = { channel, orgUnitId };
|
|
145
|
+
|
|
146
|
+
it('should handle apiResponse with hostName', () => {
|
|
147
|
+
const apiResponse = {
|
|
148
|
+
entity: {
|
|
149
|
+
[channel]: [
|
|
150
|
+
{
|
|
151
|
+
domainProperties: {
|
|
152
|
+
hostName: 'example.com',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const generator = getSenderDetails(action);
|
|
160
|
+
expect(generator.next().value).toEqual(call(api.getSenderDetails, channel, orgUnitId));
|
|
161
|
+
expect(generator.next(apiResponse).value).toEqual(
|
|
162
|
+
put({
|
|
163
|
+
type: types.GET_SENDER_DETAILS_SUCCESS,
|
|
164
|
+
payload: 'example.com',
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should handle apiResponse without hostName', () => {
|
|
170
|
+
const apiResponse = {
|
|
171
|
+
entity: {
|
|
172
|
+
[channel]: [
|
|
173
|
+
{
|
|
174
|
+
domainProperties: {},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const generator = getSenderDetails(action);
|
|
181
|
+
expect(generator.next().value).toEqual(call(api.getSenderDetails, channel, orgUnitId));
|
|
182
|
+
expect(generator.next(apiResponse).value).toEqual(
|
|
183
|
+
put({
|
|
184
|
+
type: types.GET_SENDER_DETAILS_SUCCESS,
|
|
185
|
+
payload: '',
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fromJS } from "immutable";
|
|
2
|
+
import { makeSelectTemplatesResponse } from "../selectors";
|
|
3
|
+
|
|
4
|
+
describe("Template selectors", () => {
|
|
5
|
+
const mockState = fromJS({
|
|
6
|
+
templates: [],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe("makeSelectTemplatesResponse selector", () => {
|
|
10
|
+
it("should return the correct substate", () => {
|
|
11
|
+
const selected = makeSelectTemplatesResponse().resultFunc(
|
|
12
|
+
mockState.get("templates")
|
|
13
|
+
);
|
|
14
|
+
expect(selected).toEqual(mockState.getIn(["templates", "templates"]));
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import { connect } from 'react-redux';
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
|
-
import { bindActionCreators } from 'redux';
|
|
12
|
+
import { bindActionCreators, compose } from 'redux';
|
|
13
13
|
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
14
|
import { find, get } from 'lodash';
|
|
15
15
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -29,9 +29,60 @@ import FTP from '../FTP';
|
|
|
29
29
|
import Gallery from '../Assets/Gallery';
|
|
30
30
|
import withStyles from '../../hoc/withStyles';
|
|
31
31
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
32
|
-
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS } from '../App/constants';
|
|
32
|
+
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP } from '../App/constants';
|
|
33
33
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
34
34
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
35
|
+
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
36
|
+
import injectSaga from '../../utils/injectSaga';
|
|
37
|
+
import injectReducer from '../../utils/injectReducer';
|
|
38
|
+
|
|
39
|
+
import reducer from '../Templates/reducer';
|
|
40
|
+
import v2CapReducer from '../Cap/reducer';
|
|
41
|
+
import v2CreativesContainerReducer from '../CreativesContainer/reducer';
|
|
42
|
+
import v2SmsCreateReducer from '../Sms/Create/reducer';
|
|
43
|
+
import v2SmsEditReducer from '../Sms/Edit/reducer';
|
|
44
|
+
import v2EmailReducer from '../Email/reducer';
|
|
45
|
+
import v2CallTaskReducer from '../CallTask/reducer';
|
|
46
|
+
import v2MobilePushCreateReducer from '../MobilePush/Create/reducer';
|
|
47
|
+
import v2MobilePushEditReducer from '../MobilePush/Edit/reducer';
|
|
48
|
+
import v2WechatMapTemplatesReducer from '../WeChat/MapTemplates/reducer';
|
|
49
|
+
import v2WechatRichmediaTemplatesCreateReducer from '../WeChat/RichmediaTemplates/Create/reducer';
|
|
50
|
+
import v2WechatRichmediaTemplatesEditReducer from '../WeChat/RichmediaTemplates/Edit/reducer';
|
|
51
|
+
import v2AssetsGalleryReducer from '../Assets/Gallery/reducer';
|
|
52
|
+
import v2FacebookReducer from '../Facebook/reducer';
|
|
53
|
+
import v2LineContainerReducer from '../Line/Container/reducer';
|
|
54
|
+
import v2ViberReducer from '../Viber/reducer';
|
|
55
|
+
import v2CapFacebookPreviewReducer from '../CapFacebookPreview/reducer';
|
|
56
|
+
import v2SmsTraiCreateReducer from '../SmsTrai/Create/reducer';
|
|
57
|
+
import v2WhatsappReducer from '../Whatsapp/reducer';
|
|
58
|
+
import v2ZaloReducer from '../Zalo/reducer';
|
|
59
|
+
import v2InAppReducer from '../InApp/reducer';
|
|
60
|
+
import v2RcsReducer from '../InApp/reducer';
|
|
61
|
+
import leftNavReducer from '@capillarytech/cap-ui-library/CapCollapsibleLeftNavigation/reducer';
|
|
62
|
+
|
|
63
|
+
import { v2TemplateSaga } from '../Templates/sagas';
|
|
64
|
+
import { v2CapSagas } from '../Cap/sagas';
|
|
65
|
+
import { v2SmsCreateSagas } from '../Sms/Create/sagas';
|
|
66
|
+
import { v2SmsEditSagas } from '../Sms/Edit/sagas';
|
|
67
|
+
import { v2EmailSagas } from '../Email/sagas';
|
|
68
|
+
import { v2BeeEditionSagas } from '../BeeEditor/sagas';
|
|
69
|
+
import { v2CallTaskSagas } from '../CallTask/sagas';
|
|
70
|
+
import { v2MobilePushCreateSagas } from '../MobilePush/Create/sagas';
|
|
71
|
+
import { v2MobilePushEditSagas } from '../MobilePush/Edit/sagas';
|
|
72
|
+
import { v2WechatMapTemplatesSagas } from '../WeChat/MapTemplates/sagas';
|
|
73
|
+
import { v2WechatRichmediaTemplatesCreateSagas } from '../WeChat/RichmediaTemplates/Create/sagas';
|
|
74
|
+
import { v2WechatRichmediaTemplatesEditSagas } from '../WeChat/RichmediaTemplates/Edit/sagas';
|
|
75
|
+
import { v2GallerySagas } from '../Assets/Gallery/sagas';
|
|
76
|
+
import { v2FacebookSagas } from '../Facebook/sagas';
|
|
77
|
+
import { v2LineContainerSagas } from '../Line/Container/sagas';
|
|
78
|
+
import { v2ViberSagas } from '../Viber/sagas';
|
|
79
|
+
import { v2CapFacebookPreviewSagas } from '../CapFacebookPreview/sagas';
|
|
80
|
+
import { v2SmsTraiCreateSagas } from '../SmsTrai/Create/sagas';
|
|
81
|
+
import { v2WhatsappSagas } from '../Whatsapp/sagas';
|
|
82
|
+
import { v2ZaloSagas } from '../Zalo/saga';
|
|
83
|
+
import { v2InAppSagas } from '../InApp/sagas';
|
|
84
|
+
import { v2RcsSagas } from '../Rcs/sagas';
|
|
85
|
+
import navigationSagas from '@capillarytech/cap-ui-library/CapCollapsibleLeftNavigation/saga';
|
|
35
86
|
|
|
36
87
|
const {CapCustomCardList} = CapCustomCard;
|
|
37
88
|
|
|
@@ -51,6 +102,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
51
102
|
onChannelChange,
|
|
52
103
|
showDisabledFBInfo,
|
|
53
104
|
enableNewChannels = [],
|
|
105
|
+
currentOrgDetails = {},
|
|
106
|
+
cap = {},
|
|
54
107
|
} = props;
|
|
55
108
|
|
|
56
109
|
const defaultPanes = {
|
|
@@ -60,10 +113,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
60
113
|
weChat: {content: <></>, tab: intl.formatMessage(messages.wechat), key: 'wechat'},
|
|
61
114
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
62
115
|
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
116
|
+
inApp: { content: <div></div>, tab: intl.formatMessage(messages.inapp), key: INAPP },
|
|
63
117
|
line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
|
|
64
118
|
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
65
119
|
facebook: {content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'},
|
|
66
120
|
whatsapp: { content: <></>, tab: intl.formatMessage(messages.whatsapp), key: WHATSAPP },
|
|
121
|
+
zalo: { content: <div></div>, tab: intl.formatMessage(messages.zalo), key: ZALO },
|
|
67
122
|
};
|
|
68
123
|
let filteredPanes = Object.keys(defaultPanes)
|
|
69
124
|
.filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
|
|
@@ -85,10 +140,10 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
85
140
|
|
|
86
141
|
// we only show channels which other than commonChannels
|
|
87
142
|
// if it is coming in enableNewChannels array
|
|
88
|
-
filteredPanes.filter((item) => {
|
|
143
|
+
filteredPanes = filteredPanes.filter((item) => {
|
|
89
144
|
const channel = item.key;
|
|
90
145
|
if (!commonChannels.includes(channel)) {
|
|
91
|
-
return
|
|
146
|
+
return enableNewChannels.includes(channel.toUpperCase());
|
|
92
147
|
}
|
|
93
148
|
return true;
|
|
94
149
|
});
|
|
@@ -112,6 +167,15 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
112
167
|
return pane;
|
|
113
168
|
});
|
|
114
169
|
|
|
170
|
+
// This data will be available when it will be accessed in full mode
|
|
171
|
+
const { accessibleFeatures = [] } = currentOrgDetails || {};
|
|
172
|
+
// This data will be available when it will be accessed in library mode
|
|
173
|
+
const { currentOrgDetails: { accessibleFeatures: libModeAccessibleFeatures = [] } = {} } = cap || {};
|
|
174
|
+
const hideEngagementChannel = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE) || libModeAccessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
175
|
+
// Show only line and email channel content with both channel tabs if the JP_LOCALE_HIDE_FEATURE feature is enabled;
|
|
176
|
+
filteredPanes = hideEngagementChannel ? filteredPanes?.filter((pane) => [EMAIL, LINE, ASSETS].includes(pane?.key) && pane) : filteredPanes;
|
|
177
|
+
defaultChannel = hideEngagementChannel ? EMAIL : defaultChannel;
|
|
178
|
+
|
|
115
179
|
const channel = ['sms', 'email', 'mobilepush', 'line', 'call_task'];
|
|
116
180
|
if (!isEmpty(channelsToDisable)) {
|
|
117
181
|
channel.some((ch) => {
|
|
@@ -136,7 +200,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
136
200
|
|
|
137
201
|
componentDidMount() {
|
|
138
202
|
const queryItems = getObjFromQueryParams(location.search);
|
|
139
|
-
|
|
140
203
|
if (queryItems.channel === WHATSAPP) {
|
|
141
204
|
this.channelChange(WHATSAPP);
|
|
142
205
|
}
|
|
@@ -289,8 +352,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
289
352
|
return this.props.Templates.loadingTemplates;
|
|
290
353
|
}
|
|
291
354
|
render() {
|
|
292
|
-
const { isFullMode, className, cap = {},
|
|
293
|
-
const { accessiblePermissions = []} = cap.user ||
|
|
355
|
+
const { isFullMode, className, cap = {}, Global = {}} = this.props;
|
|
356
|
+
const { accessiblePermissions = []} = cap.user || Global.user || {};
|
|
294
357
|
let isCreativeAccessible = true;
|
|
295
358
|
if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
296
359
|
isCreativeAccessible = false;
|
|
@@ -341,15 +404,19 @@ TemplatesV2.propTypes = {
|
|
|
341
404
|
authData: PropTypes.object,
|
|
342
405
|
FTPMode: PropTypes.string,
|
|
343
406
|
messageStrategy: PropTypes.string,
|
|
407
|
+
currentOrgDetails: PropTypes.object,
|
|
344
408
|
};
|
|
345
409
|
|
|
346
410
|
TemplatesV2.defaultProps = {
|
|
347
411
|
isFullMode: true,
|
|
412
|
+
currentOrgDetails: {},
|
|
348
413
|
};
|
|
349
414
|
|
|
350
415
|
const mapStateToProps = createStructuredSelector({
|
|
416
|
+
Global: makeSelectAuthenticated(),
|
|
351
417
|
Templates: makeSelectTemplates(),
|
|
352
418
|
TemplatesList: makeSelectTemplatesResponse(),
|
|
419
|
+
currentOrgDetails: selectCurrentOrgDetails(),
|
|
353
420
|
});
|
|
354
421
|
|
|
355
422
|
function mapDispatchToProps(dispatch) {
|
|
@@ -359,4 +426,109 @@ function mapDispatchToProps(dispatch) {
|
|
|
359
426
|
};
|
|
360
427
|
}
|
|
361
428
|
|
|
362
|
-
|
|
429
|
+
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
|
430
|
+
|
|
431
|
+
const withTemplatesReducer = injectReducer({ key: 'templates', reducer });
|
|
432
|
+
const withCapReducer = injectReducer({ key: 'cap', reducer: v2CapReducer });
|
|
433
|
+
const withCreativesContainerReducer = injectReducer({ key: 'creativesContainer', reducer: v2CreativesContainerReducer });
|
|
434
|
+
const withSmsCreateReducer = injectReducer({ key: 'create', reducer: v2SmsCreateReducer });
|
|
435
|
+
const withSmsEditReducer = injectReducer({ key: 'edit', reducer: v2SmsEditReducer });
|
|
436
|
+
const withEmailReducer = injectReducer({ key: 'email', reducer: v2EmailReducer });
|
|
437
|
+
const withCallTaskReducer = injectReducer({ key: 'callTask', reducer: v2CallTaskReducer });
|
|
438
|
+
const withMobilePushCreateReducer = injectReducer({ key: 'mobileCreate', reducer: v2MobilePushCreateReducer });
|
|
439
|
+
const withMobilePushEditReducer = injectReducer({ key: 'mobileEdit', reducer: v2MobilePushEditReducer });
|
|
440
|
+
const withWeChatMapTemplatesReducer = injectReducer({ key: 'weChatMapTemplate', reducer: v2WechatMapTemplatesReducer });
|
|
441
|
+
const withWeChatRichmediaCreateReducer = injectReducer({ key: 'weChatRichmediaCreate', reducer: v2WechatRichmediaTemplatesCreateReducer });
|
|
442
|
+
const withWeChatRichmediaEditReducer = injectReducer({ key: 'weChatRichmediaEdit', reducer: v2WechatRichmediaTemplatesEditReducer });
|
|
443
|
+
const withGalleryReducer = injectReducer({ key: 'gallery', reducer: v2AssetsGalleryReducer });
|
|
444
|
+
const withFacebookReducer = injectReducer({ key: 'facebook', reducer: v2FacebookReducer });
|
|
445
|
+
const withLineContainerReducer = injectReducer({ key: 'lineCreate', reducer: v2LineContainerReducer });
|
|
446
|
+
const withViberReducer = injectReducer({ key: 'viber', reducer: v2ViberReducer });
|
|
447
|
+
const withCapFacebookPreviewReducer = injectReducer({ key: 'facebookPreview', reducer: v2CapFacebookPreviewReducer });
|
|
448
|
+
const withSmsTraiCreateReducer = injectReducer({ key: 'smsTrai', reducer: v2SmsTraiCreateReducer });
|
|
449
|
+
const withWhatsappReducer = injectReducer({ key: 'whatsapp', reducer: v2WhatsappReducer });
|
|
450
|
+
const withZaloReducer = injectReducer({ key: 'zalo', reducer: v2ZaloReducer });
|
|
451
|
+
const withInAppReducer = injectReducer({ key: 'inapp', reducer: v2InAppReducer });
|
|
452
|
+
const withRcsReducer = injectReducer({ key: 'rcs', reducer: v2RcsReducer });
|
|
453
|
+
const withNavigationReducer = injectReducer({ key: 'navigationBar', reducer: leftNavReducer });
|
|
454
|
+
|
|
455
|
+
const withSaga = injectSaga({ key: 'templates', saga: v2TemplateSaga });
|
|
456
|
+
const withCapSaga = injectSaga({ key: 'cap', saga: v2CapSagas });
|
|
457
|
+
const withGallerySaga = injectSaga({ key: 'gallery', saga: v2GallerySagas });
|
|
458
|
+
const withSmsCreateSaga = injectSaga({ key: 'create', saga: v2SmsCreateSagas });
|
|
459
|
+
const withSmsEditSaga = injectSaga({ key: 'edit', saga: v2SmsEditSagas });
|
|
460
|
+
const withEmailSaga = injectSaga({ key: 'email', saga: v2EmailSagas });
|
|
461
|
+
const withBeeEditorSaga = injectSaga({ key: 'beeEditor', saga: v2BeeEditionSagas });
|
|
462
|
+
const withCallTaskSagas = injectSaga({ key: 'callTask', saga: v2CallTaskSagas });
|
|
463
|
+
const withMobilePushCreateSaga = injectSaga({ key: 'mobileCreate', saga: v2MobilePushCreateSagas });
|
|
464
|
+
const withMobilePushEditSaga = injectSaga({ key: 'mobileEdit', saga: v2MobilePushEditSagas });
|
|
465
|
+
const withWeChatMapTemplatesSagas = injectSaga({ key: 'weChatMapTemplate', saga: v2WechatMapTemplatesSagas });
|
|
466
|
+
const withWeChatRichmediaCreateSaga = injectSaga({ key: 'weChatRichmediaCreate', saga: v2WechatRichmediaTemplatesCreateSagas });
|
|
467
|
+
const withWeChatRichmediaEditSaga = injectSaga({ key: 'weChatRichmediaEdit', saga: v2WechatRichmediaTemplatesEditSagas });
|
|
468
|
+
const withFacebookSagas = injectSaga({ key: 'facebook', saga: v2FacebookSagas });
|
|
469
|
+
const withLineContainerSagas = injectSaga({ key: 'lineCreate', saga: v2LineContainerSagas });
|
|
470
|
+
const withViberSagas = injectSaga({ key: 'viber', saga: v2ViberSagas });
|
|
471
|
+
const withCapFacebookPreviewSagas = injectSaga({ key: 'facebookPreview', saga: v2CapFacebookPreviewSagas });
|
|
472
|
+
const withSmsTraiCreateSagas = injectSaga({ key: 'smsTrai', saga: v2SmsTraiCreateSagas });
|
|
473
|
+
const withWhatsappSagas = injectSaga({ key: 'whatsapp', saga: v2WhatsappSagas });
|
|
474
|
+
const withZaloSagas = injectSaga({ key: 'zalo', saga: v2ZaloSagas });
|
|
475
|
+
const withInAppSagas = injectSaga({ key: 'inapp', saga: v2InAppSagas });
|
|
476
|
+
const withRcsSagas = injectSaga({ key: 'rcs', saga: v2RcsSagas });
|
|
477
|
+
const withNavigationSaga = injectSaga({
|
|
478
|
+
key: 'navigation',
|
|
479
|
+
saga: function* navigationConfigSaga() {
|
|
480
|
+
yield all(navigationSagas.map(saga => saga.call()));
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
export default compose(
|
|
485
|
+
UserIsAuthenticated,
|
|
486
|
+
withSaga,
|
|
487
|
+
withCapSaga,
|
|
488
|
+
withGallerySaga,
|
|
489
|
+
withSmsCreateSaga,
|
|
490
|
+
withSmsEditSaga,
|
|
491
|
+
withEmailSaga,
|
|
492
|
+
withBeeEditorSaga,
|
|
493
|
+
withCallTaskSagas,
|
|
494
|
+
withMobilePushCreateSaga,
|
|
495
|
+
withMobilePushEditSaga,
|
|
496
|
+
withWeChatMapTemplatesSagas,
|
|
497
|
+
withWeChatRichmediaCreateSaga,
|
|
498
|
+
withWeChatRichmediaEditSaga,
|
|
499
|
+
withFacebookSagas,
|
|
500
|
+
withLineContainerSagas,
|
|
501
|
+
withViberSagas,
|
|
502
|
+
withCapFacebookPreviewSagas,
|
|
503
|
+
withSmsTraiCreateSagas,
|
|
504
|
+
withWhatsappSagas,
|
|
505
|
+
withZaloSagas,
|
|
506
|
+
withInAppSagas,
|
|
507
|
+
withRcsSagas,
|
|
508
|
+
withNavigationSaga,
|
|
509
|
+
|
|
510
|
+
withTemplatesReducer,
|
|
511
|
+
withCapReducer,
|
|
512
|
+
withCreativesContainerReducer,
|
|
513
|
+
withSmsCreateReducer,
|
|
514
|
+
withSmsEditReducer,
|
|
515
|
+
withEmailReducer,
|
|
516
|
+
withCallTaskReducer,
|
|
517
|
+
withMobilePushCreateReducer,
|
|
518
|
+
withMobilePushEditReducer,
|
|
519
|
+
withWeChatMapTemplatesReducer,
|
|
520
|
+
withWeChatRichmediaCreateReducer,
|
|
521
|
+
withWeChatRichmediaEditReducer,
|
|
522
|
+
withGalleryReducer,
|
|
523
|
+
withFacebookReducer,
|
|
524
|
+
withLineContainerReducer,
|
|
525
|
+
withViberReducer,
|
|
526
|
+
withCapFacebookPreviewReducer,
|
|
527
|
+
withSmsTraiCreateReducer,
|
|
528
|
+
withWhatsappReducer,
|
|
529
|
+
withZaloReducer,
|
|
530
|
+
withInAppReducer,
|
|
531
|
+
withRcsReducer,
|
|
532
|
+
withNavigationReducer,
|
|
533
|
+
withConnect,
|
|
534
|
+
)(injectIntl(withStyles(TemplatesV2, styles)));
|
|
@@ -78,4 +78,12 @@ export default defineMessages({
|
|
|
78
78
|
id: `creatives.containersV2.TemplatesV2.facebookDisableinfo`,
|
|
79
79
|
defaultMessage: 'Please integrate Facebook page ID & page name to enable this option.',
|
|
80
80
|
},
|
|
81
|
+
zalo: {
|
|
82
|
+
id: `creatives.containersV2.TemplatesV2.zalo`,
|
|
83
|
+
defaultMessage: 'Zalo',
|
|
84
|
+
},
|
|
85
|
+
inapp: {
|
|
86
|
+
id: `creatives.containersV2.TemplatesV2.inapp`,
|
|
87
|
+
defaultMessage: 'In app message',
|
|
88
|
+
},
|
|
81
89
|
});
|