@capillarytech/creatives-library 2.0.70 → 2.0.72
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 +1 -1
- package/components/Ckeditor/index.js +2 -1
- package/components/EmailMobilePreview/index.scss +0 -1
- package/components/EmailPreviewV2/_emailPreviewV2.scss +4 -1
- package/components/EmailPreviewV2/index.js +1 -1
- package/components/FormBuilder/index.js +25 -10
- package/components/Header/index.js +3 -1
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +38 -3
- package/components/TemplatePreview/index.js +45 -51
- package/components/TemplatePreview/messages.js +1 -1
- package/config/app.js +1 -0
- package/containers/Cap/actions.js +0 -5
- package/containers/Cap/reducer.js +1 -1
- package/containers/Cap/selectors.js +0 -13
- package/containers/Ebill/index.js +1 -2
- package/containers/Email/_email.scss +1 -0
- package/containers/Email/actions.js +3 -8
- package/containers/Email/constants.js +0 -1
- package/containers/Email/index.js +947 -322
- package/containers/Email/reducer.js +0 -3
- package/containers/Email/sagas.js +6 -3
- package/containers/Email/selectors.js +1 -4
- package/containers/Line/Create/index.js +1 -2
- package/containers/Line/Edit/_lineEdit.scss +4 -0
- package/containers/Line/Edit/index.js +1 -3
- package/containers/MobilePush/Create/_mobilePushCreate.scss +3 -12
- package/containers/MobilePush/Create/actions.js +0 -6
- package/containers/MobilePush/Create/constants.js +0 -1
- package/containers/MobilePush/Create/index.js +1133 -628
- package/containers/MobilePush/Create/messages.js +1 -5
- package/containers/MobilePush/Create/reducer.js +0 -2
- package/containers/MobilePush/Create/selectors.js +3 -3
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +3 -9
- package/containers/MobilePush/Edit/index.js +1127 -393
- package/containers/MobilePush/Edit/messages.js +0 -4
- package/containers/MobilePush/Edit/reducer.js +1 -2
- package/containers/MobilePush/Edit/selectors.js +3 -6
- package/containers/Sms/Create/_smsCreate.scss +2 -1
- package/containers/Sms/Create/actions.js +4 -4
- package/containers/Sms/Create/index.js +570 -102
- package/containers/Sms/Create/sagas.js +2 -1
- package/containers/Sms/Edit/actions.js +5 -10
- package/containers/Sms/Edit/constants.js +0 -1
- package/containers/Sms/Edit/index.js +548 -103
- package/containers/Sms/Edit/reducer.js +0 -2
- package/containers/Sms/Edit/sagas.js +3 -1
- package/containers/TagList/index.js +3 -3
- package/containers/Templates/actions.js +1 -3
- package/containers/Templates/index.js +299 -268
- package/containers/Templates/messages.js +90 -122
- package/containers/Templates/reducer.js +3 -3
- package/containers/Templates/sagas.js +1 -5
- package/containers/Templates/selectors.js +1 -41
- package/containers/WeChat/MapTemplates/index.js +3 -4
- package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -4
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +4 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +3 -1
- package/containers/WeChat/RichmediaTemplates/View/index.js +3 -1
- package/index.js +31 -31
- package/initialState.js +6 -0
- package/package.json +3 -3
- package/routes.js +24 -19
- package/services/api.js +6 -2
- package/services/getSchema.js +18 -0
- package/v2Containers/App/actions.js +7 -0
- package/v2Containers/App/constants.js +3 -0
- package/v2Containers/App/reducer.js +19 -0
- package/v2Containers/App/sagas.js +26 -0
- package/v2Containers/App/selectors.js +25 -0
- package/v2Containers/App/tests/actions.test.js +18 -0
- package/v2Containers/App/tests/reducer.test.js +9 -0
- package/v2Containers/App/tests/sagas.test.js +15 -0
- package/v2Containers/App/tests/selectors.test.js +10 -0
- package/v2Containers/Assets/Gallery/_gallery.scss +0 -0
- package/v2Containers/Assets/Gallery/actions.js +37 -0
- package/v2Containers/Assets/Gallery/constants.js +23 -0
- package/v2Containers/Assets/Gallery/index.js +479 -0
- package/v2Containers/Assets/Gallery/messages.js +97 -0
- package/v2Containers/Assets/Gallery/reducer.js +81 -0
- package/v2Containers/Assets/Gallery/sagas.js +84 -0
- package/v2Containers/Assets/Gallery/selectors.js +25 -0
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +7 -0
- package/v2Containers/Assets/Gallery/tests/actions.test.js +26 -0
- package/v2Containers/Assets/Gallery/tests/index.test.js +10 -0
- package/v2Containers/Assets/Gallery/tests/reducer.test.js +95 -0
- package/v2Containers/Assets/Gallery/tests/sagas.test.js +15 -0
- package/v2Containers/Assets/Gallery/tests/selectors.test.js +10 -0
- package/v2Containers/CallTask/_callTask.scss +5 -0
- package/v2Containers/CallTask/actions.js +15 -0
- package/v2Containers/CallTask/constants.js +7 -0
- package/v2Containers/CallTask/index.js +141 -0
- package/v2Containers/CallTask/messages.js +21 -0
- package/v2Containers/CallTask/reducer.js +23 -0
- package/v2Containers/CallTask/sagas.js +11 -0
- package/v2Containers/CallTask/selectors.js +25 -0
- package/v2Containers/CallTask/tests/actions.test.js +18 -0
- package/v2Containers/CallTask/tests/index.test.js +10 -0
- package/v2Containers/CallTask/tests/reducer.test.js +9 -0
- package/v2Containers/CallTask/tests/sagas.test.js +15 -0
- package/v2Containers/CallTask/tests/selectors.test.js +10 -0
- package/v2Containers/Cap/actions.js +64 -0
- package/v2Containers/Cap/constants.js +24 -0
- package/v2Containers/Cap/index.js +349 -0
- package/v2Containers/Cap/messsages.js +63 -0
- package/v2Containers/Cap/reducer.js +111 -0
- package/v2Containers/Cap/sagas.js +143 -0
- package/v2Containers/Cap/selectors.js +85 -0
- package/v2Containers/Cap/tests/index.test.js +16 -0
- package/v2Containers/Cap/tests/selectors.test.js +28 -0
- package/v2Containers/ChannelTemplates/actions.js +20 -0
- package/v2Containers/ChannelTemplates/constants.js +8 -0
- package/v2Containers/ChannelTemplates/index.js +48 -0
- package/v2Containers/ChannelTemplates/messages.js +13 -0
- package/v2Containers/ChannelTemplates/reducer.js +34 -0
- package/v2Containers/ChannelTemplates/sagas.js +32 -0
- package/v2Containers/ChannelTemplates/selectors.js +25 -0
- package/v2Containers/ChannelTemplates/tests/actions.test.js +18 -0
- package/v2Containers/ChannelTemplates/tests/index.test.js +10 -0
- package/v2Containers/ChannelTemplates/tests/reducer.test.js +9 -0
- package/v2Containers/ChannelTemplates/tests/sagas.test.js +15 -0
- package/v2Containers/ChannelTemplates/tests/selectors.test.js +10 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +257 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +45 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +70 -0
- package/v2Containers/CreativesContainer/actions.js +27 -0
- package/v2Containers/CreativesContainer/constants.js +16 -0
- package/v2Containers/CreativesContainer/index.js +483 -0
- package/v2Containers/CreativesContainer/index.scss +27 -0
- package/v2Containers/CreativesContainer/messages.js +293 -0
- package/v2Containers/CreativesContainer/reducer.js +29 -0
- package/v2Containers/CreativesContainer/sagas.js +11 -0
- package/v2Containers/CreativesContainer/selectors.js +30 -0
- package/v2Containers/CreativesContainer/tests/actions.test.js +18 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +10 -0
- package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -0
- package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -0
- package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -0
- package/v2Containers/Dashboard/actions.js +15 -0
- package/v2Containers/Dashboard/constants.js +7 -0
- package/v2Containers/Dashboard/index.js +54 -0
- package/v2Containers/Dashboard/messages.js +13 -0
- package/v2Containers/Dashboard/reducer.js +21 -0
- package/v2Containers/Dashboard/sagas.js +11 -0
- package/v2Containers/Dashboard/selectors.js +25 -0
- package/v2Containers/Dashboard/tests/actions.test.js +18 -0
- package/v2Containers/Dashboard/tests/index.test.js +10 -0
- package/v2Containers/Dashboard/tests/reducer.test.js +9 -0
- package/v2Containers/Dashboard/tests/sagas.test.js +15 -0
- package/v2Containers/Dashboard/tests/selectors.test.js +10 -0
- package/v2Containers/Ebill/_ebill.scss +5 -0
- package/v2Containers/Ebill/actions.js +43 -0
- package/v2Containers/Ebill/constants.js +20 -0
- package/v2Containers/Ebill/index.js +1261 -0
- package/v2Containers/Ebill/messages.js +73 -0
- package/v2Containers/Ebill/reducer.js +72 -0
- package/v2Containers/Ebill/sagas.js +65 -0
- package/v2Containers/Ebill/selectors.js +25 -0
- package/v2Containers/Ebill/tests/actions.test.js +18 -0
- package/v2Containers/Ebill/tests/index.test.js +10 -0
- package/v2Containers/Ebill/tests/reducer.test.js +9 -0
- package/v2Containers/Ebill/tests/sagas.test.js +15 -0
- package/v2Containers/Ebill/tests/selectors.test.js +10 -0
- package/v2Containers/Email/_email.scss +140 -0
- package/v2Containers/Email/actions.js +86 -0
- package/v2Containers/Email/constants.js +37 -0
- package/v2Containers/Email/index.js +2703 -0
- package/v2Containers/Email/initialSchema.js +540 -0
- package/v2Containers/Email/messages.js +237 -0
- package/v2Containers/Email/reducer.js +147 -0
- package/v2Containers/Email/sagas.js +133 -0
- package/v2Containers/Email/selectors.js +34 -0
- package/v2Containers/Email/tests/actions.test.js +18 -0
- package/v2Containers/Email/tests/index.test.js +10 -0
- package/v2Containers/Email/tests/reducer.test.js +9 -0
- package/v2Containers/Email/tests/sagas.test.js +15 -0
- package/v2Containers/Email/tests/selectors.test.js +10 -0
- package/v2Containers/EmailWrapper/actions.js +15 -0
- package/v2Containers/EmailWrapper/constants.js +7 -0
- package/v2Containers/EmailWrapper/index.js +258 -0
- package/v2Containers/EmailWrapper/messages.js +57 -0
- package/v2Containers/EmailWrapper/reducer.js +23 -0
- package/v2Containers/EmailWrapper/sagas.js +11 -0
- package/v2Containers/EmailWrapper/selectors.js +25 -0
- package/v2Containers/EmailWrapper/tests/actions.test.js +18 -0
- package/v2Containers/EmailWrapper/tests/index.test.js +10 -0
- package/v2Containers/EmailWrapper/tests/reducer.test.js +9 -0
- package/v2Containers/EmailWrapper/tests/sagas.test.js +15 -0
- package/v2Containers/EmailWrapper/tests/selectors.test.js +10 -0
- package/v2Containers/LanguageProvider/actions.js +17 -0
- package/v2Containers/LanguageProvider/constants.js +8 -0
- package/v2Containers/LanguageProvider/index.js +46 -0
- package/v2Containers/LanguageProvider/reducer.js +30 -0
- package/v2Containers/LanguageProvider/selectors.js +20 -0
- package/v2Containers/LanguageProvider/tests/actions.test.js +19 -0
- package/v2Containers/LanguageProvider/tests/index.test.js +49 -0
- package/v2Containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/v2Containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/v2Containers/Line/Create/_lineCreate.scss +43 -0
- package/v2Containers/Line/Create/actions.js +90 -0
- package/v2Containers/Line/Create/constants.js +39 -0
- package/v2Containers/Line/Create/index.js +822 -0
- package/v2Containers/Line/Create/messages.js +173 -0
- package/v2Containers/Line/Create/reducer.js +99 -0
- package/v2Containers/Line/Create/sagas.js +107 -0
- package/v2Containers/Line/Create/selectors.js +36 -0
- package/v2Containers/Line/Edit/_lineEdit.scss +21 -0
- package/v2Containers/Line/Edit/actions.js +79 -0
- package/v2Containers/Line/Edit/constants.js +27 -0
- package/v2Containers/Line/Edit/index.js +1050 -0
- package/v2Containers/Line/Edit/messages.js +157 -0
- package/v2Containers/Line/Edit/reducer.js +83 -0
- package/v2Containers/Line/Edit/sagas.js +81 -0
- package/v2Containers/Line/Edit/selectors.js +29 -0
- package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
- package/v2Containers/Line/Edit/tests/index.test.js +10 -0
- package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/Login/assets/images/capillary_logo.png +0 -0
- package/v2Containers/Login/components/LoginForm/index.js +59 -0
- package/v2Containers/Login/components/LoginForm/messages.js +21 -0
- package/v2Containers/Login/components/LoginForm/tests/index.test.js +10 -0
- package/v2Containers/Login/index.js +106 -0
- package/v2Containers/Login/messages.js +21 -0
- package/v2Containers/Login/selectors.js +25 -0
- package/v2Containers/Login/tests/index.test.js +10 -0
- package/v2Containers/Login/tests/sagas.test.js +15 -0
- package/v2Containers/Login/tests/selectors.test.js +10 -0
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +41 -0
- package/v2Containers/MobilePush/Create/actions.js +52 -0
- package/v2Containers/MobilePush/Create/constants.js +24 -0
- package/v2Containers/MobilePush/Create/index.js +1759 -0
- package/v2Containers/MobilePush/Create/messages.js +237 -0
- package/v2Containers/MobilePush/Create/reducer.js +72 -0
- package/v2Containers/MobilePush/Create/sagas.js +60 -0
- package/v2Containers/MobilePush/Create/selectors.js +28 -0
- package/v2Containers/MobilePush/Create/tests/actions.test.js +18 -0
- package/v2Containers/MobilePush/Create/tests/index.test.js +10 -0
- package/v2Containers/MobilePush/Create/tests/reducer.test.js +9 -0
- package/v2Containers/MobilePush/Create/tests/sagas.test.js +15 -0
- package/v2Containers/MobilePush/Create/tests/selectors.test.js +10 -0
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +38 -0
- package/v2Containers/MobilePush/Edit/actions.js +91 -0
- package/v2Containers/MobilePush/Edit/constants.js +35 -0
- package/v2Containers/MobilePush/Edit/index.js +1851 -0
- package/v2Containers/MobilePush/Edit/messages.js +253 -0
- package/v2Containers/MobilePush/Edit/reducer.js +113 -0
- package/v2Containers/MobilePush/Edit/sagas.js +119 -0
- package/v2Containers/MobilePush/Edit/selectors.js +32 -0
- package/v2Containers/MobilePush/Edit/tests/actions.test.js +18 -0
- package/v2Containers/MobilePush/Edit/tests/index.test.js +10 -0
- package/v2Containers/MobilePush/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/MobilePush/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/MobilePush/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/MobilePush/commonMethods.js +249 -0
- package/v2Containers/MobilePush/eventsMap.js +127 -0
- package/v2Containers/MobilePush/initialSchema.js +1739 -0
- package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +18 -0
- package/v2Containers/MobilepushWrapper/index.js +136 -0
- package/v2Containers/MobilepushWrapper/messages.js +29 -0
- package/v2Containers/MobilepushWrapper/tests/index.test.js +10 -0
- package/v2Containers/NotFoundPage/index.js +25 -0
- package/v2Containers/NotFoundPage/messages.js +13 -0
- package/v2Containers/NotFoundPage/tests/index.test.js +17 -0
- package/v2Containers/Sms/Create/_smsCreate.scss +58 -0
- package/v2Containers/Sms/Create/actions.js +27 -0
- package/v2Containers/Sms/Create/constants.js +16 -0
- package/v2Containers/Sms/Create/index.js +1017 -0
- package/v2Containers/Sms/Create/messages.js +85 -0
- package/v2Containers/Sms/Create/reducer.js +41 -0
- package/v2Containers/Sms/Create/sagas.js +35 -0
- package/v2Containers/Sms/Create/selectors.js +28 -0
- package/v2Containers/Sms/Create/tests/actions.test.js +18 -0
- package/v2Containers/Sms/Create/tests/index.test.js +10 -0
- package/v2Containers/Sms/Create/tests/reducer.test.js +9 -0
- package/v2Containers/Sms/Create/tests/sagas.test.js +15 -0
- package/v2Containers/Sms/Create/tests/selectors.test.js +10 -0
- package/v2Containers/Sms/Edit/actions.js +45 -0
- package/v2Containers/Sms/Edit/constants.js +18 -0
- package/v2Containers/Sms/Edit/index.js +1018 -0
- package/v2Containers/Sms/Edit/messages.js +89 -0
- package/v2Containers/Sms/Edit/reducer.js +52 -0
- package/v2Containers/Sms/Edit/sagas.js +50 -0
- package/v2Containers/Sms/Edit/selectors.js +32 -0
- package/v2Containers/Sms/Edit/tests/actions.test.js +18 -0
- package/v2Containers/Sms/Edit/tests/index.test.js +10 -0
- package/v2Containers/Sms/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/Sms/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/Sms/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/Sms/initialSchema.js +281 -0
- package/v2Containers/TagList/_tagList.scss +8 -0
- package/v2Containers/TagList/actions.js +15 -0
- package/v2Containers/TagList/constants.js +7 -0
- package/v2Containers/TagList/index.js +236 -0
- package/v2Containers/TagList/messages.js +13 -0
- package/v2Containers/TagList/reducer.js +23 -0
- package/v2Containers/TagList/sagas.js +11 -0
- package/v2Containers/TagList/selectors.js +25 -0
- package/v2Containers/TagList/tests/actions.test.js +18 -0
- package/v2Containers/TagList/tests/index.test.js +10 -0
- package/v2Containers/TagList/tests/reducer.test.js +9 -0
- package/v2Containers/TagList/tests/sagas.test.js +15 -0
- package/v2Containers/TagList/tests/selectors.test.js +10 -0
- package/v2Containers/Templates/_templates.scss +349 -0
- package/v2Containers/Templates/actions.js +110 -0
- package/v2Containers/Templates/constants.js +45 -0
- package/v2Containers/Templates/index.js +1725 -0
- package/v2Containers/Templates/messages.js +278 -0
- package/v2Containers/Templates/reducer.js +142 -0
- package/v2Containers/Templates/sagas.js +180 -0
- package/v2Containers/Templates/selectors.js +68 -0
- package/v2Containers/Templates/tests/actions.test.js +18 -0
- package/v2Containers/Templates/tests/index.test.js +10 -0
- package/v2Containers/Templates/tests/reducer.test.js +9 -0
- package/v2Containers/Templates/tests/sagas.test.js +15 -0
- package/v2Containers/Templates/tests/selectors.test.js +10 -0
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/actions.js +16 -0
- package/v2Containers/TemplatesV2/constants.js +10 -0
- package/v2Containers/TemplatesV2/index.js +217 -0
- package/v2Containers/TemplatesV2/messages.js +29 -0
- package/v2Containers/TemplatesV2/selectors.js +25 -0
- package/v2Containers/TemplatesV2/tests/actions.test.js +18 -0
- package/v2Containers/TemplatesV2/tests/index.test.js +10 -0
- package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -0
- package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -0
- package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -0
- package/v2Containers/TestPage/constants.js +7 -0
- package/v2Containers/TestPage/index.js +31 -0
- package/v2Containers/TestPage/messages.js +13 -0
- package/v2Containers/TestPage/reducer.js +21 -0
- package/v2Containers/TestPage/sagas.js +11 -0
- package/v2Containers/Testv2/actions.js +15 -0
- package/v2Containers/Testv2/constants.js +7 -0
- package/v2Containers/Testv2/index.js +47 -0
- package/v2Containers/Testv2/messages.js +13 -0
- package/v2Containers/Testv2/reducer.js +23 -0
- package/v2Containers/Testv2/sagas.js +11 -0
- package/v2Containers/Testv2/selectors.js +25 -0
- package/v2Containers/Testv2/tests/actions.test.js +18 -0
- package/v2Containers/Testv2/tests/index.test.js +10 -0
- package/v2Containers/Testv2/tests/reducer.test.js +9 -0
- package/v2Containers/Testv2/tests/sagas.test.js +15 -0
- package/v2Containers/Testv2/tests/selectors.test.js +10 -0
- package/v2Containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/v2Containers/WeChat/MapTemplates/actions.js +52 -0
- package/v2Containers/WeChat/MapTemplates/constants.js +28 -0
- package/v2Containers/WeChat/MapTemplates/index.js +1385 -0
- package/v2Containers/WeChat/MapTemplates/messages.js +73 -0
- package/v2Containers/WeChat/MapTemplates/reducer.js +74 -0
- package/v2Containers/WeChat/MapTemplates/sagas.js +86 -0
- package/v2Containers/WeChat/MapTemplates/selectors.js +25 -0
- package/v2Containers/WeChat/MapTemplates/tests/actions.test.js +18 -0
- package/v2Containers/WeChat/MapTemplates/tests/index.test.js +10 -0
- package/v2Containers/WeChat/MapTemplates/tests/reducer.test.js +9 -0
- package/v2Containers/WeChat/MapTemplates/tests/sagas.test.js +15 -0
- package/v2Containers/WeChat/MapTemplates/tests/selectors.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1053 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +141 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +48 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/tests/actions.test.js +18 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/tests/index.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/tests/reducer.test.js +9 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/tests/sagas.test.js +15 -0
- package/v2Containers/WeChat/RichmediaTemplates/Create/tests/selectors.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +116 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +32 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/actions.test.js +18 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/index.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/reducer.test.js +9 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/sagas.test.js +15 -0
- package/v2Containers/WeChat/RichmediaTemplates/Edit/tests/selectors.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/messages.js +13 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/tests/actions.test.js +18 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/tests/index.test.js +10 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/tests/reducer.test.js +9 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/tests/sagas.test.js +15 -0
- package/v2Containers/WeChat/RichmediaTemplates/View/tests/selectors.test.js +10 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const DEFAULT_LOCALE = 'en';
|
|
2
|
+
export const SWITCH_ORG_REQUEST = 'cap/SWITCH_ORG_REQUEST';
|
|
3
|
+
export const SWITCH_ORG_SUCCESS = 'cap/SWITCH_ORG_SUCCESS';
|
|
4
|
+
export const SWITCH_ORG_FAILURE = 'cap/SWITCH_ORG_FAILURE';
|
|
5
|
+
export const LOGIN_REQUEST = 'cap/LOGIN_REQUEST';
|
|
6
|
+
export const LOGIN_SUCCESS = 'cap/LOGIN_SUCCESS';
|
|
7
|
+
export const LOGIN_FAILURE = 'cap/LOGIN_FAILURE';
|
|
8
|
+
|
|
9
|
+
export const LOGOUT_REQUEST = 'cap/LOGOUT_REQUEST';
|
|
10
|
+
export const LOGOUT_SUCCESS = 'cap/LOGOUT_SUCCESS';
|
|
11
|
+
export const LOGOUT_FAILURE = 'cap/LOGOUT_FAILURE';
|
|
12
|
+
export const ADD_MESSAGE = 'cap/ADD_MESSAGE';
|
|
13
|
+
export const REMOVE_MESSAGE = 'cap/REMOVE_MESSAGE';
|
|
14
|
+
export const GET_USER_DATA_REQUEST = 'cap/GET_USER_DATA_REQUEST';
|
|
15
|
+
export const GET_USER_DATA_SUCCESS = 'cap/GET_USER_DATA_SUCCESS';
|
|
16
|
+
export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE';
|
|
17
|
+
|
|
18
|
+
export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE';
|
|
19
|
+
export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
|
|
20
|
+
export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
|
|
21
|
+
export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
|
|
22
|
+
export const HIDE_TAGS = 'cap/HIDE_TAGS';
|
|
23
|
+
|
|
24
|
+
export const SET_INJECTED_TAGS = 'cap/SET_INJECTED_TAGS';
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Helmet from 'react-helmet';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
// import { Link } from 'react-router';
|
|
6
|
+
// import { Icon } from 'semantic-ui-react';
|
|
7
|
+
import { bindActionCreators } from 'redux';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { createStructuredSelector } from 'reselect';
|
|
10
|
+
import _ from 'lodash';
|
|
11
|
+
import moment from 'moment';
|
|
12
|
+
import 'moment/locale/zh-cn';
|
|
13
|
+
import { injectIntl, intlShape } from 'react-intl';
|
|
14
|
+
import {CapNotification} from '@capillarytech/cap-ui-library';
|
|
15
|
+
import TopBar from '../../components/TopBar';
|
|
16
|
+
// import 'moment/locale/en-us';
|
|
17
|
+
import Sidebar from '../../components/Sidebar';
|
|
18
|
+
import { makeSelectAuthenticated, makeSelectUser } from './selectors';
|
|
19
|
+
import * as actions from './actions';
|
|
20
|
+
import * as locationActions from '../LanguageProvider/actions';
|
|
21
|
+
import * as appActions from '../App/actions';
|
|
22
|
+
import config from '../../config/app';
|
|
23
|
+
import messages from './messsages';
|
|
24
|
+
const gtm = window.dataLayer || [];
|
|
25
|
+
|
|
26
|
+
const CapWrapper = styled.div`
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
display: flex;
|
|
29
|
+
min-height: 100%;
|
|
30
|
+
padding: 0;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export class Cap extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
35
|
+
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props);
|
|
38
|
+
this.state = {
|
|
39
|
+
menuData: [],
|
|
40
|
+
switchedOrg: false,
|
|
41
|
+
};
|
|
42
|
+
this.changeOrg = this.changeOrg.bind(this);
|
|
43
|
+
this.logout = this.logout.bind(this);
|
|
44
|
+
this.handleRemoveMessage = this.handleRemoveMessage.bind(this);
|
|
45
|
+
this.getMappedLocale = this.getMappedLocale.bind(this);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentWillMount() {
|
|
49
|
+
this.props.actions.getUserData();
|
|
50
|
+
if (this.props.Global.user) {
|
|
51
|
+
const userGtmData = this.getUserGtmData(this.props);
|
|
52
|
+
gtm.push(userGtmData);
|
|
53
|
+
}
|
|
54
|
+
if (this.props.Global.orgID !== undefined) {
|
|
55
|
+
gtm.push({orgId: this.props.Global.orgID});
|
|
56
|
+
}
|
|
57
|
+
if (this.props.Global.isLoggedIn) {
|
|
58
|
+
if (this.props.Global.user && Object.keys(this.props.Global.user).length) {
|
|
59
|
+
// gtm.push({userId: this.props.Global.user.id});
|
|
60
|
+
this.props.appActions.getSidebar();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
componentDidMount() {
|
|
66
|
+
const user = localStorage.getItem('user');
|
|
67
|
+
let locale = 'en';
|
|
68
|
+
if (user) {
|
|
69
|
+
locale = JSON.parse(user).lang;
|
|
70
|
+
}
|
|
71
|
+
locale = this.getMappedLocale(locale);
|
|
72
|
+
//locale = 'zh';
|
|
73
|
+
console.log('Setting final locale as', locale);
|
|
74
|
+
moment.locale(locale);
|
|
75
|
+
this.props.locationActions.changeLocale(locale);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
componentWillReceiveProps(nextProps) {
|
|
79
|
+
const user = this.props.Global.user;
|
|
80
|
+
const nextPropsUser = nextProps.Global.user;
|
|
81
|
+
if (!nextProps.Global.settingProxyOrg && nextProps.Global.changeProxyOrgSuccess &&
|
|
82
|
+
!_.isEqual(nextProps.Global.changeProxyOrgSuccess, this.props.Global.changeProxyOrgSuccess) && !this.state.switchedOrg) {
|
|
83
|
+
this.navigateToDashboard();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const callBack = nextProps.routeParams.callbackUrl ? decodeURIComponent(nextProps.routeParams.callbackUrl) : "";
|
|
87
|
+
if (nextProps.Global.error) {
|
|
88
|
+
const locationValue = `${window.location.origin}${callBack}?flash=${nextProps.Global.error}`;
|
|
89
|
+
window.location.replace(locationValue);
|
|
90
|
+
window.location.reload();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (nextPropsUser && user && nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
|
|
94
|
+
this.props.appActions.getSidebar();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (nextProps.Global.user && this.props.Global.user && (nextProps.Global.user.refID !== this.props.Global.user.refID)) {
|
|
98
|
+
const userGtmData = this.getUserGtmData(nextProps);
|
|
99
|
+
gtm.push(userGtmData);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (nextProps.Global.isLoggedIn && nextProps.Global.isLoggedIn !== this.props.Global.isLoggedIn) {
|
|
103
|
+
if (nextProps.Global.orgID !== undefined && !_.isEqual(nextProps.Global.orgID, this.props.Global.orgID)) {
|
|
104
|
+
const userGtmData = this.getUserGtmData(nextProps);
|
|
105
|
+
gtm.push(userGtmData);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
componentWillUnmount() {
|
|
111
|
+
this.setState({ switchedOrg: false });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// getSideBarData(reportData) {
|
|
115
|
+
// const tmpMenuData = [];
|
|
116
|
+
// const categoryId = reportData.categories ? Object.keys(reportData.categories) : [];
|
|
117
|
+
// _.forEach(categoryId, (id) => {
|
|
118
|
+
// const groupReport = {
|
|
119
|
+
// group: reportData.categories[id].name,
|
|
120
|
+
// items: [],
|
|
121
|
+
// };
|
|
122
|
+
// _.forEach(reportData.reportList, (report, reportId) => {
|
|
123
|
+
// if (report.category === id) {
|
|
124
|
+
// groupReport.items.push({
|
|
125
|
+
// link: `/report/${reportId}`,
|
|
126
|
+
// text: report.name,
|
|
127
|
+
// });
|
|
128
|
+
// }
|
|
129
|
+
// });
|
|
130
|
+
// tmpMenuData.push(groupReport);
|
|
131
|
+
// });
|
|
132
|
+
// const menuLibrary = {
|
|
133
|
+
// group: 'Library',
|
|
134
|
+
// items: [
|
|
135
|
+
// {
|
|
136
|
+
// link: '/library/charts',
|
|
137
|
+
// text: 'Charts',
|
|
138
|
+
// },
|
|
139
|
+
// {
|
|
140
|
+
// link: '/library/dimension',
|
|
141
|
+
// text: 'Dimensions',
|
|
142
|
+
// },
|
|
143
|
+
// ],
|
|
144
|
+
// };
|
|
145
|
+
// tmpMenuData.push(menuLibrary);
|
|
146
|
+
// this.setState({ menuData: tmpMenuData });
|
|
147
|
+
// }
|
|
148
|
+
|
|
149
|
+
getUserGtmData = (props) => {
|
|
150
|
+
const { user: userData } = props.Global;
|
|
151
|
+
const userName = userData.attributes.USERNAME;
|
|
152
|
+
const userEmail = userData.attributes.EMAIL;
|
|
153
|
+
const orgObj = find(userData.proxyOrgList, {orgID: props.Global.orgID});
|
|
154
|
+
const gtmData = {
|
|
155
|
+
orgId: props.Global.orgID,
|
|
156
|
+
orgName: orgObj && orgObj.orgName,
|
|
157
|
+
userId: userData.refID,
|
|
158
|
+
userName: userName && userName.value,
|
|
159
|
+
userEmail: userEmail && userEmail.value,
|
|
160
|
+
isCapUser: userData.isCapUser,
|
|
161
|
+
};
|
|
162
|
+
return gtmData;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
getMappedLocale(locale) {
|
|
166
|
+
const map = {
|
|
167
|
+
'en': 'en',
|
|
168
|
+
'zh-cn': 'zh',
|
|
169
|
+
};
|
|
170
|
+
return map[locale];
|
|
171
|
+
}
|
|
172
|
+
handleRemoveMessage(messageIndex) {
|
|
173
|
+
this.props.actions.removeMessageFromQueue(messageIndex);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
navigateToDashboard() {
|
|
177
|
+
const dashboardUrl = process.env.NODE_ENV === 'production' ? config.production.dashboard_url : config.development.dashboard_url;
|
|
178
|
+
this.props.router.push({ pathname: dashboardUrl, state: {} });
|
|
179
|
+
this.props.router.go(dashboardUrl);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
logout() {
|
|
183
|
+
this.props.actions.logout();
|
|
184
|
+
}
|
|
185
|
+
changeOrg(orgId) {
|
|
186
|
+
this.props.actions.changeOrg(orgId);
|
|
187
|
+
//this.navigateToDashboard();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
render() {
|
|
191
|
+
const userData = this.props.Global;
|
|
192
|
+
const type = this.props.location.query.type;
|
|
193
|
+
// const changeOrg = this.props.actions.changeOrg;
|
|
194
|
+
// const logout = this.props.actions.logout;
|
|
195
|
+
console.log('props', this.props);
|
|
196
|
+
const proxyOrgList = [];
|
|
197
|
+
let defaultOrgName = '';
|
|
198
|
+
let defaultOrgId = '';
|
|
199
|
+
let userName = '';
|
|
200
|
+
const navigateToDashboard = this.navigateToDashboard;
|
|
201
|
+
if (userData && userData.user && userData.user !== '') {
|
|
202
|
+
console.log('Org name ', userData.user.orgName, userData.user.orgID);
|
|
203
|
+
defaultOrgName = userData.user.orgName;
|
|
204
|
+
defaultOrgId = userData.user.orgID;
|
|
205
|
+
proxyOrgList.push({ text: defaultOrgName, value: defaultOrgId });
|
|
206
|
+
const orgList = userData.user.proxyOrgList;
|
|
207
|
+
if (!_.isEmpty(orgList)) {
|
|
208
|
+
_.forEach(orgList, (item) => {
|
|
209
|
+
const id = item.orgID;
|
|
210
|
+
let name = item.orgName;
|
|
211
|
+
if (id === 486) {
|
|
212
|
+
name = 'Demo Org';
|
|
213
|
+
}
|
|
214
|
+
proxyOrgList.push({ key: id, text: name, value: id });
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
userName = userData.user.firstName;
|
|
218
|
+
}
|
|
219
|
+
const actionComponents = "";
|
|
220
|
+
const toastMessages = this.props.Global.messages;
|
|
221
|
+
const loggedIn = this.props.Global.isLoggedIn;
|
|
222
|
+
const menuData = [
|
|
223
|
+
{
|
|
224
|
+
group: this.props.intl.formatMessage(messages.creativesDashboard),
|
|
225
|
+
items: [
|
|
226
|
+
{
|
|
227
|
+
link: '/sms',
|
|
228
|
+
text: this.props.intl.formatMessage(messages.sms),
|
|
229
|
+
value: 'SMS',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
link: '/wechat',
|
|
233
|
+
text: this.props.intl.formatMessage(messages.wechat),
|
|
234
|
+
value: 'WECHAT',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
link: '/mobilepush',
|
|
238
|
+
text: 'Mobile Push',
|
|
239
|
+
value: 'MOBILEPUSH',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
link: '/assets',
|
|
243
|
+
text: this.props.intl.formatMessage(messages.gallery),
|
|
244
|
+
value: 'GALLERY',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
link: '/email',
|
|
248
|
+
text: this.props.intl.formatMessage(messages.email),
|
|
249
|
+
value: 'EMAIL',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
link: '/ebill',
|
|
253
|
+
text: this.props.intl.formatMessage(messages.ebill),
|
|
254
|
+
value: 'EBILL',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
link: '/line',
|
|
258
|
+
text: 'Line',
|
|
259
|
+
value: 'LINE',
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
group: this.props.intl.formatMessage(messages.campaignsDashboard),
|
|
265
|
+
items: [
|
|
266
|
+
{
|
|
267
|
+
link: '/campaign/index',
|
|
268
|
+
text: this.props.intl.formatMessage(messages.campaignsHome),
|
|
269
|
+
value: 'Campaigns Home',
|
|
270
|
+
external: true,
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
return (
|
|
276
|
+
<CapWrapper>
|
|
277
|
+
<Helmet
|
|
278
|
+
titleTemplate="Capillary - %s"
|
|
279
|
+
defaultTitle="App Name"
|
|
280
|
+
meta={[
|
|
281
|
+
{ name: 'description', content: 'App Name' },
|
|
282
|
+
]}
|
|
283
|
+
/>
|
|
284
|
+
<div className="wrapper">
|
|
285
|
+
{loggedIn && type !== 'embedded' ?
|
|
286
|
+
<TopBar
|
|
287
|
+
proxyOrgList={proxyOrgList}
|
|
288
|
+
userName={userName}
|
|
289
|
+
orgName={defaultOrgName}
|
|
290
|
+
orgID={defaultOrgId}
|
|
291
|
+
changeOrg={this.changeOrg}
|
|
292
|
+
navigateToDashboard={navigateToDashboard}
|
|
293
|
+
logout={this.logout}
|
|
294
|
+
/> : ''}
|
|
295
|
+
<div className="main">
|
|
296
|
+
{loggedIn && type !== 'embedded' && this.props.location.pathname.indexOf('v2') === -1 ? <div id="cap-sidebar" className={'sidebar'}>
|
|
297
|
+
<Sidebar
|
|
298
|
+
menuData={menuData}
|
|
299
|
+
actionComponents={actionComponents}
|
|
300
|
+
router={this.props.router}
|
|
301
|
+
/>
|
|
302
|
+
</div> : '' }
|
|
303
|
+
<div className="main-content">
|
|
304
|
+
{React.Children.toArray(this.props.children)}
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
{(toastMessages && toastMessages.length > 0) &&
|
|
309
|
+
toastMessages.map((message) => CapNotification[message.type]({message: message.text, key: message.text, duration: message.duration || 5})
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
{this.props.Global.fetching_userdata &&
|
|
313
|
+
<div className="cap-loader-box">
|
|
314
|
+
<img
|
|
315
|
+
className="loader-image"
|
|
316
|
+
src="https://s3.amazonaws.com/fileservice.in/intouch_creative_assets/88561f46de9407021cad.gif"
|
|
317
|
+
alt="Capillary"/>
|
|
318
|
+
</div>
|
|
319
|
+
}
|
|
320
|
+
</CapWrapper>
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
Cap.propTypes = {
|
|
326
|
+
children: PropTypes.node,
|
|
327
|
+
actions: PropTypes.object.isRequired,
|
|
328
|
+
Global: PropTypes.object,
|
|
329
|
+
router: PropTypes.object,
|
|
330
|
+
appActions: PropTypes.object,
|
|
331
|
+
locationActions: PropTypes.object,
|
|
332
|
+
location: PropTypes.object,
|
|
333
|
+
intl: intlShape.isRequired,
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const mapStateToProps = createStructuredSelector({
|
|
337
|
+
Global: makeSelectAuthenticated(),
|
|
338
|
+
User: makeSelectUser(),
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
function mapDispatchToProps(dispatch) {
|
|
342
|
+
return {
|
|
343
|
+
actions: bindActionCreators(actions, dispatch),
|
|
344
|
+
appActions: bindActionCreators(appActions, dispatch),
|
|
345
|
+
locationActions: bindActionCreators(locationActions, dispatch),
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(Cap));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export default defineMessages({
|
|
3
|
+
"sms": {
|
|
4
|
+
id: 'reon.components.Cap.sms',
|
|
5
|
+
defaultMessage: 'SMS',
|
|
6
|
+
},
|
|
7
|
+
"wechat": {
|
|
8
|
+
id: 'reon.components.Cap.wechat',
|
|
9
|
+
defaultMessage: 'WeChat',
|
|
10
|
+
},
|
|
11
|
+
"gallery": {
|
|
12
|
+
id: 'reon.components.Cap.gallery',
|
|
13
|
+
defaultMessage: 'Gallery',
|
|
14
|
+
},
|
|
15
|
+
"creativesDashboard": {
|
|
16
|
+
id: 'reon.components.Cap.creativesDashboard',
|
|
17
|
+
defaultMessage: 'Creatives',
|
|
18
|
+
},
|
|
19
|
+
"creatives": {
|
|
20
|
+
id: 'reon.components.Cap.creatives',
|
|
21
|
+
defaultMessage: 'Creatives',
|
|
22
|
+
},
|
|
23
|
+
"campaigns": {
|
|
24
|
+
id: 'reon.components.Cap.campaigns',
|
|
25
|
+
defaultMessage: 'Campaigns',
|
|
26
|
+
},
|
|
27
|
+
"loyalty": {
|
|
28
|
+
id: 'reon.components.Cap.loyalty',
|
|
29
|
+
defaultMessage: 'Loyalty',
|
|
30
|
+
},
|
|
31
|
+
"member care": {
|
|
32
|
+
id: 'reon.components.Cap.memberCare',
|
|
33
|
+
defaultMessage: 'Member Care',
|
|
34
|
+
},
|
|
35
|
+
"workbench": {
|
|
36
|
+
id: 'reon.components.Cap.Workbench',
|
|
37
|
+
defaultMessage: 'WorkBench',
|
|
38
|
+
},
|
|
39
|
+
"store care": {
|
|
40
|
+
id: 'reon.components.Cap.storeCare',
|
|
41
|
+
defaultMessage: 'Store Care',
|
|
42
|
+
},
|
|
43
|
+
"store performance": {
|
|
44
|
+
id: 'reon.components.Cap.storePerformance',
|
|
45
|
+
defaultMessage: 'Store Performance',
|
|
46
|
+
},
|
|
47
|
+
"email": {
|
|
48
|
+
id: 'reon.components.Cap.email',
|
|
49
|
+
defaultMessage: 'Email',
|
|
50
|
+
},
|
|
51
|
+
"ebill": {
|
|
52
|
+
id: 'reon.components.Cap.ebill',
|
|
53
|
+
defaultMessage: 'Ebill',
|
|
54
|
+
},
|
|
55
|
+
"campaignsDashboard": {
|
|
56
|
+
id: 'reon.components.campaignsDashboard',
|
|
57
|
+
defaultMessage: 'Campaigns',
|
|
58
|
+
},
|
|
59
|
+
"campaignsHome": {
|
|
60
|
+
id: 'reon.components.campaignsHome',
|
|
61
|
+
defaultMessage: "Campaigns Home",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by vivek on 22/5/17.
|
|
3
|
+
*/
|
|
4
|
+
import { fromJS } from 'immutable';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import * as types from './constants';
|
|
7
|
+
import initialState from '../../initialState';
|
|
8
|
+
|
|
9
|
+
function capReducer(state = fromJS(initialState.cap), action) {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case types.LOGIN_REQUEST:
|
|
12
|
+
return state.set('login_progress', true);
|
|
13
|
+
case types.LOGIN_SUCCESS:
|
|
14
|
+
return state
|
|
15
|
+
.set('login_progress', false)
|
|
16
|
+
.set('token', action.res.token)
|
|
17
|
+
.set('user', fromJS(action.res.user))
|
|
18
|
+
.set('message', '')
|
|
19
|
+
.set('authenticated', true)
|
|
20
|
+
.set('isLoggedIn', true);
|
|
21
|
+
case types.LOGIN_FAILURE:
|
|
22
|
+
return state
|
|
23
|
+
.set('login_progress', false)
|
|
24
|
+
.set('message', action.error.message);
|
|
25
|
+
case types.LOGOUT_REQUEST:
|
|
26
|
+
return state.set('login_progress', false);
|
|
27
|
+
case types.LOGOUT_SUCCESS:
|
|
28
|
+
return state;
|
|
29
|
+
case types.LOGOUT_FAILURE:
|
|
30
|
+
return state;
|
|
31
|
+
case types.SWITCH_ORG_REQUEST:
|
|
32
|
+
return state
|
|
33
|
+
.set('settingProxyOrg', true)
|
|
34
|
+
.set('changeProxyOrgSuccess', false);
|
|
35
|
+
case types.SWITCH_ORG_SUCCESS:
|
|
36
|
+
return state
|
|
37
|
+
.set('orgID', action.orgID)
|
|
38
|
+
.set('settingProxyOrg', false)
|
|
39
|
+
.set('changeProxyOrgSuccess', action.isSuccess);
|
|
40
|
+
case types.SWITCH_ORG_FAILURE:
|
|
41
|
+
return state
|
|
42
|
+
.set('settingProxyOrg', false)
|
|
43
|
+
.set('changeProxyOrgSuccess', false);
|
|
44
|
+
case types.ADD_MESSAGE: {
|
|
45
|
+
const message = {
|
|
46
|
+
messageId: action.message.id,
|
|
47
|
+
title: action.message.title,
|
|
48
|
+
text: action.message.text,
|
|
49
|
+
type: action.message.type,
|
|
50
|
+
hideProgressBar: action.message.hideProgressBar,
|
|
51
|
+
};
|
|
52
|
+
return state
|
|
53
|
+
.set('messages', fromJS(state.get('messages').concat(message)));
|
|
54
|
+
}
|
|
55
|
+
case types.REMOVE_MESSAGE: {
|
|
56
|
+
const messageQueue = state.get('messages').toJS();
|
|
57
|
+
const messageIndex = _.findIndex(messageQueue, { messageId: action.messageIndex });
|
|
58
|
+
messageQueue.splice(messageIndex, 1);
|
|
59
|
+
return state
|
|
60
|
+
.set('messages', fromJS(messageQueue));
|
|
61
|
+
}
|
|
62
|
+
case types.GET_USER_DATA_REQUEST:
|
|
63
|
+
return state
|
|
64
|
+
.set('fetching_userdata', true)
|
|
65
|
+
.set('isLoggedIn', false);
|
|
66
|
+
case types.GET_USER_DATA_SUCCESS:
|
|
67
|
+
return state
|
|
68
|
+
.set('fetching_userdata', false)
|
|
69
|
+
.set('user', fromJS(action.userData))
|
|
70
|
+
.set('currentOrgDetails', fromJS(action.currentOrgDetails))
|
|
71
|
+
.set('isLoggedIn', true)
|
|
72
|
+
.set('orgID', action.currentOrgId);
|
|
73
|
+
case types.GET_USER_DATA_FAILURE:
|
|
74
|
+
return state
|
|
75
|
+
.set('fetching_userdata', false)
|
|
76
|
+
.set('isLoggedIn', false);
|
|
77
|
+
case types.GET_SCHEMA_FOR_ENTITY_REQUEST:
|
|
78
|
+
return state
|
|
79
|
+
.set('fetchingSchema', true);
|
|
80
|
+
case types.GET_SCHEMA_FOR_ENTITY_FAILURE:
|
|
81
|
+
return state
|
|
82
|
+
.set('fetchingSchema', false);
|
|
83
|
+
case types.GET_SCHEMA_FOR_ENTITY_SUCCESS: {
|
|
84
|
+
const stateMeta = state.get('metaEntities');
|
|
85
|
+
console.log('stateMeta', stateMeta);
|
|
86
|
+
return state
|
|
87
|
+
.set('fetchingSchema', false)
|
|
88
|
+
.set('metaEntities', {
|
|
89
|
+
layouts: action.data && action.entityType === 'LAYOUT' ? action.data.metaEntities : stateMeta.layouts,
|
|
90
|
+
tags: action.data && action.entityType === 'TAG' ? action.data.metaEntities : stateMeta.tags,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
case types.CLEAR_META_ENTITIES:
|
|
94
|
+
return state.set('metaEntities', {
|
|
95
|
+
layouts: [],
|
|
96
|
+
tags: [],
|
|
97
|
+
});
|
|
98
|
+
// eslint-disable-next-line no-case-declarations
|
|
99
|
+
case types.HIDE_TAGS:
|
|
100
|
+
const metaEntities = {tags: {}, layouts: state.get('metaEntities').layouts};
|
|
101
|
+
metaEntities.tags.standard = _.filter(state.get('metaEntities').tags.standard, (tag) => action.tagList.indexOf(tag.definition.value) === -1);
|
|
102
|
+
metaEntities.tags.custom = _.filter(state.get('metaEntities').tags.custom, (tag) => action.tagList.indexOf(tag.name) === -1);
|
|
103
|
+
return state.setIn(['metaEntities'], metaEntities);
|
|
104
|
+
case types.SET_INJECTED_TAGS:
|
|
105
|
+
return state.set('injectedTags', action.injectedTags);
|
|
106
|
+
default:
|
|
107
|
+
return state;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default capReducer;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { fork, take, call, put, cancelled, cancel, takeLatest } from 'redux-saga/effects';
|
|
2
|
+
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
+
// import { normalize } from 'normalizr';
|
|
4
|
+
import * as Api from '../../services/api';
|
|
5
|
+
import * as LocalStorage from '../../services/localStorageApi';
|
|
6
|
+
import * as types from './constants';
|
|
7
|
+
import config from '../../config/app';
|
|
8
|
+
import pathConfig from '../../config/path';
|
|
9
|
+
// import {makeSelectOrgId} from './selectors';
|
|
10
|
+
|
|
11
|
+
function* authorize(user) {
|
|
12
|
+
try {
|
|
13
|
+
const res = yield call(Api.authorize, user);
|
|
14
|
+
yield call(LocalStorage.saveItem, 'token', res.token);
|
|
15
|
+
yield call(LocalStorage.saveItem, 'orgID', res.user.orgID);
|
|
16
|
+
yield call(LocalStorage.saveItem, 'user', res.user);
|
|
17
|
+
// yield call(LocalStorage.saveItem, 'isLoggedIn', true);
|
|
18
|
+
yield put({ type: types.LOGIN_SUCCESS, res });
|
|
19
|
+
} catch (error) {
|
|
20
|
+
yield put({ type: types.LOGIN_FAILURE, error });
|
|
21
|
+
} finally {
|
|
22
|
+
if (yield cancelled()) {
|
|
23
|
+
// reducer will clear out login_progress on logout request
|
|
24
|
+
// So this block is not exactly required
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function* switchOrg({orgID}) {
|
|
30
|
+
try {
|
|
31
|
+
LocalStorage.saveItem('orgID', orgID);
|
|
32
|
+
const res = yield call(Api.changeProxyOrg, orgID);
|
|
33
|
+
yield [put({ type: types.SWITCH_ORG_SUCCESS, orgID, isSuccess: res.success })];
|
|
34
|
+
} catch (error) {
|
|
35
|
+
yield put({ type: types.SWITCH_ORG_FAILURE, error });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function* loginFlow() {
|
|
40
|
+
const condition = true;
|
|
41
|
+
while (condition) {
|
|
42
|
+
const { user } = yield take(types.LOGIN_REQUEST);
|
|
43
|
+
const task = yield fork(authorize, user);
|
|
44
|
+
const action = yield take([types.LOGOUT_REQUEST, types.LOGIN_FAILURE]);
|
|
45
|
+
if (action.type === types.LOGOUT_REQUEST) {
|
|
46
|
+
yield cancel(task);
|
|
47
|
+
}
|
|
48
|
+
// yield call(LocalStorage.clearItem, 'token');
|
|
49
|
+
// yield call(LocalStorage.clearItem, 'orgID');
|
|
50
|
+
// yield call(LocalStorage.clearItem, 'user');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function* logoutFlow() {
|
|
55
|
+
try {
|
|
56
|
+
const serverLogout = yield call(Api.logout);
|
|
57
|
+
if (serverLogout.success && serverLogout.success === true) {
|
|
58
|
+
const loginUrl = (process.env.NODE_ENV === 'production') ?
|
|
59
|
+
`${pathConfig.publicPath}${config.production.login_url}` : `${pathConfig.publicPath}${config.development.login_url}`;
|
|
60
|
+
yield [put({type: types.LOGOUT_SUCCESS})];
|
|
61
|
+
yield call(LocalStorage.clearItem, 'token');
|
|
62
|
+
yield call(LocalStorage.clearItem, 'orgID');
|
|
63
|
+
yield call(LocalStorage.clearItem, 'user');
|
|
64
|
+
yield call(LocalStorage.clearItem, 'isLoggedIn');
|
|
65
|
+
window.location.href = loginUrl;
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
yield put({ type: types.LOGOUT_FAILURE, error });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function* fetchUserInfo() {
|
|
73
|
+
try {
|
|
74
|
+
const result = yield call(Api.getUserData);
|
|
75
|
+
const userData = result.user;
|
|
76
|
+
// const orgId = yield select(makeSelectOrgId());
|
|
77
|
+
// yield put({type: types.GET_ORG_DETAILS_REQUEST, orgId});
|
|
78
|
+
const currentOrgDetails = result.currentOrgDetails;
|
|
79
|
+
if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.base_language && (currentOrgDetails.basic_details.base_language !== "" || currentOrgDetails.basic_details.base_language === null))) {
|
|
80
|
+
currentOrgDetails.basic_details.base_language = 'en';
|
|
81
|
+
}
|
|
82
|
+
if (!(currentOrgDetails && currentOrgDetails.basic_details && currentOrgDetails.basic_details.supported_languages && currentOrgDetails.basic_details.supported_languages.length > 0)) {
|
|
83
|
+
currentOrgDetails.basic_details.supported_languages = [
|
|
84
|
+
{
|
|
85
|
+
lang_id: 69,
|
|
86
|
+
language: "English",
|
|
87
|
+
iso_code: "en",
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
yield call(LocalStorage.saveItem, 'orgID', result.currentOrgId);
|
|
92
|
+
yield call(LocalStorage.saveItem, 'user', userData);
|
|
93
|
+
yield put({type: types.GET_USER_DATA_SUCCESS, userData, currentOrgId: result.currentOrgId, currentOrgDetails});
|
|
94
|
+
} catch (error) {
|
|
95
|
+
yield call(LocalStorage.clearItem, 'user');
|
|
96
|
+
yield put({
|
|
97
|
+
type: types.GET_USER_DATA_FAILURE,
|
|
98
|
+
error,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function* fetchSchemaForEntity(queryParams) {
|
|
104
|
+
try {
|
|
105
|
+
console.log('saga fetch Schema For Entity', queryParams);
|
|
106
|
+
const result = yield call(Api.fetchSchemaForEntity, queryParams);
|
|
107
|
+
console.log('cap saga', result);
|
|
108
|
+
// const sidebar = result.response.sidebar;
|
|
109
|
+
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', entityType: queryParams.queryParams.type });
|
|
110
|
+
} catch (error) {
|
|
111
|
+
yield put({ type: types.GET_SCHEMA_FOR_ENTITY_FAILURE, error });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
function* watchFetchSchemaForEntity() {
|
|
117
|
+
console.log('inside watch get schema');
|
|
118
|
+
const watcher = yield takeLatest(types.GET_SCHEMA_FOR_ENTITY_REQUEST, fetchSchemaForEntity);
|
|
119
|
+
yield take(LOCATION_CHANGE);
|
|
120
|
+
yield cancel(watcher);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function* watchForOrgChange() {
|
|
125
|
+
yield takeLatest(types.SWITCH_ORG_REQUEST, switchOrg);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function* watchForLogoutFlow() {
|
|
129
|
+
yield takeLatest(types.LOGOUT_REQUEST, logoutFlow);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function* watchForFetchUserInfo() {
|
|
133
|
+
yield takeLatest(types.GET_USER_DATA_REQUEST, fetchUserInfo);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
export default [
|
|
138
|
+
loginFlow,
|
|
139
|
+
watchForOrgChange,
|
|
140
|
+
watchForLogoutFlow,
|
|
141
|
+
watchForFetchUserInfo,
|
|
142
|
+
watchFetchSchemaForEntity,
|
|
143
|
+
];
|