@capillarytech/creatives-library 8.0.316 → 8.0.317-alpha.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/constants/unified.js +15 -0
- package/package.json +1 -1
- package/services/api.js +6 -0
- package/services/tests/api.test.js +7 -0
- package/utils/common.js +6 -1
- package/utils/templateVarUtils.js +172 -0
- package/utils/tests/tagValidations.test.js +34 -0
- package/utils/tests/templateVarUtils.test.js +160 -0
- package/v2Components/CapTagList/index.js +25 -22
- package/v2Components/CapTagList/style.scss +48 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapWhatsappCTA/index.js +2 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +11 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +12 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -0
- package/v2Components/CommonTestAndPreview/index.js +693 -155
- package/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +269 -1
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +14 -1
- package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +956 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +8 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/v2Containers/CommunicationFlow/constants.js +200 -0
- package/v2Containers/CommunicationFlow/index.js +102 -0
- package/v2Containers/CommunicationFlow/messages.js +346 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -5
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +12 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +289 -93
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +104 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +7 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/v2Containers/InAppWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/constants.js +32 -1
- package/v2Containers/Rcs/index.js +951 -873
- package/v2Containers/Rcs/index.scss +85 -6
- package/v2Containers/Rcs/messages.js +10 -1
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +40834 -1963
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/index.test.js +41 -38
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/v2Containers/Rcs/utils.js +358 -10
- package/v2Containers/Sms/Create/index.js +83 -36
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +611 -128
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4327 -2374
- package/v2Containers/SmsWrapper/index.js +39 -8
- package/v2Containers/TagList/index.js +47 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +61 -2
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +90 -40
- package/v2Containers/Templates/sagas.js +57 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/Viber/index.js +5 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/Whatsapp/index.js +8 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +598 -34
- package/v2Containers/Zalo/index.js +2 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Covers `localTemplatesConfig` / `useLocalTemplates` branch in SlideBoxContent → TemplatesV2
|
|
3
|
+
* (embedded SMS template list / RCS SMS fallback).
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { mountWithIntl, shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
7
|
+
import { SlideBoxContent } from '../SlideBoxContent';
|
|
8
|
+
|
|
9
|
+
const mockTemplatesV2 = jest.fn(() => <div data-testid="templates-v2-mock" />);
|
|
10
|
+
jest.mock('../../TemplatesV2', () => ({
|
|
11
|
+
__esModule: true,
|
|
12
|
+
default: (props) => mockTemplatesV2(props),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
const baseProps = {
|
|
16
|
+
slidBoxContent: 'templates',
|
|
17
|
+
currentChannel: 'SMS',
|
|
18
|
+
onSelectTemplate: jest.fn(),
|
|
19
|
+
onPreviewTemplate: jest.fn(),
|
|
20
|
+
onCreateNew: jest.fn(),
|
|
21
|
+
onChannelChange: jest.fn(),
|
|
22
|
+
location: { pathname: '/sms', query: {}, search: '' },
|
|
23
|
+
cap: {},
|
|
24
|
+
channelsToHide: [],
|
|
25
|
+
channelsToDisable: [],
|
|
26
|
+
handleClose: jest.fn(),
|
|
27
|
+
messageDetails: {},
|
|
28
|
+
onCreateComplete: jest.fn(),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
describe('SlideBoxContent local templates (TemplatesV2)', () => {
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
mockTemplatesV2.mockClear();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Use mount when asserting TemplatesV2 mock calls: shallow does not invoke children under styled CreativesWrapper.
|
|
37
|
+
it('renders TemplatesV2 in full mode when useLocalTemplates is true', () => {
|
|
38
|
+
mountWithIntl(
|
|
39
|
+
<SlideBoxContent
|
|
40
|
+
{...baseProps}
|
|
41
|
+
isFullMode
|
|
42
|
+
localTemplatesConfig={{
|
|
43
|
+
useLocalTemplates: true,
|
|
44
|
+
localTemplates: [],
|
|
45
|
+
localTemplatesLoading: false,
|
|
46
|
+
}}
|
|
47
|
+
/>,
|
|
48
|
+
);
|
|
49
|
+
expect(mockTemplatesV2).toHaveBeenCalled();
|
|
50
|
+
const passed = mockTemplatesV2.mock.calls[mockTemplatesV2.mock.calls.length - 1][0];
|
|
51
|
+
expect(passed.localTemplatesConfig.useLocalTemplates).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('does not render TemplatesV2 in full mode when useLocalTemplates is false', () => {
|
|
55
|
+
shallowWithIntl(
|
|
56
|
+
<SlideBoxContent
|
|
57
|
+
{...baseProps}
|
|
58
|
+
isFullMode
|
|
59
|
+
localTemplatesConfig={{ useLocalTemplates: false }}
|
|
60
|
+
/>,
|
|
61
|
+
);
|
|
62
|
+
expect(mockTemplatesV2).not.toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('renders TemplatesV2 in library mode without localTemplates flag', () => {
|
|
66
|
+
mountWithIntl(
|
|
67
|
+
<SlideBoxContent
|
|
68
|
+
{...baseProps}
|
|
69
|
+
isFullMode={false}
|
|
70
|
+
/>,
|
|
71
|
+
);
|
|
72
|
+
expect(mockTemplatesV2).toHaveBeenCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('merges top-level local template props via pick when localTemplatesConfig is omitted', () => {
|
|
76
|
+
mountWithIntl(
|
|
77
|
+
<SlideBoxContent
|
|
78
|
+
{...baseProps}
|
|
79
|
+
isFullMode
|
|
80
|
+
useLocalTemplates
|
|
81
|
+
localTemplates={[{ _id: '1' }]}
|
|
82
|
+
localTemplatesLoading={false}
|
|
83
|
+
/>,
|
|
84
|
+
);
|
|
85
|
+
expect(mockTemplatesV2).toHaveBeenCalled();
|
|
86
|
+
const passed = mockTemplatesV2.mock.calls[mockTemplatesV2.mock.calls.length - 1][0];
|
|
87
|
+
expect(passed.localTemplatesConfig.useLocalTemplates).toBe(true);
|
|
88
|
+
expect(passed.localTemplatesConfig.localTemplates).toEqual([{ _id: '1' }]);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -529,4 +529,108 @@ describe('shouldCheckValidation (line 79)', () => {
|
|
|
529
529
|
expect(updateBtn).toBeEnabled();
|
|
530
530
|
});
|
|
531
531
|
});
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
describe('SlideBoxFooter — isHtmlEditorValidationStateActive via issueCounts', () => {
|
|
535
|
+
beforeEach(() => {
|
|
536
|
+
jest.clearAllMocks();
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
it('activates via issueCounts.total > 0 even when validationComplete=false and hasErrors=false', () => {
|
|
540
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
541
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
542
|
+
|
|
543
|
+
renderComponent({
|
|
544
|
+
...baseFooterProps,
|
|
545
|
+
currentChannel: 'EMAIL',
|
|
546
|
+
slidBoxContent: 'editTemplate',
|
|
547
|
+
htmlEditorValidationState: {
|
|
548
|
+
validationComplete: false,
|
|
549
|
+
hasErrors: false,
|
|
550
|
+
errorsAcknowledged: false,
|
|
551
|
+
isContentEmpty: false,
|
|
552
|
+
issueCounts: { html: 1, label: 0, liquid: 0, total: 1 },
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
// isHtmlEditorValidationStateActive = true (via issueCounts.total > 0)
|
|
556
|
+
// isHTMLEditorModeInEdit = true, shouldCheckValidation = true
|
|
557
|
+
// hasValidationErrors = false, shouldDisableButtons = false (no hasErrors)
|
|
558
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
559
|
+
expect(updateBtn).toBeEnabled();
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
it('issueCounts.total=0 with validationComplete=false → not activated (BEE edit mode)', () => {
|
|
563
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
564
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
565
|
+
|
|
566
|
+
renderComponent({
|
|
567
|
+
...baseFooterProps,
|
|
568
|
+
currentChannel: 'EMAIL',
|
|
569
|
+
slidBoxContent: 'editTemplate',
|
|
570
|
+
htmlEditorValidationState: {
|
|
571
|
+
validationComplete: false,
|
|
572
|
+
hasErrors: false,
|
|
573
|
+
errorsAcknowledged: false,
|
|
574
|
+
isContentEmpty: false,
|
|
575
|
+
issueCounts: { html: 0, label: 0, liquid: 0, total: 0 },
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
// isHtmlEditorValidationStateActive = false → isHTMLEditorModeInEdit = false
|
|
579
|
+
// isBEEEditor = true (isEditMode && !isHtmlEditorValidationStateActive)
|
|
580
|
+
// shouldCheckValidation = false → button enabled
|
|
581
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
582
|
+
expect(updateBtn).toBeEnabled();
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
describe('SlideBoxFooter — isBEEEditor detection in create mode via emailCreateMode=editor', () => {
|
|
587
|
+
beforeEach(() => {
|
|
588
|
+
jest.clearAllMocks();
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
it('detects BEE editor when emailCreateMode=editor and selectedEmailCreateMode is not html_editor (create mode)', () => {
|
|
592
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
593
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
594
|
+
|
|
595
|
+
renderComponent({
|
|
596
|
+
...baseFooterProps,
|
|
597
|
+
currentChannel: 'EMAIL',
|
|
598
|
+
slidBoxContent: 'createTemplate',
|
|
599
|
+
emailCreateMode: 'editor',
|
|
600
|
+
selectedEmailCreateMode: 'drag_drop',
|
|
601
|
+
htmlEditorValidationState: {
|
|
602
|
+
validationComplete: false,
|
|
603
|
+
hasErrors: false,
|
|
604
|
+
isContentEmpty: false,
|
|
605
|
+
issueCounts: { html: 0, label: 0, liquid: 0, total: 0 },
|
|
606
|
+
},
|
|
607
|
+
});
|
|
608
|
+
// selectedEmailCreateMode=drag_drop → isBEEEditor = true (DRAG_DROP branch)
|
|
609
|
+
// shouldCheckValidation = false → button not disabled by validation
|
|
610
|
+
const createBtn = screen.getByRole('button', { name: /create/i });
|
|
611
|
+
expect(createBtn).toBeInTheDocument();
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it('enables primary action button when emailCreateMode=editor but mode is not HTML editor (BEE editor path)', () => {
|
|
615
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
616
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
617
|
+
|
|
618
|
+
renderComponent({
|
|
619
|
+
...baseFooterProps,
|
|
620
|
+
currentChannel: 'EMAIL',
|
|
621
|
+
slidBoxContent: 'createTemplate',
|
|
622
|
+
emailCreateMode: 'editor',
|
|
623
|
+
selectedEmailCreateMode: undefined,
|
|
624
|
+
htmlEditorValidationState: {
|
|
625
|
+
validationComplete: false,
|
|
626
|
+
hasErrors: false,
|
|
627
|
+
isContentEmpty: false,
|
|
628
|
+
issueCounts: { html: 0, label: 0, liquid: 0, total: 0 },
|
|
629
|
+
},
|
|
630
|
+
});
|
|
631
|
+
// isHTMLEditorModeInCreate = false (selectedEmailCreateMode is undefined, not html_editor)
|
|
632
|
+
// emailCreateMode === 'editor' && !isHTMLEditorMode → isBEEEditor = true
|
|
633
|
+
const createBtn = screen.getByRole('button', { name: /create/i });
|
|
634
|
+
expect(createBtn).toBeInTheDocument();
|
|
635
|
+
});
|
|
532
636
|
});
|
|
@@ -72,4 +72,114 @@ describe('Test SlideBoxHeader container', () => {
|
|
|
72
72
|
renderFunction("ZALO", "editTemplate", zaloEditTemplateData, true);
|
|
73
73
|
expect(renderedComponent).toMatchSnapshot();
|
|
74
74
|
});
|
|
75
|
+
|
|
76
|
+
it('renders templateNameRenderProp when isFullMode and shouldShowTemplateName are both true', () => {
|
|
77
|
+
const templateNameRenderProp = jest.fn().mockReturnValue(null);
|
|
78
|
+
renderedComponent = shallowWithIntl(
|
|
79
|
+
<SlideBoxHeader
|
|
80
|
+
slidBoxContent="editTemplate"
|
|
81
|
+
channel="SMS"
|
|
82
|
+
templateData={{ name: 'My Template' }}
|
|
83
|
+
onCreateComplete={onCreateComplete}
|
|
84
|
+
isFullMode
|
|
85
|
+
shouldShowTemplateName
|
|
86
|
+
templateNameRenderProp={templateNameRenderProp}
|
|
87
|
+
moduleType="journey"
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
expect(templateNameRenderProp).toHaveBeenCalled();
|
|
91
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('does not call templateNameRenderProp when isFullMode is false (showTemplateNameHeader=false)', () => {
|
|
95
|
+
const templateNameRenderProp = jest.fn().mockReturnValue(null);
|
|
96
|
+
renderedComponent = shallowWithIntl(
|
|
97
|
+
<SlideBoxHeader
|
|
98
|
+
slidBoxContent="editTemplate"
|
|
99
|
+
channel="SMS"
|
|
100
|
+
templateData={{ name: 'My Template' }}
|
|
101
|
+
onCreateComplete={onCreateComplete}
|
|
102
|
+
isFullMode={false}
|
|
103
|
+
shouldShowTemplateName
|
|
104
|
+
templateNameRenderProp={templateNameRenderProp}
|
|
105
|
+
moduleType="journey"
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
expect(templateNameRenderProp).not.toHaveBeenCalled();
|
|
109
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('does not call templateNameRenderProp when shouldShowTemplateName is false (showTemplateNameHeader=false)', () => {
|
|
113
|
+
const templateNameRenderProp = jest.fn().mockReturnValue(null);
|
|
114
|
+
renderedComponent = shallowWithIntl(
|
|
115
|
+
<SlideBoxHeader
|
|
116
|
+
slidBoxContent="editTemplate"
|
|
117
|
+
channel="SMS"
|
|
118
|
+
templateData={{ name: 'My Template' }}
|
|
119
|
+
onCreateComplete={onCreateComplete}
|
|
120
|
+
isFullMode
|
|
121
|
+
shouldShowTemplateName={false}
|
|
122
|
+
templateNameRenderProp={templateNameRenderProp}
|
|
123
|
+
moduleType="journey"
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
expect(templateNameRenderProp).not.toHaveBeenCalled();
|
|
127
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('shows edit header for InApp edit without fullMode (shouldShowInAppEditHeader=true)', () => {
|
|
131
|
+
renderedComponent = shallowWithIntl(
|
|
132
|
+
<SlideBoxHeader
|
|
133
|
+
slidBoxContent="editTemplate"
|
|
134
|
+
channel="inapp"
|
|
135
|
+
templateData={{ name: 'InApp Tpl' }}
|
|
136
|
+
onCreateComplete={onCreateComplete}
|
|
137
|
+
isFullMode={false}
|
|
138
|
+
moduleType="journey"
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('hides edit header for InApp edit with fullMode (shouldShowInAppEditHeader=false, isInAppCreate guard)', () => {
|
|
145
|
+
renderedComponent = shallowWithIntl(
|
|
146
|
+
<SlideBoxHeader
|
|
147
|
+
slidBoxContent="editTemplate"
|
|
148
|
+
channel="inapp"
|
|
149
|
+
templateData={{ name: 'InApp Tpl' }}
|
|
150
|
+
onCreateComplete={onCreateComplete}
|
|
151
|
+
isFullMode
|
|
152
|
+
moduleType="journey"
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('renders whatsappOverview=true header when WHATSAPP edit in fullMode', () => {
|
|
159
|
+
renderedComponent = shallowWithIntl(
|
|
160
|
+
<SlideBoxHeader
|
|
161
|
+
slidBoxContent="editTemplate"
|
|
162
|
+
channel="WHATSAPP"
|
|
163
|
+
templateData={whatsappEditTemplateData}
|
|
164
|
+
onCreateComplete={onCreateComplete}
|
|
165
|
+
isFullMode
|
|
166
|
+
moduleType="journey"
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('renders whatsappOverview=false header when WHATSAPP edit without fullMode', () => {
|
|
173
|
+
renderedComponent = shallowWithIntl(
|
|
174
|
+
<SlideBoxHeader
|
|
175
|
+
slidBoxContent="editTemplate"
|
|
176
|
+
channel="WHATSAPP"
|
|
177
|
+
templateData={whatsappEditTemplateData}
|
|
178
|
+
onCreateComplete={onCreateComplete}
|
|
179
|
+
isFullMode={false}
|
|
180
|
+
moduleType="journey"
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
184
|
+
});
|
|
75
185
|
});
|
|
@@ -859,6 +859,11 @@ exports[`Test SlideBoxContent container Should render correct component for rcs
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
onCreateComplete={[MockFunction]}
|
|
862
|
+
templateData={
|
|
863
|
+
Object {
|
|
864
|
+
"mode": "create",
|
|
865
|
+
}
|
|
866
|
+
}
|
|
862
867
|
/>
|
|
863
868
|
</SlideBoxContent__CreativesWrapper>
|
|
864
869
|
`;
|
|
@@ -968,6 +973,7 @@ exports[`Test SlideBoxContent container Should render correct component for rcs
|
|
|
968
973
|
<Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
|
|
969
974
|
FTPMode="create"
|
|
970
975
|
channel="rcs"
|
|
976
|
+
localTemplatesConfig={Object {}}
|
|
971
977
|
loyaltyMetaData={Object {}}
|
|
972
978
|
messageDetails={Object {}}
|
|
973
979
|
onCreateComplete={[MockFunction]}
|
|
@@ -1376,6 +1382,7 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
1376
1382
|
<Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
|
|
1377
1383
|
FTPMode="create"
|
|
1378
1384
|
channel="whatsapp"
|
|
1385
|
+
localTemplatesConfig={Object {}}
|
|
1379
1386
|
loyaltyMetaData={Object {}}
|
|
1380
1387
|
messageDetails={Object {}}
|
|
1381
1388
|
onCreateComplete={[MockFunction]}
|
|
@@ -3365,6 +3372,7 @@ exports[`Test SlideBoxContent container getViber utility function Should handle
|
|
|
3365
3372
|
"name": "sms",
|
|
3366
3373
|
}
|
|
3367
3374
|
}
|
|
3375
|
+
templateData={null}
|
|
3368
3376
|
/>
|
|
3369
3377
|
</SlideBoxContent__CreativesWrapper>
|
|
3370
3378
|
`;
|