@capillarytech/creatives-library 8.0.159 → 8.0.161
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/components/BreadCrumbs/index.js +65 -0
- package/components/BreadCrumbs/messages.js +13 -0
- package/components/CapTagList/index.js +235 -0
- package/components/CapTagList/messages.js +45 -0
- package/components/Card/_customCard.scss +40 -0
- package/components/Card/index.js +78 -0
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +20 -0
- package/components/CardGrid/index.js +71 -0
- package/components/Ckeditor/index.js +238 -0
- package/components/Ckeditor/messages.js +13 -0
- package/components/Ckeditor/style.scss +3 -0
- package/components/Component/index.js +29 -0
- package/components/CustomPopOver/index.js +81 -0
- package/components/CustomPopOver/messages.js +17 -0
- package/components/DateFilter/index.js +349 -0
- package/components/DateFilter/messages.js +57 -0
- package/components/DateRange/index.js +114 -0
- package/components/DateRange/messages.js +25 -0
- package/components/Edmeditor/index.js +65 -0
- package/components/Edmeditor/messages.js +13 -0
- package/components/EmailPreview/_emailPreview.scss +119 -0
- package/components/EmailPreview/assets/images/iPad.svg +10 -0
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +107 -0
- package/components/EmailPreview/messages.js +33 -0
- package/components/Footer/index.js +27 -0
- package/components/Footer/messages.js +13 -0
- package/components/FormBuilder/_formBuilder.scss +83 -0
- package/components/FormBuilder/index.js +3279 -0
- package/components/FormBuilder/messages.js +61 -0
- package/components/Header/index.js +44 -0
- package/components/Header/messages.js +29 -0
- package/components/ImagePreview/_imagePreview.scss +63 -0
- package/components/ImagePreview/index.js +52 -0
- package/components/ImagePreview/messages.js +17 -0
- package/components/PageHeader/_pageHeader.scss +22 -0
- package/components/PageHeader/index.js +37 -0
- package/components/PageHeader/messages.js +13 -0
- package/components/Pagination/_pagination.scss +5 -0
- package/components/Pagination/index.js +49 -0
- package/components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/components/PreviewSideBar/index.js +152 -0
- package/components/PreviewSideBar/messages.js +41 -0
- package/components/Sidebar/_sidebar.scss +115 -0
- package/components/Sidebar/index.js +214 -0
- package/components/Sidebar/messages.js +21 -0
- package/components/SlideBox/_slideBox.scss +63 -0
- package/components/SlideBox/index.js +47 -0
- package/components/SlideBox/tests/index.test.js +103 -0
- package/components/SmsEditor/index.js +55 -0
- package/components/SmsTest/index.js +117 -0
- package/components/SmsTest/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/_templatePreview.scss +642 -0
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
- package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
- package/components/TemplatePreview/index.js +617 -0
- package/components/TemplatePreview/messages.js +78 -0
- package/components/Toastr/index.js +60 -0
- package/components/Toastr/messages.js +13 -0
- package/components/ToastrMessage/index.js +113 -0
- package/components/ToastrMessage/messages.js +17 -0
- package/components/TopBar/_topbar.scss +46 -0
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +113 -0
- package/components/TopBar/messages.js +29 -0
- package/containers/App/actions.js +7 -0
- package/containers/App/constants.js +114 -0
- package/containers/App/index.js +52 -0
- package/containers/App/reducer.js +19 -0
- package/containers/App/sagas.js +31 -0
- package/containers/App/selectors.js +25 -0
- package/containers/App/test/saga.test.js +11 -0
- package/containers/Assets/Gallery/_gallery.scss +126 -0
- package/containers/Assets/Gallery/actions.js +37 -0
- package/containers/Assets/Gallery/constants.js +23 -0
- package/containers/Assets/Gallery/index.js +473 -0
- package/containers/Assets/Gallery/messages.js +93 -0
- package/containers/Assets/Gallery/reducer.js +81 -0
- package/containers/Assets/Gallery/sagas.js +80 -0
- package/containers/Assets/Gallery/selectors.js +25 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
- package/containers/Assets/Gallery/tests/actions.test.js +25 -0
- package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
- package/containers/Assets/Gallery/tests/saga.test.js +157 -0
- package/containers/Cap/actions.js +66 -0
- package/containers/Cap/constants.js +25 -0
- package/containers/Cap/index.js +402 -0
- package/containers/Cap/messages.js +75 -0
- package/containers/Cap/reducer.js +113 -0
- package/containers/Cap/sagas.js +159 -0
- package/containers/Cap/selectors.js +75 -0
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +2270 -0
- package/containers/Cap/tests/index.test.js +22 -0
- package/containers/Cap/tests/saga.test.js +284 -0
- package/containers/Dashboard/actions.js +15 -0
- package/containers/Dashboard/constants.js +7 -0
- package/containers/Dashboard/index.js +76 -0
- package/containers/Dashboard/messages.js +13 -0
- package/containers/Dashboard/reducer.js +21 -0
- package/containers/Dashboard/sagas.js +17 -0
- package/containers/Dashboard/selectors.js +25 -0
- package/containers/Dashboard/test/saga.test.js +9 -0
- package/containers/Ebill/_ebill.scss +5 -0
- package/containers/Ebill/actions.js +43 -0
- package/containers/Ebill/constants.js +20 -0
- package/containers/Ebill/index.js +1278 -0
- package/containers/Ebill/messages.js +77 -0
- package/containers/Ebill/reducer.js +72 -0
- package/containers/Ebill/sagas.js +74 -0
- package/containers/Ebill/selectors.js +25 -0
- package/containers/Ebill/test/saga.test.js +11 -0
- package/containers/Email/_email.scss +141 -0
- package/containers/Email/actions.js +81 -0
- package/containers/Email/constants.js +36 -0
- package/containers/Email/index.js +3325 -0
- package/containers/Email/messages.js +289 -0
- package/containers/Email/reducer.js +142 -0
- package/containers/Email/sagas.js +135 -0
- package/containers/Email/selectors.js +31 -0
- package/containers/Email/test/saga.test.js +671 -0
- package/containers/LanguageProvider/actions.js +17 -0
- package/containers/LanguageProvider/constants.js +8 -0
- package/containers/LanguageProvider/index.js +80 -0
- package/containers/LanguageProvider/reducer.js +30 -0
- package/containers/LanguageProvider/selectors.js +20 -0
- package/containers/LanguageProvider/tests/actions.test.js +19 -0
- package/containers/LanguageProvider/tests/index.test.js +78 -0
- package/containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/containers/Line/Create/_lineCreate.scss +54 -0
- package/containers/Line/Create/actions.js +90 -0
- package/containers/Line/Create/constants.js +39 -0
- package/containers/Line/Create/index.js +836 -0
- package/containers/Line/Create/messages.js +189 -0
- package/containers/Line/Create/reducer.js +99 -0
- package/containers/Line/Create/sagas.js +121 -0
- package/containers/Line/Create/selectors.js +36 -0
- package/containers/Line/Create/tests/saga.test.js +202 -0
- package/containers/Line/Edit/_lineEdit.scss +35 -0
- package/containers/Line/Edit/actions.js +79 -0
- package/containers/Line/Edit/constants.js +27 -0
- package/containers/Line/Edit/index.js +1050 -0
- package/containers/Line/Edit/messages.js +177 -0
- package/containers/Line/Edit/reducer.js +83 -0
- package/containers/Line/Edit/sagas.js +80 -0
- package/containers/Line/Edit/selectors.js +29 -0
- package/containers/Line/Edit/test/saga.test.js +160 -0
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +62 -0
- package/containers/Login/components/LoginForm/messages.js +33 -0
- package/containers/Login/index.js +130 -0
- package/containers/Login/messages.js +25 -0
- package/containers/Login/selectors.js +25 -0
- package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Create/actions.js +46 -0
- package/containers/MobilePush/Create/constants.js +23 -0
- package/containers/MobilePush/Create/index.js +2303 -0
- package/containers/MobilePush/Create/messages.js +269 -0
- package/containers/MobilePush/Create/reducer.js +70 -0
- package/containers/MobilePush/Create/sagas.js +74 -0
- package/containers/MobilePush/Create/selectors.js +28 -0
- package/containers/MobilePush/Create/test/saga.test.js +19 -0
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Edit/actions.js +91 -0
- package/containers/MobilePush/Edit/constants.js +35 -0
- package/containers/MobilePush/Edit/index.js +2601 -0
- package/containers/MobilePush/Edit/messages.js +266 -0
- package/containers/MobilePush/Edit/reducer.js +112 -0
- package/containers/MobilePush/Edit/sagas.js +126 -0
- package/containers/MobilePush/Edit/selectors.js +29 -0
- package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
- package/containers/NotFoundPage/index.js +25 -0
- package/containers/NotFoundPage/messages.js +13 -0
- package/containers/NotFoundPage/tests/index.test.js +17 -0
- package/containers/Sms/Create/_smsCreate.scss +42 -0
- package/containers/Sms/Create/actions.js +27 -0
- package/containers/Sms/Create/constants.js +16 -0
- package/containers/Sms/Create/index.js +1488 -0
- package/containers/Sms/Create/messages.js +109 -0
- package/containers/Sms/Create/reducer.js +41 -0
- package/containers/Sms/Create/sagas.js +40 -0
- package/containers/Sms/Create/selectors.js +28 -0
- package/containers/Sms/Create/test/saga.test.js +11 -0
- package/containers/Sms/Edit/actions.js +40 -0
- package/containers/Sms/Edit/constants.js +17 -0
- package/containers/Sms/Edit/index.js +1472 -0
- package/containers/Sms/Edit/messages.js +105 -0
- package/containers/Sms/Edit/reducer.js +50 -0
- package/containers/Sms/Edit/sagas.js +60 -0
- package/containers/Sms/Edit/selectors.js +32 -0
- package/containers/Sms/Edit/test/saga.test.js +13 -0
- package/containers/TagList/_tagList.scss +8 -0
- package/containers/TagList/actions.js +15 -0
- package/containers/TagList/constants.js +32 -0
- package/containers/TagList/index.js +236 -0
- package/containers/TagList/messages.js +13 -0
- package/containers/TagList/reducer.js +23 -0
- package/containers/TagList/sagas.js +11 -0
- package/containers/TagList/selectors.js +25 -0
- package/containers/Templates/_templates.scss +333 -0
- package/containers/Templates/actions.js +103 -0
- package/containers/Templates/constants.js +60 -0
- package/containers/Templates/index.js +1756 -0
- package/containers/Templates/messages.js +337 -0
- package/containers/Templates/reducer.js +142 -0
- package/containers/Templates/sagas.js +163 -0
- package/containers/Templates/selectors.js +28 -0
- package/containers/Templates/test/saga.test.js +241 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1610 -0
- package/containers/WeChat/MapTemplates/messages.js +157 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +84 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/index.js +2 -4
- package/package.json +1 -1
- package/routes.js +202 -136
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +0 -1
- package/tests/i18n.test.js +1 -1
- package/utils/asyncInjectors.js +78 -0
- package/utils/authWrapper.js +1 -1
- package/utils/callNativeEvent.js +16 -0
- package/utils/checkStore.js +21 -0
- package/utils/common.js +2 -2
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/tagValidations.js +1 -1
- package/utils/tests/authWrapper.test.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +1 -1
- package/v2Components/CapTagList/index.js +14 -9
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/CustomerSearchSection/index.js +83 -79
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/EmailPreview/_emailPreview.scss +1 -0
- package/v2Components/EmailPreviewV2/_emailPreviewV2.scss +1 -0
- package/v2Components/FormBuilder/index.js +80 -55
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +1 -1
- package/v2Components/TestAndPreviewSlidebox/SendTestMessage.js +1 -1
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +2 -1
- package/v2Components/TestAndPreviewSlidebox/index.js +223 -22
- package/v2Components/TestAndPreviewSlidebox/reducer.js +15 -6
- package/v2Components/TestAndPreviewSlidebox/sagas.js +24 -3
- package/v2Components/TestAndPreviewSlidebox/tests/PreviewSection.test.js +1 -1
- package/v2Components/TestAndPreviewSlidebox/tests/reducer.test.js +21 -5
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +20 -5
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +9 -3
- package/v2Containers/CreativesContainer/index.js +22 -15
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +599 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +1941 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +5 -0
- package/v2Containers/Email/index.js +116 -32
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +6 -0
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +1 -1
- package/v2Containers/Sms/Create/index.js +1 -1
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/constants/unified.js +0 -189
|
@@ -4,6 +4,7 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { SlideBoxContent } from '../SlideBoxContent';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
import { templateDetailsImage, templateDetailsVideo, templateDetailsText, templateDetails_ } from '../../Viber/tests/mockData';
|
|
7
|
+
import { CREATE, RICH_MEDIA } from '../../WeChat/Wrapper/constants';
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
10
|
whatsappEditTemplateData,
|
|
@@ -26,14 +27,37 @@ jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
|
26
27
|
describe('Test SlideBoxContent container', () => {
|
|
27
28
|
const onCreateComplete = jest.fn();
|
|
28
29
|
let renderedComponent;
|
|
30
|
+
let originalDate;
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
beforeAll(() => {
|
|
33
|
+
// Store the original Date
|
|
34
|
+
originalDate = global.Date;
|
|
35
|
+
// Mock Date to always return a fixed timestamp
|
|
36
|
+
const fixedDate = new Date('2024-01-01T00:00:00.000Z');
|
|
37
|
+
global.Date = class extends Date {
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
return fixedDate;
|
|
41
|
+
}
|
|
42
|
+
getMilliseconds() {
|
|
43
|
+
return 123; // Fixed milliseconds value
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterAll(() => {
|
|
49
|
+
// Restore the original Date
|
|
50
|
+
global.Date = originalDate;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const renderFunction = (channel, mode, templateData, additionalProps = {}) => {
|
|
31
54
|
renderedComponent = shallowWithIntl(
|
|
32
55
|
<SlideBoxContent
|
|
33
56
|
slidBoxContent={mode}
|
|
34
57
|
currentChannel={channel}
|
|
35
58
|
templateData={templateData}
|
|
36
59
|
onCreateComplete={onCreateComplete}
|
|
60
|
+
{...additionalProps}
|
|
37
61
|
/>,
|
|
38
62
|
);
|
|
39
63
|
};
|
|
@@ -102,4 +126,578 @@ describe('Test SlideBoxContent container', () => {
|
|
|
102
126
|
renderFunction('VIBER', 'preview', templateDetailsText);
|
|
103
127
|
expect(renderedComponent).toMatchSnapshot();
|
|
104
128
|
});
|
|
129
|
+
|
|
130
|
+
it('Should render correctly with isTestAndPreviewMode enabled', () => {
|
|
131
|
+
// Test with WhatsApp channel
|
|
132
|
+
renderFunction('WHATSAPP', 'createTemplate', { mode: 'create' }, { isTestAndPreviewMode: true });
|
|
133
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
134
|
+
|
|
135
|
+
// Test with Email channel
|
|
136
|
+
renderFunction('EMAIL', 'createTemplate', { mode: 'create' }, { isTestAndPreviewMode: true });
|
|
137
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
138
|
+
|
|
139
|
+
// Test with preview mode
|
|
140
|
+
renderFunction('VIBER', 'preview', templateDetailsText, { isTestAndPreviewMode: true });
|
|
141
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('Should render correctly with isTestAndPreviewMode disabled', () => {
|
|
145
|
+
// Test with WhatsApp channel
|
|
146
|
+
renderFunction('WHATSAPP', 'createTemplate', { mode: 'create' }, { isTestAndPreviewMode: false });
|
|
147
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
148
|
+
|
|
149
|
+
// Test with Email channel
|
|
150
|
+
renderFunction('EMAIL', 'createTemplate', { mode: 'create' }, { isTestAndPreviewMode: false });
|
|
151
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
152
|
+
|
|
153
|
+
// Test with preview mode
|
|
154
|
+
renderFunction('VIBER', 'preview', templateDetailsText, { isTestAndPreviewMode: false });
|
|
155
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('Should handle isTestAndPreviewMode IIFE implementation correctly', () => {
|
|
159
|
+
// Test the IIFE implementation with true value
|
|
160
|
+
const wrapper = shallowWithIntl(
|
|
161
|
+
<SlideBoxContent
|
|
162
|
+
slidBoxContent="createTemplate"
|
|
163
|
+
currentChannel="WHATSAPP"
|
|
164
|
+
templateData={{ mode: 'create' }}
|
|
165
|
+
onCreateComplete={onCreateComplete}
|
|
166
|
+
isTestAndPreviewMode={(() => {
|
|
167
|
+
return true;
|
|
168
|
+
})()}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
expect(wrapper).toMatchSnapshot();
|
|
172
|
+
|
|
173
|
+
// Test the IIFE implementation with false value
|
|
174
|
+
const wrapper2 = shallowWithIntl(
|
|
175
|
+
<SlideBoxContent
|
|
176
|
+
slidBoxContent="createTemplate"
|
|
177
|
+
currentChannel="WHATSAPP"
|
|
178
|
+
templateData={{ mode: 'create' }}
|
|
179
|
+
onCreateComplete={onCreateComplete}
|
|
180
|
+
isTestAndPreviewMode={(() => {
|
|
181
|
+
return false;
|
|
182
|
+
})()}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
expect(wrapper2).toMatchSnapshot();
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
describe('getWechatTemplateType utility function', () => {
|
|
189
|
+
it('Should return RICH_MEDIA when mode is not CREATE and msgcontent is RICH_MEDIA_WECHAT', () => {
|
|
190
|
+
const templateData = {
|
|
191
|
+
definition: {
|
|
192
|
+
msgcontent: 'RICH_MEDIA_WECHAT'
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
renderFunction('WECHAT', 'editTemplate', templateData);
|
|
196
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('Should return MAP_TEMPLATE when mode is not CREATE and msgcontent is not RICH_MEDIA_WECHAT', () => {
|
|
200
|
+
const templateData = {
|
|
201
|
+
definition: {
|
|
202
|
+
msgcontent: 'OTHER'
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
renderFunction('WECHAT', 'editTemplate', templateData);
|
|
206
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('Should return weChatTemplateType when mode is CREATE', () => {
|
|
210
|
+
renderFunction('WECHAT', CREATE, null, { weChatTemplateType: RICH_MEDIA });
|
|
211
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
describe('getLineType utility function', () => {
|
|
216
|
+
it('Should handle LINE channel in create mode with full mode', () => {
|
|
217
|
+
renderFunction('LINE', 'createTemplate', null, { isFullMode: true });
|
|
218
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('Should handle LINE channel in edit mode with full mode', () => {
|
|
222
|
+
renderFunction('LINE', 'editTemplate', { type: 'LINE' }, { isFullMode: true });
|
|
223
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('Should handle LINE channel in non-full mode with template data', () => {
|
|
227
|
+
const templateData = {
|
|
228
|
+
isDefault: true,
|
|
229
|
+
_id: '123',
|
|
230
|
+
versions: {
|
|
231
|
+
base: {
|
|
232
|
+
content: {
|
|
233
|
+
messages: [{ text: 'test' }]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
renderFunction('LINE', 'editTemplate', templateData, { isFullMode: false });
|
|
239
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('Should handle LINE channel in non-full mode with default template', () => {
|
|
243
|
+
const templateData = {
|
|
244
|
+
isDefault: true
|
|
245
|
+
};
|
|
246
|
+
renderFunction('LINE', 'createTemplate', templateData, { isFullMode: false });
|
|
247
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
describe('getViber utility function', () => {
|
|
252
|
+
it('Should handle VIBER channel in create mode', () => {
|
|
253
|
+
renderFunction('VIBER', 'createTemplate', null);
|
|
254
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('Should handle VIBER channel in edit mode', () => {
|
|
258
|
+
renderFunction('VIBER', 'editTemplate', { type: 'VIBER' });
|
|
259
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('Should handle non-VIBER channel', () => {
|
|
263
|
+
renderFunction('SMS', 'createTemplate', null);
|
|
264
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
describe('Email component isTestAndPreviewMode IIFE', () => {
|
|
269
|
+
const commonEmailProps = {
|
|
270
|
+
editor: 'default',
|
|
271
|
+
cap: {},
|
|
272
|
+
showTemplateName: jest.fn(),
|
|
273
|
+
onValidationFail: jest.fn(),
|
|
274
|
+
moduleType: 'email',
|
|
275
|
+
showLiquidErrorInFooter: false,
|
|
276
|
+
eventContextTags: {},
|
|
277
|
+
isLoyaltyModule: false,
|
|
278
|
+
handleTestAndPreview: jest.fn(),
|
|
279
|
+
handleCloseTestAndPreview: jest.fn()
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
it('Should handle isTestAndPreviewMode IIFE in Email edit mode with ID', () => {
|
|
283
|
+
const emailTemplateData = {
|
|
284
|
+
type: 'EMAIL',
|
|
285
|
+
_id: '123',
|
|
286
|
+
versions: {
|
|
287
|
+
base: {
|
|
288
|
+
content: {}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// Test with isTestAndPreviewMode true
|
|
294
|
+
renderFunction('EMAIL', 'editTemplate', emailTemplateData, {
|
|
295
|
+
...commonEmailProps,
|
|
296
|
+
isTestAndPreviewMode: true,
|
|
297
|
+
showTestAndPreviewSlidebox: true
|
|
298
|
+
});
|
|
299
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
300
|
+
|
|
301
|
+
// Test with isTestAndPreviewMode false
|
|
302
|
+
renderFunction('EMAIL', 'editTemplate', emailTemplateData, {
|
|
303
|
+
...commonEmailProps,
|
|
304
|
+
isTestAndPreviewMode: false,
|
|
305
|
+
showTestAndPreviewSlidebox: false
|
|
306
|
+
});
|
|
307
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('Should handle isTestAndPreviewMode IIFE in Email edit mode without ID', () => {
|
|
311
|
+
const emailTemplateData = {
|
|
312
|
+
type: 'EMAIL',
|
|
313
|
+
versions: {
|
|
314
|
+
base: {
|
|
315
|
+
content: {}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// Test with isTestAndPreviewMode true
|
|
321
|
+
renderFunction('EMAIL', 'editTemplate', emailTemplateData, {
|
|
322
|
+
...commonEmailProps,
|
|
323
|
+
isTestAndPreviewMode: true,
|
|
324
|
+
showTestAndPreviewSlidebox: true
|
|
325
|
+
});
|
|
326
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
327
|
+
|
|
328
|
+
// Test with isTestAndPreviewMode false
|
|
329
|
+
renderFunction('EMAIL', 'editTemplate', emailTemplateData, {
|
|
330
|
+
...commonEmailProps,
|
|
331
|
+
isTestAndPreviewMode: false,
|
|
332
|
+
showTestAndPreviewSlidebox: false
|
|
333
|
+
});
|
|
334
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe('getChannelPreviewContent utility function for LINE messages type detection', () => {
|
|
339
|
+
it('Should detect text type in LINE messages', () => {
|
|
340
|
+
const templateData = {
|
|
341
|
+
type: 'LINE',
|
|
342
|
+
versions: {
|
|
343
|
+
base: {
|
|
344
|
+
content: {
|
|
345
|
+
messages: [{
|
|
346
|
+
text: 'Hello World'
|
|
347
|
+
}]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
renderFunction('LINE', 'preview', templateData);
|
|
353
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it('Should detect image type in LINE messages', () => {
|
|
357
|
+
const templateData = {
|
|
358
|
+
type: 'LINE',
|
|
359
|
+
versions: {
|
|
360
|
+
base: {
|
|
361
|
+
content: {
|
|
362
|
+
messages: [{
|
|
363
|
+
previewImageUrl: 'image.jpg'
|
|
364
|
+
}]
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
renderFunction('LINE', 'preview', templateData);
|
|
370
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
it('Should detect sticker type in LINE messages', () => {
|
|
374
|
+
const templateData = {
|
|
375
|
+
type: 'LINE',
|
|
376
|
+
versions: {
|
|
377
|
+
base: {
|
|
378
|
+
content: {
|
|
379
|
+
messages: [{
|
|
380
|
+
selectedSticker: {
|
|
381
|
+
stickerUrl: 'sticker.jpg',
|
|
382
|
+
stickerId: '123',
|
|
383
|
+
packageId: '456'
|
|
384
|
+
}
|
|
385
|
+
}]
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
renderFunction('LINE', 'preview', templateData);
|
|
391
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
392
|
+
|
|
393
|
+
// Test with just stickerUrl
|
|
394
|
+
const templateData2 = {
|
|
395
|
+
type: 'LINE',
|
|
396
|
+
versions: {
|
|
397
|
+
base: {
|
|
398
|
+
content: {
|
|
399
|
+
messages: [{
|
|
400
|
+
stickerUrl: 'sticker.jpg'
|
|
401
|
+
}]
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
renderFunction('LINE', 'preview', templateData2);
|
|
407
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it('Should detect imagemap type in LINE messages', () => {
|
|
411
|
+
const templateData = {
|
|
412
|
+
type: 'LINE',
|
|
413
|
+
versions: {
|
|
414
|
+
base: {
|
|
415
|
+
content: {
|
|
416
|
+
messages: [{
|
|
417
|
+
baseUrl: 'base.jpg'
|
|
418
|
+
}]
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
renderFunction('LINE', 'preview', templateData);
|
|
424
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('Should detect video type in LINE messages', () => {
|
|
428
|
+
const templateData = {
|
|
429
|
+
type: 'LINE',
|
|
430
|
+
versions: {
|
|
431
|
+
base: {
|
|
432
|
+
content: {
|
|
433
|
+
messages: [{
|
|
434
|
+
video: {
|
|
435
|
+
originalContentUrl: 'video.mp4',
|
|
436
|
+
externalLink: {
|
|
437
|
+
linkUri: 'example.com'
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}]
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
renderFunction('LINE', 'preview', templateData);
|
|
446
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it('Should detect image_carousel type in LINE messages with template', () => {
|
|
450
|
+
const templateData = {
|
|
451
|
+
type: 'LINE',
|
|
452
|
+
versions: {
|
|
453
|
+
base: {
|
|
454
|
+
content: {
|
|
455
|
+
messages: [{
|
|
456
|
+
template: {}
|
|
457
|
+
}]
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
renderFunction('LINE', 'preview', templateData);
|
|
463
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
it('Should detect image_carousel type in LINE messages with contents', () => {
|
|
467
|
+
const templateData = {
|
|
468
|
+
type: 'LINE',
|
|
469
|
+
versions: {
|
|
470
|
+
base: {
|
|
471
|
+
content: {
|
|
472
|
+
messages: [{
|
|
473
|
+
contents: {}
|
|
474
|
+
}]
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
renderFunction('LINE', 'preview', templateData);
|
|
480
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
describe('getChannelPreviewContent utility function', () => {
|
|
485
|
+
it('Should handle SMS channel preview content with DLT enabled', () => {
|
|
486
|
+
const templateData = {
|
|
487
|
+
type: 'SMS',
|
|
488
|
+
versions: {
|
|
489
|
+
base: {
|
|
490
|
+
'updated-sms-editor': ['Hello', 'World']
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
renderFunction('SMS', 'preview', templateData, { smsRegister: true, isFullMode: true });
|
|
495
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it('Should handle SMS channel preview content without DLT', () => {
|
|
499
|
+
const templateData = {
|
|
500
|
+
type: 'SMS',
|
|
501
|
+
versions: {
|
|
502
|
+
base: {
|
|
503
|
+
'sms-editor': 'Hello World'
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
renderFunction('SMS', 'preview', templateData);
|
|
508
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
it('Should handle LINE channel preview content with flex type', () => {
|
|
512
|
+
const templateData = {
|
|
513
|
+
type: 'LINE',
|
|
514
|
+
versions: {
|
|
515
|
+
base: {
|
|
516
|
+
content: {
|
|
517
|
+
messages: [{
|
|
518
|
+
type: 'flex',
|
|
519
|
+
contents: {
|
|
520
|
+
contents: [{
|
|
521
|
+
hero: { url: 'image.jpg' },
|
|
522
|
+
footer: { contents: [{ action: { label: 'Click' } }] }
|
|
523
|
+
}]
|
|
524
|
+
}
|
|
525
|
+
}]
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
renderFunction('LINE', 'preview', templateData);
|
|
531
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
it('Should handle LINE channel preview content with template type', () => {
|
|
535
|
+
const templateData = {
|
|
536
|
+
type: 'LINE',
|
|
537
|
+
versions: {
|
|
538
|
+
base: {
|
|
539
|
+
content: {
|
|
540
|
+
messages: [{
|
|
541
|
+
template: {
|
|
542
|
+
columns: [{
|
|
543
|
+
imageUrl: 'image.jpg',
|
|
544
|
+
action: { label: 'Click' }
|
|
545
|
+
}]
|
|
546
|
+
}
|
|
547
|
+
}]
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
renderFunction('LINE', 'preview', templateData);
|
|
553
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('Should handle FACEBOOK channel preview content', () => {
|
|
557
|
+
const templateData = {
|
|
558
|
+
type: 'FACEBOOK',
|
|
559
|
+
versions: {
|
|
560
|
+
base: {
|
|
561
|
+
content: {
|
|
562
|
+
FacebookAd: [{
|
|
563
|
+
type: 'image',
|
|
564
|
+
primaryText: 'Hello',
|
|
565
|
+
callToAction: 'Click',
|
|
566
|
+
displayLink: 'example.com',
|
|
567
|
+
imgSrc: 'image.jpg',
|
|
568
|
+
linkDesc: 'Description',
|
|
569
|
+
linkHeadLine: 'Headline',
|
|
570
|
+
subType: 'single',
|
|
571
|
+
webSiteLink: 'example.com'
|
|
572
|
+
}],
|
|
573
|
+
pageOrgUnitId: '123'
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
const campaignSettings = {
|
|
579
|
+
accountSettings: {
|
|
580
|
+
socialAccountSettings: {
|
|
581
|
+
facebookAccountSettings: [{
|
|
582
|
+
accountId: '123',
|
|
583
|
+
employeeAccessToken: 'token',
|
|
584
|
+
orgUnitFacebookPageSettingsMap: {
|
|
585
|
+
'123': {
|
|
586
|
+
pageAccessToken: 'page-token',
|
|
587
|
+
pageId: 'page-123'
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}]
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
renderFunction('FACEBOOK', 'preview', templateData, { campaignSettings });
|
|
595
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
it('Should handle VIBER channel preview content with all content types', () => {
|
|
599
|
+
const templateData = {
|
|
600
|
+
type: 'VIBER',
|
|
601
|
+
versions: {
|
|
602
|
+
base: {
|
|
603
|
+
content: {
|
|
604
|
+
content: {
|
|
605
|
+
text: 'Hello World',
|
|
606
|
+
button: {
|
|
607
|
+
text: 'Click Me'
|
|
608
|
+
},
|
|
609
|
+
image: {
|
|
610
|
+
url: 'image.jpg'
|
|
611
|
+
},
|
|
612
|
+
video: {
|
|
613
|
+
url: 'video.mp4',
|
|
614
|
+
thumbnailUrl: 'thumbnail.jpg'
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
renderFunction('VIBER', 'preview', templateData);
|
|
622
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
it('Should handle VIBER channel preview content with only text', () => {
|
|
626
|
+
const templateData = {
|
|
627
|
+
type: 'VIBER',
|
|
628
|
+
versions: {
|
|
629
|
+
base: {
|
|
630
|
+
content: {
|
|
631
|
+
content: {
|
|
632
|
+
text: 'Hello World'
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
renderFunction('VIBER', 'preview', templateData);
|
|
639
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
it('Should handle VIBER channel preview content with only image', () => {
|
|
643
|
+
const templateData = {
|
|
644
|
+
type: 'VIBER',
|
|
645
|
+
versions: {
|
|
646
|
+
base: {
|
|
647
|
+
content: {
|
|
648
|
+
content: {
|
|
649
|
+
image: {
|
|
650
|
+
url: 'image.jpg'
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
renderFunction('VIBER', 'preview', templateData);
|
|
658
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
it('Should handle VIBER channel preview content with only video', () => {
|
|
662
|
+
const templateData = {
|
|
663
|
+
type: 'VIBER',
|
|
664
|
+
versions: {
|
|
665
|
+
base: {
|
|
666
|
+
content: {
|
|
667
|
+
content: {
|
|
668
|
+
video: {
|
|
669
|
+
url: 'video.mp4',
|
|
670
|
+
thumbnailUrl: 'thumbnail.jpg'
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
renderFunction('VIBER', 'preview', templateData);
|
|
678
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
it('Should handle RCS channel preview content', () => {
|
|
682
|
+
const templateData = {
|
|
683
|
+
type: 'RCS',
|
|
684
|
+
versions: {
|
|
685
|
+
base: {
|
|
686
|
+
content: {
|
|
687
|
+
RCS: {
|
|
688
|
+
cardContent: [{
|
|
689
|
+
description: 'Description',
|
|
690
|
+
media: { mediaUrl: 'image.jpg' },
|
|
691
|
+
title: 'Title',
|
|
692
|
+
suggestions: [{ text: 'Click' }]
|
|
693
|
+
}]
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
renderFunction('RCS', 'preview', templateData);
|
|
700
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
701
|
+
});
|
|
702
|
+
});
|
|
105
703
|
});
|