cap-creatives-ui 8.0.280 → 8.0.321
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/.github/workflows/pr-title-check.yml +88 -0
- package/app/constants/unified.js +21 -1
- package/app/containers/App/constants.js +0 -1
- package/app/containers/Login/test/index.test.js +123 -0
- package/app/containers/Login/test/selectors.test.js +165 -0
- package/app/initialState.js +0 -2
- package/app/services/api.js +6 -0
- package/app/services/tests/api.test.js +7 -0
- package/app/services/tests/getSchema.test.js +95 -0
- package/app/utils/common.js +23 -9
- package/app/utils/commonUtils.js +64 -93
- package/app/utils/tagValidations.js +83 -219
- package/app/utils/templateVarUtils.js +172 -0
- package/app/utils/tests/common.test.js +265 -323
- package/app/utils/tests/commonUtil.test.js +461 -118
- package/app/utils/tests/commonUtils.test.js +581 -0
- package/app/utils/tests/messageUtils.test.js +95 -0
- package/app/utils/tests/smsCharCount.test.js +304 -0
- package/app/utils/tests/smsCharCountV2.test.js +213 -10
- package/app/utils/tests/tagValidations.test.js +474 -357
- package/app/utils/tests/templateVarUtils.test.js +160 -0
- package/app/v2Components/CapDeviceContent/index.js +10 -7
- package/app/v2Components/CapTagList/index.js +32 -24
- package/app/v2Components/CapTagList/style.scss +48 -0
- package/app/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/app/v2Components/CapTagListWithInput/index.js +8 -0
- package/app/v2Components/CapWhatsappCTA/index.js +2 -0
- package/app/v2Components/CapWhatsappCarouselButton/index.js +32 -14
- package/app/v2Components/CapWhatsappCarouselButton/tests/index.test.js +120 -2
- package/app/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +39 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +606 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +36 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +79 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/index.js +314 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +141 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +156 -0
- package/app/v2Components/CommonTestAndPreview/SendTestMessage.js +57 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/app/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +210 -4
- package/app/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/app/v2Components/CommonTestAndPreview/constants.js +57 -1
- package/app/v2Components/CommonTestAndPreview/index.js +878 -156
- package/app/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/app/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/app/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/app/v2Components/CommonTestAndPreview/sagas.js +75 -5
- package/app/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/app/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +1156 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +334 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +576 -0
- package/app/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +156 -0
- package/app/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/app/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/app/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -7
- package/app/v2Components/CommonTestAndPreview/tests/index.test.js +914 -5
- package/app/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/app/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/app/v2Components/CommonTestAndPreview/tests/sagas.test.js +146 -378
- package/app/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- package/app/v2Components/ErrorInfoNote/index.js +24 -26
- package/app/v2Components/FormBuilder/index.js +182 -204
- package/app/v2Components/FormBuilder/messages.js +4 -8
- package/app/v2Components/HtmlEditor/HTMLEditor.js +7 -6
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -1
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +928 -17
- package/app/v2Components/HtmlEditor/components/CodeEditorPane/index.js +4 -2
- package/app/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +452 -3
- package/app/v2Components/HtmlEditor/hooks/useValidation.js +12 -9
- package/app/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +132 -0
- package/app/v2Components/HtmlEditor/utils/htmlValidator.js +4 -2
- package/app/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/app/v2Components/SmsFallback/constants.js +73 -0
- package/app/v2Components/SmsFallback/index.js +956 -0
- package/app/v2Components/SmsFallback/index.scss +265 -0
- package/app/v2Components/SmsFallback/messages.js +78 -0
- package/app/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/app/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/app/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/app/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/app/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/app/v2Components/TestAndPreviewSlidebox/index.js +22 -1
- package/app/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/app/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/app/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/app/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/app/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/app/v2Containers/BeeEditor/index.js +3 -0
- package/app/v2Containers/BeePopupEditor/index.js +9 -2
- package/app/v2Containers/Cap/mockData.js +0 -14
- package/app/v2Containers/Cap/reducer.js +3 -55
- package/app/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/app/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/app/v2Containers/CommunicationFlow/constants.js +200 -0
- package/app/v2Containers/CommunicationFlow/index.js +102 -0
- package/app/v2Containers/CommunicationFlow/messages.js +346 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/app/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/app/v2Containers/CreativesContainer/SlideBoxContent.js +127 -11
- package/app/v2Containers/CreativesContainer/SlideBoxFooter.js +62 -9
- package/app/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/app/v2Containers/CreativesContainer/constants.js +24 -0
- package/app/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/app/v2Containers/CreativesContainer/index.js +346 -71
- package/app/v2Containers/CreativesContainer/index.scss +51 -1
- package/app/v2Containers/CreativesContainer/messages.js +12 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +69 -1
- package/app/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +443 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +147 -4
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +57 -10
- package/app/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/app/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/app/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/app/v2Containers/Email/index.js +2 -5
- package/app/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +58 -77
- package/app/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +158 -89
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/app/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +17 -12
- package/app/v2Containers/EmailWrapper/index.js +4 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +133 -0
- package/app/v2Containers/FTP/index.js +2 -51
- package/app/v2Containers/FTP/messages.js +0 -4
- package/app/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +110 -155
- package/app/v2Containers/InApp/index.js +297 -118
- package/app/v2Containers/InApp/tests/index.test.js +17 -6
- package/app/v2Containers/InApp/tests/mockData.js +1 -1
- package/app/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/app/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/app/v2Containers/InAppWrapper/index.js +3 -0
- package/app/v2Containers/InappAdvance/index.js +5 -104
- package/app/v2Containers/InappAdvance/tests/index.test.js +2 -0
- package/app/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +24 -3
- package/app/v2Containers/Line/Container/Text/index.js +0 -1
- package/app/v2Containers/MobilePush/Create/index.js +105 -28
- package/app/v2Containers/MobilePush/Create/messages.js +4 -0
- package/app/v2Containers/MobilePush/Edit/index.js +250 -68
- package/app/v2Containers/MobilePush/Edit/messages.js +4 -0
- package/app/v2Containers/MobilePushNew/components/PlatformContentFields.js +36 -12
- package/app/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +68 -27
- package/app/v2Containers/MobilePushNew/index.js +78 -35
- package/app/v2Containers/MobilePushNew/messages.js +8 -0
- package/app/v2Containers/MobilepushWrapper/index.js +11 -1
- package/app/v2Containers/Rcs/constants.js +32 -1
- package/app/v2Containers/Rcs/index.js +963 -916
- package/app/v2Containers/Rcs/index.scss +85 -6
- package/app/v2Containers/Rcs/messages.js +10 -1
- package/app/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/app/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +41136 -1566
- package/app/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/app/v2Containers/Rcs/tests/index.test.js +41 -38
- package/app/v2Containers/Rcs/tests/mockData.js +38 -0
- package/app/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/app/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/app/v2Containers/Rcs/utils.js +358 -10
- package/app/v2Containers/Sms/Create/index.js +122 -39
- package/app/v2Containers/Sms/Create/messages.js +4 -0
- package/app/v2Containers/Sms/Edit/index.js +37 -3
- package/app/v2Containers/Sms/commonMethods.js +3 -6
- package/app/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/app/v2Containers/Sms/tests/commonMethods.test.js +122 -0
- package/app/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/app/v2Containers/SmsTrai/Create/index.js +9 -4
- package/app/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/app/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/app/v2Containers/SmsTrai/Edit/index.js +667 -160
- package/app/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/app/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/app/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4590 -2436
- package/app/v2Containers/SmsWrapper/index.js +41 -8
- package/app/v2Containers/TagList/index.js +63 -2
- package/app/v2Containers/TagList/messages.js +8 -0
- package/app/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/app/v2Containers/TagList/tests/mockdata.js +17 -0
- package/app/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/app/v2Containers/Templates/_templates.scss +61 -2
- package/app/v2Containers/Templates/actions.js +11 -0
- package/app/v2Containers/Templates/constants.js +2 -0
- package/app/v2Containers/Templates/index.js +90 -40
- package/app/v2Containers/Templates/reducer.js +3 -1
- package/app/v2Containers/Templates/sagas.js +57 -12
- package/app/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/app/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/app/v2Containers/Templates/tests/reducer.test.js +12 -0
- package/app/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/app/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/app/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/app/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/app/v2Containers/TemplatesV2/index.js +147 -49
- package/app/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/app/v2Containers/Viber/index.js +9 -10
- package/app/v2Containers/Viber/index.scss +1 -1
- package/app/v2Containers/WebPush/Create/components/BrandIconSection.test.js +264 -0
- package/app/v2Containers/WebPush/Create/components/MessageSection.js +78 -19
- package/app/v2Containers/WebPush/Create/components/MessageSection.test.js +82 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/BrandIconSection.test.js.snap +187 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +25 -17
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.js +80 -0
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.test.js +210 -0
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -5
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/app/v2Containers/WebPush/Create/index.js +36 -6
- package/app/v2Containers/WebPush/Create/index.scss +5 -0
- package/app/v2Containers/WebPush/Create/messages.js +8 -1
- package/app/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +269 -0
- package/app/v2Containers/WebPush/Create/utils/validation.js +31 -15
- package/app/v2Containers/WebPush/Create/utils/validation.test.js +72 -24
- package/app/v2Containers/Whatsapp/index.js +28 -53
- package/app/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26939 -3982
- package/app/v2Containers/Whatsapp/tests/index.test.js +172 -0
- package/app/v2Containers/Zalo/index.js +5 -11
- package/package.json +2 -2
- package/version +9 -0
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
$classPrefix: add-creatives-section;
|
|
4
4
|
|
|
5
|
+
/* Local SMS template picker: fill slidebox height; global .v2-pagination-container uses 100vh-20rem and leaves a dead zone inside slideboxes */
|
|
6
|
+
.#{$classPrefix}.creatives-slidebox--local-sms-templates {
|
|
7
|
+
.cap-slide-box-v2-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
max-height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.slidebox-content-container {
|
|
15
|
+
flex: 1;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.slidebox-content-container > div {
|
|
23
|
+
flex: 1;
|
|
24
|
+
min-height: 0;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* TemplatesV2 root: fill slidebox so the template grid can flex instead of using 100vh-based pagination height */
|
|
31
|
+
.slidebox-content-container .creatives-templates-container--local-sms.library-mode {
|
|
32
|
+
flex: 1;
|
|
33
|
+
min-height: 0;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
height: auto;
|
|
38
|
+
max-height: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
5
42
|
.#{$classPrefix} {
|
|
6
43
|
&.creatives-library-mode{
|
|
7
44
|
.sms-create-container, .sms-email-container{
|
|
@@ -80,5 +117,18 @@ $classPrefix: add-creatives-section;
|
|
|
80
117
|
}
|
|
81
118
|
|
|
82
119
|
.template-footer-width {
|
|
83
|
-
width: 100
|
|
120
|
+
width: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.slidebox-footer-actions {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-wrap: nowrap;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 0.75rem;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
|
|
130
|
+
.ant-btn,
|
|
131
|
+
button {
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
}
|
|
84
134
|
}
|
|
@@ -378,4 +378,16 @@ export default defineMessages({
|
|
|
378
378
|
id: `${scope}.next`,
|
|
379
379
|
defaultMessage: `Next`,
|
|
380
380
|
},
|
|
381
|
+
"channelNotSupportedAnonymous": {
|
|
382
|
+
id: `${scope}.channelNotSupportedAnonymous`,
|
|
383
|
+
defaultMessage: `This channel is not supported for anonymous customers`,
|
|
384
|
+
},
|
|
385
|
+
"personalizationNotSupportedAnonymous": {
|
|
386
|
+
id: `${scope}.personalizationNotSupportedAnonymous`,
|
|
387
|
+
defaultMessage: `Personalization tags are not supported for anonymous customers`,
|
|
388
|
+
},
|
|
389
|
+
"personalizationTokensErrorMessage": {
|
|
390
|
+
id: `${scope}.personalizationTokensErrorMessage`,
|
|
391
|
+
defaultMessage: `Personalization tags are not supported for anonymous customers, please remove the tags.`,
|
|
392
|
+
},
|
|
381
393
|
});
|
|
@@ -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
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
3
|
-
|
|
4
3
|
import { SlideBoxContent } from '../SlideBoxContent';
|
|
5
4
|
import mockdata from '../../mockdata';
|
|
6
5
|
import { templateDetailsImage, templateDetailsVideo, templateDetailsText, templateDetails_ } from '../../Viber/tests/mockData';
|
|
@@ -42,6 +41,15 @@ jest.mock('../../WebPush', () => ({
|
|
|
42
41
|
),
|
|
43
42
|
}));
|
|
44
43
|
|
|
44
|
+
jest.mock('v2Containers/InApp', () => () => <div data-test="inapp" />);
|
|
45
|
+
jest.mock('v2Containers/InAppWrapper', () => () => <div data-test="inapp-wrapper" />);
|
|
46
|
+
|
|
47
|
+
jest.mock('../../../utils/commonUtils', () => ({
|
|
48
|
+
hasNewEditorFlowInAppEnabled: jest.fn(),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
import commonUtil from '../../../utils/commonUtils';
|
|
52
|
+
|
|
45
53
|
describe('Test SlideBoxContent container', () => {
|
|
46
54
|
const onCreateComplete = jest.fn();
|
|
47
55
|
let renderedComponent;
|
|
@@ -910,4 +918,64 @@ describe('Test SlideBoxContent container', () => {
|
|
|
910
918
|
expect(renderedComponent).toMatchSnapshot();
|
|
911
919
|
});
|
|
912
920
|
});
|
|
921
|
+
|
|
922
|
+
describe('InApp vs InAppWrapper rendering conditions', () => {
|
|
923
|
+
|
|
924
|
+
beforeEach(() => {
|
|
925
|
+
jest.clearAllMocks();
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
it('renders InAppWrapper when isFullMode=true and new editor disabled', () => {
|
|
929
|
+
commonUtil.hasNewEditorFlowInAppEnabled.mockReturnValue(false);
|
|
930
|
+
|
|
931
|
+
renderFunction(
|
|
932
|
+
'INAPP',
|
|
933
|
+
'createTemplate',
|
|
934
|
+
{ mode: 'create' },
|
|
935
|
+
{ isFullMode: true, isLoyaltyModule: false }
|
|
936
|
+
);
|
|
937
|
+
|
|
938
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
it('renders InApp when isFullMode=false and loyalty module enabled', () => {
|
|
942
|
+
commonUtil.hasNewEditorFlowInAppEnabled.mockReturnValue(false);
|
|
943
|
+
|
|
944
|
+
renderFunction(
|
|
945
|
+
'INAPP',
|
|
946
|
+
'createTemplate',
|
|
947
|
+
{ mode: 'create' },
|
|
948
|
+
{ isFullMode: false, isLoyaltyModule: true }
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
it('renders InApp when not full mode, not loyalty and new editor disabled', () => {
|
|
955
|
+
commonUtil.hasNewEditorFlowInAppEnabled.mockReturnValue(false);
|
|
956
|
+
|
|
957
|
+
renderFunction(
|
|
958
|
+
'INAPP',
|
|
959
|
+
'createTemplate',
|
|
960
|
+
{ mode: 'create' },
|
|
961
|
+
{ isFullMode: false, isLoyaltyModule: false }
|
|
962
|
+
);
|
|
963
|
+
|
|
964
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
it('renders InAppWrapper when full mode and new editor enabled', () => {
|
|
968
|
+
commonUtil.hasNewEditorFlowInAppEnabled.mockReturnValue(true);
|
|
969
|
+
|
|
970
|
+
renderFunction(
|
|
971
|
+
'INAPP',
|
|
972
|
+
'createTemplate',
|
|
973
|
+
{ mode: 'create' },
|
|
974
|
+
{ isFullMode: true, isLoyaltyModule: false }
|
|
975
|
+
);
|
|
976
|
+
|
|
977
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
});
|
|
913
981
|
});
|
|
@@ -190,4 +190,447 @@ describe('shouldCheckValidation (line 79)', () => {
|
|
|
190
190
|
const saveBtn = screen.getByRole('button', { name: /create/i });
|
|
191
191
|
expect(saveBtn).toBeDisabled();
|
|
192
192
|
});
|
|
193
|
+
|
|
194
|
+
describe('personalization tokens handling', () => {
|
|
195
|
+
it('disables Save and Test & Preview when anonymous mobile push template has personalization tokens', () => {
|
|
196
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
197
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
198
|
+
|
|
199
|
+
renderComponent({
|
|
200
|
+
...baseFooterProps,
|
|
201
|
+
currentChannel: 'MOBILE_PUSH',
|
|
202
|
+
slidBoxContent: 'editTemplate',
|
|
203
|
+
showTestAndPreviewButton: true,
|
|
204
|
+
restrictPersonalization: true,
|
|
205
|
+
isAnonymousType: true,
|
|
206
|
+
templateData: {
|
|
207
|
+
versions: {
|
|
208
|
+
ANDROID: {
|
|
209
|
+
base: {
|
|
210
|
+
title: 'Hello {{name}}',
|
|
211
|
+
expandibleDetails: {
|
|
212
|
+
message: 'Body',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
221
|
+
expect(updateBtn).toBeDisabled();
|
|
222
|
+
|
|
223
|
+
const previewBtn = screen.getByRole('button', { name: /preview and test/i });
|
|
224
|
+
expect(previewBtn).toBeDisabled();
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('uses hasPersonalizationTokenError prop override even when templateData has no tokens', () => {
|
|
228
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
229
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
230
|
+
|
|
231
|
+
renderComponent({
|
|
232
|
+
...baseFooterProps,
|
|
233
|
+
currentChannel: 'MOBILE_PUSH',
|
|
234
|
+
slidBoxContent: 'editTemplate',
|
|
235
|
+
showTestAndPreviewButton: true,
|
|
236
|
+
restrictPersonalization: true,
|
|
237
|
+
isAnonymousType: true,
|
|
238
|
+
templateData: {}, // no personalization tokens in template data
|
|
239
|
+
hasPersonalizationTokenError: true,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
243
|
+
expect(updateBtn).toBeDisabled();
|
|
244
|
+
|
|
245
|
+
const previewBtn = screen.getByRole('button', { name: /preview and test/i });
|
|
246
|
+
expect(previewBtn).toBeDisabled();
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('does not disable buttons when isAnonymousType is false even with liquid tags', () => {
|
|
250
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
251
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
252
|
+
|
|
253
|
+
renderComponent({
|
|
254
|
+
...baseFooterProps,
|
|
255
|
+
currentChannel: 'MOBILE_PUSH',
|
|
256
|
+
slidBoxContent: 'editTemplate',
|
|
257
|
+
showTestAndPreviewButton: true,
|
|
258
|
+
restrictPersonalization: true,
|
|
259
|
+
isAnonymousType: false, // non-anonymous user
|
|
260
|
+
templateData: {
|
|
261
|
+
versions: {
|
|
262
|
+
ANDROID: {
|
|
263
|
+
base: {
|
|
264
|
+
title: 'Hello {{name}}',
|
|
265
|
+
expandibleDetails: {
|
|
266
|
+
message: 'Welcome',
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
275
|
+
expect(updateBtn).toBeEnabled();
|
|
276
|
+
|
|
277
|
+
const previewBtn = screen.getByRole('button', { name: /preview and test/i });
|
|
278
|
+
expect(previewBtn).toBeEnabled();
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('does not disable buttons when restrictPersonalization is false even for anonymous users with tokens', () => {
|
|
282
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
283
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
284
|
+
|
|
285
|
+
renderComponent({
|
|
286
|
+
...baseFooterProps,
|
|
287
|
+
currentChannel: 'MOBILE_PUSH',
|
|
288
|
+
slidBoxContent: 'editTemplate',
|
|
289
|
+
showTestAndPreviewButton: true,
|
|
290
|
+
restrictPersonalization: false, // personalization is allowed
|
|
291
|
+
isAnonymousType: true,
|
|
292
|
+
templateData: {
|
|
293
|
+
versions: {
|
|
294
|
+
ANDROID: {
|
|
295
|
+
base: {
|
|
296
|
+
title: 'Hello {{name}}',
|
|
297
|
+
expandibleDetails: {
|
|
298
|
+
message: 'Welcome',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
307
|
+
expect(updateBtn).toBeEnabled();
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('detects liquid tags {{ }} in Android title and disables buttons', () => {
|
|
311
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
312
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
313
|
+
|
|
314
|
+
renderComponent({
|
|
315
|
+
...baseFooterProps,
|
|
316
|
+
currentChannel: 'MOBILE_PUSH',
|
|
317
|
+
slidBoxContent: 'editTemplate',
|
|
318
|
+
restrictPersonalization: true,
|
|
319
|
+
isAnonymousType: true,
|
|
320
|
+
templateData: {
|
|
321
|
+
versions: {
|
|
322
|
+
ANDROID: {
|
|
323
|
+
base: {
|
|
324
|
+
title: '{{dynamicTitle}}',
|
|
325
|
+
expandibleDetails: {
|
|
326
|
+
message: 'Static body',
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
335
|
+
expect(updateBtn).toBeDisabled();
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it('detects liquid tags {{ }} in iOS message body and disables buttons', () => {
|
|
339
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
340
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
341
|
+
|
|
342
|
+
renderComponent({
|
|
343
|
+
...baseFooterProps,
|
|
344
|
+
currentChannel: 'MOBILE_PUSH',
|
|
345
|
+
slidBoxContent: 'editTemplate',
|
|
346
|
+
restrictPersonalization: true,
|
|
347
|
+
isAnonymousType: true,
|
|
348
|
+
templateData: {
|
|
349
|
+
versions: {
|
|
350
|
+
IOS: {
|
|
351
|
+
base: {
|
|
352
|
+
title: 'Static',
|
|
353
|
+
expandableDetails: {
|
|
354
|
+
message: 'Message with {{variable}}',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
363
|
+
expect(updateBtn).toBeDisabled();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('detects event context tags [ ] and disables buttons', () => {
|
|
367
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
368
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
369
|
+
|
|
370
|
+
renderComponent({
|
|
371
|
+
...baseFooterProps,
|
|
372
|
+
currentChannel: 'MOBILE_PUSH',
|
|
373
|
+
slidBoxContent: 'editTemplate',
|
|
374
|
+
restrictPersonalization: true,
|
|
375
|
+
isAnonymousType: true,
|
|
376
|
+
templateData: {
|
|
377
|
+
versions: {
|
|
378
|
+
ANDROID: {
|
|
379
|
+
base: {
|
|
380
|
+
title: 'Hello [eventContext]',
|
|
381
|
+
expandibleDetails: {
|
|
382
|
+
message: 'Body',
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
391
|
+
expect(updateBtn).toBeDisabled();
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('allows buttons when template has no personalization tokens', () => {
|
|
395
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
396
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
397
|
+
|
|
398
|
+
renderComponent({
|
|
399
|
+
...baseFooterProps,
|
|
400
|
+
currentChannel: 'MOBILE_PUSH',
|
|
401
|
+
slidBoxContent: 'editTemplate',
|
|
402
|
+
showTestAndPreviewButton: true,
|
|
403
|
+
restrictPersonalization: true,
|
|
404
|
+
isAnonymousType: true,
|
|
405
|
+
templateData: {
|
|
406
|
+
versions: {
|
|
407
|
+
ANDROID: {
|
|
408
|
+
base: {
|
|
409
|
+
title: 'Static Title',
|
|
410
|
+
expandibleDetails: {
|
|
411
|
+
message: 'Static Message Body',
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
IOS: {
|
|
416
|
+
base: {
|
|
417
|
+
title: 'iOS Title',
|
|
418
|
+
expandibleDetails: {
|
|
419
|
+
message: 'iOS Message',
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
428
|
+
expect(updateBtn).toBeEnabled();
|
|
429
|
+
|
|
430
|
+
const previewBtn = screen.getByRole('button', { name: /preview and test/i });
|
|
431
|
+
expect(previewBtn).toBeEnabled();
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it('handles expandableDetails spelling variant (corrected spelling)', () => {
|
|
435
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
436
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
437
|
+
|
|
438
|
+
renderComponent({
|
|
439
|
+
...baseFooterProps,
|
|
440
|
+
currentChannel: 'MOBILE_PUSH',
|
|
441
|
+
slidBoxContent: 'editTemplate',
|
|
442
|
+
restrictPersonalization: true,
|
|
443
|
+
isAnonymousType: true,
|
|
444
|
+
templateData: {
|
|
445
|
+
versions: {
|
|
446
|
+
ANDROID: {
|
|
447
|
+
base: {
|
|
448
|
+
title: 'Static',
|
|
449
|
+
expandableDetails: { // correct spelling
|
|
450
|
+
message: 'Message with {{token}}',
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
459
|
+
expect(updateBtn).toBeDisabled();
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it('checks both Android and iOS versions for tokens', () => {
|
|
463
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
464
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
465
|
+
|
|
466
|
+
renderComponent({
|
|
467
|
+
...baseFooterProps,
|
|
468
|
+
currentChannel: 'MOBILE_PUSH',
|
|
469
|
+
slidBoxContent: 'editTemplate',
|
|
470
|
+
restrictPersonalization: true,
|
|
471
|
+
isAnonymousType: true,
|
|
472
|
+
templateData: {
|
|
473
|
+
versions: {
|
|
474
|
+
ANDROID: {
|
|
475
|
+
base: {
|
|
476
|
+
title: 'Android Title',
|
|
477
|
+
expandibleDetails: {
|
|
478
|
+
message: 'Android Message',
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
IOS: {
|
|
483
|
+
base: {
|
|
484
|
+
title: 'iOS [context]',
|
|
485
|
+
expandibleDetails: {
|
|
486
|
+
message: 'iOS Message',
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
495
|
+
expect(updateBtn).toBeDisabled();
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it('returns false when templateData is null', () => {
|
|
499
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
500
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
501
|
+
|
|
502
|
+
renderComponent({
|
|
503
|
+
...baseFooterProps,
|
|
504
|
+
currentChannel: 'MOBILE_PUSH',
|
|
505
|
+
slidBoxContent: 'editTemplate',
|
|
506
|
+
restrictPersonalization: true,
|
|
507
|
+
isAnonymousType: true,
|
|
508
|
+
templateData: null,
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
512
|
+
expect(updateBtn).toBeEnabled();
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
it('returns false when templateData is undefined', () => {
|
|
516
|
+
const { hasSupportCKEditor } = require('../../../utils/common');
|
|
517
|
+
hasSupportCKEditor.mockReturnValue(false);
|
|
518
|
+
|
|
519
|
+
renderComponent({
|
|
520
|
+
...baseFooterProps,
|
|
521
|
+
currentChannel: 'MOBILE_PUSH',
|
|
522
|
+
slidBoxContent: 'editTemplate',
|
|
523
|
+
restrictPersonalization: true,
|
|
524
|
+
isAnonymousType: true,
|
|
525
|
+
templateData: undefined,
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
const updateBtn = screen.getByRole('button', { name: /update/i });
|
|
529
|
+
expect(updateBtn).toBeEnabled();
|
|
530
|
+
});
|
|
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
|
+
});
|
|
193
636
|
});
|