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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Test SlideBoxContent container campaign message, add creative click rcs 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<CreativesSlideBoxWrapper
|
|
5
5
|
className="add-creatives-section creatives-library-mode "
|
|
6
6
|
shouldApplyFooterMargin={false}
|
|
7
7
|
slideBoxWrapperMargin={0}
|
|
@@ -12,14 +12,18 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
12
12
|
closeIconType="close"
|
|
13
13
|
content={
|
|
14
14
|
<SlideBoxContent
|
|
15
|
+
channelsToHide={Array []}
|
|
15
16
|
currentChannel="RCS"
|
|
17
|
+
customerType=""
|
|
16
18
|
getFormData={[Function]}
|
|
17
19
|
handleClose={[Function]}
|
|
18
20
|
handleCloseTestAndPreview={[Function]}
|
|
19
21
|
handleTestAndPreview={[Function]}
|
|
20
22
|
hostName=""
|
|
21
23
|
inAppEditorType={null}
|
|
24
|
+
isAnonymousType={false}
|
|
22
25
|
isTestAndPreviewMode={false}
|
|
26
|
+
localTemplatesConfig={Object {}}
|
|
23
27
|
loyaltyMetaData={
|
|
24
28
|
Object {
|
|
25
29
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -38,6 +42,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
38
42
|
onInAppEditorTypeChange={[Function]}
|
|
39
43
|
onInAppModeChange={[Function]}
|
|
40
44
|
onMobilepushModeChange={[Function]}
|
|
45
|
+
onPersonalizationTokensChange={[Function]}
|
|
41
46
|
onPreviewTemplate={[Function]}
|
|
42
47
|
onRemoveTemplateName={[Function]}
|
|
43
48
|
onResetStep={[Function]}
|
|
@@ -46,6 +51,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
46
51
|
onValidationFail={[Function]}
|
|
47
52
|
onWeChatMaptemplateStepChange={[Function]}
|
|
48
53
|
onWechatTemplateChange={[Function]}
|
|
54
|
+
restrictPersonalization={false}
|
|
49
55
|
saveMessage={[Function]}
|
|
50
56
|
setIsLoadingContent={[Function]}
|
|
51
57
|
showLiquidErrorInFooter={[Function]}
|
|
@@ -80,6 +86,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
80
86
|
}
|
|
81
87
|
templateNameRenderProp={[Function]}
|
|
82
88
|
templateStep="modeSelection"
|
|
89
|
+
useLocalTemplates={false}
|
|
83
90
|
weChatMaptemplateStep={0}
|
|
84
91
|
weChatTemplateType=""
|
|
85
92
|
/>
|
|
@@ -88,11 +95,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
88
95
|
show={true}
|
|
89
96
|
size="size-xl"
|
|
90
97
|
/>
|
|
91
|
-
</
|
|
98
|
+
</CreativesSlideBoxWrapper>
|
|
92
99
|
`;
|
|
93
100
|
|
|
94
101
|
exports[`Test SlideBoxContent container campaign message, add creative click whatsapp 1`] = `
|
|
95
|
-
<
|
|
102
|
+
<CreativesSlideBoxWrapper
|
|
96
103
|
className="add-creatives-section creatives-library-mode "
|
|
97
104
|
shouldApplyFooterMargin={false}
|
|
98
105
|
slideBoxWrapperMargin={0}
|
|
@@ -103,14 +110,18 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
103
110
|
closeIconType="close"
|
|
104
111
|
content={
|
|
105
112
|
<SlideBoxContent
|
|
113
|
+
channelsToHide={Array []}
|
|
106
114
|
currentChannel="WHATSAPP"
|
|
115
|
+
customerType=""
|
|
107
116
|
getFormData={[Function]}
|
|
108
117
|
handleClose={[Function]}
|
|
109
118
|
handleCloseTestAndPreview={[Function]}
|
|
110
119
|
handleTestAndPreview={[Function]}
|
|
111
120
|
hostName=""
|
|
112
121
|
inAppEditorType={null}
|
|
122
|
+
isAnonymousType={false}
|
|
113
123
|
isTestAndPreviewMode={false}
|
|
124
|
+
localTemplatesConfig={Object {}}
|
|
114
125
|
loyaltyMetaData={
|
|
115
126
|
Object {
|
|
116
127
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -129,6 +140,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
129
140
|
onInAppEditorTypeChange={[Function]}
|
|
130
141
|
onInAppModeChange={[Function]}
|
|
131
142
|
onMobilepushModeChange={[Function]}
|
|
143
|
+
onPersonalizationTokensChange={[Function]}
|
|
132
144
|
onPreviewTemplate={[Function]}
|
|
133
145
|
onRemoveTemplateName={[Function]}
|
|
134
146
|
onResetStep={[Function]}
|
|
@@ -137,6 +149,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
137
149
|
onValidationFail={[Function]}
|
|
138
150
|
onWeChatMaptemplateStepChange={[Function]}
|
|
139
151
|
onWechatTemplateChange={[Function]}
|
|
152
|
+
restrictPersonalization={false}
|
|
140
153
|
saveMessage={[Function]}
|
|
141
154
|
setIsLoadingContent={[Function]}
|
|
142
155
|
showLiquidErrorInFooter={[Function]}
|
|
@@ -171,6 +184,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
171
184
|
}
|
|
172
185
|
templateNameRenderProp={[Function]}
|
|
173
186
|
templateStep="modeSelection"
|
|
187
|
+
useLocalTemplates={false}
|
|
174
188
|
weChatMaptemplateStep={0}
|
|
175
189
|
weChatTemplateType=""
|
|
176
190
|
/>
|
|
@@ -179,11 +193,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
179
193
|
show={true}
|
|
180
194
|
size="size-xl"
|
|
181
195
|
/>
|
|
182
|
-
</
|
|
196
|
+
</CreativesSlideBoxWrapper>
|
|
183
197
|
`;
|
|
184
198
|
|
|
185
199
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit all data 1`] = `
|
|
186
|
-
<
|
|
200
|
+
<CreativesSlideBoxWrapper
|
|
187
201
|
className="add-creatives-section creatives-library-mode "
|
|
188
202
|
shouldApplyFooterMargin={false}
|
|
189
203
|
slideBoxWrapperMargin={0}
|
|
@@ -194,14 +208,18 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
194
208
|
closeIconType="close"
|
|
195
209
|
content={
|
|
196
210
|
<SlideBoxContent
|
|
211
|
+
channelsToHide={Array []}
|
|
197
212
|
currentChannel="WHATSAPP"
|
|
213
|
+
customerType=""
|
|
198
214
|
getFormData={[Function]}
|
|
199
215
|
handleClose={[Function]}
|
|
200
216
|
handleCloseTestAndPreview={[Function]}
|
|
201
217
|
handleTestAndPreview={[Function]}
|
|
202
218
|
hostName=""
|
|
203
219
|
inAppEditorType={null}
|
|
220
|
+
isAnonymousType={false}
|
|
204
221
|
isTestAndPreviewMode={false}
|
|
222
|
+
localTemplatesConfig={Object {}}
|
|
205
223
|
loyaltyMetaData={
|
|
206
224
|
Object {
|
|
207
225
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -220,6 +238,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
220
238
|
onInAppEditorTypeChange={[Function]}
|
|
221
239
|
onInAppModeChange={[Function]}
|
|
222
240
|
onMobilepushModeChange={[Function]}
|
|
241
|
+
onPersonalizationTokensChange={[Function]}
|
|
223
242
|
onPreviewTemplate={[Function]}
|
|
224
243
|
onRemoveTemplateName={[Function]}
|
|
225
244
|
onResetStep={[Function]}
|
|
@@ -228,6 +247,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
228
247
|
onValidationFail={[Function]}
|
|
229
248
|
onWeChatMaptemplateStepChange={[Function]}
|
|
230
249
|
onWechatTemplateChange={[Function]}
|
|
250
|
+
restrictPersonalization={false}
|
|
231
251
|
saveMessage={[Function]}
|
|
232
252
|
setIsLoadingContent={[Function]}
|
|
233
253
|
showLiquidErrorInFooter={[Function]}
|
|
@@ -257,6 +277,8 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
257
277
|
}
|
|
258
278
|
}
|
|
259
279
|
fetchingCmsData={false}
|
|
280
|
+
formData={Array []}
|
|
281
|
+
hasPersonalizationTokenError={false}
|
|
260
282
|
htmlEditorValidationState={
|
|
261
283
|
Object {
|
|
262
284
|
"errorsAcknowledged": false,
|
|
@@ -269,6 +291,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
269
291
|
"validationComplete": false,
|
|
270
292
|
}
|
|
271
293
|
}
|
|
294
|
+
isAnonymousType={false}
|
|
272
295
|
isContinueButtonDisabled={false}
|
|
273
296
|
isCreatingTemplate={false}
|
|
274
297
|
isEmptyContent={false}
|
|
@@ -280,6 +303,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
280
303
|
onEditTemplate={[Function]}
|
|
281
304
|
onSave={[Function]}
|
|
282
305
|
onTestAndPreview={[Function]}
|
|
306
|
+
restrictPersonalization={false}
|
|
283
307
|
selectedEmailCreateMode={null}
|
|
284
308
|
shouldShowContinueFooter={[Function]}
|
|
285
309
|
shouldShowDoneFooter={[Function]}
|
|
@@ -300,6 +324,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
300
324
|
slidBoxContent="editTemplate"
|
|
301
325
|
templateNameRenderProp={[Function]}
|
|
302
326
|
templateStep="modeSelection"
|
|
327
|
+
useLocalTemplates={false}
|
|
303
328
|
weChatMaptemplateStep={0}
|
|
304
329
|
weChatTemplateType=""
|
|
305
330
|
/>
|
|
@@ -308,11 +333,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
308
333
|
show={false}
|
|
309
334
|
size="size-xl"
|
|
310
335
|
/>
|
|
311
|
-
</
|
|
336
|
+
</CreativesSlideBoxWrapper>
|
|
312
337
|
`;
|
|
313
338
|
|
|
314
339
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit min data 1`] = `
|
|
315
|
-
<
|
|
340
|
+
<CreativesSlideBoxWrapper
|
|
316
341
|
className="add-creatives-section creatives-library-mode "
|
|
317
342
|
shouldApplyFooterMargin={false}
|
|
318
343
|
slideBoxWrapperMargin={0}
|
|
@@ -323,14 +348,18 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
323
348
|
closeIconType="close"
|
|
324
349
|
content={
|
|
325
350
|
<SlideBoxContent
|
|
351
|
+
channelsToHide={Array []}
|
|
326
352
|
currentChannel="WHATSAPP"
|
|
353
|
+
customerType=""
|
|
327
354
|
getFormData={[Function]}
|
|
328
355
|
handleClose={[Function]}
|
|
329
356
|
handleCloseTestAndPreview={[Function]}
|
|
330
357
|
handleTestAndPreview={[Function]}
|
|
331
358
|
hostName=""
|
|
332
359
|
inAppEditorType={null}
|
|
360
|
+
isAnonymousType={false}
|
|
333
361
|
isTestAndPreviewMode={false}
|
|
362
|
+
localTemplatesConfig={Object {}}
|
|
334
363
|
loyaltyMetaData={
|
|
335
364
|
Object {
|
|
336
365
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -349,6 +378,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
349
378
|
onInAppEditorTypeChange={[Function]}
|
|
350
379
|
onInAppModeChange={[Function]}
|
|
351
380
|
onMobilepushModeChange={[Function]}
|
|
381
|
+
onPersonalizationTokensChange={[Function]}
|
|
352
382
|
onPreviewTemplate={[Function]}
|
|
353
383
|
onRemoveTemplateName={[Function]}
|
|
354
384
|
onResetStep={[Function]}
|
|
@@ -357,6 +387,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
357
387
|
onValidationFail={[Function]}
|
|
358
388
|
onWeChatMaptemplateStepChange={[Function]}
|
|
359
389
|
onWechatTemplateChange={[Function]}
|
|
390
|
+
restrictPersonalization={false}
|
|
360
391
|
saveMessage={[Function]}
|
|
361
392
|
setIsLoadingContent={[Function]}
|
|
362
393
|
showLiquidErrorInFooter={[Function]}
|
|
@@ -386,6 +417,8 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
386
417
|
}
|
|
387
418
|
}
|
|
388
419
|
fetchingCmsData={false}
|
|
420
|
+
formData={Array []}
|
|
421
|
+
hasPersonalizationTokenError={false}
|
|
389
422
|
htmlEditorValidationState={
|
|
390
423
|
Object {
|
|
391
424
|
"errorsAcknowledged": false,
|
|
@@ -398,6 +431,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
398
431
|
"validationComplete": false,
|
|
399
432
|
}
|
|
400
433
|
}
|
|
434
|
+
isAnonymousType={false}
|
|
401
435
|
isContinueButtonDisabled={false}
|
|
402
436
|
isCreatingTemplate={false}
|
|
403
437
|
isEmptyContent={false}
|
|
@@ -409,6 +443,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
409
443
|
onEditTemplate={[Function]}
|
|
410
444
|
onSave={[Function]}
|
|
411
445
|
onTestAndPreview={[Function]}
|
|
446
|
+
restrictPersonalization={false}
|
|
412
447
|
selectedEmailCreateMode={null}
|
|
413
448
|
shouldShowContinueFooter={[Function]}
|
|
414
449
|
shouldShowDoneFooter={[Function]}
|
|
@@ -429,6 +464,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
429
464
|
slidBoxContent="editTemplate"
|
|
430
465
|
templateNameRenderProp={[Function]}
|
|
431
466
|
templateStep="modeSelection"
|
|
467
|
+
useLocalTemplates={false}
|
|
432
468
|
weChatMaptemplateStep={0}
|
|
433
469
|
weChatTemplateType=""
|
|
434
470
|
/>
|
|
@@ -437,11 +473,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
437
473
|
show={false}
|
|
438
474
|
size="size-xl"
|
|
439
475
|
/>
|
|
440
|
-
</
|
|
476
|
+
</CreativesSlideBoxWrapper>
|
|
441
477
|
`;
|
|
442
478
|
|
|
443
479
|
exports[`Test SlideBoxContent container it should clear the url, on channel change from new whatsapp to another 1`] = `
|
|
444
|
-
<
|
|
480
|
+
<CreativesSlideBoxWrapper
|
|
445
481
|
className="add-creatives-section creatives-library-mode "
|
|
446
482
|
shouldApplyFooterMargin={false}
|
|
447
483
|
slideBoxWrapperMargin={0}
|
|
@@ -452,14 +488,18 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
452
488
|
closeIconType="close"
|
|
453
489
|
content={
|
|
454
490
|
<SlideBoxContent
|
|
491
|
+
channelsToHide={Array []}
|
|
455
492
|
currentChannel="WHATSAPP"
|
|
493
|
+
customerType=""
|
|
456
494
|
getFormData={[Function]}
|
|
457
495
|
handleClose={[Function]}
|
|
458
496
|
handleCloseTestAndPreview={[Function]}
|
|
459
497
|
handleTestAndPreview={[Function]}
|
|
460
498
|
hostName=""
|
|
461
499
|
inAppEditorType={null}
|
|
500
|
+
isAnonymousType={false}
|
|
462
501
|
isTestAndPreviewMode={false}
|
|
502
|
+
localTemplatesConfig={Object {}}
|
|
463
503
|
loyaltyMetaData={
|
|
464
504
|
Object {
|
|
465
505
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -478,6 +518,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
478
518
|
onInAppEditorTypeChange={[Function]}
|
|
479
519
|
onInAppModeChange={[Function]}
|
|
480
520
|
onMobilepushModeChange={[Function]}
|
|
521
|
+
onPersonalizationTokensChange={[Function]}
|
|
481
522
|
onPreviewTemplate={[Function]}
|
|
482
523
|
onRemoveTemplateName={[Function]}
|
|
483
524
|
onResetStep={[Function]}
|
|
@@ -486,6 +527,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
486
527
|
onValidationFail={[Function]}
|
|
487
528
|
onWeChatMaptemplateStepChange={[Function]}
|
|
488
529
|
onWechatTemplateChange={[Function]}
|
|
530
|
+
restrictPersonalization={false}
|
|
489
531
|
saveMessage={[Function]}
|
|
490
532
|
setIsLoadingContent={[Function]}
|
|
491
533
|
showLiquidErrorInFooter={[Function]}
|
|
@@ -515,6 +557,8 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
515
557
|
}
|
|
516
558
|
}
|
|
517
559
|
fetchingCmsData={false}
|
|
560
|
+
formData={Array []}
|
|
561
|
+
hasPersonalizationTokenError={false}
|
|
518
562
|
htmlEditorValidationState={
|
|
519
563
|
Object {
|
|
520
564
|
"errorsAcknowledged": false,
|
|
@@ -527,6 +571,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
527
571
|
"validationComplete": false,
|
|
528
572
|
}
|
|
529
573
|
}
|
|
574
|
+
isAnonymousType={false}
|
|
530
575
|
isContinueButtonDisabled={false}
|
|
531
576
|
isCreatingTemplate={false}
|
|
532
577
|
isEmptyContent={false}
|
|
@@ -538,6 +583,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
538
583
|
onEditTemplate={[Function]}
|
|
539
584
|
onSave={[Function]}
|
|
540
585
|
onTestAndPreview={[Function]}
|
|
586
|
+
restrictPersonalization={false}
|
|
541
587
|
selectedEmailCreateMode={null}
|
|
542
588
|
shouldShowContinueFooter={[Function]}
|
|
543
589
|
shouldShowDoneFooter={[Function]}
|
|
@@ -558,6 +604,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
558
604
|
slidBoxContent="editTemplate"
|
|
559
605
|
templateNameRenderProp={[Function]}
|
|
560
606
|
templateStep="modeSelection"
|
|
607
|
+
useLocalTemplates={false}
|
|
561
608
|
weChatMaptemplateStep={0}
|
|
562
609
|
weChatTemplateType=""
|
|
563
610
|
/>
|
|
@@ -566,5 +613,5 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
566
613
|
show={false}
|
|
567
614
|
size="size-xl"
|
|
568
615
|
/>
|
|
569
|
-
</
|
|
616
|
+
</CreativesSlideBoxWrapper>
|
|
570
617
|
`;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CAP_SPACE_32,
|
|
3
|
+
CAP_SPACE_56,
|
|
4
|
+
CAP_SPACE_64,
|
|
5
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
6
|
+
import {
|
|
7
|
+
isDeepEmpty,
|
|
8
|
+
getSlideBoxWrapperMarginFromLiquidErrors,
|
|
9
|
+
computeLiquidFooterUpdateFromFormBuilder,
|
|
10
|
+
} from '../embeddedSlideboxUtils';
|
|
11
|
+
import { ANDROID, IOS, MOBILE_PUSH, LIQUID_ERROR_MSG, STANDARD_ERROR_MSG } from '../constants';
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// isDeepEmpty
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
describe('isDeepEmpty', () => {
|
|
18
|
+
it('returns true for null', () => {
|
|
19
|
+
expect(isDeepEmpty(null)).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('returns true for undefined', () => {
|
|
23
|
+
expect(isDeepEmpty(undefined)).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('returns true for empty string', () => {
|
|
27
|
+
expect(isDeepEmpty('')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('returns false for non-empty string', () => {
|
|
31
|
+
expect(isDeepEmpty('hello')).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('returns true for empty array', () => {
|
|
35
|
+
expect(isDeepEmpty([])).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('returns false for non-empty array', () => {
|
|
39
|
+
expect(isDeepEmpty(['item'])).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('returns true for empty object', () => {
|
|
43
|
+
expect(isDeepEmpty({})).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('returns true for object where all values are deep-empty', () => {
|
|
47
|
+
expect(isDeepEmpty({ a: null, b: '', c: [] })).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('returns false for object with at least one non-empty value', () => {
|
|
51
|
+
expect(isDeepEmpty({ a: null, b: 'something' })).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('returns true for nested all-empty object', () => {
|
|
55
|
+
expect(isDeepEmpty({ a: { b: null, c: [] } })).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('returns false for nested object with a non-empty leaf', () => {
|
|
59
|
+
expect(isDeepEmpty({ a: { b: 'value' } })).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('returns false for a number (non-null, non-string, non-array, non-object)', () => {
|
|
63
|
+
expect(isDeepEmpty(0)).toBe(false);
|
|
64
|
+
expect(isDeepEmpty(42)).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('returns false for a boolean false', () => {
|
|
68
|
+
expect(isDeepEmpty(false)).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// getSlideBoxWrapperMarginFromLiquidErrors
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
describe('getSlideBoxWrapperMarginFromLiquidErrors', () => {
|
|
77
|
+
it('returns 0 when liquidErrorMessage is null', () => {
|
|
78
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors(null)).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('returns 0 when liquidErrorMessage is undefined', () => {
|
|
82
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors(undefined)).toBe(0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('returns 0 when both error arrays are empty', () => {
|
|
86
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
87
|
+
STANDARD_ERROR_MSG: [],
|
|
88
|
+
LIQUID_ERROR_MSG: [],
|
|
89
|
+
})).toBe(0);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('returns 0 when neither error array is present', () => {
|
|
93
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({})).toBe(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('returns CAP_SPACE_64 when both STANDARD and LIQUID errors are present', () => {
|
|
97
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
98
|
+
STANDARD_ERROR_MSG: ['std error'],
|
|
99
|
+
LIQUID_ERROR_MSG: ['liquid error'],
|
|
100
|
+
})).toBe(CAP_SPACE_64);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('returns CAP_SPACE_56 when only LIQUID errors are present', () => {
|
|
104
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
105
|
+
STANDARD_ERROR_MSG: [],
|
|
106
|
+
LIQUID_ERROR_MSG: ['liquid error'],
|
|
107
|
+
})).toBe(CAP_SPACE_56);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('returns CAP_SPACE_32 when only STANDARD errors are present', () => {
|
|
111
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
112
|
+
STANDARD_ERROR_MSG: ['std error'],
|
|
113
|
+
LIQUID_ERROR_MSG: [],
|
|
114
|
+
})).toBe(CAP_SPACE_32);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('returns CAP_SPACE_56 when LIQUID has multiple errors and STANDARD is absent', () => {
|
|
118
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
119
|
+
LIQUID_ERROR_MSG: ['err1', 'err2'],
|
|
120
|
+
})).toBe(CAP_SPACE_56);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('returns CAP_SPACE_32 when STANDARD has multiple errors and LIQUID is absent', () => {
|
|
124
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
125
|
+
STANDARD_ERROR_MSG: ['err1', 'err2'],
|
|
126
|
+
})).toBe(CAP_SPACE_32);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// computeLiquidFooterUpdateFromFormBuilder
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
describe('computeLiquidFooterUpdateFromFormBuilder', () => {
|
|
135
|
+
const noErrors = { [LIQUID_ERROR_MSG]: [], [STANDARD_ERROR_MSG]: [] };
|
|
136
|
+
const liquidOnly = { [LIQUID_ERROR_MSG]: ['liquid err'], [STANDARD_ERROR_MSG]: [] };
|
|
137
|
+
const standardOnly = { [LIQUID_ERROR_MSG]: [], [STANDARD_ERROR_MSG]: ['std err'] };
|
|
138
|
+
const bothErrors = { [LIQUID_ERROR_MSG]: ['l'], [STANDARD_ERROR_MSG]: ['s'] };
|
|
139
|
+
|
|
140
|
+
describe('normal (non-null) returns', () => {
|
|
141
|
+
it('returns isLiquidValidationError=false when no errors', () => {
|
|
142
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
143
|
+
previousIsLiquidValidationError: false,
|
|
144
|
+
currentChannelUpper: 'SMS',
|
|
145
|
+
});
|
|
146
|
+
expect(result).not.toBeNull();
|
|
147
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
148
|
+
expect(result.liquidErrorMessage).toEqual(noErrors);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('sets isLiquidValidationError=true when liquid errors present', () => {
|
|
152
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
153
|
+
previousIsLiquidValidationError: false,
|
|
154
|
+
currentChannelUpper: 'SMS',
|
|
155
|
+
});
|
|
156
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('sets isLiquidValidationError=true when standard errors present', () => {
|
|
160
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(standardOnly, 1, {
|
|
161
|
+
previousIsLiquidValidationError: false,
|
|
162
|
+
currentChannelUpper: 'SMS',
|
|
163
|
+
});
|
|
164
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('sets isLiquidValidationError=true when both errors present', () => {
|
|
168
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(bothErrors, 1, {
|
|
169
|
+
previousIsLiquidValidationError: false,
|
|
170
|
+
currentChannelUpper: 'SMS',
|
|
171
|
+
});
|
|
172
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('maps tab 1 to ANDROID', () => {
|
|
176
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
177
|
+
previousIsLiquidValidationError: false,
|
|
178
|
+
currentChannelUpper: 'SMS',
|
|
179
|
+
});
|
|
180
|
+
expect(result.activeFormBuilderTab).toBe(ANDROID);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('maps tab 2 to IOS', () => {
|
|
184
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 2, {
|
|
185
|
+
previousIsLiquidValidationError: false,
|
|
186
|
+
currentChannelUpper: 'SMS',
|
|
187
|
+
});
|
|
188
|
+
expect(result.activeFormBuilderTab).toBe(IOS);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('maps tab 3 (or any other tab) to null', () => {
|
|
192
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 3, {
|
|
193
|
+
previousIsLiquidValidationError: false,
|
|
194
|
+
currentChannelUpper: 'SMS',
|
|
195
|
+
});
|
|
196
|
+
expect(result.activeFormBuilderTab).toBeNull();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('maps undefined tab to null for activeFormBuilderTab', () => {
|
|
200
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, undefined, {
|
|
201
|
+
previousIsLiquidValidationError: false,
|
|
202
|
+
currentChannelUpper: 'SMS',
|
|
203
|
+
});
|
|
204
|
+
expect(result.activeFormBuilderTab).toBeNull();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('does NOT return null for Mobile Push when errors ARE present', () => {
|
|
208
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
209
|
+
previousIsLiquidValidationError: true,
|
|
210
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
211
|
+
});
|
|
212
|
+
expect(result).not.toBeNull();
|
|
213
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('does NOT return null for non-Mobile Push channel even with previousIsLiquidValidationError', () => {
|
|
217
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
218
|
+
previousIsLiquidValidationError: true,
|
|
219
|
+
currentChannelUpper: 'SMS',
|
|
220
|
+
});
|
|
221
|
+
expect(result).not.toBeNull();
|
|
222
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('works without options argument (uses defaults)', () => {
|
|
226
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1);
|
|
227
|
+
expect(result).not.toBeNull();
|
|
228
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('Mobile Push OLD clear (returns null)', () => {
|
|
233
|
+
it('returns null when no errors and previousIsLiquidValidationError is true for MOBILEPUSH', () => {
|
|
234
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
235
|
+
previousIsLiquidValidationError: true,
|
|
236
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
237
|
+
});
|
|
238
|
+
expect(result).toBeNull();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('does NOT return null when previousIsLiquidValidationError is false for MOBILEPUSH', () => {
|
|
242
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
243
|
+
previousIsLiquidValidationError: false,
|
|
244
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
245
|
+
});
|
|
246
|
+
expect(result).not.toBeNull();
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('does NOT return null when only standard errors cleared but liquid error remains for MOBILEPUSH', () => {
|
|
250
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
251
|
+
previousIsLiquidValidationError: true,
|
|
252
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
253
|
+
});
|
|
254
|
+
// hasLiquid = true → condition !hasLiquid is false → does not return null
|
|
255
|
+
expect(result).not.toBeNull();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
});
|