@capillarytech/creatives-library 7.18.0-beta.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +27 -54
- package/assets/Line_Preview_English.svg +24 -0
- package/assets/Line_Preview_Japanese.svg +24 -0
- package/components/CapTagList/index.js +2 -2
- package/components/CapTagList/messages.js +8 -0
- package/components/Ckeditor/index.js +4 -2
- package/components/Ckeditor/style.scss +3 -0
- package/components/FormBuilder/_formBuilder.scss +4 -16
- package/components/FormBuilder/index.js +4 -3
- package/components/FormBuilder/messages.js +4 -0
- package/components/Sidebar/index.js +4 -4
- package/config/path.js +1 -1
- package/containers/App/constants.js +95 -0
- package/containers/App/index.js +52 -0
- package/containers/App/sagas.js +8 -3
- package/containers/Assets/Gallery/index.js +17 -3
- package/containers/Assets/Gallery/messages.js +4 -0
- package/containers/Assets/Gallery/sagas.js +14 -14
- package/containers/Cap/index.js +84 -50
- package/containers/Cap/sagas.js +20 -12
- package/containers/Cap/selectors.js +13 -13
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +1 -1
- package/containers/Cap/tests/saga.test.js +81 -1
- package/containers/Dashboard/index.js +34 -17
- package/containers/Dashboard/sagas.js +7 -1
- package/containers/Ebill/index.js +16 -3
- package/containers/Ebill/sagas.js +18 -11
- package/containers/Email/index.js +20 -3
- package/containers/Email/sagas.js +34 -23
- package/containers/LanguageProvider/index.js +49 -31
- package/containers/LanguageProvider/tests/index.test.js +5 -3
- package/containers/Line/Create/index.js +15 -2
- package/containers/Line/Create/sagas.js +26 -17
- package/containers/Line/Edit/sagas.js +12 -13
- package/containers/Login/index.js +36 -11
- package/containers/MobilePush/Create/index.js +17 -2
- package/containers/MobilePush/Create/sagas.js +18 -12
- package/containers/MobilePush/Edit/index.js +20 -3
- package/containers/MobilePush/Edit/sagas.js +30 -20
- package/containers/Sms/Create/index.js +15 -2
- package/containers/Sms/Create/sagas.js +8 -6
- package/containers/Sms/Edit/index.js +15 -3
- package/containers/Sms/Edit/sagas.js +14 -8
- package/containers/TagList/constants.js +23 -0
- package/containers/Templates/actions.js +0 -5
- package/containers/Templates/index.js +47 -14
- package/containers/Templates/sagas.js +20 -23
- package/containers/WeChat/MapTemplates/index.js +19 -2
- package/containers/WeChat/MapTemplates/sagas.js +17 -17
- package/containers/WeChat/RichmediaTemplates/Create/index.js +18 -2
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +11 -8
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +21 -2
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
- package/entry.js +2 -0
- package/global-styles.js +2 -2
- package/gtm/eventDefinitionsMap.js +1 -1
- package/helpers/intl-enzym-test-helpers.js +1 -1
- package/hoc/withReactRouterV3Compatibility.js +66 -0
- package/index.js +12 -0
- package/initialReducer.js +32 -0
- package/initialState.js +1 -0
- package/mfe-exposed-components.js +8 -0
- package/package.json +16 -11
- package/routes.js +206 -749
- package/services/api.js +62 -17
- package/services/tests/api.test.js +248 -1
- package/styles/components/navigation/_leftnav.scss +13 -0
- package/styles/containers/layout/_layoutPage.scss +14 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +21 -16
- package/tests/store.test.js +5 -3
- package/translations/en.json +1 -9
- package/translations/ja-JP.json +0 -8
- package/translations/zh.json +0 -8
- package/utils/authWrapper.js +43 -17
- package/utils/cdnTransformation.js +73 -44
- package/utils/checkStore.js +21 -0
- package/utils/common.js +198 -8
- package/utils/commonUtils.js +17 -1
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/history.js +8 -0
- package/utils/injectReducer.js +2 -0
- package/utils/injectSaga.js +2 -0
- package/utils/tagValidations.js +2 -2
- package/utils/tests/cdnTransformation.test.js +6 -4
- package/utils/tests/common.mockdata.js +623 -0
- package/utils/tests/common.test.js +273 -0
- package/utils/tests/commonUtil.test.js +79 -0
- package/v2Components/CapDeviceContent/index.js +330 -0
- package/v2Components/CapDeviceContent/index.scss +115 -0
- package/v2Components/CapDeviceContent/messages.js +94 -0
- package/v2Components/CapDeviceContent/tests/index.test.js +89 -0
- package/v2Components/CapImageUpload/constants.js +6 -0
- package/v2Components/CapImageUpload/index.js +23 -15
- package/v2Components/CapImageUpload/index.scss +6 -0
- package/v2Components/CapImageUpload/messages.js +7 -7
- package/v2Components/CapInAppCTA/constants.js +25 -0
- package/v2Components/CapInAppCTA/index.js +279 -0
- package/v2Components/CapInAppCTA/index.scss +99 -0
- package/v2Components/CapInAppCTA/messages.js +85 -0
- package/v2Components/CapTagList/index.js +149 -26
- package/v2Components/CapTagList/messages.js +12 -0
- package/v2Components/CapTagList/style.scss +26 -0
- package/v2Components/CapVideoUpload/constants.js +6 -0
- package/v2Components/CapVideoUpload/index.js +48 -22
- package/v2Components/CapVideoUpload/index.scss +4 -2
- package/v2Components/CapVideoUpload/messages.js +10 -6
- package/v2Components/CapWhatsappQuickReply/index.js +255 -0
- package/v2Components/CapWhatsappQuickReply/index.scss +54 -0
- package/v2Components/CapWhatsappQuickReply/messages.js +32 -0
- package/v2Components/Ckeditor/index.js +56 -22
- package/v2Components/Ckeditor/style.scss +3 -0
- package/v2Components/Ckeditor/tests/index.test.js +44 -0
- package/v2Components/CmsTemplatesComponent/index.js +1 -0
- package/v2Components/CmsTemplatesComponent/messages.js +4 -0
- package/v2Components/EmailMobilePreview/index.js +4 -2
- package/v2Components/EmailPreviewV2/index.js +6 -4
- package/v2Components/EmailPreviewV2/tests/__snapshots__/index.test.js.snap +0 -3
- package/v2Components/FormBuilder/_formBuilder.scss +1 -0
- package/v2Components/FormBuilder/constants.js +1 -1
- package/v2Components/FormBuilder/index.js +111 -29
- package/v2Components/FormBuilder/messages.js +4 -0
- package/v2Components/FormBuilder/tests/index.test.js +5 -2
- package/v2Components/MobilePushPreviewV2/index.js +57 -22
- package/v2Components/NavigationBar/constants.js +1 -0
- package/v2Components/NavigationBar/index.js +84 -113
- package/v2Components/NavigationBar/messages.js +8 -0
- package/v2Components/NavigationBar/style.js +9 -0
- package/v2Components/NavigationBar/tests/index.test.js +32 -9
- package/v2Components/NavigationBar/tests/mockData.js +1 -0
- package/v2Components/NewCallTask/tests/index.test.js +5 -3
- package/v2Components/Pagination/index.js +2 -1
- package/v2Components/RenderRoute/RenderRoute.js +11 -0
- package/v2Components/RenderRoute/index.js +1 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +535 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +6 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +18 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +7 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +13 -0
- package/v2Components/TemplatePreview/index.js +745 -362
- package/v2Components/TemplatePreview/messages.js +8 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -14
- package/v2Components/TemplatePreview/tests/index.test.js +9 -0
- package/v2Components/WhatsappStatusContainer/_whatsappStatusContainer.scss +8 -1
- package/v2Containers/App/constants.js +12 -6
- package/v2Containers/App/sagas.js +0 -1
- package/v2Containers/Assets/Gallery/index.js +1 -0
- package/v2Containers/Assets/Gallery/sagas.js +15 -14
- package/v2Containers/BeeEditor/index.js +3 -1
- package/v2Containers/BeeEditor/sagas.js +8 -5
- package/v2Containers/CallTask/sagas.js +7 -1
- package/v2Containers/Cap/actions.js +4 -0
- package/v2Containers/Cap/constants.js +20 -1
- package/v2Containers/Cap/index.js +116 -17
- package/v2Containers/Cap/messages.js +8 -0
- package/v2Containers/Cap/reducer.js +18 -3
- package/v2Containers/Cap/sagas.js +64 -9
- package/v2Containers/Cap/selectors.js +27 -13
- package/v2Containers/Cap/tests/Cap.test.js +164 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +2 -1
- package/v2Containers/Cap/tests/actions.test.js +11 -0
- package/v2Containers/Cap/tests/reducer.test.js +59 -0
- package/v2Containers/Cap/tests/saga.test.js +181 -2
- package/v2Containers/Cap/tests/selectors.test.js +42 -18
- package/v2Containers/CapFacebookPreview/sagas.js +7 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +86 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +4 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +30 -14
- package/v2Containers/CreativesContainer/constants.js +5 -0
- package/v2Containers/CreativesContainer/index.js +157 -38
- package/v2Containers/CreativesContainer/index.scss +12 -0
- package/v2Containers/CreativesContainer/messages.js +33 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +11 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +5 -2
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +7 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +227 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +73 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +80 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +16 -0
- package/v2Containers/Ebill/sagas.js +3 -10
- package/v2Containers/Email/index.js +38 -19
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/Email/sagas.js +22 -26
- package/v2Containers/EmailWrapper/index.js +18 -8
- package/v2Containers/FTP/index.js +2 -2
- package/v2Containers/FTP/sagas.js +3 -4
- package/v2Containers/Facebook/sagas.js +26 -17
- package/v2Containers/InApp/actions.js +64 -0
- package/v2Containers/InApp/constants.js +160 -0
- package/v2Containers/InApp/index.js +792 -0
- package/v2Containers/InApp/index.scss +50 -0
- package/v2Containers/InApp/messages.js +114 -0
- package/v2Containers/InApp/reducer.js +109 -0
- package/v2Containers/InApp/sagas.js +151 -0
- package/v2Containers/InApp/selectors.js +12 -0
- package/v2Containers/InApp/tests/action.test.js +53 -0
- package/v2Containers/InApp/tests/index.test.js +165 -0
- package/v2Containers/InApp/tests/mockData.js +898 -0
- package/v2Containers/InApp/tests/reducer.test.js +177 -0
- package/v2Containers/InApp/tests/sagas.test.js +391 -0
- package/v2Containers/InApp/utils.js +12 -0
- package/v2Containers/LanguageProvider/index.js +17 -5
- package/v2Containers/LanguageProvider/reducer.js +3 -2
- package/v2Containers/LanguageProvider/sagas.js +7 -8
- package/v2Containers/LanguageProvider/selectors.js +2 -1
- package/v2Containers/LanguageProvider/tests/index.test.js +5 -2
- package/v2Containers/LanguageProvider/tests/reducer.test.js +6 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +28 -16
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +5 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +5 -3
- package/v2Containers/Line/Container/ImageMap/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +16 -1
- package/v2Containers/Line/Container/Video/index.js +2 -1
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +18134 -107
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +5 -3
- package/v2Containers/Line/Container/Wrapper/utils.js +1 -1
- package/v2Containers/Line/Container/index.js +4 -0
- package/v2Containers/Line/Container/sagas.js +30 -20
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +123 -81
- package/v2Containers/Line/Container/tests/index.test.js +5 -2
- package/v2Containers/Login/index.js +1 -2
- package/v2Containers/MobilePush/Create/index.js +40 -17
- package/v2Containers/MobilePush/Create/sagas.js +18 -12
- package/v2Containers/MobilePush/Edit/index.js +16 -7
- package/v2Containers/MobilePush/Edit/sagas.js +30 -20
- package/v2Containers/MobilepushWrapper/index.js +3 -0
- package/v2Containers/Rcs/sagas.js +14 -14
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +123 -87
- package/v2Containers/Rcs/tests/index.test.js +5 -3
- package/v2Containers/Sms/Create/sagas.js +10 -6
- package/v2Containers/Sms/Edit/sagas.js +14 -8
- package/v2Containers/SmsTrai/Create/sagas.js +9 -10
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +12 -8
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +5 -3
- package/v2Containers/TagList/_tagList.scss +18 -0
- package/v2Containers/TagList/index.js +81 -42
- package/v2Containers/TagList/tests/TagList.test.js +6 -7
- package/v2Containers/TagList/tests/mockdata.js +10 -166
- package/v2Containers/TagList/tests/utils.test.js +17 -0
- package/v2Containers/TagList/utils.js +15 -0
- package/v2Containers/Templates/_templates.scss +60 -5
- package/v2Containers/Templates/actions.js +6 -5
- package/v2Containers/Templates/constants.js +2 -1
- package/v2Containers/Templates/index.js +576 -181
- package/v2Containers/Templates/messages.js +52 -8
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/Templates/sagas.js +54 -38
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +669 -43
- package/v2Containers/Templates/tests/actions.test.js +19 -0
- package/v2Containers/Templates/tests/index.test.js +53 -1
- package/v2Containers/Templates/tests/mockData.js +45 -1
- package/v2Containers/Templates/tests/reducer.test.js +50 -0
- package/v2Containers/Templates/tests/sagas.test.js +116 -3
- package/v2Containers/Templates/tests/selector.test.js +17 -0
- package/v2Containers/TemplatesV2/index.js +180 -8
- package/v2Containers/TemplatesV2/messages.js +8 -0
- package/v2Containers/TemplatesV2/tests/index.test.js +104 -0
- package/v2Containers/TemplatesV2/tests/mockData.js +685 -0
- package/v2Containers/Viber/constants.js +58 -0
- package/v2Containers/Viber/index.js +404 -421
- package/v2Containers/Viber/index.scss +107 -0
- package/v2Containers/Viber/messages.js +70 -2
- package/v2Containers/Viber/sagas.js +22 -14
- package/v2Containers/Viber/style.js +20 -0
- package/v2Containers/Viber/tests/index.test.js +299 -0
- package/v2Containers/Viber/tests/mockData.js +134 -0
- package/v2Containers/WeChat/MapTemplates/sagas.js +22 -14
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +12 -11
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +9 -5
- package/v2Containers/Whatsapp/actions.js +16 -0
- package/v2Containers/Whatsapp/constants.js +24 -0
- package/v2Containers/Whatsapp/index.js +892 -222
- package/v2Containers/Whatsapp/index.scss +91 -1
- package/v2Containers/Whatsapp/messages.js +98 -1
- package/v2Containers/Whatsapp/reducer.js +19 -0
- package/v2Containers/Whatsapp/sagas.js +67 -12
- package/v2Containers/Whatsapp/styles.scss +35 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34983 -24886
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +12 -0
- package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
- package/v2Containers/Whatsapp/tests/index.test.js +17 -4
- package/v2Containers/Whatsapp/tests/mockData.js +77 -0
- package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
- package/v2Containers/Whatsapp/tests/saga.test.js +201 -0
- package/v2Containers/Whatsapp/tests/utils.test.js +18 -0
- package/v2Containers/Whatsapp/utils.js +65 -4
- package/v2Containers/Zalo/actions.js +24 -0
- package/v2Containers/Zalo/constants.js +59 -0
- package/v2Containers/Zalo/index.js +548 -0
- package/v2Containers/Zalo/index.scss +75 -0
- package/v2Containers/Zalo/messages.js +86 -0
- package/v2Containers/Zalo/reducer.js +63 -0
- package/v2Containers/Zalo/saga.js +45 -0
- package/v2Containers/Zalo/selectors.js +19 -0
- package/v2Containers/Zalo/tests/actions.test.js +26 -0
- package/v2Containers/Zalo/tests/index.test.js +149 -0
- package/v2Containers/Zalo/tests/mockData.js +11527 -0
- package/v2Containers/Zalo/tests/reducer.test.js +96 -0
- package/v2Containers/Zalo/tests/saga.test.js +118 -0
- package/v2Containers/Zalo/tests/selector.test.js +51 -0
- package/v2Containers/mockdata.js +1531 -680
- package/containers/TestPage/constants.js +0 -7
- package/containers/TestPage/index.js +0 -31
- package/containers/TestPage/messages.js +0 -13
- package/containers/TestPage/reducer.js +0 -21
- package/containers/TestPage/sagas.js +0 -11
- package/containers/Testv2/actions.js +0 -15
- package/containers/Testv2/constants.js +0 -7
- package/containers/Testv2/index.js +0 -47
- package/containers/Testv2/messages.js +0 -21
- package/containers/Testv2/reducer.js +0 -23
- package/containers/Testv2/sagas.js +0 -11
- package/containers/Testv2/selectors.js +0 -25
- package/reducers.js +0 -73
- package/store.js +0 -61
- package/utils/tests/asyncInjectors.test.js +0 -173
- package/v2Containers/TestPage/constants.js +0 -7
- package/v2Containers/TestPage/index.js +0 -31
- package/v2Containers/TestPage/messages.js +0 -13
- package/v2Containers/TestPage/reducer.js +0 -21
- package/v2Containers/TestPage/sagas.js +0 -11
- package/v2Containers/Testv2/actions.js +0 -15
- package/v2Containers/Testv2/constants.js +0 -7
- package/v2Containers/Testv2/index.js +0 -47
- package/v2Containers/Testv2/messages.js +0 -21
- package/v2Containers/Testv2/reducer.js +0 -23
- package/v2Containers/Testv2/sagas.js +0 -11
- package/v2Containers/Testv2/selectors.js +0 -25
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import messages from './messages';
|
|
4
|
+
export const SUCCESS_ALERT = 'success';
|
|
5
|
+
export const WARNING_ALERT = 'warning';
|
|
6
|
+
export const ERROR_ALERT = 'error';
|
|
7
|
+
export const SUCCESS = 'SUCCESS';
|
|
8
|
+
export const REQUEST = 'REQUEST';
|
|
9
|
+
export const ERROR = 'ERROR';
|
|
10
|
+
export const STRING = 'STRING';
|
|
11
|
+
export const NUMBER = 'NUMBER';
|
|
12
|
+
export const DATE = 'DATE';
|
|
13
|
+
|
|
14
|
+
export const TAG = 'TAG';
|
|
15
|
+
export const EMBEDDED = 'embedded';
|
|
16
|
+
export const DEFAULT = 'default';
|
|
17
|
+
export const LIBRARY = 'library';
|
|
18
|
+
export const FULL = 'full';
|
|
19
|
+
export const ALL = 'all';
|
|
20
|
+
export const OUTBOUND = 'outbound';
|
|
21
|
+
export const VIET_GUYS = 'vietguyszalotrans';
|
|
22
|
+
|
|
23
|
+
const prefix = 'app/v2Containers/Zalo';
|
|
24
|
+
export const ZALO_TEMPLATE_INFO_REQUEST = `${prefix}/ZALO_TEMPLATE_INFO_REQUEST`;
|
|
25
|
+
export const ZALO_TEMPLATE_INFO_SUCCESS = `${prefix}/ZALO_TEMPLATE_INFO_SUCCESS`;
|
|
26
|
+
export const ZALO_TEMPLATE_INFO_ERROR = `${prefix}/ZALO_TEMPLATE_INFO_ERROR`;
|
|
27
|
+
export const ZALO_TEMPLATE_PREVIEW_RESET = `${prefix}/ZALO_TEMPLATE_PREVIEW_RESET`;
|
|
28
|
+
export const ZALO_TEMPLATE_PREVIEW_INFO = `${prefix}/ZALO_TEMPLATE_PREVIEW_INFO`;
|
|
29
|
+
export const ZALO_TEMPLATE_INFO_RESET = `${prefix}/ZALO_TEMPLATE_INFO_RESET`;
|
|
30
|
+
|
|
31
|
+
export const ZALO_STATUSES = {
|
|
32
|
+
PENDING_REVIEW: 'PENDING_REVIEW',
|
|
33
|
+
REJECT: 'REJECT',
|
|
34
|
+
ENABLE: 'ENABLE',
|
|
35
|
+
DISABLE: 'DISABLE',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const ZALO_STATUS_OPTIONS = [
|
|
39
|
+
{
|
|
40
|
+
key: 'enable',
|
|
41
|
+
value: ZALO_STATUSES.ENABLE,
|
|
42
|
+
label: <FormattedMessage {...messages.ENABLE_STATUS} />,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'reject',
|
|
46
|
+
value: ZALO_STATUSES.REJECT,
|
|
47
|
+
label: <FormattedMessage {...messages.REJECT_STATUS} />,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'disable',
|
|
51
|
+
value: ZALO_STATUSES.DISABLE,
|
|
52
|
+
label: <FormattedMessage {...messages.DISABLE_STATUS} />,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'reviewPending',
|
|
56
|
+
value: ZALO_STATUSES.PENDING_REVIEW,
|
|
57
|
+
label: <FormattedMessage {...messages.PENDING_REVIEW_STATUS} />,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
/* eslint-disable react/jsx-indent */
|
|
3
|
+
import React, { useState, useEffect } from 'react';
|
|
4
|
+
import { bindActionCreators } from 'redux';
|
|
5
|
+
import { createStructuredSelector } from 'reselect';
|
|
6
|
+
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
7
|
+
import { get, isEmpty, update } from 'lodash';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
10
|
+
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
11
|
+
import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
12
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
13
|
+
import CapAlert from '@capillarytech/cap-ui-library/CapAlert';
|
|
14
|
+
import CapInput from '@capillarytech/cap-ui-library/CapInput';
|
|
15
|
+
import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
|
|
16
|
+
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
17
|
+
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
18
|
+
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
19
|
+
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
20
|
+
import {
|
|
21
|
+
CAP_SPACE_16,
|
|
22
|
+
CAP_SPACE_24,
|
|
23
|
+
CAP_SPACE_32,
|
|
24
|
+
CAP_WHITE,
|
|
25
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
26
|
+
import { makeSelectZalo, makeSelectAccount, makeSelectGapitTemplates } from './selectors';
|
|
27
|
+
import { makeSelectMetaEntities, setInjectedTags } from '../Cap/selectors';
|
|
28
|
+
import * as zaloActions from './actions';
|
|
29
|
+
import './index.scss';
|
|
30
|
+
import {
|
|
31
|
+
SUCCESS_ALERT,
|
|
32
|
+
REQUEST,
|
|
33
|
+
EMBEDDED,
|
|
34
|
+
DEFAULT,
|
|
35
|
+
TAG,
|
|
36
|
+
FULL,
|
|
37
|
+
ALL,
|
|
38
|
+
OUTBOUND,
|
|
39
|
+
LIBRARY,
|
|
40
|
+
ERROR_ALERT,
|
|
41
|
+
WARNING_ALERT,
|
|
42
|
+
ZALO_STATUSES,
|
|
43
|
+
VIET_GUYS,
|
|
44
|
+
} from './constants';
|
|
45
|
+
import { SMS, ZALO } from '../CreativesContainer/constants';
|
|
46
|
+
import messages from './messages';
|
|
47
|
+
import globalMessages from '../Cap/messages';
|
|
48
|
+
import withCreatives from '../../hoc/withCreatives';
|
|
49
|
+
import TagList from '../TagList';
|
|
50
|
+
import { validateTags } from '../../utils/tagValidations';
|
|
51
|
+
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
52
|
+
|
|
53
|
+
export const Zalo = (props) => {
|
|
54
|
+
const {
|
|
55
|
+
intl,
|
|
56
|
+
actions,
|
|
57
|
+
isFullMode,
|
|
58
|
+
templateData = {},
|
|
59
|
+
editData = {},
|
|
60
|
+
accountData: { selectedZaloAccount = {}, senderDetails = {} } = {},
|
|
61
|
+
globalActions,
|
|
62
|
+
location,
|
|
63
|
+
getDefaultTags,
|
|
64
|
+
supportedTags,
|
|
65
|
+
metaEntities,
|
|
66
|
+
injectedTags,
|
|
67
|
+
getFormData,
|
|
68
|
+
selectedOfferDetails,
|
|
69
|
+
gapItTemplateData,
|
|
70
|
+
} = props || {};
|
|
71
|
+
const {hostName = ''} = senderDetails;
|
|
72
|
+
const { formatMessage } = intl;
|
|
73
|
+
const [oa_id, setOaId] = useState('');
|
|
74
|
+
const [token, setToken] = useState('');
|
|
75
|
+
const [username, setUsername] = useState('');
|
|
76
|
+
const [templateName, setTemplateName] = useState('');
|
|
77
|
+
const [templateId, setTemplateId] = useState('');
|
|
78
|
+
// Initialize the state for templateListParams based on the nested properties of templateData.
|
|
79
|
+
// If templateData.versions.base.content.zalo.listParams is available, use it.
|
|
80
|
+
// Otherwise, if hostName is VIET_GUYS and templateData.templateConfigs.varMapped is available,
|
|
81
|
+
// convert it to an array of entries. If not, use templateData.templateConfigs.varMapped or an empty array.
|
|
82
|
+
const [templateListParams, setTemplateListParams] = useState(
|
|
83
|
+
(templateData?.versions?.base?.content?.zalo?.listParams ||
|
|
84
|
+
((hostName === VIET_GUYS && templateData?.templateConfigs?.varMapped)
|
|
85
|
+
? Object.entries(templateData?.templateConfigs?.varMapped)
|
|
86
|
+
: templateData?.templateConfigs?.varMapped)) ?? []
|
|
87
|
+
);
|
|
88
|
+
const [templatePreviewUrl, setTemplatePreviewUrl] = useState('');
|
|
89
|
+
const [templateStatus, setZaloTemplateStatus] = useState(
|
|
90
|
+
ZALO_STATUSES.ENABLE,
|
|
91
|
+
);
|
|
92
|
+
const [gapitAllTemplateData, setGapitAllTemplateData] = useState([]);
|
|
93
|
+
const [tags, updateTags] = useState([]);
|
|
94
|
+
const [textAreaId, updateTextAreaId] = useState('');
|
|
95
|
+
const { zaloTemplateInfoValue = {}, zaloTemplateInfoStatus = REQUEST } =
|
|
96
|
+
editData;
|
|
97
|
+
const {
|
|
98
|
+
_id = '',
|
|
99
|
+
accountId = '',
|
|
100
|
+
zaloAccountId = '',
|
|
101
|
+
accountName = '',
|
|
102
|
+
templateConfigs: { id = '', varMapped = {} } = {},
|
|
103
|
+
token: zaloToken = '',
|
|
104
|
+
} = templateData;
|
|
105
|
+
const zaloTempId = _id || id;
|
|
106
|
+
const ZaloFooter = styled.div`
|
|
107
|
+
background-color: ${CAP_WHITE};
|
|
108
|
+
position: fixed;
|
|
109
|
+
bottom: 0;
|
|
110
|
+
width: 100%;
|
|
111
|
+
margin-left: -32px;
|
|
112
|
+
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
113
|
+
z-index: 1;
|
|
114
|
+
|
|
115
|
+
.ant-btn {
|
|
116
|
+
margin-right: ${CAP_SPACE_16};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
//gets account details
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!isEmpty(selectedZaloAccount) || !isEmpty(templateData)) {
|
|
123
|
+
const {
|
|
124
|
+
sourceAccountIdentifier = '',
|
|
125
|
+
configs: { token: accessToken = '' } = {},
|
|
126
|
+
name = '',
|
|
127
|
+
} = selectedZaloAccount;
|
|
128
|
+
const oaId = getDefaultTags === OUTBOUND ? zaloAccountId : accountId;
|
|
129
|
+
setOaId(sourceAccountIdentifier || oaId);
|
|
130
|
+
setToken(accessToken || zaloToken);
|
|
131
|
+
setUsername(name || accountName);
|
|
132
|
+
}
|
|
133
|
+
setGapitAllTemplateData(gapItTemplateData);
|
|
134
|
+
}, [selectedZaloAccount, templateData, gapItTemplateData]);
|
|
135
|
+
|
|
136
|
+
const updateTemplateData = (gapitTemplateId, templateName, listParams, previewUrl, status) => {
|
|
137
|
+
setTemplateName(templateName);
|
|
138
|
+
setTemplateId(gapitTemplateId);
|
|
139
|
+
setTemplateListParams(listParams);
|
|
140
|
+
setTemplatePreviewUrl(previewUrl);
|
|
141
|
+
setZaloTemplateStatus(status);
|
|
142
|
+
updateTextAreaId(listParams[0]?.name);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
//gets template details
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (zaloTempId && oa_id && token && username && hostName === VIET_GUYS) {
|
|
148
|
+
actions.getTemplateInfoById({
|
|
149
|
+
username,
|
|
150
|
+
oa_id,
|
|
151
|
+
token,
|
|
152
|
+
id: zaloTempId,
|
|
153
|
+
actionCallback,
|
|
154
|
+
});
|
|
155
|
+
} else if (hostName !== VIET_GUYS) {
|
|
156
|
+
const { _id: gapitTemplateId = '' } = templateData;
|
|
157
|
+
if (gapitTemplateId) {
|
|
158
|
+
const data = gapitAllTemplateData.find(template => template._id == gapitTemplateId);
|
|
159
|
+
const { templateName = "", listParams = [], previewUrl = "", status = "" } = data?.versions?.base?.content?.zalo || {};
|
|
160
|
+
updateTemplateData(gapitTemplateId, templateName, listParams, previewUrl, status);
|
|
161
|
+
} else {
|
|
162
|
+
const { id: gapitTemplateId = '', name: templateName = '', template: previewUrl = '', varMapped: listParams = {} } = templateData?.templateConfigs || {};
|
|
163
|
+
updateTemplateData(gapitTemplateId, templateName, listParams, previewUrl, ZALO_STATUSES.ENABLE);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//cleanup code
|
|
167
|
+
return () => {
|
|
168
|
+
actions.resetTemplateInfoData();
|
|
169
|
+
};
|
|
170
|
+
}, [zaloTempId, oa_id, token, username]);
|
|
171
|
+
|
|
172
|
+
const handleSetValues = (paramsData = []) =>
|
|
173
|
+
paramsData?.map((paramData) => {
|
|
174
|
+
for (const key in varMapped) {
|
|
175
|
+
if (paramData?.name === key) {
|
|
176
|
+
paramData.value = varMapped[key];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return paramData;
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const setDataForEdit = (setValues) => {
|
|
183
|
+
if(hostName === VIET_GUYS) {
|
|
184
|
+
const {
|
|
185
|
+
name = '',
|
|
186
|
+
_id: zaloId = '',
|
|
187
|
+
versions: {
|
|
188
|
+
base: {
|
|
189
|
+
content: {
|
|
190
|
+
zalo: {
|
|
191
|
+
listParams: paramsData = [],
|
|
192
|
+
previewUrl = '',
|
|
193
|
+
status = '',
|
|
194
|
+
} = {},
|
|
195
|
+
} = {},
|
|
196
|
+
} = {},
|
|
197
|
+
} = {},
|
|
198
|
+
} = zaloTemplateInfoValue;
|
|
199
|
+
const handledListParams = setValues ? handleSetValues(paramsData) : paramsData;
|
|
200
|
+
updateTemplateData(zaloId, name, handledListParams, previewUrl, status);
|
|
201
|
+
} else {
|
|
202
|
+
if (setValues) {
|
|
203
|
+
const { id: gapitTemplateId = '', name: templateName = '', template: previewUrl = '', varMapped: listParams = {} } = templateData?.templateConfigs || {};
|
|
204
|
+
const handledListParams = handleSetValues(listParams);
|
|
205
|
+
updateTemplateData(gapitTemplateId, templateName, handledListParams, previewUrl, ZALO_STATUSES.ENABLE);
|
|
206
|
+
} else {
|
|
207
|
+
const { _id: gapitTemplateId = '' } = templateData;
|
|
208
|
+
let data = gapitAllTemplateData?.find(template => template?._id == gapitTemplateId);
|
|
209
|
+
const { templateName = "", listParams = [], previewUrl = "", status = "" } = data?.versions?.base?.content?.zalo || {};
|
|
210
|
+
updateTemplateData(gapitTemplateId, templateName, listParams, previewUrl, status);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
setDataForEdit(false);
|
|
217
|
+
}, [zaloTemplateInfoValue]);
|
|
218
|
+
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (!isEmpty(varMapped)) {
|
|
221
|
+
setDataForEdit(true);
|
|
222
|
+
}
|
|
223
|
+
}, [varMapped, zaloTemplateInfoValue]);
|
|
224
|
+
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
let tag = get(metaEntities, `tags.standard`, []);
|
|
227
|
+
const { type, module } = location?.query || {};
|
|
228
|
+
if (type === EMBEDDED && module === LIBRARY && !getDefaultTags) {
|
|
229
|
+
tag = supportedTags;
|
|
230
|
+
}
|
|
231
|
+
updateTags(tag);
|
|
232
|
+
}, [metaEntities]);
|
|
233
|
+
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
//fetching tags
|
|
236
|
+
const { type, module } = location?.query || {};
|
|
237
|
+
const isEmbedded = type === EMBEDDED;
|
|
238
|
+
const query = {
|
|
239
|
+
layout: SMS,
|
|
240
|
+
type: TAG,
|
|
241
|
+
context: isEmbedded ? module : DEFAULT,
|
|
242
|
+
embedded: isEmbedded ? type : FULL,
|
|
243
|
+
};
|
|
244
|
+
if (getDefaultTags) {
|
|
245
|
+
query.context = getDefaultTags;
|
|
246
|
+
}
|
|
247
|
+
globalActions.fetchSchemaForEntity(query);
|
|
248
|
+
}, []);
|
|
249
|
+
|
|
250
|
+
const handleOnTagsContextChange = (data) => {
|
|
251
|
+
const { type } = location?.query || {};
|
|
252
|
+
const isEmbedded = type === EMBEDDED;
|
|
253
|
+
const query = {
|
|
254
|
+
layout: SMS,
|
|
255
|
+
type: TAG,
|
|
256
|
+
context:
|
|
257
|
+
(data || '').toLowerCase() === ALL
|
|
258
|
+
? DEFAULT
|
|
259
|
+
: (data || '').toLowerCase(),
|
|
260
|
+
embedded: isEmbedded ? type : FULL,
|
|
261
|
+
};
|
|
262
|
+
globalActions.fetchSchemaForEntity(query);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const onTagSelect = (data) => {
|
|
266
|
+
if (data && textAreaId) {
|
|
267
|
+
const updatedZaloTemplateInfo = templateListParams?.map((listParams) => {
|
|
268
|
+
const { name = '', value = '', minLength, maxLength } = listParams;
|
|
269
|
+
if (name === textAreaId) {
|
|
270
|
+
const text = `${value}{{${data}}}`;
|
|
271
|
+
const isLengthError =
|
|
272
|
+
text.length <= minLength || text.length > maxLength;
|
|
273
|
+
return {
|
|
274
|
+
...listParams,
|
|
275
|
+
value: text,
|
|
276
|
+
error: isLengthError
|
|
277
|
+
? formatMessage(messages.maxMinLengthMessage, {
|
|
278
|
+
minLength,
|
|
279
|
+
maxLength,
|
|
280
|
+
})
|
|
281
|
+
: '',
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
return listParams;
|
|
285
|
+
});
|
|
286
|
+
setTemplateListParams(updatedZaloTemplateInfo);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const tagValidationErrorMessage = (message) => {
|
|
291
|
+
const tagValidationResponse =
|
|
292
|
+
validateTags({
|
|
293
|
+
content: message,
|
|
294
|
+
tagsParam: tags,
|
|
295
|
+
injectedTagsParams: injectedTags,
|
|
296
|
+
location,
|
|
297
|
+
tagModule: getDefaultTags,
|
|
298
|
+
}) || {};
|
|
299
|
+
const { unsupportedTags = [], isBraceError } = tagValidationResponse;
|
|
300
|
+
let tagError = '';
|
|
301
|
+
if (unsupportedTags.length > 0) {
|
|
302
|
+
tagError = formatMessage(globalMessages.unsupportedTagsValidationError, {
|
|
303
|
+
unsupportedTags,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (isBraceError) {
|
|
307
|
+
tagError = formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
308
|
+
}
|
|
309
|
+
return tagError;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
//this function is used for checking errror validation in this it validate tags error and length error
|
|
313
|
+
const handleErrorValidation = (e, field) => {
|
|
314
|
+
const { minLength, maxLength } = field;
|
|
315
|
+
let error = e ? tagValidationErrorMessage(e) : '';
|
|
316
|
+
if (!e || e.length <= minLength || e.length > maxLength) {
|
|
317
|
+
error = formatMessage(messages.maxMinLengthMessage, {
|
|
318
|
+
minLength,
|
|
319
|
+
maxLength,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return error;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// this function is used for handle form data change in this also handle error validtion on change of value
|
|
326
|
+
const handleFormDataChange = (e, field) => {
|
|
327
|
+
const {
|
|
328
|
+
target: { value },
|
|
329
|
+
} = e;
|
|
330
|
+
const updatedZaloTemplateInfo = templateListParams?.map((listParams) => {
|
|
331
|
+
if (listParams?.name === field?.name) {
|
|
332
|
+
const error = handleErrorValidation(value, field);
|
|
333
|
+
return {
|
|
334
|
+
...listParams,
|
|
335
|
+
value,
|
|
336
|
+
error,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
return listParams;
|
|
340
|
+
});
|
|
341
|
+
setTemplateListParams(updatedZaloTemplateInfo);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const renderTextBoxesForListParams = (listParam) => {
|
|
345
|
+
const { name, error, value } = listParam;
|
|
346
|
+
return (
|
|
347
|
+
<CapInput
|
|
348
|
+
id={`zalo-${name}`}
|
|
349
|
+
onChange={(e) => handleFormDataChange(e, listParam)}
|
|
350
|
+
errorMessage={error}
|
|
351
|
+
placeholder={formatMessage(messages.addVariableWithMessage)}
|
|
352
|
+
defaultValue={value || ''}
|
|
353
|
+
value={value || ''}
|
|
354
|
+
size="default"
|
|
355
|
+
onFocus={() => setTextAreaId(name)}
|
|
356
|
+
disabled={isFullMode}
|
|
357
|
+
/>
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
const setTextAreaId = (fieldName) => {
|
|
362
|
+
updateTextAreaId(fieldName);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const getTemplateStatusType = () => {
|
|
366
|
+
switch (templateStatus) {
|
|
367
|
+
case ZALO_STATUSES.ENABLE:
|
|
368
|
+
return SUCCESS_ALERT;
|
|
369
|
+
case ZALO_STATUSES.REJECT:
|
|
370
|
+
return ERROR_ALERT;
|
|
371
|
+
default:
|
|
372
|
+
return WARNING_ALERT;
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const actionCallback = () => {
|
|
377
|
+
CapNotification.error({
|
|
378
|
+
message: formatMessage(messages.zaloFailureNotificationTemplate),
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const isEditDoneDisabled = () => {
|
|
383
|
+
let disableCheck = false;
|
|
384
|
+
templateListParams?.forEach((listParams) => {
|
|
385
|
+
const { error, value } = listParams;
|
|
386
|
+
const errorMessage = !error
|
|
387
|
+
? handleErrorValidation(value, listParams)
|
|
388
|
+
: error;
|
|
389
|
+
if (errorMessage) {
|
|
390
|
+
disableCheck = true;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
return disableCheck;
|
|
394
|
+
};
|
|
395
|
+
const createPayload = () => {
|
|
396
|
+
let varMap = {};
|
|
397
|
+
if (hostName !== VIET_GUYS) {
|
|
398
|
+
varMap = templateListParams;
|
|
399
|
+
} else {
|
|
400
|
+
templateListParams?.forEach((listParam) => {
|
|
401
|
+
const { name = '', value = '' } = listParam;
|
|
402
|
+
varMap[name] = value;
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
const payload = {
|
|
407
|
+
channel: ZALO,
|
|
408
|
+
accountId: oa_id,
|
|
409
|
+
...(getDefaultTags === OUTBOUND && {
|
|
410
|
+
zaloAccountId: oa_id,
|
|
411
|
+
}),
|
|
412
|
+
accountName: username,
|
|
413
|
+
templateConfigs: {
|
|
414
|
+
id: templateId?.toString(),
|
|
415
|
+
name: templateName,
|
|
416
|
+
template: templatePreviewUrl,
|
|
417
|
+
varMapped: varMap,
|
|
418
|
+
},
|
|
419
|
+
token,
|
|
420
|
+
host: hostName,
|
|
421
|
+
};
|
|
422
|
+
return payload;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const saveToMessage = () => {
|
|
426
|
+
getFormData({
|
|
427
|
+
value: createPayload(),
|
|
428
|
+
_id: templateId,
|
|
429
|
+
validity: true,
|
|
430
|
+
type: ZALO,
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const renderContent = () =>
|
|
435
|
+
templateListParams?.map((listParam) => {
|
|
436
|
+
const { name = '', value = '', maxLength } = listParam;
|
|
437
|
+
return (
|
|
438
|
+
<>
|
|
439
|
+
{renderTextBoxesForListParams(listParam)}
|
|
440
|
+
<CapRow className="variable-field-container">
|
|
441
|
+
<CapLabel className="variable-field-name">
|
|
442
|
+
{formatMessage(messages.variableType, {
|
|
443
|
+
name,
|
|
444
|
+
})}
|
|
445
|
+
</CapLabel>
|
|
446
|
+
<CapLabel className="variable-field-length">
|
|
447
|
+
{formatMessage(messages.charactersCount, {
|
|
448
|
+
variableLength: value.length,
|
|
449
|
+
maxLength,
|
|
450
|
+
})}
|
|
451
|
+
</CapLabel>
|
|
452
|
+
</CapRow>
|
|
453
|
+
</>
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return (
|
|
458
|
+
<CapSpin spinning={zaloTemplateInfoStatus === REQUEST && hostName === VIET_GUYS}>
|
|
459
|
+
<CapRow type="flex" className="cap-zalo-creatives">
|
|
460
|
+
<CapColumn span={14}>
|
|
461
|
+
{templateStatus && (
|
|
462
|
+
<CapAlert
|
|
463
|
+
message={
|
|
464
|
+
<CapLabel type="label2">
|
|
465
|
+
{formatMessage(messages.approvedStatusMsg, {
|
|
466
|
+
status: formatMessage(messages?.[templateStatus]),
|
|
467
|
+
})}
|
|
468
|
+
</CapLabel>
|
|
469
|
+
}
|
|
470
|
+
type={getTemplateStatusType()}
|
|
471
|
+
/>
|
|
472
|
+
)}
|
|
473
|
+
<CapRow>
|
|
474
|
+
<CapRow className="whatsapp-render-heading">
|
|
475
|
+
<CapHeader
|
|
476
|
+
className="zalo-variable-heading"
|
|
477
|
+
title={
|
|
478
|
+
<CapHeading type="h4">
|
|
479
|
+
{formatMessage(messages.variables)}
|
|
480
|
+
</CapHeading>
|
|
481
|
+
}
|
|
482
|
+
suffix={
|
|
483
|
+
<TagList
|
|
484
|
+
label={formatMessage(globalMessages.addLabels)}
|
|
485
|
+
onTagSelect={onTagSelect}
|
|
486
|
+
location={location}
|
|
487
|
+
tags={tags || []}
|
|
488
|
+
onContextChange={handleOnTagsContextChange}
|
|
489
|
+
injectedTags={injectedTags || {}}
|
|
490
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
491
|
+
disabled={isFullMode}
|
|
492
|
+
/>
|
|
493
|
+
}
|
|
494
|
+
/>
|
|
495
|
+
</CapRow>
|
|
496
|
+
<CapRow className="zalo-variable-list">{renderContent()}</CapRow>
|
|
497
|
+
</CapRow>
|
|
498
|
+
</CapColumn>
|
|
499
|
+
<CapColumn span={10}>
|
|
500
|
+
<TemplatePreview
|
|
501
|
+
channel={ZALO}
|
|
502
|
+
templateData={{ templatePreviewUrl, fullMode: isFullMode }}
|
|
503
|
+
/>
|
|
504
|
+
</CapColumn>
|
|
505
|
+
</CapRow>
|
|
506
|
+
{!isFullMode && (
|
|
507
|
+
<ZaloFooter>
|
|
508
|
+
<CapTooltip
|
|
509
|
+
title={
|
|
510
|
+
isEditDoneDisabled()
|
|
511
|
+
? formatMessage(messages.btnDisabledTooltip)
|
|
512
|
+
: ''
|
|
513
|
+
}
|
|
514
|
+
placement={'right'}
|
|
515
|
+
>
|
|
516
|
+
<div className="button-disabled-tooltip-wrapper">
|
|
517
|
+
<CapButton
|
|
518
|
+
onClick={saveToMessage}
|
|
519
|
+
disabled={isEditDoneDisabled()}
|
|
520
|
+
>
|
|
521
|
+
<FormattedMessage {...globalMessages.done} />
|
|
522
|
+
</CapButton>
|
|
523
|
+
</div>
|
|
524
|
+
</CapTooltip>
|
|
525
|
+
</ZaloFooter>
|
|
526
|
+
)}
|
|
527
|
+
</CapSpin>
|
|
528
|
+
);
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
const mapStateToProps = createStructuredSelector({
|
|
532
|
+
editData: makeSelectZalo(),
|
|
533
|
+
accountData: makeSelectAccount(),
|
|
534
|
+
metaEntities: makeSelectMetaEntities(),
|
|
535
|
+
injectedTags: setInjectedTags(),
|
|
536
|
+
gapItTemplateData: makeSelectGapitTemplates(),
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
const mapDispatchToProps = (dispatch) => ({
|
|
540
|
+
actions: bindActionCreators(zaloActions, dispatch),
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
export default withCreatives({
|
|
544
|
+
WrappedComponent: injectIntl(Zalo),
|
|
545
|
+
mapStateToProps,
|
|
546
|
+
mapDispatchToProps,
|
|
547
|
+
userAuth: true,
|
|
548
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.cap-zalo-creatives {
|
|
5
|
+
.zalo-variable-heading {
|
|
6
|
+
margin-top: $CAP_SPACE_24;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.zalo-variable-list {
|
|
10
|
+
margin: 0px 0px 200px;
|
|
11
|
+
|
|
12
|
+
input {
|
|
13
|
+
height: $CAP_SPACE_40;
|
|
14
|
+
margin-top: $CAP_SPACE_16;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ant-calendar-picker {
|
|
18
|
+
width: 100%;
|
|
19
|
+
|
|
20
|
+
.ant-calendar-picker-icon {
|
|
21
|
+
top: 50%;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ant-input-suffix {
|
|
26
|
+
top: 62%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.variable-field-container {
|
|
31
|
+
display: flex;
|
|
32
|
+
margin-top: $CAP_SPACE_08;
|
|
33
|
+
|
|
34
|
+
div {
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.variable-field-length {
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.zalo-preview-container {
|
|
45
|
+
position: fixed;
|
|
46
|
+
text-align: center;
|
|
47
|
+
padding-left: 72px;
|
|
48
|
+
padding-right: 110px;
|
|
49
|
+
|
|
50
|
+
.preview-head {
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
font-size: $FONT_SIZE_M;
|
|
53
|
+
color: $FONT_COLOR_01;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.preview-text {
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
font-size: $FONT_SIZE_S;
|
|
59
|
+
padding-top: $CAP_SPACE_08;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.preview-link {
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
font-size: $FONT_SIZE_M;
|
|
65
|
+
color: $FONT_COLOR_05;
|
|
66
|
+
margin-top: $CAP_SPACE_19;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
|
|
69
|
+
svg {
|
|
70
|
+
height: $CAP_SPACE_16;
|
|
71
|
+
width: $CAP_SPACE_16;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|