@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
|
@@ -10,33 +10,142 @@ import React from 'react';
|
|
|
10
10
|
import { connect } from 'react-redux';
|
|
11
11
|
import { bindActionCreators } from 'redux';
|
|
12
12
|
import { Row, Col, Spin, Breadcrumb, notification } from 'antd';
|
|
13
|
-
import
|
|
13
|
+
import _ from 'lodash';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import { injectIntl, intlShape
|
|
16
|
-
import
|
|
17
|
-
import { CapSlideBox, CapHeader, CapTable, CapLink, CapRow, CapColumn, CapIcons} from '@capillarytech/cap-ui-library';
|
|
18
|
-
import { makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta } from './selectors';
|
|
15
|
+
import { injectIntl, intlShape } from 'react-intl';
|
|
16
|
+
import { makeSelectCreate, makeSelectCreateResponse } from './selectors';
|
|
19
17
|
import { makeSelectMetaEntities, setInjectedTags } from '../../Cap/selectors';
|
|
20
18
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
21
19
|
import FormBuilder from '../../../components/FormBuilder';
|
|
22
20
|
import './_mobilePushCreate.scss';
|
|
23
21
|
import * as actions from './actions';
|
|
24
|
-
|
|
25
22
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
26
23
|
import { makeSelectTemplates } from '../../Templates/selectors';
|
|
27
24
|
import messages from './messages';
|
|
28
|
-
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
29
|
-
import getEventsMap from '../eventsMap';
|
|
30
25
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
31
|
-
|
|
32
|
-
const PrefixWrapper = styled.div`
|
|
33
|
-
margin-right: 16px;
|
|
34
|
-
`;
|
|
35
26
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
27
|
constructor(props) {
|
|
37
28
|
super(props);
|
|
38
|
-
const eventsMap = getEventsMap(this);
|
|
39
29
|
if (this.props.Templates.selectedWeChatAccount) {
|
|
30
|
+
const map = {
|
|
31
|
+
"template-name": {
|
|
32
|
+
onChange: this.onTemplateNameChange,
|
|
33
|
+
},
|
|
34
|
+
"cta-deeplink-secondary-cta-0": {
|
|
35
|
+
onChange: this.onLinkTypeChange,
|
|
36
|
+
},
|
|
37
|
+
"cta-deeplink-secondary-cta-1": {
|
|
38
|
+
onChange: this.onLinkTypeChange,
|
|
39
|
+
},
|
|
40
|
+
"cta-deeplink-secondary-cta-12": {
|
|
41
|
+
onChange: this.onLinkTypeChange,
|
|
42
|
+
},
|
|
43
|
+
"cta-deeplink-delete": {
|
|
44
|
+
onDelete: this.deletePrimaryCTA,
|
|
45
|
+
},
|
|
46
|
+
"cta-deeplink2-delete": {
|
|
47
|
+
onDelete: this.deletePrimaryCTA,
|
|
48
|
+
},
|
|
49
|
+
"secondary-cta-0-delete": {
|
|
50
|
+
onDelete: this.deleteSecondaryCTA,
|
|
51
|
+
},
|
|
52
|
+
"secondary-cta-1-delete": {
|
|
53
|
+
onDelete: this.deleteSecondaryCTA,
|
|
54
|
+
},
|
|
55
|
+
"secondary-cta-1-delete-ios": {
|
|
56
|
+
onDelete: this.deleteSecondaryCtaIos,
|
|
57
|
+
},
|
|
58
|
+
"discard-button": {
|
|
59
|
+
discardValues: this.discardValues,
|
|
60
|
+
},
|
|
61
|
+
"cancel-button": {
|
|
62
|
+
cancelTemplate: this.cancelTemplate,
|
|
63
|
+
},
|
|
64
|
+
"copy-android-content": {
|
|
65
|
+
onClick: this.copyAndroidContent,
|
|
66
|
+
},
|
|
67
|
+
"copy-iphone-content": {
|
|
68
|
+
onClick: this.copyIphoneContent,
|
|
69
|
+
},
|
|
70
|
+
"save-button": {
|
|
71
|
+
saveFormData: this.saveFormData,
|
|
72
|
+
},
|
|
73
|
+
"message-editor": {
|
|
74
|
+
onChange: this.onTemplateContentChange,
|
|
75
|
+
},
|
|
76
|
+
"message-editor2": {
|
|
77
|
+
onChange: this.onTemplateContentChange,
|
|
78
|
+
},
|
|
79
|
+
"message-tagList": {
|
|
80
|
+
onTagSelect: this.onTagSelect,
|
|
81
|
+
},
|
|
82
|
+
"message-tagList2": {
|
|
83
|
+
onTagSelect: this.onTagSelect,
|
|
84
|
+
},
|
|
85
|
+
"title-tagList": {
|
|
86
|
+
onTagSelect: this.onTagSelect,
|
|
87
|
+
},
|
|
88
|
+
"title-tagList2": {
|
|
89
|
+
onTagSelect: this.onTagSelect,
|
|
90
|
+
},
|
|
91
|
+
"pane": {
|
|
92
|
+
onTabChange: this.onTabChange,
|
|
93
|
+
},
|
|
94
|
+
"cta-deeplink": {
|
|
95
|
+
onChange: this.onLinkTypeChange,
|
|
96
|
+
},
|
|
97
|
+
"cta-deeplink2": {
|
|
98
|
+
onChange: this.onLinkTypeChange,
|
|
99
|
+
},
|
|
100
|
+
"cta-deeplink-secondary-cta-1-select": {
|
|
101
|
+
onSelect: this.showCtaKeys,
|
|
102
|
+
},
|
|
103
|
+
"cta-deeplink-secondary-cta-0-select": {
|
|
104
|
+
onSelect: this.showCtaKeys,
|
|
105
|
+
},
|
|
106
|
+
"cta-deeplink-secondary-cta-1-select2": {
|
|
107
|
+
onSelect: this.showCtaKeys,
|
|
108
|
+
},
|
|
109
|
+
"cta-deeplink-select": {
|
|
110
|
+
onSelect: this.showCtaKeys,
|
|
111
|
+
},
|
|
112
|
+
"cta-deeplink2-select": {
|
|
113
|
+
onSelect: this.showCtaKeys,
|
|
114
|
+
},
|
|
115
|
+
"add-pri-cta": {
|
|
116
|
+
addPrimaryCta: this.addPrimaryCta,
|
|
117
|
+
},
|
|
118
|
+
"add-pri-cta-ios": {
|
|
119
|
+
addPrimaryCta: this.addPrimaryCta,
|
|
120
|
+
},
|
|
121
|
+
"add-sec-cta": {
|
|
122
|
+
addSecondaryCta: this.addSecondoryCta,
|
|
123
|
+
},
|
|
124
|
+
"add-sec-cta-ios": {
|
|
125
|
+
addSecondaryCtaIos: this.addSecondoryCtaIos,
|
|
126
|
+
},
|
|
127
|
+
"image-upload-android": {
|
|
128
|
+
onUpload: this.uploadImage,
|
|
129
|
+
},
|
|
130
|
+
"image-upload-ios": {
|
|
131
|
+
onUpload: this.uploadImage,
|
|
132
|
+
},
|
|
133
|
+
"secondary-cta-1-table": {
|
|
134
|
+
onRowClick: this.selectCtaIos,
|
|
135
|
+
},
|
|
136
|
+
"cta-deeplink-select-show-keys": {
|
|
137
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
138
|
+
},
|
|
139
|
+
"cta-deeplink-secondary-cta-0-select-show-keys": {
|
|
140
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
141
|
+
},
|
|
142
|
+
"cta-deeplink-secondary-cta-1-select-show-keys": {
|
|
143
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
144
|
+
},
|
|
145
|
+
"wechat-template": {
|
|
146
|
+
onSelect: this.onTemplateChange,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
40
149
|
this.state = {
|
|
41
150
|
formData: {},
|
|
42
151
|
tabCount: 1,
|
|
@@ -46,7 +155,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
46
155
|
tabKey: '',
|
|
47
156
|
checkValidation: false,
|
|
48
157
|
schema: {},
|
|
49
|
-
eventsMap,
|
|
158
|
+
eventsMap: map,
|
|
50
159
|
errorData: {},
|
|
51
160
|
displayProps: {},
|
|
52
161
|
modalContent: {title: "Alert", body: "template not configured,", type: 'confirm'},
|
|
@@ -73,26 +182,35 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
73
182
|
};
|
|
74
183
|
|
|
75
184
|
componentDidMount = () => {
|
|
185
|
+
console.log('added listener create,', this.props);
|
|
76
186
|
const query = {
|
|
77
187
|
layout: 'MOBILEPUSH',
|
|
78
188
|
type: 'LAYOUT',
|
|
79
|
-
version: "v2",
|
|
80
189
|
};
|
|
81
190
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
82
191
|
window.addEventListener("message", this.handleFrameTasks);
|
|
192
|
+
const type = this.props.location.query.type;
|
|
193
|
+
if (type === 'embedded') {
|
|
194
|
+
const response = {
|
|
195
|
+
action: 'startTemplateCreation',
|
|
196
|
+
};
|
|
197
|
+
parent.postMessage(JSON.stringify(response), '*');
|
|
198
|
+
}
|
|
83
199
|
};
|
|
84
200
|
|
|
85
201
|
componentWillReceiveProps = (nextProps) => {
|
|
202
|
+
console.log('recieved props ', nextProps, nextProps.Create, this.props.Create);
|
|
86
203
|
if (nextProps.isGetFormData) {
|
|
87
204
|
nextProps.getFormLibraryData(this.getFormData());
|
|
88
205
|
}
|
|
89
206
|
if (nextProps.Create.uploadedAssetData) {
|
|
90
|
-
const formData = cloneDeep(this.state.formData);
|
|
207
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
91
208
|
formData[this.state.currentTab - 1].image = nextProps.Create.uploadedAssetData.metaInfo.public_url;
|
|
92
209
|
this.setState({formData});
|
|
93
210
|
this.props.actions.clearAsset();
|
|
94
211
|
}
|
|
95
212
|
if (nextProps.createResponse && nextProps.createResponse.templateId) {
|
|
213
|
+
console.log('create response', nextProps.createResponse);
|
|
96
214
|
this.discardValues();
|
|
97
215
|
const message = getMessageObject('success', this.props.intl.formatMessage(messages["Mobile Push Template Created Successfully"]), true);
|
|
98
216
|
this.props.globalActions.addMessageToQueue(message);
|
|
@@ -107,29 +225,16 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
107
225
|
if (nextProps.params.mode) {
|
|
108
226
|
this.setState({mode: nextProps.params.mode});
|
|
109
227
|
}
|
|
110
|
-
if (nextProps.Create.createTemplateError && !isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
|
|
228
|
+
if (nextProps.Create.createTemplateError && !_.isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
|
|
111
229
|
const message = getMessageObject('error', (nextProps.Create.createTemplateErrorMessage && nextProps.Create.createTemplateErrorMessage !== '') ? nextProps.Create.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong), true);
|
|
112
230
|
this.props.globalActions.addMessageToQueue(message);
|
|
113
231
|
}
|
|
114
|
-
if (nextProps.iosCtasData) {
|
|
115
|
-
this.setState({
|
|
232
|
+
if (nextProps.Create.iosCtasData) {
|
|
233
|
+
this.setState({iosCtasData: nextProps.Create.iosCtasData});
|
|
116
234
|
}
|
|
117
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && isEmpty(this.state.schema)) {
|
|
235
|
+
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
236
|
+
console.log('final schema is**', nextProps.metaEntities.layouts[0].definition);
|
|
118
237
|
const schema = this.props.params.mode === "text" ? nextProps.metaEntities.layouts[0].definition.textSchema : nextProps.metaEntities.layouts[0].definition.imageSchema;
|
|
119
|
-
const isAndroidSupported = get(this, "props.Templates.selectedWeChatAccount.configs.android") === '1';
|
|
120
|
-
const isIosSupported = get(this, "props.Templates.selectedWeChatAccount.configs.ios") === '1';
|
|
121
|
-
if (!isAndroidSupported) {
|
|
122
|
-
const androidField = get(schema, "containers[0].panes[0]");
|
|
123
|
-
androidField.isSupported = false;
|
|
124
|
-
this.setState({currentTab: 2});
|
|
125
|
-
set(schema, "containers[0].panes[0]", androidField);
|
|
126
|
-
}
|
|
127
|
-
if (!isIosSupported) {
|
|
128
|
-
const iosField = get(schema, "containers[0].panes[1]");
|
|
129
|
-
iosField.isSupported = false;
|
|
130
|
-
|
|
131
|
-
set(schema, "containers[0].panes[1]", iosField);
|
|
132
|
-
}
|
|
133
238
|
schema.standalone.sections.splice(1, 1);
|
|
134
239
|
this.injectEvents(schema);
|
|
135
240
|
const query = {
|
|
@@ -148,25 +253,27 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
148
253
|
}
|
|
149
254
|
};
|
|
150
255
|
componentWillUnmount = () => {
|
|
151
|
-
|
|
256
|
+
console.log('removed listener create');
|
|
152
257
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
153
258
|
};
|
|
154
259
|
onTemplateChange = () => {
|
|
155
260
|
|
|
156
261
|
};
|
|
157
262
|
|
|
158
|
-
onFormDataChange = (formData, tabCount) => {
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] =
|
|
163
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] =
|
|
263
|
+
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
264
|
+
console.log('Form data changed is ', formData, tabCount, currentTab);
|
|
265
|
+
const newFormData = _.cloneDeep(formData);
|
|
266
|
+
if (newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`]) {
|
|
267
|
+
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].name;
|
|
268
|
+
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[0].buttonText;
|
|
164
269
|
delete newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`];
|
|
165
|
-
if (
|
|
166
|
-
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`] =
|
|
270
|
+
if (newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[1]) {
|
|
271
|
+
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].ctaTemplateDetails[1].buttonText;
|
|
167
272
|
}
|
|
168
273
|
}
|
|
169
|
-
|
|
274
|
+
if (this.state.isSchemaChanged) {
|
|
275
|
+
this.setState({isSchemaChanged: false});
|
|
276
|
+
}
|
|
170
277
|
// copy content code
|
|
171
278
|
// if (newFormData[0]['copy-iphone-content'] === "") {
|
|
172
279
|
//
|
|
@@ -188,16 +295,18 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
188
295
|
// newFormData[1]['copy-android-content'] = "";
|
|
189
296
|
// }
|
|
190
297
|
// }
|
|
191
|
-
this.setState({formData: newFormData, tabCount
|
|
298
|
+
this.setState({formData: newFormData, tabCount});
|
|
192
299
|
};
|
|
193
300
|
|
|
194
301
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
302
|
+
console.log('parent data tag', data, currentTab);
|
|
195
303
|
const editorId = srcComp.target;
|
|
196
304
|
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`);
|
|
197
305
|
document.getElementById(editorId).focus();
|
|
198
306
|
};
|
|
199
307
|
|
|
200
308
|
onTabChange = (data) => {
|
|
309
|
+
console.log('inside parent ontabchange', data, this.state);
|
|
201
310
|
this.setState({currentTab: data});
|
|
202
311
|
};
|
|
203
312
|
onTemplateNameChange = (name) => {
|
|
@@ -206,113 +315,148 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
206
315
|
|
|
207
316
|
|
|
208
317
|
onLinkTypeChange = (eventTriggered, formData, field) => {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
318
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
319
|
+
_.forEach(schema.containers, (container) => {
|
|
320
|
+
_.forEach(container.panes, (pane, paneIndex) => {
|
|
321
|
+
_.forEach(pane.sections, (section) => {
|
|
322
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
323
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
324
|
+
const formChaild = child;
|
|
325
|
+
if (child.type === 'multicols') {
|
|
326
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
327
|
+
if (inputField) {
|
|
328
|
+
_.forEach(inputField.cols, (col) => {
|
|
329
|
+
if (col.id === field.id && paneIndex === this.state.currentTab - 1) {
|
|
330
|
+
console.log(child, fieldIndex, this.state.formData);
|
|
331
|
+
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
332
|
+
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
333
|
+
const deeplinkValue = formData[this.state.currentTab - 1][field.id];
|
|
334
|
+
const componentIndex = fieldIndex + 1;
|
|
335
|
+
const inputId = deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" ? `${col.id}-select` : `${col.id}-text`;
|
|
336
|
+
if ( deeplinkValue && deeplinkValue.toLowerCase() === "deeplink" && (fieldIndex === child.inputFields.length - 1 || child.inputFields[componentIndex].id !== "cta-deeplink-select-section")) {
|
|
337
|
+
const row = {
|
|
338
|
+
rowClassName: 'mobile-push-row',
|
|
339
|
+
id: 'cta-deeplink-select-section',
|
|
340
|
+
cols: [
|
|
341
|
+
{
|
|
342
|
+
id: "cta-label",
|
|
343
|
+
metaType: "label",
|
|
344
|
+
value: "",
|
|
345
|
+
primitive: true,
|
|
346
|
+
dynamicTab: false,
|
|
347
|
+
type: "div",
|
|
348
|
+
width: 4,
|
|
349
|
+
onlyDisplay: true,
|
|
350
|
+
colStyle: {
|
|
351
|
+
flex: 1,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
id: inputId,
|
|
356
|
+
placeholder: "Select DeepLink",
|
|
357
|
+
type: "select", //Resembles component to be used
|
|
358
|
+
options: deepLinkOptions,
|
|
359
|
+
metaType: "text",
|
|
360
|
+
datatype: "string",
|
|
361
|
+
errorMessage: "Select a deeplink",
|
|
362
|
+
required: true,
|
|
363
|
+
fluid: true,
|
|
364
|
+
width: 19,
|
|
365
|
+
style: {
|
|
366
|
+
fontSize: '14px',
|
|
367
|
+
fontFamily: 'open-sans',
|
|
368
|
+
fontStyle: 'normal',
|
|
369
|
+
// fontWeight: 600,
|
|
370
|
+
marginBottom: '16px',
|
|
371
|
+
},
|
|
372
|
+
styling: "semantic",
|
|
373
|
+
order: 1,
|
|
374
|
+
customComponent: false,
|
|
375
|
+
supportedEvents: [
|
|
376
|
+
'onSelect',
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
};
|
|
381
|
+
if (!child.inputFields[fieldIndex + 1] || child.inputFields[componentIndex].id === "cta-external-link") {
|
|
382
|
+
formChaild.inputFields[componentIndex] = row;
|
|
383
|
+
} else {
|
|
384
|
+
formChaild.inputFields.splice(componentIndex, 0, row);
|
|
385
|
+
}
|
|
386
|
+
} else if ( deeplinkValue && deeplinkValue.toLowerCase() === "external link") {
|
|
387
|
+
const row = {
|
|
388
|
+
rowClassName: 'mobile-push-row',
|
|
389
|
+
id: 'cta-external-link',
|
|
390
|
+
cols: [
|
|
391
|
+
{
|
|
392
|
+
id: "cta-label",
|
|
393
|
+
metaType: "label",
|
|
394
|
+
value: "",
|
|
395
|
+
primitive: true,
|
|
396
|
+
dynamicTab: false,
|
|
397
|
+
type: "div",
|
|
398
|
+
width: 4,
|
|
399
|
+
offset: 0,
|
|
400
|
+
onlyDisplay: true,
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: inputId,
|
|
404
|
+
placeholder: "External Link",
|
|
405
|
+
type: "input", //Resembles component to be used
|
|
406
|
+
metaType: "text",
|
|
407
|
+
datatype: "string",
|
|
408
|
+
errorMessage: "External Link cannot be empty",
|
|
409
|
+
required: true,
|
|
410
|
+
fluid: true,
|
|
411
|
+
width: 19,
|
|
412
|
+
style: {
|
|
413
|
+
fontSize: '14px',
|
|
414
|
+
fontFamily: 'open-sans',
|
|
415
|
+
fontStyle: 'normal',
|
|
416
|
+
// fontWeight: 600,
|
|
417
|
+
marginBottom: '16px',
|
|
418
|
+
},
|
|
419
|
+
styling: "semantic",
|
|
420
|
+
order: 1,
|
|
421
|
+
offSet: 4,
|
|
422
|
+
customComponent: false,
|
|
423
|
+
standalone: false,
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
};
|
|
427
|
+
if (!child.inputFields[fieldIndex + 1] || child.inputFields[componentIndex].id === "cta-deeplink-select-section") {
|
|
428
|
+
formChaild.inputFields[componentIndex] = row;
|
|
429
|
+
if (child.inputFields[componentIndex + 1] && child.inputFields[componentIndex + 1].id === "show-cta-deeplink-keys-label") {
|
|
430
|
+
formChaild.inputFields.splice(componentIndex + 1, 1);
|
|
431
|
+
}
|
|
432
|
+
if (child.inputFields[componentIndex + 1] && child.inputFields[componentIndex + 1].id === "cta-deeplink-keys") {
|
|
433
|
+
let configkeys = _.filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][`${col.id}-select`]);
|
|
434
|
+
if (configkeys[0]) {
|
|
435
|
+
configkeys = configkeys[0].keys;
|
|
436
|
+
}
|
|
437
|
+
if (configkeys.length) {
|
|
438
|
+
formChaild.inputFields = formChaild.inputFields.slice(0, componentIndex + 1).concat(formChaild.inputFields.slice( componentIndex + 1 + configkeys.length, formChaild.inputFields.length));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
} else {
|
|
442
|
+
formChaild.inputFields.splice(componentIndex, 0, row);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
});
|
|
300
447
|
}
|
|
301
|
-
}
|
|
302
|
-
} else {
|
|
303
|
-
inputFields.splice(componentIndex, 0, row);
|
|
448
|
+
});
|
|
304
449
|
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
450
|
+
});
|
|
451
|
+
});
|
|
307
452
|
});
|
|
308
|
-
}
|
|
453
|
+
});
|
|
309
454
|
});
|
|
310
|
-
schema = set(schema, `containers[0].panes[${this.state.currentTab - 1}].sections[0].childSections[0].childSections[0].inputFields`, inputFields);
|
|
311
455
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
312
456
|
this.injectEvents(schema);
|
|
313
457
|
};
|
|
314
|
-
onTemplateContentChange = () => {
|
|
315
|
-
|
|
458
|
+
onTemplateContentChange = (content) => {
|
|
459
|
+
console.log('Template content changed to ', content);
|
|
316
460
|
};
|
|
317
461
|
onModalCancel = () => {
|
|
318
462
|
if (this.state.modalContent && this.state.modalContent.show) {
|
|
@@ -322,7 +466,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
322
466
|
getLinkName = (link) => {
|
|
323
467
|
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
324
468
|
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
325
|
-
const deepLinkOptions = filter(JSON.parse(deeplinks), (l) => l.link === link);
|
|
469
|
+
const deepLinkOptions = _.filter(JSON.parse(deeplinks), (l) => l.link === link);
|
|
326
470
|
if (deepLinkOptions[0]) {
|
|
327
471
|
return deepLinkOptions[0].name;
|
|
328
472
|
}
|
|
@@ -330,8 +474,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
330
474
|
};
|
|
331
475
|
|
|
332
476
|
getMappedEvent = (id, event) => {
|
|
333
|
-
const
|
|
334
|
-
|
|
477
|
+
const map = this.state.eventsMap;
|
|
478
|
+
if (!map[id] || !map[id][event]) {
|
|
479
|
+
console.log(`error map[id] ${map[id]}` );
|
|
480
|
+
}
|
|
481
|
+
return map[id][event];
|
|
335
482
|
};
|
|
336
483
|
getCurrentWindow = (e) => {
|
|
337
484
|
const response = {
|
|
@@ -342,12 +489,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
342
489
|
parent.postMessage(JSON.stringify(response), '*');
|
|
343
490
|
};
|
|
344
491
|
getFormData = (e) => {
|
|
345
|
-
|
|
492
|
+
console.log('posting final result', this.state.formData);
|
|
346
493
|
const response = {
|
|
347
494
|
action: "getFormData",
|
|
348
|
-
value:
|
|
495
|
+
value: this.getTransformedData(this.state.formData),
|
|
349
496
|
validity: this.state.isFormValid,
|
|
350
|
-
type: templateData.type,
|
|
351
497
|
};
|
|
352
498
|
this.setState({checkValidation: true});
|
|
353
499
|
if (e) {
|
|
@@ -383,7 +529,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
383
529
|
});
|
|
384
530
|
obj.versions.base = {};
|
|
385
531
|
delete android.base;
|
|
386
|
-
if (!isEmpty(android)) {
|
|
532
|
+
if (!_.isEmpty(android)) {
|
|
387
533
|
obj.versions.base.ANDROID = {
|
|
388
534
|
luid: "{{luid}}",
|
|
389
535
|
cuid: "{{cuid}}",
|
|
@@ -394,14 +540,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
394
540
|
style: "BIG_TEXT",
|
|
395
541
|
message: android['message-editor'],
|
|
396
542
|
},
|
|
397
|
-
custom: map(android, (field, key) => {
|
|
543
|
+
custom: _.map(android, (field, key) => {
|
|
398
544
|
if (key.indexOf('custom-value') > -1) {
|
|
399
545
|
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select', ''), value: field} : undefined;
|
|
400
546
|
}
|
|
401
547
|
return undefined;
|
|
402
548
|
}).filter((custom) => custom),
|
|
403
549
|
};
|
|
404
|
-
obj.name = isEmpty(obj.name) ? android['message-title'] : obj.name;
|
|
405
550
|
}
|
|
406
551
|
if (android['cta-deeplink'] && android['cta-deeplink'] !== "") {
|
|
407
552
|
obj.versions.base.ANDROID.cta = {
|
|
@@ -413,7 +558,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
413
558
|
delete obj.versions.base.ANDROID.cta.deepLinkName;
|
|
414
559
|
}
|
|
415
560
|
}
|
|
416
|
-
if (!isEmpty(ios)) {
|
|
561
|
+
if (!_.isEmpty(ios)) {
|
|
417
562
|
obj.versions.base.IOS = {
|
|
418
563
|
luid: "{{luid}}",
|
|
419
564
|
cuid: "{{cuid}}",
|
|
@@ -427,14 +572,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
427
572
|
],
|
|
428
573
|
categoryId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].id : undefined,
|
|
429
574
|
},
|
|
430
|
-
custom: map(ios, (field, key) => {
|
|
575
|
+
custom: _.map(ios, (field, key) => {
|
|
431
576
|
if (key.indexOf('custom-value') > -1) {
|
|
432
577
|
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink2-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select2', ''), value: field} : undefined;
|
|
433
578
|
}
|
|
434
579
|
return undefined;
|
|
435
580
|
}).filter((custom) => custom),
|
|
436
581
|
};
|
|
437
|
-
obj.name = isEmpty(obj.name) ? ios['message-title2'] : obj.name;
|
|
438
582
|
}
|
|
439
583
|
if (ios['cta-deeplink2'] && ios['cta-deeplink2'] !== "") {
|
|
440
584
|
obj.versions.base.IOS.cta = {
|
|
@@ -448,7 +592,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
448
592
|
}
|
|
449
593
|
if (obj.versions.base.ANDROID) {
|
|
450
594
|
if (obj.versions.base.ANDROID.cta && obj.versions.base.ANDROID.cta.type === "DEEP_LINK") {
|
|
451
|
-
const params = map(android, (field, key) => {
|
|
595
|
+
const params = _.map(android, (field, key) => {
|
|
452
596
|
let actionLink;
|
|
453
597
|
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-select') > -1) {
|
|
454
598
|
const param = key.replace('custom-value-', "").replace('-cta-deeplink-select', '');
|
|
@@ -481,7 +625,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
481
625
|
}
|
|
482
626
|
obj.versions.base.ANDROID.expandableDetails.ctas.push(cta);
|
|
483
627
|
if (obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
484
|
-
const params = map(android, (field, key) => {
|
|
628
|
+
const params = _.map(android, (field, key) => {
|
|
485
629
|
let actionLink;
|
|
486
630
|
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-0-select') > -1) {
|
|
487
631
|
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-0-select', '');
|
|
@@ -506,7 +650,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
506
650
|
}
|
|
507
651
|
obj.versions.base.ANDROID.expandableDetails.ctas.push(cta);
|
|
508
652
|
if (obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
509
|
-
const params = map(android, (field, key) => {
|
|
653
|
+
const params = _.map(android, (field, key) => {
|
|
510
654
|
let actionLink;
|
|
511
655
|
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-1-select') > -1) {
|
|
512
656
|
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-1-select', '');
|
|
@@ -523,7 +667,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
523
667
|
}
|
|
524
668
|
if (obj.versions.base.IOS) {
|
|
525
669
|
if (obj.versions.base.IOS.cta && obj.versions.base.IOS.cta.type === "DEEP_LINK") {
|
|
526
|
-
const params = map(ios, (field, key) => {
|
|
670
|
+
const params = _.map(ios, (field, key) => {
|
|
527
671
|
let actionLink;
|
|
528
672
|
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink2-select') > -1) {
|
|
529
673
|
const param = key.replace('custom-value-', "").replace('-cta-deeplink2-select', '');
|
|
@@ -543,7 +687,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
543
687
|
}
|
|
544
688
|
if (secondaryCtaIos) {
|
|
545
689
|
obj.versions.base.IOS.expandableDetails.ctas = [];
|
|
546
|
-
const templateCtaId = get(this.state, "templateCta.ctaTemplateDetails[0].id");
|
|
547
690
|
const cta = {
|
|
548
691
|
actionText: ios['secondary-cta-1-label'],
|
|
549
692
|
actionLabel: ios['secondary-cta-1-action'],
|
|
@@ -551,14 +694,14 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
551
694
|
type: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
|
|
552
695
|
actionLink: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? (ios['cta-deeplink-secondary-cta-1-select2'] || ios['cta-deeplink-secondary-cta-1-select']) : ios['cta-deeplink-secondary-cta-1-text']),
|
|
553
696
|
ioscdeepLinkName: this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
|
|
554
|
-
templateCtaId,
|
|
697
|
+
templateCtaId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].ctaTemplateDetails[0].id : undefined,
|
|
555
698
|
};
|
|
556
699
|
if (this.props.location.query.type === 'embedded') {
|
|
557
700
|
delete cta.ioscdeepLinkName;
|
|
558
701
|
}
|
|
559
702
|
obj.versions.base.IOS.expandableDetails.ctas.push(cta);
|
|
560
703
|
if (obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
561
|
-
const params = map(ios, (field, key) => {
|
|
704
|
+
const params = _.map(ios, (field, key) => {
|
|
562
705
|
let actionLink;
|
|
563
706
|
if (key.indexOf('custom-value') > -1 && key.indexOf('cta-deeplink-secondary-cta-1-select') > -1) {
|
|
564
707
|
const param = key.replace('custom-value-', "").replace('-cta-deeplink-secondary-cta-1-select2', '');
|
|
@@ -609,6 +752,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
609
752
|
};
|
|
610
753
|
|
|
611
754
|
moveToTemplates = () => {
|
|
755
|
+
console.log('in move to Templates');
|
|
612
756
|
const modalContent = {
|
|
613
757
|
title: "Alert",
|
|
614
758
|
body: this.props.intl.formatMessage(messages["Do you really want to go back? All your temporary changes will be lost!"]),
|
|
@@ -633,12 +777,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
633
777
|
if (temp.standalone) {
|
|
634
778
|
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
635
779
|
}
|
|
636
|
-
forEach(temp.containers, (container) => {
|
|
780
|
+
_.forEach(temp.containers, (container) => {
|
|
637
781
|
let tempContainer = container;
|
|
638
782
|
tempContainer = this.injectContainer(tempContainer);
|
|
639
783
|
return tempContainer;
|
|
640
784
|
});
|
|
641
|
-
|
|
785
|
+
console.log('final injected schema', schema);
|
|
642
786
|
this.setState({schema, isSchemaChanged: true}, () => {
|
|
643
787
|
this.removeStandAlone();
|
|
644
788
|
});
|
|
@@ -649,10 +793,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
649
793
|
const temp = container;
|
|
650
794
|
if (temp.type === 'tabs') {
|
|
651
795
|
temp.injectedEvents = {};
|
|
652
|
-
forEach(temp.supportedEvents, (event) => {
|
|
796
|
+
_.forEach(temp.supportedEvents, (event) => {
|
|
653
797
|
temp.injectedEvents[event] = this.getMappedEvent(temp.id, event);
|
|
654
798
|
});
|
|
655
|
-
forEach(temp.panes, (pane) => {
|
|
799
|
+
_.forEach(temp.panes, (pane) => {
|
|
656
800
|
const tempPane = pane;
|
|
657
801
|
tempPane.sectionsHeaders = this.injectSections(tempPane.sectionsHeaders);
|
|
658
802
|
tempPane.sections = this.injectSections(tempPane.sections);
|
|
@@ -662,8 +806,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
662
806
|
};
|
|
663
807
|
|
|
664
808
|
injectMultiColSection = (section) => {
|
|
665
|
-
forEach(section.inputFields, (inputField) => {
|
|
666
|
-
forEach(inputField.cols, (col) => {
|
|
809
|
+
_.forEach(section.inputFields, (inputField) => {
|
|
810
|
+
_.forEach(inputField.cols, (col) => {
|
|
667
811
|
const temp = col;
|
|
668
812
|
if (temp.type === 'popover') {
|
|
669
813
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
@@ -681,14 +825,15 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
681
825
|
}
|
|
682
826
|
temp.injectedEvents = {};
|
|
683
827
|
|
|
684
|
-
forEach(col.supportedEvents, (event) => {
|
|
828
|
+
_.forEach(col.supportedEvents, (event) => {
|
|
829
|
+
console.log('injected event for ', col, event);
|
|
685
830
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
686
831
|
});
|
|
687
832
|
return true;
|
|
688
833
|
});
|
|
689
834
|
});
|
|
690
|
-
forEach(section.actionFields, (actionField) => {
|
|
691
|
-
forEach(actionField.cols, (col) => {
|
|
835
|
+
_.forEach(section.actionFields, (actionField) => {
|
|
836
|
+
_.forEach(actionField.cols, (col) => {
|
|
692
837
|
const temp = col;
|
|
693
838
|
if (temp.type === 'popover') {
|
|
694
839
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
@@ -696,7 +841,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
696
841
|
return true;
|
|
697
842
|
}
|
|
698
843
|
temp.injectedEvents = {};
|
|
699
|
-
forEach(col.supportedEvents, (event) => {
|
|
844
|
+
_.forEach(col.supportedEvents, (event) => {
|
|
700
845
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
701
846
|
});
|
|
702
847
|
return true;
|
|
@@ -706,7 +851,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
706
851
|
};
|
|
707
852
|
|
|
708
853
|
injectColLabelSection = (section) => {
|
|
709
|
-
forEach(section.inputFields, (inputField) => {
|
|
854
|
+
_.forEach(section.inputFields, (inputField) => {
|
|
710
855
|
const temp = inputField;
|
|
711
856
|
if (temp.type === 'popover') {
|
|
712
857
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
@@ -714,12 +859,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
714
859
|
return true;
|
|
715
860
|
}
|
|
716
861
|
temp.injectedEvents = {};
|
|
717
|
-
forEach(inputField.supportedEvents, (event) => {
|
|
862
|
+
_.forEach(inputField.supportedEvents, (event) => {
|
|
718
863
|
temp.injectedEvents[event] = this.getMappedEvent(inputField.id, event);
|
|
719
864
|
});
|
|
720
865
|
return true;
|
|
721
866
|
});
|
|
722
|
-
forEach(section.actionFields, (actionField) => {
|
|
867
|
+
_.forEach(section.actionFields, (actionField) => {
|
|
723
868
|
const temp = actionField;
|
|
724
869
|
if (temp.type === 'popover') {
|
|
725
870
|
temp.content.sections = this.injectSections(temp.content.sections);
|
|
@@ -727,7 +872,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
727
872
|
return true;
|
|
728
873
|
}
|
|
729
874
|
temp.injectedEvents = {};
|
|
730
|
-
forEach(actionField.supportedEvents, (event) => {
|
|
875
|
+
_.forEach(actionField.supportedEvents, (event) => {
|
|
731
876
|
temp.injectedEvents[event] = this.getMappedEvent(actionField.id, event);
|
|
732
877
|
});
|
|
733
878
|
return true;
|
|
@@ -736,7 +881,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
736
881
|
};
|
|
737
882
|
|
|
738
883
|
injectSections = (sections) => {
|
|
739
|
-
forEach(sections, (section) => {
|
|
884
|
+
_.forEach(sections, (section) => {
|
|
740
885
|
let temp = section;
|
|
741
886
|
if (temp.type === 'col-label') {
|
|
742
887
|
temp = this.injectColLabelSection(temp);
|
|
@@ -750,7 +895,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
750
895
|
};
|
|
751
896
|
|
|
752
897
|
injectParentSection = (section) => {
|
|
753
|
-
forEach(section.childSections, (childSection) => {
|
|
898
|
+
_.forEach(section.childSections, (childSection) => {
|
|
754
899
|
let temp = childSection;
|
|
755
900
|
if (temp.type === 'col-label') {
|
|
756
901
|
temp = this.injectColLabelSection(temp);
|
|
@@ -781,12 +926,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
781
926
|
myField.value += myValue;
|
|
782
927
|
}
|
|
783
928
|
const event = new Event('input', { bubbles: true });
|
|
784
|
-
|
|
929
|
+
myField.dispatchEvent(event);
|
|
785
930
|
};
|
|
786
931
|
|
|
787
932
|
startTemplateCreation = (data) => {
|
|
933
|
+
console.log('startTemplateCreation', data);
|
|
788
934
|
const content = data.content;
|
|
789
|
-
const id = uniqueId();
|
|
935
|
+
const id = _.uniqueId();
|
|
790
936
|
const tempData = {
|
|
791
937
|
'message-editor': content,
|
|
792
938
|
'base': true,
|
|
@@ -796,18 +942,24 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
796
942
|
formData[0] = tempData;
|
|
797
943
|
formData.base = tempData;
|
|
798
944
|
this.setState({formData, loading: false});
|
|
945
|
+
if (data.tags) {
|
|
946
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
947
|
+
}
|
|
799
948
|
};
|
|
800
949
|
|
|
801
950
|
startLoading = (ifEdit) => {
|
|
951
|
+
console.log('startLoading', ifEdit);
|
|
802
952
|
if (ifEdit) {
|
|
803
953
|
this.setState({loading: true});
|
|
804
954
|
}
|
|
805
955
|
};
|
|
806
956
|
|
|
807
957
|
handleFrameTasks = (e) => {
|
|
958
|
+
console.log('data listened to is', e.data);
|
|
808
959
|
const type = e.data;
|
|
809
|
-
|
|
960
|
+
console.log('data type', typeof type);
|
|
810
961
|
if (typeof type === 'object') {
|
|
962
|
+
console.log('received something', type);
|
|
811
963
|
const action = type.action;
|
|
812
964
|
switch (action) {
|
|
813
965
|
case "startTemplateCreation":
|
|
@@ -828,15 +980,15 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
828
980
|
this.getFormData(e);
|
|
829
981
|
break;
|
|
830
982
|
case "startTemplateCreation":
|
|
831
|
-
|
|
983
|
+
console.log('Starting to create template');
|
|
832
984
|
//this.getFormData(e);
|
|
833
985
|
break;
|
|
834
986
|
case "moveToTemplates":
|
|
835
|
-
|
|
987
|
+
console.log('moving to templates');
|
|
836
988
|
this.moveToTemplates();
|
|
837
989
|
break;
|
|
838
990
|
case "validateContent":
|
|
839
|
-
|
|
991
|
+
console.log('validating Content');
|
|
840
992
|
this.validateContent(e);
|
|
841
993
|
break;
|
|
842
994
|
default:
|
|
@@ -846,7 +998,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
846
998
|
};
|
|
847
999
|
|
|
848
1000
|
removeStandAlone = () => {
|
|
849
|
-
const schema = cloneDeep(this.state.schema);
|
|
1001
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
850
1002
|
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === 'loyalty') {
|
|
851
1003
|
schema.standalone.sections.splice(0, 1);
|
|
852
1004
|
} else if (this.props.location.query.type === 'embedded' && typeof this.props.location.query.module !== 'undefined') {
|
|
@@ -858,6 +1010,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
858
1010
|
};
|
|
859
1011
|
|
|
860
1012
|
validateContent = (e) => {
|
|
1013
|
+
console.log('posting final validation result', this.state.isFormValid);
|
|
861
1014
|
const response = {
|
|
862
1015
|
action: "validateContent",
|
|
863
1016
|
value: this.state.isFormValid,
|
|
@@ -890,347 +1043,643 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
890
1043
|
copyContent = () => {
|
|
891
1044
|
|
|
892
1045
|
};
|
|
893
|
-
addSecondoryCtaIos = (
|
|
894
|
-
const id =
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1046
|
+
addSecondoryCtaIos = (ev) => {
|
|
1047
|
+
const id = ev.target.id;
|
|
1048
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1049
|
+
_.forEach(schema.containers, (container) => {
|
|
1050
|
+
_.forEach(container.panes, (pane, paneIndex) => {
|
|
1051
|
+
_.forEach(pane.sections, (section) => {
|
|
1052
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1053
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
1054
|
+
if (child.type === 'multicols') {
|
|
1055
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1056
|
+
_.forEach(inputField.cols, (col) => {
|
|
1057
|
+
const colId = (paneIndex + 1) > 1 ? col.id + (paneIndex + 1) : col.id;
|
|
1058
|
+
if (colId === id) {
|
|
1059
|
+
const inputId = `secondary-cta-${paneIndex}`;
|
|
1060
|
+
console.log(child.inputFields, fieldIndex);
|
|
1061
|
+
child.inputFields.splice(fieldIndex, 1, {
|
|
1062
|
+
rowClassName: 'mobile-push-row',
|
|
1063
|
+
cols: [
|
|
1064
|
+
{
|
|
1065
|
+
id: `${inputId}-label`,
|
|
1066
|
+
metaType: "label",
|
|
1067
|
+
value: "Secondary CTA",
|
|
1068
|
+
primitive: true,
|
|
1069
|
+
dynamicTab: false,
|
|
1070
|
+
type: "div",
|
|
1071
|
+
width: 4,
|
|
1072
|
+
style: {
|
|
1073
|
+
backgroundColor: 'white',
|
|
1074
|
+
textAlign: 'left',
|
|
1075
|
+
color: '#333333',
|
|
1076
|
+
lineHeight: '24px',
|
|
1077
|
+
fontSize: '14px',
|
|
1078
|
+
fontFamily: 'open-sans',
|
|
1079
|
+
fontStyle: 'normal',
|
|
1080
|
+
paddingTop: '8px',
|
|
1081
|
+
},
|
|
1082
|
+
offset: 0,
|
|
1083
|
+
onlyDisplay: true,
|
|
1084
|
+
colStyle: {
|
|
1085
|
+
flex: 1,
|
|
1086
|
+
},
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
id: `${inputId}-table`,
|
|
1090
|
+
type: "table", //Resembles component to be used
|
|
1091
|
+
metaType: "text",
|
|
1092
|
+
datatype: "string",
|
|
1093
|
+
pagination: false,
|
|
1094
|
+
columns: [
|
|
1095
|
+
{
|
|
1096
|
+
title: "Name and Description",
|
|
1097
|
+
dataIndex: "name",
|
|
1098
|
+
key: "name",
|
|
1099
|
+
width: 200,
|
|
1100
|
+
render: (text, record) => (
|
|
1101
|
+
<div>
|
|
1102
|
+
<div>{record.name}</div>
|
|
1103
|
+
<div>{record.description}</div>
|
|
1104
|
+
</div>),
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
title: "Button 1",
|
|
1108
|
+
dataIndex: "description",
|
|
1109
|
+
key: "button1",
|
|
1110
|
+
width: 100,
|
|
1111
|
+
render: (text, record) => (
|
|
1112
|
+
<div>
|
|
1113
|
+
{record.ctaTemplateDetails[0] && record.ctaTemplateDetails[0].buttonText}
|
|
1114
|
+
</div>),
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
title: "Button 2",
|
|
1118
|
+
dataIndex: "description",
|
|
1119
|
+
key: "button2",
|
|
1120
|
+
width: 100,
|
|
1121
|
+
render: (text, record) => (
|
|
1122
|
+
<div>
|
|
1123
|
+
{record.ctaTemplateDetails[1] ? record.ctaTemplateDetails[1].buttonText : ''}
|
|
1124
|
+
</div>
|
|
1125
|
+
),
|
|
1126
|
+
},
|
|
1127
|
+
],
|
|
1128
|
+
required: true,
|
|
1129
|
+
width: 16,
|
|
1130
|
+
fluid: true,
|
|
1131
|
+
styling: "semantic",
|
|
1132
|
+
order: 1,
|
|
1133
|
+
customComponent: false,
|
|
1134
|
+
supportedEvents: ["onRowClick"],
|
|
1135
|
+
},
|
|
1136
|
+
],
|
|
1137
|
+
});
|
|
1138
|
+
|
|
1139
|
+
const colField = col;
|
|
1140
|
+
colField.value = "Add Another CTA";
|
|
1141
|
+
colField.fieldsCount += 1;
|
|
1142
|
+
if (col.fieldsCount === col.fieldsLimit) {
|
|
1143
|
+
child.inputFields.pop();
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
915
1151
|
});
|
|
916
1152
|
});
|
|
917
|
-
}
|
|
1153
|
+
});
|
|
1154
|
+
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1155
|
+
this.injectEvents(schema);
|
|
1156
|
+
this.props.actions.getIosCtas(this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier);//TODO: need to get license code of accoutn and send as arg
|
|
918
1157
|
};
|
|
919
1158
|
showSelectedIosCta = (selectedConfig) => {
|
|
920
1159
|
const currentTab = this.state.currentTab;
|
|
921
|
-
const schema = cloneDeep(this.state.schema);
|
|
1160
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
922
1161
|
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
923
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1162
|
+
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1163
|
+
_.forEach(schema.containers, (container) => {
|
|
1164
|
+
_.forEach(container.panes, (pane, paneIndex) => {
|
|
1165
|
+
_.forEach(pane.sections, (section) => {
|
|
1166
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1167
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
1168
|
+
const formChaild = child;
|
|
1169
|
+
if (child.type === 'multicols') {
|
|
1170
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1171
|
+
_.forEach(inputField.cols, (col) => {
|
|
1172
|
+
if (col.id.indexOf(`secondary-cta-${currentTab - 1}-table`) > -1) {
|
|
1173
|
+
console.log(child, fieldIndex, this.state.formData);
|
|
1174
|
+
const inputId = `secondary-cta-${paneIndex}`;
|
|
1175
|
+
|
|
1176
|
+
formChaild.inputFields[fieldIndex] = {
|
|
1177
|
+
rowClassName: 'mobile-push-row',
|
|
1178
|
+
cols: [
|
|
1179
|
+
{
|
|
1180
|
+
id: `${inputId}-action-label`,
|
|
1181
|
+
metaType: "label",
|
|
1182
|
+
value: "Secondary CTA",
|
|
1183
|
+
primitive: true,
|
|
1184
|
+
dynamicTab: false,
|
|
1185
|
+
type: "div",
|
|
1186
|
+
width: 4,
|
|
1187
|
+
style: {
|
|
1188
|
+
backgroundColor: 'white',
|
|
1189
|
+
textAlign: 'left',
|
|
1190
|
+
color: '#333333',
|
|
1191
|
+
lineHeight: '24px',
|
|
1192
|
+
fontSize: '14px',
|
|
1193
|
+
fontFamily: 'open-sans',
|
|
1194
|
+
fontStyle: 'normal',
|
|
1195
|
+
paddingTop: '8px',
|
|
1196
|
+
},
|
|
1197
|
+
offset: 0,
|
|
1198
|
+
onlyDisplay: true,
|
|
1199
|
+
colStyle: {
|
|
1200
|
+
flex: 1,
|
|
1201
|
+
},
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
id: `${inputId}-label`,
|
|
1205
|
+
metaType: "label",
|
|
1206
|
+
value: "",
|
|
1207
|
+
primitive: true,
|
|
1208
|
+
dynamicTab: false,
|
|
1209
|
+
type: "div",
|
|
1210
|
+
width: 16,
|
|
1211
|
+
style: {
|
|
1212
|
+
backgroundColor: 'white',
|
|
1213
|
+
textAlign: 'left',
|
|
1214
|
+
color: '#333333',
|
|
1215
|
+
lineHeight: '24px',
|
|
1216
|
+
fontSize: '14px',
|
|
1217
|
+
fontFamily: 'open-sans',
|
|
1218
|
+
fontStyle: 'normal',
|
|
1219
|
+
paddingTop: '8px',
|
|
1220
|
+
},
|
|
1221
|
+
offset: 0,
|
|
1222
|
+
colStyle: {
|
|
1223
|
+
flex: 1,
|
|
1224
|
+
},
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
id: `${inputId}-delete-ios`,
|
|
1228
|
+
type: "icon",
|
|
1229
|
+
value: 'delete',
|
|
1230
|
+
width: 4,
|
|
1231
|
+
submitAction: "onDelete",
|
|
1232
|
+
supportedEvents: ["onDelete"],
|
|
1233
|
+
},
|
|
1234
|
+
],
|
|
1235
|
+
};
|
|
1236
|
+
formChaild.inputFields[fieldIndex + 1] = {
|
|
1237
|
+
rowClassName: 'mobile-push-row',
|
|
1238
|
+
cols: [
|
|
1239
|
+
{
|
|
1240
|
+
id: `${inputId}-action-label-empty`,
|
|
1241
|
+
metaType: "label",
|
|
1242
|
+
value: "",
|
|
1243
|
+
primitive: true,
|
|
1244
|
+
dynamicTab: false,
|
|
1245
|
+
type: "div",
|
|
1246
|
+
width: 4,
|
|
1247
|
+
onlyDisplay: true,
|
|
1248
|
+
colStyle: {
|
|
1249
|
+
flex: 1,
|
|
1250
|
+
},
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
id: `${inputId}-action`,
|
|
1254
|
+
metaType: "label",
|
|
1255
|
+
value: "",
|
|
1256
|
+
primitive: true,
|
|
1257
|
+
dynamicTab: false,
|
|
1258
|
+
type: "div",
|
|
1259
|
+
width: 8,
|
|
1260
|
+
offset: 0,
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
id: `${inputId}-action2`,
|
|
1264
|
+
metaType: "label",
|
|
1265
|
+
value: "",
|
|
1266
|
+
primitive: true,
|
|
1267
|
+
dynamicTab: false,
|
|
1268
|
+
type: "div",
|
|
1269
|
+
width: 8,
|
|
1270
|
+
offset: 0,
|
|
1271
|
+
style: {display: 'none'},
|
|
1272
|
+
},
|
|
1273
|
+
],
|
|
1274
|
+
};
|
|
1275
|
+
if (selectedConfig && (selectedConfig.id !== "16589g0g" && selectedConfig.id !== "17543720" && selectedConfig.id !== "1a491g56")) {
|
|
1276
|
+
formChaild.inputFields[fieldIndex + 2] = {
|
|
1277
|
+
rowClassName: "mobile-push-row",
|
|
1278
|
+
cols: [
|
|
1279
|
+
{
|
|
1280
|
+
id: `${inputId}-action-label-empty`,
|
|
1281
|
+
metaType: "label",
|
|
1282
|
+
value: "",
|
|
1283
|
+
primitive: true,
|
|
1284
|
+
dynamicTab: false,
|
|
1285
|
+
type: "div",
|
|
1286
|
+
width: 4,
|
|
1287
|
+
offset: 0,
|
|
1288
|
+
onlyDisplay: true,
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
id: `cta-deeplink-${inputId}`,
|
|
1292
|
+
type: "radioGroup", //Resembles component to be used
|
|
1293
|
+
metaType: "text",
|
|
1294
|
+
datatype: "string",
|
|
1295
|
+
options: ["Deeplink", "External Link"],
|
|
1296
|
+
value: "Deeplink",
|
|
1297
|
+
required: true,
|
|
1298
|
+
width: 16,
|
|
1299
|
+
offSet: 4,
|
|
1300
|
+
errorMessage: "Please select link type",
|
|
1301
|
+
fluid: true,
|
|
1302
|
+
style: {
|
|
1303
|
+
fontFamily: 'open-sans',
|
|
1304
|
+
fontSize: '14px',
|
|
1305
|
+
lineHeight: '24px',
|
|
1306
|
+
},
|
|
1307
|
+
styling: "semantic",
|
|
1308
|
+
order: 1,
|
|
1309
|
+
supportedEvents: ["onChange"],
|
|
1310
|
+
customComponent: false,
|
|
1311
|
+
},
|
|
1312
|
+
],
|
|
1313
|
+
};
|
|
1314
|
+
formChaild.inputFields[fieldIndex + 3] = {
|
|
1315
|
+
rowClassName: 'mobile-push-row',
|
|
1316
|
+
id: 'cta-deeplink-select-section',
|
|
1317
|
+
cols: [
|
|
1318
|
+
{
|
|
1319
|
+
id: "cta-label",
|
|
1320
|
+
metaType: "label",
|
|
1321
|
+
value: "",
|
|
1322
|
+
primitive: true,
|
|
1323
|
+
dynamicTab: false,
|
|
1324
|
+
type: "div",
|
|
1325
|
+
width: 4,
|
|
1326
|
+
onlyDisplay: true,
|
|
1327
|
+
colStyle: {
|
|
1328
|
+
flex: 1,
|
|
1329
|
+
},
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
id: `cta-deeplink-${inputId}-select2`,
|
|
1333
|
+
placeholder: "Select DeepLink",
|
|
1334
|
+
type: "select", //Resembles component to be used
|
|
1335
|
+
options: deepLinkOptions,
|
|
1336
|
+
metaType: "text",
|
|
1337
|
+
datatype: "string",
|
|
1338
|
+
errorMessage: "Select a deeplink",
|
|
1339
|
+
required: true,
|
|
1340
|
+
fluid: true,
|
|
1341
|
+
width: 19,
|
|
1342
|
+
style: {
|
|
1343
|
+
fontSize: '14px',
|
|
1344
|
+
fontFamily: 'open-sans',
|
|
1345
|
+
fontStyle: 'normal',
|
|
1346
|
+
// fontWeight: 600,
|
|
1347
|
+
marginBottom: '16px',
|
|
1348
|
+
},
|
|
1349
|
+
styling: "semantic",
|
|
1350
|
+
order: 1,
|
|
1351
|
+
customComponent: false,
|
|
1352
|
+
supportedEvents: [
|
|
1353
|
+
'onSelect',
|
|
1354
|
+
],
|
|
1355
|
+
},
|
|
1356
|
+
],
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1035
1363
|
});
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1038
1366
|
});
|
|
1039
1367
|
});
|
|
1040
|
-
// set(schema, `containers[0].panes[${this.state.currentTab - 1}].sections[0].childSections[0].childSections[0].inputFields`, inputFields);
|
|
1041
|
-
|
|
1042
1368
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1043
1369
|
this.injectEvents(schema);
|
|
1044
1370
|
};
|
|
1045
|
-
addPrimaryCta = (
|
|
1046
|
-
const id =
|
|
1047
|
-
const schema = cloneDeep(this.state.schema);
|
|
1371
|
+
addPrimaryCta = (ev) => {
|
|
1372
|
+
const id = ev.target.id;
|
|
1373
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1048
1374
|
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1049
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1050
|
-
// const eventsMap = cloneDeep(this.state.eventsMap);
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1375
|
+
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1376
|
+
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1377
|
+
_.forEach(schema.containers, (container) => {
|
|
1378
|
+
_.forEach(container.panes, (pane) => {
|
|
1379
|
+
_.forEach(pane.sections, (section) => {
|
|
1380
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1381
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
1382
|
+
if (child.type === 'multicols') {
|
|
1383
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1384
|
+
_.forEach(inputField.cols, (col) => {
|
|
1385
|
+
const colId = `${col.id}${this.state.currentTab > 1 ? this.state.currentTab : ''}`;
|
|
1386
|
+
if (colId === id) {
|
|
1387
|
+
console.log(child.inputFields, fieldIndex);
|
|
1388
|
+
child.inputFields.splice(fieldIndex, 1, {
|
|
1389
|
+
rowClassName: 'mobile-push-row',
|
|
1390
|
+
cols: [
|
|
1391
|
+
{
|
|
1392
|
+
id: "cta-label",
|
|
1393
|
+
metaType: "label",
|
|
1394
|
+
value: "Primary CTA",
|
|
1395
|
+
primitive: true,
|
|
1396
|
+
dynamicTab: false,
|
|
1397
|
+
type: "div",
|
|
1398
|
+
width: 4,
|
|
1399
|
+
style: {
|
|
1400
|
+
backgroundColor: 'white',
|
|
1401
|
+
textAlign: 'left',
|
|
1402
|
+
color: '#333333',
|
|
1403
|
+
lineHeight: '24px',
|
|
1404
|
+
fontSize: '14px',
|
|
1405
|
+
fontFamily: 'open-sans',
|
|
1406
|
+
fontStyle: 'normal',
|
|
1407
|
+
},
|
|
1408
|
+
offset: 0,
|
|
1409
|
+
onlyDisplay: true,
|
|
1410
|
+
colStyle: {
|
|
1411
|
+
flex: 1,
|
|
1412
|
+
},
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}`,
|
|
1416
|
+
type: "radioGroup", //Resembles component to be used
|
|
1417
|
+
metaType: "text",
|
|
1418
|
+
datatype: "string",
|
|
1419
|
+
options: ["Deeplink", "External Link"],
|
|
1420
|
+
value: "Deeplink",
|
|
1421
|
+
required: true,
|
|
1422
|
+
width: 18,
|
|
1423
|
+
errorMessage: "Please select link type",
|
|
1424
|
+
fluid: true,
|
|
1425
|
+
styling: "semantic",
|
|
1426
|
+
order: 1,
|
|
1427
|
+
customComponent: false,
|
|
1428
|
+
supportedEvents: ["onChange"],
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-delete`,
|
|
1432
|
+
type: "icon",
|
|
1433
|
+
value: 'delete',
|
|
1434
|
+
width: 1,
|
|
1435
|
+
submitAction: "onDelete",
|
|
1436
|
+
supportedEvents: ["onDelete"],
|
|
1437
|
+
},
|
|
1438
|
+
],
|
|
1439
|
+
});
|
|
1440
|
+
child.inputFields.splice(fieldIndex + 1, 0, {
|
|
1441
|
+
rowClassName: 'mobile-push-row',
|
|
1442
|
+
id: 'cta-deeplink-select-section',
|
|
1443
|
+
cols: [
|
|
1444
|
+
{
|
|
1445
|
+
id: "cta-label",
|
|
1446
|
+
metaType: "label",
|
|
1447
|
+
value: "",
|
|
1448
|
+
primitive: true,
|
|
1449
|
+
dynamicTab: false,
|
|
1450
|
+
type: "div",
|
|
1451
|
+
width: 4,
|
|
1452
|
+
onlyDisplay: true,
|
|
1453
|
+
colStyle: {
|
|
1454
|
+
flex: 1,
|
|
1455
|
+
},
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
id: `cta-deeplink${this.state.currentTab > 1 ? this.state.currentTab : ''}-select`,
|
|
1459
|
+
placeholder: "Select DeepLink",
|
|
1460
|
+
type: "select", //Resembles component to be used
|
|
1461
|
+
options: deepLinkOptions,
|
|
1462
|
+
metaType: "text",
|
|
1463
|
+
datatype: "string",
|
|
1464
|
+
required: true,
|
|
1465
|
+
errorMessage: "Select a deeplink",
|
|
1466
|
+
fluid: true,
|
|
1467
|
+
width: 19,
|
|
1468
|
+
style: {
|
|
1469
|
+
fontSize: '14px',
|
|
1470
|
+
fontFamily: 'open-sans',
|
|
1471
|
+
fontStyle: 'normal',
|
|
1472
|
+
// fontWeight: 600,
|
|
1473
|
+
marginBottom: '16px',
|
|
1474
|
+
},
|
|
1475
|
+
styling: "semantic",
|
|
1476
|
+
order: 1,
|
|
1477
|
+
customComponent: false,
|
|
1478
|
+
supportedEvents: [
|
|
1479
|
+
'onSelect',
|
|
1480
|
+
],
|
|
1481
|
+
},
|
|
1482
|
+
],
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1112
1488
|
});
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
const indexOfNextField = findIndex(inputFields, {identifier});
|
|
1116
|
-
const deleteCount = indexOfNextField - fieldIndex;
|
|
1117
|
-
const newInputFields = [...inputFields.slice(0, fieldIndex + 1), ...inputFields.slice(fieldIndex + deleteCount, inputFields.length)];
|
|
1118
|
-
set(schema, `containers[0].panes[${this.state.currentTab - 1}].sections[0].childSections[0].childSections[0].inputFields`, newInputFields);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1121
1491
|
});
|
|
1122
1492
|
});
|
|
1123
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true
|
|
1493
|
+
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1494
|
+
this.injectEvents(schema);
|
|
1124
1495
|
};
|
|
1125
|
-
addSecondoryCta = (
|
|
1126
|
-
const id =
|
|
1127
|
-
const schema = cloneDeep(this.state.schema);
|
|
1496
|
+
addSecondoryCta = (ev) => {
|
|
1497
|
+
const id = ev.target.id;
|
|
1498
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1128
1499
|
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
1129
1500
|
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1130
|
-
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1131
|
-
// const eventsMap = cloneDeep(this.state.eventsMap);
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1501
|
+
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1502
|
+
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1503
|
+
_.forEach(schema.containers, (container) => {
|
|
1504
|
+
_.forEach(container.panes, (pane) => {
|
|
1505
|
+
_.forEach(pane.sections, (section) => {
|
|
1506
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1507
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
1508
|
+
if (child.type === 'multicols') {
|
|
1509
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1510
|
+
_.forEach(inputField.cols, (col) => {
|
|
1511
|
+
if (col.id === id) {
|
|
1512
|
+
if (col.fieldsCount < col.fieldsLimit) {
|
|
1513
|
+
const inputId = `secondary-cta-${col.fieldsCount}`;
|
|
1514
|
+
console.log(child.inputFields, fieldIndex);
|
|
1515
|
+
child.inputFields.splice(fieldIndex, 0, {
|
|
1516
|
+
rowClassName: 'mobile-push-row',
|
|
1517
|
+
cols: [
|
|
1518
|
+
{
|
|
1519
|
+
id: `${inputId}-space`,
|
|
1520
|
+
metaType: "label",
|
|
1521
|
+
value: "Secondary CTA",
|
|
1522
|
+
primitive: true,
|
|
1523
|
+
dynamicTab: false,
|
|
1524
|
+
type: "div",
|
|
1525
|
+
width: 4,
|
|
1526
|
+
style: {
|
|
1527
|
+
backgroundColor: 'white',
|
|
1528
|
+
textAlign: 'left',
|
|
1529
|
+
color: '#333333',
|
|
1530
|
+
lineHeight: '24px',
|
|
1531
|
+
fontSize: '14px',
|
|
1532
|
+
fontFamily: 'open-sans',
|
|
1533
|
+
fontStyle: 'normal',
|
|
1534
|
+
paddingTop: '8px',
|
|
1535
|
+
},
|
|
1536
|
+
offset: 0,
|
|
1537
|
+
onlyDisplay: true,
|
|
1538
|
+
colStyle: {
|
|
1539
|
+
flex: 1,
|
|
1540
|
+
},
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
id: `${inputId}-label`,
|
|
1544
|
+
label: "link",
|
|
1545
|
+
type: "input", //Resembles component to be used
|
|
1546
|
+
metaType: "text",
|
|
1547
|
+
datatype: "string",
|
|
1548
|
+
required: true,
|
|
1549
|
+
width: 18,
|
|
1550
|
+
offset: 4,
|
|
1551
|
+
placeholder: "Enter CTA Label here",
|
|
1552
|
+
fluid: true,
|
|
1553
|
+
styling: "semantic",
|
|
1554
|
+
order: 1,
|
|
1555
|
+
customComponent: false,
|
|
1556
|
+
errorMessage: "CTA label cannot be empty.",
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
id: `${inputId}-delete`,
|
|
1560
|
+
type: "icon",
|
|
1561
|
+
value: 'delete',
|
|
1562
|
+
width: 1,
|
|
1563
|
+
submitAction: "onDelete",
|
|
1564
|
+
supportedEvents: ["onDelete"],
|
|
1565
|
+
},
|
|
1566
|
+
],
|
|
1567
|
+
});
|
|
1568
|
+
child.inputFields.splice(fieldIndex + 1, 0, {
|
|
1569
|
+
rowClassName: 'mobile-push-row',
|
|
1570
|
+
cols: [
|
|
1571
|
+
{
|
|
1572
|
+
id: `${inputId}-label-space`,
|
|
1573
|
+
metaType: "label",
|
|
1574
|
+
value: "",
|
|
1575
|
+
primitive: true,
|
|
1576
|
+
dynamicTab: false,
|
|
1577
|
+
type: "div",
|
|
1578
|
+
width: 4,
|
|
1579
|
+
style: {
|
|
1580
|
+
backgroundColor: 'white',
|
|
1581
|
+
textAlign: 'left',
|
|
1582
|
+
color: '#333333',
|
|
1583
|
+
lineHeight: '24px',
|
|
1584
|
+
fontSize: '14px',
|
|
1585
|
+
fontFamily: 'open-sans',
|
|
1586
|
+
fontStyle: 'normal',
|
|
1587
|
+
paddingTop: '8px',
|
|
1588
|
+
},
|
|
1589
|
+
offset: 0,
|
|
1590
|
+
onlyDisplay: true,
|
|
1591
|
+
colStyle: {
|
|
1592
|
+
flex: 1,
|
|
1593
|
+
},
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
id: `cta-deeplink-${inputId}`,
|
|
1597
|
+
type: "radioGroup", //Resembles component to be used
|
|
1598
|
+
metaType: "text",
|
|
1599
|
+
datatype: "string",
|
|
1600
|
+
options: ["Deeplink", "External Link"],
|
|
1601
|
+
value: "Deeplink",
|
|
1602
|
+
required: true,
|
|
1603
|
+
width: 16,
|
|
1604
|
+
errorMessage: "Please select link type",
|
|
1605
|
+
fluid: true,
|
|
1606
|
+
styling: "semantic",
|
|
1607
|
+
order: 1,
|
|
1608
|
+
style: {
|
|
1609
|
+
lineHeight: '24px',
|
|
1610
|
+
fontSize: '14px',
|
|
1611
|
+
},
|
|
1612
|
+
customComponent: false,
|
|
1613
|
+
supportedEvents: ["onChange"],
|
|
1614
|
+
},
|
|
1615
|
+
],
|
|
1616
|
+
});
|
|
1617
|
+
child.inputFields.splice(fieldIndex + 2, 0, {
|
|
1618
|
+
rowClassName: 'mobile-push-row',
|
|
1619
|
+
id: 'cta-deeplink-select-section',
|
|
1620
|
+
cols: [
|
|
1621
|
+
{
|
|
1622
|
+
id: "cta-label",
|
|
1623
|
+
metaType: "label",
|
|
1624
|
+
value: "",
|
|
1625
|
+
primitive: true,
|
|
1626
|
+
dynamicTab: false,
|
|
1627
|
+
type: "div",
|
|
1628
|
+
width: 4,
|
|
1629
|
+
onlyDisplay: true,
|
|
1630
|
+
colStyle: {
|
|
1631
|
+
flex: 1,
|
|
1632
|
+
},
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
id: `cta-deeplink-${inputId}-select`,
|
|
1636
|
+
placeholder: "Select DeepLink",
|
|
1637
|
+
type: "select", //Resembles component to be used
|
|
1638
|
+
options: deepLinkOptions,
|
|
1639
|
+
errorMessage: "Select a deeplink",
|
|
1640
|
+
metaType: "text",
|
|
1641
|
+
datatype: "string",
|
|
1642
|
+
required: true,
|
|
1643
|
+
fluid: true,
|
|
1644
|
+
width: 19,
|
|
1645
|
+
style: {
|
|
1646
|
+
fontSize: '14px',
|
|
1647
|
+
fontFamily: 'open-sans',
|
|
1648
|
+
fontStyle: 'normal',
|
|
1649
|
+
// fontWeight: 600,
|
|
1650
|
+
marginBottom: '16px',
|
|
1651
|
+
},
|
|
1652
|
+
styling: "semantic",
|
|
1653
|
+
order: 1,
|
|
1654
|
+
customComponent: false,
|
|
1655
|
+
supportedEvents: [
|
|
1656
|
+
'onSelect',
|
|
1657
|
+
],
|
|
1658
|
+
},
|
|
1659
|
+
],
|
|
1660
|
+
});
|
|
1661
|
+
const colField = col;
|
|
1662
|
+
colField.value = "Add Another CTA";
|
|
1663
|
+
colField.fieldsCount += 1;
|
|
1664
|
+
if (col.fieldsCount === col.fieldsLimit) {
|
|
1665
|
+
child.inputFields.pop();
|
|
1666
|
+
}
|
|
1667
|
+
// eventsMap[`cta-deeplink-${inputId}`] = {"onChange": this.onLinkTypeChange};
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
});
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1216
1673
|
});
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
} else {
|
|
1220
|
-
const identifier = id === "add-sec-cta" ? 'add-sec-cta-2' : null;
|
|
1221
|
-
const indexOfNextField = identifier ? findIndex(inputFields, {identifier}) : inputFields.length;
|
|
1222
|
-
const deleteCount = indexOfNextField - fieldIndex;
|
|
1223
|
-
const newInputFields = [...inputFields.slice(0, fieldIndex + 1), ...inputFields.slice(fieldIndex + deleteCount, inputFields.length)];
|
|
1224
|
-
set(schema, `containers[0].panes[${this.state.currentTab - 1}].sections[0].childSections[0].childSections[0].inputFields`, newInputFields);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1674
|
+
});
|
|
1675
|
+
});
|
|
1227
1676
|
});
|
|
1228
1677
|
});
|
|
1229
1678
|
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true});
|
|
1230
1679
|
this.injectEvents(schema);
|
|
1231
1680
|
};
|
|
1232
1681
|
copyIphoneContent = () => {
|
|
1233
|
-
const formData = cloneDeep(this.state.formData);
|
|
1682
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1234
1683
|
if (!!formData[1]['message-title2'] && !!formData[1]['message-editor2']) {
|
|
1235
1684
|
formData[0]['message-title'] = formData[1]['message-title2'];
|
|
1236
1685
|
formData[0]['message-editor'] = formData[1]['message-editor2'];
|
|
@@ -1240,7 +1689,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1240
1689
|
}
|
|
1241
1690
|
};
|
|
1242
1691
|
copyAndroidContent = () => {
|
|
1243
|
-
const formData = cloneDeep(this.state.formData);
|
|
1692
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1244
1693
|
if (!!formData[0]['message-title'] && !!formData[0]['message-editor']) {
|
|
1245
1694
|
formData[1]['message-title2'] = formData[0]['message-title'];
|
|
1246
1695
|
formData[1]['message-editor2'] = formData[0]['message-editor'];
|
|
@@ -1265,40 +1714,76 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1265
1714
|
};
|
|
1266
1715
|
|
|
1267
1716
|
showCtaKeys = (eventTriggered, formData, field) => {
|
|
1268
|
-
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1717
|
+
console.log(this.props.Templates);
|
|
1718
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1719
|
+
const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1720
|
+
_.forEach(schema.containers, (container) => {
|
|
1721
|
+
_.forEach(container.panes, (pane) => {
|
|
1722
|
+
_.forEach(pane.sections, (section) => {
|
|
1723
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1724
|
+
_.forEach(childeSection.childSections, (child) => {
|
|
1275
1725
|
const formChaild = child;
|
|
1276
1726
|
if (child.type === 'multicols') {
|
|
1277
|
-
forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1278
|
-
forEach(inputField.cols, (col) => {
|
|
1727
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1728
|
+
_.forEach(inputField.cols, (col) => {
|
|
1279
1729
|
if (col.id === field.id) {
|
|
1280
1730
|
const formDataKey = col.id.replace("-show-keys", "");
|
|
1281
1731
|
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1282
|
-
let keys = this.props.Templates.selectedWeChatAccount ? filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][formDataKey]) : [];
|
|
1732
|
+
let keys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === formData[this.state.currentTab - 1][formDataKey]) : [];
|
|
1283
1733
|
if (keys[0]) {
|
|
1284
1734
|
keys = keys[0].keys;
|
|
1285
1735
|
}
|
|
1286
|
-
let rows = map(keys, (key) => {
|
|
1736
|
+
let rows = _.map(keys, (key) => {
|
|
1287
1737
|
const row = {
|
|
1288
1738
|
rowClassName: 'mobile-push-row',
|
|
1289
1739
|
id: 'cta-deeplink-keys',
|
|
1290
1740
|
cols: [
|
|
1291
|
-
|
|
1292
|
-
|
|
1741
|
+
{
|
|
1742
|
+
id: `${key}-space`,
|
|
1743
|
+
metaType: "label",
|
|
1744
|
+
value: "",
|
|
1745
|
+
primitive: true,
|
|
1746
|
+
dynamicTab: false,
|
|
1747
|
+
type: "div",
|
|
1748
|
+
width: 4,
|
|
1749
|
+
offset: 0,
|
|
1750
|
+
onlyDisplay: true,
|
|
1751
|
+
colStyle: {
|
|
1752
|
+
flex: 1,
|
|
1753
|
+
},
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
id: `${key}-label`,
|
|
1757
|
+
metaType: "label",
|
|
1758
|
+
value: key.replace('_', " "),
|
|
1759
|
+
primitive: true,
|
|
1760
|
+
dynamicTab: false,
|
|
1761
|
+
type: "div",
|
|
1762
|
+
width: 5,
|
|
1763
|
+
style: {
|
|
1764
|
+
backgroundColor: 'white',
|
|
1765
|
+
textAlign: 'left',
|
|
1766
|
+
lineHeight: '24px',
|
|
1767
|
+
fontSize: '14px',
|
|
1768
|
+
fontFamily: 'open-sans',
|
|
1769
|
+
fontStyle: 'normal',
|
|
1770
|
+
cursor: 'pointer',
|
|
1771
|
+
paddingTop: '8px',
|
|
1772
|
+
},
|
|
1773
|
+
offset: 0,
|
|
1774
|
+
onlyDisplay: true,
|
|
1775
|
+
colStyle: {
|
|
1776
|
+
flex: 1,
|
|
1777
|
+
},
|
|
1778
|
+
},
|
|
1293
1779
|
{
|
|
1294
1780
|
id: `custom-value-${key}-${col.id}`,
|
|
1295
|
-
label:
|
|
1781
|
+
label: "value",
|
|
1296
1782
|
type: "input", //Resembles component to be used
|
|
1297
1783
|
metaType: "text",
|
|
1298
1784
|
datatype: "string",
|
|
1299
1785
|
required: true,
|
|
1300
|
-
width:
|
|
1301
|
-
offset: 1,
|
|
1786
|
+
width: 14,
|
|
1302
1787
|
placeholder: `Please input ${key.replace('_', " ")} here .`,
|
|
1303
1788
|
fluid: true,
|
|
1304
1789
|
styling: "semantic",
|
|
@@ -1312,9 +1797,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1312
1797
|
return row;
|
|
1313
1798
|
// formChaild.inputFields[fieldIndex + index] = field;
|
|
1314
1799
|
});
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
const configkeys = filter(JSON.parse(deeplinks), (dl) => dl.link === this.state.formData[this.state.currentTab - 1][field.id]);
|
|
1800
|
+
console.log(formChaild);
|
|
1801
|
+
console.log("this in getctakeys", this);
|
|
1802
|
+
const configkeys = _.filter(JSON.parse(deeplinks), (dl) => dl.link === this.state.formData[this.state.currentTab - 1][field.id]);
|
|
1318
1803
|
if (configkeys.length) {
|
|
1319
1804
|
const options = configkeys[0].keys;
|
|
1320
1805
|
formChaild.inputFields = formChaild.inputFields.slice(0, fieldIndex + 1).concat(formChaild.inputFields.slice( fieldIndex + options.length + 1, formChaild.inputFields.length));
|
|
@@ -1341,42 +1826,109 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1341
1826
|
this.injectEvents(schema);
|
|
1342
1827
|
};
|
|
1343
1828
|
saveFormData = (formData) => {
|
|
1829
|
+
console.log('Saving form data', formData, this.state.tabCount);
|
|
1344
1830
|
const obj = this.getTransformedData(formData);
|
|
1345
|
-
|
|
1831
|
+
console.log('obj', obj);
|
|
1346
1832
|
this.props.actions.createTemplate(obj);
|
|
1347
1833
|
};
|
|
1348
|
-
deleteSecondaryCtaIos = (
|
|
1349
|
-
const
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1834
|
+
deleteSecondaryCtaIos = (event) => {
|
|
1835
|
+
const id = event.currentTarget.id;
|
|
1836
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1837
|
+
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1838
|
+
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`cta-deeplink-${id.replace('delete-ios', 'select2')}`];
|
|
1839
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1840
|
+
const self = this;
|
|
1841
|
+
const device = this.state.currentTab === 1 ? 'android' : 'ios';
|
|
1842
|
+
_.forEach(schema.containers, (container) => {
|
|
1843
|
+
_.forEach(container.panes, (pane) => {
|
|
1844
|
+
_.forEach(pane.sections, (section) => {
|
|
1845
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1846
|
+
_.forEach(childeSection.childSections, (formChild) => {
|
|
1847
|
+
const child = formChild;
|
|
1848
|
+
if (child.type === 'multicols') {
|
|
1849
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1850
|
+
if (inputField) {
|
|
1851
|
+
_.forEach(inputField.cols, (col) => {
|
|
1852
|
+
if (col.id === id) {
|
|
1853
|
+
child.inputFields.splice(fieldIndex, 3);
|
|
1854
|
+
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-external-link") {
|
|
1855
|
+
child.inputFields.splice(fieldIndex, 1);
|
|
1856
|
+
}
|
|
1857
|
+
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
1858
|
+
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1859
|
+
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1860
|
+
if (configkeys.length) {
|
|
1861
|
+
const options = configkeys[0].keys;
|
|
1862
|
+
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
1863
|
+
delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('delete', 'select')}`];
|
|
1864
|
+
delete formData[self.state.currentTab - 1][`cta-deeplink-${id.replace('-delete', '')}`];
|
|
1865
|
+
} else {
|
|
1866
|
+
child.inputFields.splice(fieldIndex, 1);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
if (device === 'ios') {
|
|
1870
|
+
child.inputFields[fieldIndex] = {
|
|
1871
|
+
cols: [
|
|
1872
|
+
{
|
|
1873
|
+
id: "add-sec-cta-ios",
|
|
1874
|
+
metaType: "label",
|
|
1875
|
+
value: "Add Secondary CTA",
|
|
1876
|
+
primitive: true,
|
|
1877
|
+
dynamicTab: false,
|
|
1878
|
+
type: "div",
|
|
1879
|
+
style: {
|
|
1880
|
+
backgroundColor: 'white',
|
|
1881
|
+
textAlign: 'left',
|
|
1882
|
+
color: '#2673D7',
|
|
1883
|
+
lineHeight: '24px',
|
|
1884
|
+
marginTop: '16px',
|
|
1885
|
+
fontSize: '14px',
|
|
1886
|
+
fontWeight: '600',
|
|
1887
|
+
fontFamily: 'open-sans',
|
|
1888
|
+
fontStyle: 'normal',
|
|
1889
|
+
cursor: 'pointer',
|
|
1890
|
+
},
|
|
1891
|
+
offset: 0,
|
|
1892
|
+
onlyDisplay: true,
|
|
1893
|
+
colStyle: {
|
|
1894
|
+
flex: 1,
|
|
1895
|
+
},
|
|
1896
|
+
submitAction: "addSecondaryCtaIos",
|
|
1897
|
+
supportedEvents: ["addSecondaryCtaIos"],
|
|
1898
|
+
},
|
|
1899
|
+
],
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
});
|
|
1357
1909
|
});
|
|
1358
|
-
}
|
|
1910
|
+
});
|
|
1359
1911
|
});
|
|
1360
|
-
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, isSchemaChanged: true}
|
|
1912
|
+
this.setState({schema, initialState: this.state.initialState ? this.state.initialState : this.state.schema, formData, isSchemaChanged: true});
|
|
1361
1913
|
this.injectEvents(schema);
|
|
1362
1914
|
};
|
|
1363
1915
|
deletePrimaryCTA = (event) => {
|
|
1364
1916
|
const id = event.currentTarget.id;
|
|
1365
|
-
const schema = cloneDeep(this.state.schema);
|
|
1366
|
-
// const eventsMap = cloneDeep(this.state.eventsMap);
|
|
1917
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
1918
|
+
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1367
1919
|
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`${id.replace('delete', 'select')}`];
|
|
1368
|
-
const formData = cloneDeep(this.state.formData);
|
|
1920
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1369
1921
|
const self = this;
|
|
1370
|
-
forEach(schema.containers, (container) => {
|
|
1371
|
-
forEach(container.panes, (pane) => {
|
|
1372
|
-
forEach(pane.sections, (section) => {
|
|
1373
|
-
forEach(section.childSections, (childeSection) => {
|
|
1374
|
-
forEach(childeSection.childSections, (formChild) => {
|
|
1922
|
+
_.forEach(schema.containers, (container) => {
|
|
1923
|
+
_.forEach(container.panes, (pane) => {
|
|
1924
|
+
_.forEach(pane.sections, (section) => {
|
|
1925
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
1926
|
+
_.forEach(childeSection.childSections, (formChild) => {
|
|
1375
1927
|
const child = formChild;
|
|
1376
1928
|
if (child.type === 'multicols') {
|
|
1377
|
-
forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1929
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1378
1930
|
if (inputField) {
|
|
1379
|
-
forEach(inputField.cols, (col) => {
|
|
1931
|
+
_.forEach(inputField.cols, (col) => {
|
|
1380
1932
|
if (col.id === id) {
|
|
1381
1933
|
child.inputFields.splice(fieldIndex, 1);
|
|
1382
1934
|
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-external-link") {
|
|
@@ -1384,7 +1936,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1384
1936
|
}
|
|
1385
1937
|
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
1386
1938
|
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1387
|
-
const configkeys = this.props.Templates.selectedWeChatAccount ? filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1939
|
+
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1388
1940
|
if (configkeys.length) {
|
|
1389
1941
|
const options = configkeys[0].keys;
|
|
1390
1942
|
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
@@ -1407,7 +1959,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1407
1959
|
backgroundColor: 'white',
|
|
1408
1960
|
textAlign: 'left',
|
|
1409
1961
|
color: '#2673D7',
|
|
1410
|
-
|
|
1962
|
+
lineHeight: '24px',
|
|
1963
|
+
fontSize: '14px',
|
|
1964
|
+
fontWeight: '600',
|
|
1965
|
+
fontFamily: 'open-sans',
|
|
1966
|
+
fontStyle: 'normal',
|
|
1411
1967
|
cursor: 'pointer',
|
|
1412
1968
|
},
|
|
1413
1969
|
offset: 0,
|
|
@@ -1444,21 +2000,21 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1444
2000
|
return;
|
|
1445
2001
|
}
|
|
1446
2002
|
}
|
|
1447
|
-
const schema = cloneDeep(this.state.schema);
|
|
1448
|
-
// const eventsMap = cloneDeep(this.state.eventsMap);
|
|
2003
|
+
const schema = _.cloneDeep(this.state.schema);
|
|
2004
|
+
// const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1449
2005
|
const selectedDeeplink = this.state.formData[this.state.currentTab - 1][`cta-deeplink-${id.replace('delete', 'select')}`];
|
|
1450
|
-
const formData = cloneDeep(this.state.formData);
|
|
2006
|
+
const formData = _.cloneDeep(this.state.formData);
|
|
1451
2007
|
const device = this.state.currentTab === 1 ? 'android' : 'ios';
|
|
1452
|
-
forEach(schema.containers, (container) => {
|
|
1453
|
-
forEach(container.panes, (pane) => {
|
|
1454
|
-
forEach(pane.sections, (section) => {
|
|
1455
|
-
forEach(section.childSections, (childeSection) => {
|
|
1456
|
-
forEach(childeSection.childSections, (formChild) => {
|
|
2008
|
+
_.forEach(schema.containers, (container) => {
|
|
2009
|
+
_.forEach(container.panes, (pane) => {
|
|
2010
|
+
_.forEach(pane.sections, (section) => {
|
|
2011
|
+
_.forEach(section.childSections, (childeSection) => {
|
|
2012
|
+
_.forEach(childeSection.childSections, (formChild) => {
|
|
1457
2013
|
const child = formChild;
|
|
1458
2014
|
if (child.type === 'multicols') {
|
|
1459
|
-
forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
2015
|
+
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1460
2016
|
if (inputField) {
|
|
1461
|
-
forEach(inputField.cols, (col) => {
|
|
2017
|
+
_.forEach(inputField.cols, (col) => {
|
|
1462
2018
|
if (col.id === id) {
|
|
1463
2019
|
if (device === 'ios') {
|
|
1464
2020
|
child.inputFields.splice(fieldIndex, 3);
|
|
@@ -1471,7 +2027,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1471
2027
|
if (child.inputFields[fieldIndex] && child.inputFields[fieldIndex].id === "cta-deeplink-select-section") {
|
|
1472
2028
|
const ck = this.props.Templates.selectedWeChatAccount.configs ? !!this.props.Templates.selectedWeChatAccount.configs.deeplink : false;
|
|
1473
2029
|
const deeplinks = ck ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1474
|
-
const configkeys = this.props.Templates.selectedWeChatAccount ? filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
2030
|
+
const configkeys = this.props.Templates.selectedWeChatAccount ? _.filter(JSON.parse(deeplinks), (dl) => dl.link === selectedDeeplink) : [];
|
|
1475
2031
|
if (configkeys.length) {
|
|
1476
2032
|
const options = configkeys[0].keys;
|
|
1477
2033
|
child.inputFields = child.inputFields.slice(0, fieldIndex).concat(child.inputFields.slice( fieldIndex + options.length + 1, child.inputFields.length));
|
|
@@ -1493,7 +2049,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1493
2049
|
backgroundColor: 'white',
|
|
1494
2050
|
textAlign: 'left',
|
|
1495
2051
|
color: '#2673D7',
|
|
1496
|
-
|
|
2052
|
+
lineHeight: '24px',
|
|
2053
|
+
fontSize: '14px',
|
|
2054
|
+
marginTop: '16px',
|
|
2055
|
+
fontWeight: '600',
|
|
2056
|
+
fontFamily: 'open-sans',
|
|
2057
|
+
fontStyle: 'normal',
|
|
1497
2058
|
cursor: 'pointer',
|
|
1498
2059
|
},
|
|
1499
2060
|
offset: 0,
|
|
@@ -1521,7 +2082,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1521
2082
|
backgroundColor: 'white',
|
|
1522
2083
|
textAlign: 'left',
|
|
1523
2084
|
color: '#2673D7',
|
|
1524
|
-
|
|
2085
|
+
lineHeight: '24px',
|
|
2086
|
+
fontSize: '14px',
|
|
2087
|
+
fontWeight: '600',
|
|
2088
|
+
marginTop: '16px',
|
|
2089
|
+
fontFamily: 'open-sans',
|
|
2090
|
+
fontStyle: 'normal',
|
|
1525
2091
|
cursor: 'pointer',
|
|
1526
2092
|
},
|
|
1527
2093
|
offset: 0,
|
|
@@ -1555,7 +2121,11 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1555
2121
|
backgroundColor: 'white',
|
|
1556
2122
|
textAlign: 'left',
|
|
1557
2123
|
color: '#2673D7',
|
|
1558
|
-
|
|
2124
|
+
lineHeight: '24px',
|
|
2125
|
+
fontSize: '14px',
|
|
2126
|
+
fontWeight: '600',
|
|
2127
|
+
fontFamily: 'open-sans',
|
|
2128
|
+
fontStyle: 'normal',
|
|
1559
2129
|
cursor: 'pointer',
|
|
1560
2130
|
},
|
|
1561
2131
|
offset: 0,
|
|
@@ -1586,6 +2156,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1586
2156
|
this.injectEvents(schema);
|
|
1587
2157
|
};
|
|
1588
2158
|
handleOnTagsContextChange = (data) => {
|
|
2159
|
+
console.log('parent tags context', data);
|
|
1589
2160
|
const query = {
|
|
1590
2161
|
layout: 'mobilepush',
|
|
1591
2162
|
type: 'TAG',
|
|
@@ -1594,11 +2165,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1594
2165
|
};
|
|
1595
2166
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
1596
2167
|
};
|
|
1597
|
-
handleClose = () => {
|
|
1598
|
-
const formData = cloneDeep(this.state.formData);
|
|
1599
|
-
formData[this.state.currentTab - 1]['add-sec-cta-ios'] = false;
|
|
1600
|
-
this.setState({showIosCtaTable: false, formData});
|
|
1601
|
-
}
|
|
1602
2168
|
render() {
|
|
1603
2169
|
let tipText = this.props.Create.createTemplateInProgress ? "Saving Template..." : "";
|
|
1604
2170
|
let loading = this.props.Create.createTemplateInProgress ? this.props.Create.createTemplateInProgress : false;
|
|
@@ -1633,13 +2199,13 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1633
2199
|
onChange={this.onFormDataChange}
|
|
1634
2200
|
currentTab={this.state.currentTab}
|
|
1635
2201
|
parent={this}
|
|
1636
|
-
formData={cloneDeep(this.state.formData)}
|
|
2202
|
+
formData={_.cloneDeep(this.state.formData)}
|
|
1637
2203
|
location={this.props.location}
|
|
1638
2204
|
tags={tags}
|
|
1639
2205
|
injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
|
|
1640
2206
|
onFormValidityChange={this.setFormValidity}
|
|
1641
2207
|
usingTabContainer
|
|
1642
|
-
checkValidation={
|
|
2208
|
+
checkValidation={false}
|
|
1643
2209
|
iosCtasData={this.state.iosCtasData}
|
|
1644
2210
|
tabKey={this.state.tabKey}
|
|
1645
2211
|
tabCount={2}
|
|
@@ -1653,65 +2219,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1653
2219
|
setModalContent={this.setModalContent}
|
|
1654
2220
|
/>
|
|
1655
2221
|
</Col>
|
|
1656
|
-
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
1657
|
-
<CapSlideBox
|
|
1658
|
-
size="size-l"
|
|
1659
|
-
header={<CapHeader
|
|
1660
|
-
title={<FormattedMessage {...messages.selectActionButton} />}
|
|
1661
|
-
prefix={
|
|
1662
|
-
<PrefixWrapper>
|
|
1663
|
-
<CapIcons.backIcon onClick={this.handleClose} />
|
|
1664
|
-
</PrefixWrapper>
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
/>}
|
|
1668
|
-
content={<CapTable
|
|
1669
|
-
rowSelection={{
|
|
1670
|
-
type: 'radio',
|
|
1671
|
-
onSelect: (record) => {
|
|
1672
|
-
this.setState({templateCta: record, showIosCtaTable: false}, () => this.selectCtaIos(record));
|
|
1673
|
-
},
|
|
1674
|
-
}}
|
|
1675
|
-
dataSource={this.props.iosCtasData} columns={[
|
|
1676
|
-
{
|
|
1677
|
-
title: "Name and Description",
|
|
1678
|
-
dataIndex: "name",
|
|
1679
|
-
key: "name",
|
|
1680
|
-
width: 200,
|
|
1681
|
-
render: (text, record) => (
|
|
1682
|
-
<div>
|
|
1683
|
-
<div>{record.name}</div>
|
|
1684
|
-
<div>{record.description}</div>
|
|
1685
|
-
</div>),
|
|
1686
|
-
},
|
|
1687
|
-
{
|
|
1688
|
-
title: "Button 1",
|
|
1689
|
-
dataIndex: "description",
|
|
1690
|
-
key: "button1",
|
|
1691
|
-
width: 100,
|
|
1692
|
-
render: (text, record) => (
|
|
1693
|
-
<div>
|
|
1694
|
-
{record.ctaTemplateDetails[0] && record.ctaTemplateDetails[0].buttonText}
|
|
1695
|
-
</div>),
|
|
1696
|
-
},
|
|
1697
|
-
{
|
|
1698
|
-
title: "Button 2",
|
|
1699
|
-
dataIndex: "description",
|
|
1700
|
-
key: "button2",
|
|
1701
|
-
width: 100,
|
|
1702
|
-
render: (text, record) => (
|
|
1703
|
-
<div>
|
|
1704
|
-
{record.ctaTemplateDetails[1] ? record.ctaTemplateDetails[1].buttonText : ''}
|
|
1705
|
-
</div>
|
|
1706
|
-
),
|
|
1707
|
-
},
|
|
1708
|
-
]}
|
|
1709
|
-
/>}
|
|
1710
|
-
show={this.state.showIosCtaTable}
|
|
1711
|
-
handleClose={this.handleClose}
|
|
1712
|
-
/>
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
2222
|
</Row>
|
|
1716
2223
|
</Spin>
|
|
1717
2224
|
</div>
|
|
@@ -1732,7 +2239,6 @@ Create.propTypes = {
|
|
|
1732
2239
|
intl: intlShape.isRequired,
|
|
1733
2240
|
supportedTags: PropTypes.array,
|
|
1734
2241
|
getDefaultTags: PropTypes.string,
|
|
1735
|
-
iosCtasData: PropTypes.array,
|
|
1736
2242
|
injectedTags: PropTypes.object,
|
|
1737
2243
|
};
|
|
1738
2244
|
|
|
@@ -1741,7 +2247,6 @@ const mapStateToProps = createStructuredSelector({
|
|
|
1741
2247
|
createResponse: makeSelectCreateResponse(),
|
|
1742
2248
|
metaEntities: makeSelectMetaEntities(),
|
|
1743
2249
|
Templates: makeSelectTemplates(),
|
|
1744
|
-
iosCtasData: makeSelectIosCta(),
|
|
1745
2250
|
injectedTags: setInjectedTags(),
|
|
1746
2251
|
});
|
|
1747
2252
|
|