@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
package/services/api.js
CHANGED
|
@@ -7,7 +7,9 @@ import config from '../config/app';
|
|
|
7
7
|
import pathConfig from '../config/path';
|
|
8
8
|
import getSchema from './getSchema';
|
|
9
9
|
import * as API from '../utils/ApiCaller';
|
|
10
|
-
import { GA } from '@capillarytech/cap-ui-utils';
|
|
10
|
+
import { GA, decompressJsonObject } from '@capillarytech/cap-ui-utils';
|
|
11
|
+
import { addBaseToTemplate } from '../utils/commonUtils';
|
|
12
|
+
import { EMAIL, SMS } from '../v2Containers/CreativesContainer/constants';
|
|
11
13
|
let API_ENDPOINT = config.development.api_endpoint;
|
|
12
14
|
let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
|
|
13
15
|
let CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_endpoint;
|
|
@@ -42,12 +44,6 @@ function getUrlWithQueryParams({url, queryParams}) {
|
|
|
42
44
|
return updatedUrl;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
// const loginUrl = (process.env.NODE_ENV === 'production') ?
|
|
46
|
-
// config.production.login_url : config.development.login_url;
|
|
47
|
-
|
|
48
|
-
// const loginUrl = (process.env.NODE_ENV === 'production') ?
|
|
49
|
-
// `${pathConfig.publicPath}${config.production.login_url}` : `${pathConfig.publicPath}${config.development.login_url}`;
|
|
50
|
-
|
|
51
47
|
function redirectIfUnauthenticated(response) {
|
|
52
48
|
const isUnauthorized = response.status === 401;
|
|
53
49
|
const isLoginPage = window.location.pathname.indexOf('auth/login') !== -1;
|
|
@@ -84,13 +80,13 @@ function checkStatus(response) {
|
|
|
84
80
|
statusCode: status,
|
|
85
81
|
});
|
|
86
82
|
}
|
|
87
|
-
if ((status >= 200 && status < 300) || [
|
|
83
|
+
if ((status >= 200 && status < 300) || [400, 409, 413, 500].includes(response.status)) {
|
|
88
84
|
return response;
|
|
89
85
|
}
|
|
90
86
|
const isLoginPage = window.location.pathname.indexOf('/login') !== -1;
|
|
91
87
|
if (!isLoginPage) redirectIfUnauthenticated(response);
|
|
92
88
|
|
|
93
|
-
const error = new Error(
|
|
89
|
+
const error = new Error(statusText);
|
|
94
90
|
error.response = response;
|
|
95
91
|
error.isError = true;
|
|
96
92
|
error.status = status;
|
|
@@ -98,7 +94,7 @@ function checkStatus(response) {
|
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
function showSomethingwentWrong() {
|
|
101
|
-
window.history.pushState({}, '', `${pathConfig.publicPath}v2/somethingwentwrong`);
|
|
97
|
+
window.history.pushState({}, '', `${pathConfig.publicPath}/v2/somethingwentwrong`);
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
function request(url, options, handleUnauthorizedStatus) {
|
|
@@ -269,16 +265,28 @@ export const createChannelWiseTemplate = ({ channel, template }) => {
|
|
|
269
265
|
|
|
270
266
|
|
|
271
267
|
export const getTemplateDetails = ({id, channel}) => {
|
|
272
|
-
const url = `${API_ENDPOINT}/templates/${id}/${channel ? channel.toUpperCase() :
|
|
273
|
-
|
|
268
|
+
const url = `${API_ENDPOINT}/templates/v1/${id}/${channel ? channel.toUpperCase() : SMS}`;
|
|
269
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
270
|
+
return compressedTemplatesData.then((data) => {
|
|
271
|
+
const { response = '' } = data || {};
|
|
272
|
+
const decompressData = decompressJsonObject(response);
|
|
273
|
+
if (channel?.toUpperCase() === EMAIL) {
|
|
274
|
+
return { ...data, response: addBaseToTemplate(decompressData) };
|
|
275
|
+
}
|
|
276
|
+
return { ...data, response: decompressData };
|
|
277
|
+
});
|
|
274
278
|
};
|
|
275
279
|
|
|
276
280
|
export const getAllTemplates = ({channel, queryParams = {}}) => {
|
|
277
281
|
const url = getUrlWithQueryParams({
|
|
278
|
-
url: `${API_ENDPOINT}/templates/${channel}?`,
|
|
282
|
+
url: `${API_ENDPOINT}/templates/v1/${channel}?`,
|
|
279
283
|
queryParams,
|
|
280
284
|
});
|
|
281
|
-
|
|
285
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
286
|
+
return compressedTemplatesData.then((data) => {
|
|
287
|
+
const { response = '' } = data || {};
|
|
288
|
+
return { ...data, response: decompressJsonObject(response)};
|
|
289
|
+
});
|
|
282
290
|
};
|
|
283
291
|
|
|
284
292
|
export const deleteTemplate = ({channel, id}) => {
|
|
@@ -304,7 +312,18 @@ export const deleteAssetById = ({assetId, assetType}) => {
|
|
|
304
312
|
|
|
305
313
|
export const uploadFile = ({file, assetType, fileParams, mode, wechatParams, whatsappParams}) => {
|
|
306
314
|
const data = new FormData();
|
|
307
|
-
|
|
315
|
+
let fileName = '';
|
|
316
|
+
try {
|
|
317
|
+
fileName = encodeURIComponent(file?.name || '');
|
|
318
|
+
} catch (error) {
|
|
319
|
+
fileName = file?.name || '';
|
|
320
|
+
}
|
|
321
|
+
// Creating a new File object with the modified filename
|
|
322
|
+
const modifiedFile = new File([file], fileName, {
|
|
323
|
+
type: file?.type,
|
|
324
|
+
});
|
|
325
|
+
// Append the modified file to the FormData object
|
|
326
|
+
data.append('file', modifiedFile);
|
|
308
327
|
data.append('fileParam', JSON.stringify(fileParams));
|
|
309
328
|
if (mode) {
|
|
310
329
|
data.append('mode', mode);
|
|
@@ -493,9 +512,35 @@ export const getSenderDetails = (channel, orgUnitId) => {
|
|
|
493
512
|
export const getCdnTransformationConfig = () => {
|
|
494
513
|
const url = `${API_ENDPOINT}/common/getCdnTransformationConfig`;
|
|
495
514
|
return request(url, getAPICallObject('GET'));
|
|
496
|
-
}
|
|
515
|
+
};
|
|
497
516
|
|
|
498
517
|
export const getS3UrlFileSizes = (data) => {
|
|
499
518
|
const url = `${API_ENDPOINT}/assets/files/metadata`;
|
|
500
519
|
return request(url, getAPICallObject('POST', data));
|
|
501
|
-
}
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
export const getTemplateInfoById = ({id, username, oa_id, token}) => {
|
|
523
|
+
const url = `${API_ENDPOINT}/templates/v1/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
|
|
524
|
+
const compressedTemplatesData = request(url, getAPICallObject('GET'));
|
|
525
|
+
return compressedTemplatesData.then((data) => {
|
|
526
|
+
const { response = '' } = data || {};
|
|
527
|
+
return { ...data, response: decompressJsonObject(response)};
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export const getMetaTags = ({previewUrl}) => {
|
|
532
|
+
const url = `${API_ENDPOINT}/common/getMetaTags?url=${previewUrl}`;
|
|
533
|
+
return request(url, getAPICallObject('GET'));
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
export const getSupportVideosConfig = () => {
|
|
537
|
+
const url = `${ARYA_ENDPOINT}/support_videos/?product=Creatives`;
|
|
538
|
+
return request(url, getAPICallObject('GET'));
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
export const getNavigationConfigApi = async () => {
|
|
542
|
+
const url = `${ARYA_ENDPOINT}/navigations`;
|
|
543
|
+
return await request(url, getAPICallObject('GET'));
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export {request, getAPICallObject};
|
|
@@ -2,11 +2,26 @@ import {
|
|
|
2
2
|
getSenderDetails,
|
|
3
3
|
uploadFile,
|
|
4
4
|
getCdnTransformationConfig,
|
|
5
|
-
createWhatsappTemplate
|
|
5
|
+
createWhatsappTemplate,
|
|
6
|
+
getMetaTags,
|
|
7
|
+
getSupportVideosConfig,
|
|
8
|
+
getNavigationConfigApi,
|
|
9
|
+
getAllTemplates,
|
|
10
|
+
getTemplateDetails,
|
|
11
|
+
getTemplateInfoById,
|
|
6
12
|
} from '../api';
|
|
7
13
|
import { mockData } from './mockData';
|
|
8
14
|
const sampleFile = require('../../assets/line.png');
|
|
9
15
|
|
|
16
|
+
let mockDecompressJsonObject;
|
|
17
|
+
jest.mock('@capillarytech/cap-ui-utils', () => {
|
|
18
|
+
mockDecompressJsonObject = jest.fn();
|
|
19
|
+
return {
|
|
20
|
+
...jest.requireActual('@capillarytech/cap-ui-utils'),
|
|
21
|
+
decompressJsonObject: mockDecompressJsonObject,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
10
25
|
describe('getSenderDetails -- Test with valid responses', () => {
|
|
11
26
|
it('Should return correct response', () =>
|
|
12
27
|
expect(getSenderDetails('WHATSAPP', -1)).toEqual(Promise.resolve()));
|
|
@@ -36,6 +51,25 @@ describe('uploadFile -- whatsapp image upload', () => {
|
|
|
36
51
|
},
|
|
37
52
|
}),
|
|
38
53
|
).toEqual(Promise.resolve()));
|
|
54
|
+
|
|
55
|
+
it('Uploads the file with the original filename when encodeURIComponent fails', async () => {
|
|
56
|
+
// Mocking the encodeURIComponent function to throw an error
|
|
57
|
+
global.encodeURIComponent = jest.fn(() => { throw new Error('encodeURIComponent error'); });
|
|
58
|
+
const blob = new Blob([''], { type: 'image/jpeg' });
|
|
59
|
+
const file = new File([blob], '@%test.jpeg', { type: 'image/jpeg' });
|
|
60
|
+
expect(
|
|
61
|
+
uploadFile({
|
|
62
|
+
file,
|
|
63
|
+
assetType: 'image',
|
|
64
|
+
fileParams: {
|
|
65
|
+
width: 275,
|
|
66
|
+
height: 183,
|
|
67
|
+
error: false,
|
|
68
|
+
},
|
|
69
|
+
whatsappParams: {},
|
|
70
|
+
}),
|
|
71
|
+
).toEqual(Promise.resolve());
|
|
72
|
+
});
|
|
39
73
|
});
|
|
40
74
|
|
|
41
75
|
describe('createWhatsappTemplate -- Test with valid responses', () => {
|
|
@@ -44,3 +78,216 @@ describe('createWhatsappTemplate -- Test with valid responses', () => {
|
|
|
44
78
|
createWhatsappTemplate(sampleFile, mockData.createWhatsappPayload),
|
|
45
79
|
).toEqual(Promise.resolve()));
|
|
46
80
|
});
|
|
81
|
+
|
|
82
|
+
describe('getMetaTags -- Test with valid responses', () => {
|
|
83
|
+
it('Should return correct response', () =>
|
|
84
|
+
expect(
|
|
85
|
+
getMetaTags({previewUrl: 'https://capillarytech.com'}),
|
|
86
|
+
).toEqual(Promise.resolve()));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe('getSupportVideosConfig -- Test with valid responses', () => {
|
|
90
|
+
it('Should return correct response', () =>
|
|
91
|
+
expect(getSupportVideosConfig()).toEqual(Promise.resolve()));
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('getNavigationConfigApi -- Test with valid responses', () => {
|
|
95
|
+
it('Should return correct response', () =>
|
|
96
|
+
expect(getNavigationConfigApi()).toEqual(Promise.resolve()));
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe('getAllTemplates -- Test with valid responses', () => {
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
global.fetch = jest.fn(); // Mocking global fetch function
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
afterEach(() => {
|
|
105
|
+
jest.restoreAllMocks(); // Restore all mocks after each test
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('Should return correct response', async () => {
|
|
109
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
110
|
+
status: 200,
|
|
111
|
+
json: () => Promise.resolve({
|
|
112
|
+
status: 200,
|
|
113
|
+
response: {
|
|
114
|
+
_id: '123',
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
}));
|
|
118
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
119
|
+
_id: '123',
|
|
120
|
+
});
|
|
121
|
+
expect(await getAllTemplates({channel: 'email'})).toEqual({
|
|
122
|
+
response: {
|
|
123
|
+
_id: '123',
|
|
124
|
+
},
|
|
125
|
+
status: 200,
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('Should not return correct response', async () => {
|
|
130
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
131
|
+
status: 200,
|
|
132
|
+
json: () => Promise.resolve({
|
|
133
|
+
status: 200,
|
|
134
|
+
data: {
|
|
135
|
+
_id: '123',
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
}));
|
|
139
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
140
|
+
_id: '123',
|
|
141
|
+
});
|
|
142
|
+
expect(await getAllTemplates({channel: 'email'})).toEqual({
|
|
143
|
+
data: {
|
|
144
|
+
_id: '123',
|
|
145
|
+
},
|
|
146
|
+
response: {
|
|
147
|
+
_id: '123',
|
|
148
|
+
},
|
|
149
|
+
status: 200,
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe('getTemplateDetails -- Test with valid responses', () => {
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
global.fetch = jest.fn(); // Mocking global fetch function
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
afterEach(() => {
|
|
160
|
+
jest.restoreAllMocks(); // Restore all mocks after each test
|
|
161
|
+
});
|
|
162
|
+
it('Should return correct response', async () => {
|
|
163
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
164
|
+
status: 200,
|
|
165
|
+
json: () => Promise.resolve({
|
|
166
|
+
status: 200,
|
|
167
|
+
response: {
|
|
168
|
+
_id: '123',
|
|
169
|
+
versions: {
|
|
170
|
+
history: ['v1', 'v2'],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
}));
|
|
175
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
176
|
+
_id: '123',
|
|
177
|
+
versions: {
|
|
178
|
+
history: ['v1', 'v2'],
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
expect(await getTemplateDetails({id: '123', channel: 'email'})).toEqual({
|
|
182
|
+
response: {
|
|
183
|
+
_id: '123',
|
|
184
|
+
versions: {
|
|
185
|
+
history: ['v1', 'v2'],
|
|
186
|
+
base: 'v1',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
status: 200,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('Should return response when channel is not email', async () => {
|
|
194
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
195
|
+
status: 200,
|
|
196
|
+
json: () => Promise.resolve({
|
|
197
|
+
status: 200,
|
|
198
|
+
data: {
|
|
199
|
+
_id: '123',
|
|
200
|
+
versions: {
|
|
201
|
+
history: ['v1', 'v2'],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
205
|
+
}));
|
|
206
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
207
|
+
_id: '123',
|
|
208
|
+
versions: {
|
|
209
|
+
history: ['v1', 'v2'],
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
expect(await getTemplateDetails({id: '123'})).toEqual({
|
|
213
|
+
data: {
|
|
214
|
+
_id: '123',
|
|
215
|
+
versions: {
|
|
216
|
+
history: ['v1', 'v2'],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
response: {
|
|
220
|
+
_id: '123',
|
|
221
|
+
versions: {
|
|
222
|
+
history: ['v1', 'v2'],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
status: 200,
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
describe('getTemplateInfoById -- Test with valid responses', () => {
|
|
231
|
+
beforeEach(() => {
|
|
232
|
+
global.fetch = jest.fn(); // Mocking global fetch function
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
afterEach(() => {
|
|
236
|
+
jest.restoreAllMocks(); // Restore all mocks after each test
|
|
237
|
+
});
|
|
238
|
+
it('Should return correct response', async () => {
|
|
239
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
240
|
+
status: 200,
|
|
241
|
+
json: () => Promise.resolve({
|
|
242
|
+
status: 200,
|
|
243
|
+
response: {
|
|
244
|
+
_id: '123',
|
|
245
|
+
},
|
|
246
|
+
}),
|
|
247
|
+
}));
|
|
248
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
249
|
+
_id: '123',
|
|
250
|
+
});
|
|
251
|
+
expect(await getTemplateInfoById({id: '123', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
252
|
+
response: {
|
|
253
|
+
_id: '123',
|
|
254
|
+
},
|
|
255
|
+
status: 200,
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('Should not return correct response', async () => {
|
|
260
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
261
|
+
status: 200,
|
|
262
|
+
json: () => Promise.resolve({
|
|
263
|
+
status: 200,
|
|
264
|
+
data: {
|
|
265
|
+
_id: '1234',
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
}));
|
|
269
|
+
mockDecompressJsonObject.mockReturnValue({
|
|
270
|
+
_id: '1234',
|
|
271
|
+
});
|
|
272
|
+
expect(await getTemplateInfoById({id: '1234', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
273
|
+
data: {
|
|
274
|
+
_id: '1234',
|
|
275
|
+
},
|
|
276
|
+
response: {
|
|
277
|
+
_id: '1234',
|
|
278
|
+
},
|
|
279
|
+
status: 200,
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('Should not return correct response when data is undefined', async () => {
|
|
284
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
285
|
+
status: 200,
|
|
286
|
+
json: () => Promise.resolve(),
|
|
287
|
+
}));
|
|
288
|
+
mockDecompressJsonObject.mockReturnValue(undefined);
|
|
289
|
+
expect(await getTemplateInfoById({id: '123', username: 'capillary_zns', 'oa_id': 'jfhagsdhj', token: 'tuyagjahs'})).toEqual({
|
|
290
|
+
response: undefined,
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
@@ -211,3 +211,16 @@
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
.cap-collapsible-new-nav {
|
|
215
|
+
.l2-quick-link-heading, .l2-item-submodule {
|
|
216
|
+
width: 11.25rem;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.l1-enabled-popover-container .l2-item-submodule {
|
|
221
|
+
width: 11.25rem;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.l1-enabled-popover-container .ant-popover-inner-content .l2-quick-link-container {
|
|
225
|
+
padding: 0.571rem 0.471rem;
|
|
226
|
+
}
|
|
@@ -83,6 +83,14 @@
|
|
|
83
83
|
color: #333333;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
.contet-width-collapse {
|
|
87
|
+
margin-left: 17rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.content-width-expanded {
|
|
91
|
+
margin-left: 4.475rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
.breadcrumbs{
|
|
87
95
|
color: $blue-cloud-burst-54;
|
|
88
96
|
margin: 16px 10px 12px 10px;
|
|
@@ -166,3 +174,9 @@
|
|
|
166
174
|
html {
|
|
167
175
|
font-size: 16px !important;
|
|
168
176
|
}
|
|
177
|
+
|
|
178
|
+
.cap-collapsible-new-nav, .l1-enabled-popover-container {
|
|
179
|
+
.l2-quick-links-icon {
|
|
180
|
+
margin-top: 0.5rem;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
within,
|
|
12
12
|
} from '../../../utils/test-utils';
|
|
13
13
|
|
|
14
|
-
import configureStore from '
|
|
14
|
+
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
15
|
+
import { initialReducer } from '../../../initialReducer';
|
|
15
16
|
import { mockInitialState } from './mocks/initialState';
|
|
16
17
|
import TemplatesV2 from '../../../v2Containers/TemplatesV2';
|
|
17
18
|
import globalMessages from '../../../v2Containers/Cap/messages';
|
|
@@ -35,8 +36,8 @@ jest.setTimeout(60000);
|
|
|
35
36
|
let history;
|
|
36
37
|
|
|
37
38
|
const initializeCreatives = () => {
|
|
38
|
-
const store = configureStore(mockInitialState, history);
|
|
39
39
|
history = createMemoryHistory();
|
|
40
|
+
const store = configureStore(mockInitialState, initialReducer, history);
|
|
40
41
|
history.push('creatives/ui/v2');
|
|
41
42
|
render(
|
|
42
43
|
<Provider store={store}>
|
|
@@ -273,12 +274,8 @@ describe("Creatives testing template creation", () => {
|
|
|
273
274
|
fireEvent.change(templateNameInput, {
|
|
274
275
|
target: { value: 'viber_test_template' },
|
|
275
276
|
});
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
/Text message/,
|
|
279
|
-
{},
|
|
280
|
-
);
|
|
281
|
-
const msgBox = templateTextInput.parentElement.nextSibling.firstChild;
|
|
277
|
+
const msgBox = screen.getByPlaceholderText(/Enter message/i);
|
|
278
|
+
msgBox.focus();
|
|
282
279
|
//Enter a template text message
|
|
283
280
|
fireEvent.change(msgBox, {
|
|
284
281
|
target: { value: 'viber_template_message' },
|
|
@@ -288,11 +285,11 @@ describe("Creatives testing template creation", () => {
|
|
|
288
285
|
fireEvent.change(msgBox, {
|
|
289
286
|
target: { value: ' ' },
|
|
290
287
|
});
|
|
291
|
-
expect(creativesScreen.getByText(/template
|
|
288
|
+
expect(creativesScreen.getByText(/template message cannot be empty/i)).toBeInTheDocument();
|
|
292
289
|
fireEvent.change(msgBox, {
|
|
293
290
|
target: { value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' },
|
|
294
291
|
});
|
|
295
|
-
expect(creativesScreen.getByText(/Template
|
|
292
|
+
expect(creativesScreen.getByText(/Template message length cannot exceed 1000/i)).toBeInTheDocument();
|
|
296
293
|
fireEvent.change(msgBox, {
|
|
297
294
|
target: { value: ' viber_test_template}}} ' },
|
|
298
295
|
});
|
|
@@ -306,24 +303,32 @@ describe("Creatives testing template creation", () => {
|
|
|
306
303
|
// first click opens the popup, and second click closes it, clicking twice is intentional
|
|
307
304
|
userEvent.click(addLabel);
|
|
308
305
|
userEvent.click(addLabel);
|
|
306
|
+
const imageRadio = creativesScreen.getByRole('radio', {name: /image/i});
|
|
307
|
+
fireEvent.click(imageRadio);
|
|
309
308
|
const imageUploader = creativesScreen.getByRole('button', {
|
|
310
|
-
name: /drag and drop image here or
|
|
309
|
+
name: /drag and drop image here or select from computer gallery/i,
|
|
311
310
|
});
|
|
312
311
|
expect(within(imageUploader).getByRole('button', {
|
|
313
|
-
name: /
|
|
312
|
+
name: /select from computer/i,
|
|
314
313
|
})).toBeInTheDocument();
|
|
315
314
|
const galleryBtn = within(imageUploader).getByRole('button', {
|
|
316
315
|
name: globalMessages.gallery.defaultMessage,
|
|
317
316
|
});
|
|
318
317
|
|
|
319
318
|
//configuring CTA button
|
|
320
|
-
const
|
|
321
|
-
|
|
319
|
+
const ctaRadioBtn = creativesScreen.getByRole('radio', {
|
|
320
|
+
name: /call to action create a button that lets customers respond to your messages or take action/i,
|
|
321
|
+
});
|
|
322
|
+
fireEvent.click(ctaRadioBtn);
|
|
323
|
+
const btnTextBox = await creativesScreen.findByPlaceholderText(
|
|
324
|
+
'Enter button text',
|
|
325
|
+
);
|
|
322
326
|
fireEvent.change(btnTextBox, {
|
|
323
327
|
target: { value: 'button' },
|
|
324
328
|
});
|
|
325
|
-
const
|
|
326
|
-
|
|
329
|
+
const btnUrlBox = await creativesScreen.findByPlaceholderText(
|
|
330
|
+
'Enter button url',
|
|
331
|
+
);
|
|
327
332
|
fireEvent.change(btnUrlBox, {
|
|
328
333
|
target: { value: 'button' },
|
|
329
334
|
});
|
package/tests/store.test.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
* Test store addons
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import configureStore from '
|
|
5
|
+
import { createBrowserHistory } from 'history';
|
|
6
|
+
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
7
|
+
import { initialReducer } from '../initialReducer';
|
|
7
8
|
|
|
8
9
|
describe('configureStore', () => {
|
|
9
10
|
let store;
|
|
11
|
+
let browserHistory = createBrowserHistory();
|
|
10
12
|
|
|
11
13
|
beforeAll(() => {
|
|
12
|
-
store = configureStore({}, browserHistory);
|
|
14
|
+
store = configureStore({}, initialReducer, browserHistory);
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
describe('asyncReducers', () => {
|
package/translations/en.json
CHANGED
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
"creatives.components.TemplatePreview.smsFormatType": "Message has unicode characters",
|
|
138
138
|
"creatives.components.TemplatePreview.smsIcon": "Sms Icon",
|
|
139
139
|
"creatives.components.TemplatePreview.unicodeIconTooltip": "This message has unicode characters. This may affect the cost per message.",
|
|
140
|
-
"creatives.components.TestPage.header": "Looks like youas are lost!",
|
|
141
140
|
"creatives.components.Toastr.header": "This is the Toastr component !",
|
|
142
141
|
"creatives.components.ToastrMessage.close": "close",
|
|
143
142
|
"creatives.components.ToastrMessage.header": "This is the ToastrMessage component !",
|
|
@@ -822,9 +821,6 @@
|
|
|
822
821
|
"creatives.containers.Templates.wechatHeader": "WECHAT",
|
|
823
822
|
"creatives.containers.Templates.yesText": "Yes",
|
|
824
823
|
"creatives.containers.Templates.zipUploadFailed": "Failed to upload zip file",
|
|
825
|
-
"creatives.containers.Testv2.descriptionTestv2": "Description of Testv2",
|
|
826
|
-
"creatives.containers.Testv2.header": "This is Testv2 container !",
|
|
827
|
-
"creatives.containers.Testv2.testv2": "Testv2",
|
|
828
824
|
"creatives.containers.View.descriptionView": "Description of View",
|
|
829
825
|
"creatives.containers.View.header": "This is View container !",
|
|
830
826
|
"creatives.containers.View.view": "View",
|
|
@@ -1830,10 +1826,6 @@
|
|
|
1830
1826
|
"creatives.containersV2.TemplatesV2.viber": "Viber",
|
|
1831
1827
|
"creatives.containersV2.TemplatesV2.wechat": "Wechat",
|
|
1832
1828
|
"creatives.containersV2.TemplatesV2.whatsapp": "WhatsApp",
|
|
1833
|
-
"creatives.containersV2.TestPage.header": "Looks like youas are lost!",
|
|
1834
|
-
"creatives.containersV2.Testv2.descriptionTestv2": "Description of Testv2",
|
|
1835
|
-
"creatives.containersV2.Testv2.header": "This is Testv2 container !",
|
|
1836
|
-
"creatives.containersV2.Testv2.testv2": "Testv2",
|
|
1837
1829
|
"creatives.containersV2.View.descriptionView": "Description of View",
|
|
1838
1830
|
"creatives.containersV2.View.header": "This is View container !",
|
|
1839
1831
|
"creatives.containersV2.View.view": "View",
|
|
@@ -1897,7 +1889,7 @@
|
|
|
1897
1889
|
"creatives.containersV2.Whatsapp.awaitingStatusMsg": "This template is awaiting approval",
|
|
1898
1890
|
"creatives.containersV2.Whatsapp.azerbaijani": "Azerbaijani",
|
|
1899
1891
|
"creatives.containersV2.Whatsapp.bengali": "Bengali",
|
|
1900
|
-
"creatives.containersV2.Whatsapp.btnDesc": "These will be
|
|
1892
|
+
"creatives.containersV2.Whatsapp.btnDesc": "These will be clickable buttons below your message.",
|
|
1901
1893
|
"creatives.containersV2.Whatsapp.btnDisabledTooltip": "Please add all mandatory fields to proceed further",
|
|
1902
1894
|
"creatives.containersV2.Whatsapp.btnLabel": "Buttons",
|
|
1903
1895
|
"creatives.containersV2.Whatsapp.btnTypeCTA": "Call to action",
|
package/translations/ja-JP.json
CHANGED
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
"creatives.components.TemplatePreview.smsFormatType": "",
|
|
138
138
|
"creatives.components.TemplatePreview.smsIcon": "",
|
|
139
139
|
"creatives.components.TemplatePreview.unicodeIconTooltip": "",
|
|
140
|
-
"creatives.components.TestPage.header": "",
|
|
141
140
|
"creatives.components.Toastr.header": "",
|
|
142
141
|
"creatives.components.ToastrMessage.close": "",
|
|
143
142
|
"creatives.components.ToastrMessage.header": "",
|
|
@@ -822,9 +821,6 @@
|
|
|
822
821
|
"creatives.containers.Templates.wechatHeader": "",
|
|
823
822
|
"creatives.containers.Templates.yesText": "",
|
|
824
823
|
"creatives.containers.Templates.zipUploadFailed": "",
|
|
825
|
-
"creatives.containers.Testv2.descriptionTestv2": "",
|
|
826
|
-
"creatives.containers.Testv2.header": "",
|
|
827
|
-
"creatives.containers.Testv2.testv2": "",
|
|
828
824
|
"creatives.containers.View.descriptionView": "",
|
|
829
825
|
"creatives.containers.View.header": "",
|
|
830
826
|
"creatives.containers.View.view": "",
|
|
@@ -1830,10 +1826,6 @@
|
|
|
1830
1826
|
"creatives.containersV2.TemplatesV2.viber": "",
|
|
1831
1827
|
"creatives.containersV2.TemplatesV2.wechat": "",
|
|
1832
1828
|
"creatives.containersV2.TemplatesV2.whatsapp": "",
|
|
1833
|
-
"creatives.containersV2.TestPage.header": "",
|
|
1834
|
-
"creatives.containersV2.Testv2.descriptionTestv2": "",
|
|
1835
|
-
"creatives.containersV2.Testv2.header": "",
|
|
1836
|
-
"creatives.containersV2.Testv2.testv2": "",
|
|
1837
1829
|
"creatives.containersV2.View.descriptionView": "",
|
|
1838
1830
|
"creatives.containersV2.View.header": "",
|
|
1839
1831
|
"creatives.containersV2.View.view": "",
|
package/translations/zh.json
CHANGED
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
"creatives.components.TemplatePreview.smsFormatType": "",
|
|
138
138
|
"creatives.components.TemplatePreview.smsIcon": "",
|
|
139
139
|
"creatives.components.TemplatePreview.unicodeIconTooltip": "",
|
|
140
|
-
"creatives.components.TestPage.header": "",
|
|
141
140
|
"creatives.components.Toastr.header": "",
|
|
142
141
|
"creatives.components.ToastrMessage.close": "",
|
|
143
142
|
"creatives.components.ToastrMessage.header": "",
|
|
@@ -822,9 +821,6 @@
|
|
|
822
821
|
"creatives.containers.Templates.wechatHeader": "",
|
|
823
822
|
"creatives.containers.Templates.yesText": "",
|
|
824
823
|
"creatives.containers.Templates.zipUploadFailed": "",
|
|
825
|
-
"creatives.containers.Testv2.descriptionTestv2": "",
|
|
826
|
-
"creatives.containers.Testv2.header": "",
|
|
827
|
-
"creatives.containers.Testv2.testv2": "",
|
|
828
824
|
"creatives.containers.View.descriptionView": "",
|
|
829
825
|
"creatives.containers.View.header": "",
|
|
830
826
|
"creatives.containers.View.view": "",
|
|
@@ -1830,10 +1826,6 @@
|
|
|
1830
1826
|
"creatives.containersV2.TemplatesV2.viber": "",
|
|
1831
1827
|
"creatives.containersV2.TemplatesV2.wechat": "",
|
|
1832
1828
|
"creatives.containersV2.TemplatesV2.whatsapp": "",
|
|
1833
|
-
"creatives.containersV2.TestPage.header": "",
|
|
1834
|
-
"creatives.containersV2.Testv2.descriptionTestv2": "",
|
|
1835
|
-
"creatives.containersV2.Testv2.header": "",
|
|
1836
|
-
"creatives.containersV2.Testv2.testv2": "",
|
|
1837
1829
|
"creatives.containersV2.View.descriptionView": "",
|
|
1838
1830
|
"creatives.containersV2.View.header": "",
|
|
1839
1831
|
"creatives.containersV2.View.view": "",
|