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
|
@@ -173,19 +173,35 @@ describe('Test SlideBoxContent container', () => {
|
|
|
173
173
|
expect(getCreativesData).toHaveBeenCalledWith({ channel: 'RCS' });
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
-
it('RCS getFormData
|
|
177
|
-
|
|
176
|
+
it('RCS getFormData mirrors smsFallBackContent onto templateData for library round-trip', async () => {
|
|
177
|
+
renderedComponent = shallowWithIntl(
|
|
178
|
+
<Creatives
|
|
179
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
180
|
+
Templates={rcsTemplates}
|
|
181
|
+
channel="RCS"
|
|
182
|
+
slidBoxContent="editTemplate"
|
|
183
|
+
templateData={rcsEditTemplateData}
|
|
184
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
185
|
+
getCreativesData={getCreativesData}
|
|
186
|
+
isFullMode={false}
|
|
187
|
+
templateActions={{
|
|
188
|
+
getCdnTransformationConfig,
|
|
189
|
+
}}
|
|
190
|
+
/>,
|
|
191
|
+
);
|
|
178
192
|
renderedComponent.instance().onEditTemplate();
|
|
179
193
|
|
|
180
194
|
const mockValue = {
|
|
195
|
+
validity: true,
|
|
181
196
|
value: {
|
|
182
197
|
name: 'rcs_creative_name',
|
|
198
|
+
type: 'RCS',
|
|
183
199
|
versions: {
|
|
184
200
|
base: {
|
|
185
201
|
content: {
|
|
186
202
|
RCS: {
|
|
187
203
|
rcsContent: { contentType: 'RICHCARD', cardType: 'STANDALONE', cardSettings: {}, cardContent: [{}] },
|
|
188
|
-
smsFallBackContent: { message: '
|
|
204
|
+
smsFallBackContent: { message: 'fallback-body' },
|
|
189
205
|
},
|
|
190
206
|
},
|
|
191
207
|
},
|
|
@@ -193,16 +209,62 @@ describe('Test SlideBoxContent container', () => {
|
|
|
193
209
|
},
|
|
194
210
|
};
|
|
195
211
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
.props()
|
|
199
|
-
.content.props.getFormData(mockValue);
|
|
212
|
+
// Call getFormData on the container instance — shallow CapSlideBox `content` shape can differ across wrappers
|
|
213
|
+
renderedComponent.instance().getFormData(mockValue);
|
|
200
214
|
await tick();
|
|
201
215
|
|
|
202
216
|
const instance = renderedComponent.instance();
|
|
203
217
|
expect(instance.state.templateData).toBeDefined();
|
|
204
|
-
|
|
205
|
-
|
|
218
|
+
expect(instance.state.templateData.smsFallBackContent).toEqual({ message: 'fallback-body' });
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('RCS getFormData mirrors rcsCardVarMapped onto templateData for campaign reopen', async () => {
|
|
222
|
+
renderedComponent = shallowWithIntl(
|
|
223
|
+
<Creatives
|
|
224
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
225
|
+
Templates={rcsTemplates}
|
|
226
|
+
channel="RCS"
|
|
227
|
+
slidBoxContent="editTemplate"
|
|
228
|
+
templateData={rcsEditTemplateData}
|
|
229
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
230
|
+
getCreativesData={getCreativesData}
|
|
231
|
+
isFullMode={false}
|
|
232
|
+
templateActions={{
|
|
233
|
+
getCdnTransformationConfig,
|
|
234
|
+
}}
|
|
235
|
+
/>,
|
|
236
|
+
);
|
|
237
|
+
renderedComponent.instance().onEditTemplate();
|
|
238
|
+
|
|
239
|
+
const cardVarMapped = { 1: '[Name]', user_name: '[Name]' };
|
|
240
|
+
const mockValue = {
|
|
241
|
+
validity: true,
|
|
242
|
+
value: {
|
|
243
|
+
name: 'rcs_creative_name',
|
|
244
|
+
type: 'RCS',
|
|
245
|
+
versions: {
|
|
246
|
+
base: {
|
|
247
|
+
content: {
|
|
248
|
+
RCS: {
|
|
249
|
+
rcsContent: {
|
|
250
|
+
contentType: 'RICHCARD',
|
|
251
|
+
cardType: 'STANDALONE',
|
|
252
|
+
cardSettings: {},
|
|
253
|
+
cardContent: [{ title: 'Hi {{user_name}}', cardVarMapped }],
|
|
254
|
+
},
|
|
255
|
+
smsFallBackContent: {},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
renderedComponent.instance().getFormData(mockValue);
|
|
264
|
+
await tick();
|
|
265
|
+
|
|
266
|
+
const instance = renderedComponent.instance();
|
|
267
|
+
expect(instance.state.templateData.rcsCardVarMapped).toEqual(cardVarMapped);
|
|
206
268
|
});
|
|
207
269
|
|
|
208
270
|
it('Text getCreatives data for rcs, data from creatives done to campaigns', async () => {
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Covers local-templates flag resolution: nested `localTemplatesConfig.useLocalTemplates`
|
|
3
|
+
* vs top-level `useLocalTemplates` (embedded consumers / SlideBoxContent).
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
7
|
+
import { Creatives } from '../index';
|
|
8
|
+
import mockdata from '../../mockdata';
|
|
9
|
+
|
|
10
|
+
const { smsTemplates, loyaltyMetaData } = mockdata;
|
|
11
|
+
|
|
12
|
+
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
13
|
+
__esModule: true,
|
|
14
|
+
default: (props) => (
|
|
15
|
+
<div className="FormBuilder-mock" {...props}>
|
|
16
|
+
FormBuilder
|
|
17
|
+
</div>
|
|
18
|
+
),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const baseProps = {
|
|
22
|
+
loyaltyMetaData,
|
|
23
|
+
Templates: smsTemplates,
|
|
24
|
+
channel: 'SMS',
|
|
25
|
+
creativesMode: 'create',
|
|
26
|
+
templateData: null,
|
|
27
|
+
isFullMode: true,
|
|
28
|
+
handleCloseCreatives: jest.fn(),
|
|
29
|
+
getCreativesData: jest.fn(),
|
|
30
|
+
templateActions: {
|
|
31
|
+
getCdnTransformationConfig: jest.fn(),
|
|
32
|
+
resetTemplateStoreData: jest.fn(),
|
|
33
|
+
},
|
|
34
|
+
globalActions: {
|
|
35
|
+
clearMetaEntities: jest.fn(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
describe('CreativesContainer useLocalTemplates prop resolution', () => {
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
jest.clearAllMocks();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('initial slidebox is templates when only top-level useLocalTemplates is true', () => {
|
|
45
|
+
const wrapper = shallowWithIntl(
|
|
46
|
+
<Creatives
|
|
47
|
+
{...baseProps}
|
|
48
|
+
useLocalTemplates
|
|
49
|
+
/>,
|
|
50
|
+
);
|
|
51
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('initial slidebox is templates when localTemplatesConfig.useLocalTemplates is true', () => {
|
|
55
|
+
const wrapper = shallowWithIntl(
|
|
56
|
+
<Creatives
|
|
57
|
+
{...baseProps}
|
|
58
|
+
localTemplatesConfig={{ useLocalTemplates: true }}
|
|
59
|
+
/>,
|
|
60
|
+
);
|
|
61
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('does not reset template store on unmount when embedded and top-level useLocalTemplates is true', () => {
|
|
65
|
+
const wrapper = shallowWithIntl(
|
|
66
|
+
<Creatives
|
|
67
|
+
{...baseProps}
|
|
68
|
+
location={{ query: { type: 'embedded' } }}
|
|
69
|
+
useLocalTemplates
|
|
70
|
+
/>,
|
|
71
|
+
);
|
|
72
|
+
wrapper.unmount();
|
|
73
|
+
expect(baseProps.templateActions.resetTemplateStoreData).not.toHaveBeenCalled();
|
|
74
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('resets template store on unmount when embedded and local templates are not used', () => {
|
|
78
|
+
const wrapper = shallowWithIntl(
|
|
79
|
+
<Creatives
|
|
80
|
+
{...baseProps}
|
|
81
|
+
location={{ query: { type: 'embedded' } }}
|
|
82
|
+
useLocalTemplates={false}
|
|
83
|
+
/>,
|
|
84
|
+
);
|
|
85
|
+
wrapper.unmount();
|
|
86
|
+
expect(baseProps.templateActions.resetTemplateStoreData).toHaveBeenCalled();
|
|
87
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('prefers nested localTemplatesConfig.useLocalTemplates=false over top-level true (not local list mode)', () => {
|
|
91
|
+
const wrapper = shallowWithIntl(
|
|
92
|
+
<Creatives
|
|
93
|
+
{...baseProps}
|
|
94
|
+
localTemplatesConfig={{ useLocalTemplates: false }}
|
|
95
|
+
useLocalTemplates
|
|
96
|
+
/>,
|
|
97
|
+
);
|
|
98
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('createTemplate');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('uses top-level useLocalTemplates when localTemplatesConfig omits the flag', () => {
|
|
102
|
+
const wrapper = shallowWithIntl(
|
|
103
|
+
<Creatives
|
|
104
|
+
{...baseProps}
|
|
105
|
+
localTemplatesConfig={{}}
|
|
106
|
+
useLocalTemplates
|
|
107
|
+
/>,
|
|
108
|
+
);
|
|
109
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('resets template store when nested useLocalTemplates is false even if top-level is true', () => {
|
|
113
|
+
const wrapper = shallowWithIntl(
|
|
114
|
+
<Creatives
|
|
115
|
+
{...baseProps}
|
|
116
|
+
location={{ query: { type: 'embedded' } }}
|
|
117
|
+
localTemplatesConfig={{ useLocalTemplates: false }}
|
|
118
|
+
useLocalTemplates
|
|
119
|
+
/>,
|
|
120
|
+
);
|
|
121
|
+
wrapper.unmount();
|
|
122
|
+
expect(baseProps.templateActions.resetTemplateStoreData).toHaveBeenCalled();
|
|
123
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -26,7 +26,7 @@ import * as globalActions from '../Cap/actions';
|
|
|
26
26
|
import './_email.scss';
|
|
27
27
|
import {getMessageObject} from '../../utils/messageUtils';
|
|
28
28
|
import EmailPreview from '../../v2Components/EmailPreview';
|
|
29
|
-
import { getDecodedFileName,
|
|
29
|
+
import { getDecodedFileName, hasSupportCKEditor } from '../../utils/common';
|
|
30
30
|
import Pagination from '../../v2Components/Pagination';
|
|
31
31
|
import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
32
32
|
import withCreatives from '../../hoc/withCreatives';
|
|
@@ -170,7 +170,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
170
170
|
deleteLanguage: this.deleteLanguage,
|
|
171
171
|
},
|
|
172
172
|
};
|
|
173
|
-
this.liquidFlow = hasLiquidSupportFeature();
|
|
174
173
|
}
|
|
175
174
|
componentWillMount() {
|
|
176
175
|
const formData = this.initFormData(this.props, true); //_.cloneDeep(this.state.formData);
|
|
@@ -255,7 +254,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
255
254
|
layout: 'EMAIL',
|
|
256
255
|
type: 'LAYOUT',
|
|
257
256
|
version: 'v2',
|
|
258
|
-
liquidFlow:this.liquidFlow,
|
|
259
257
|
};
|
|
260
258
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
261
259
|
window.addEventListener("message", this.handleFrameTasks);
|
|
@@ -347,7 +345,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
347
345
|
type: 'TAG',
|
|
348
346
|
context: this.props.location.query.type === 'embedded' ? this.props.location.query.module : 'default',
|
|
349
347
|
embedded: this.props.location.query.type === 'embedded' ? this.props.location.query.type : 'full',
|
|
350
|
-
liquidFlow:this.liquidFlow
|
|
351
348
|
};
|
|
352
349
|
if (this.props.getDefaultTags) {
|
|
353
350
|
query.context = this.props.getDefaultTags;
|
|
@@ -2373,7 +2370,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2373
2370
|
type: 'TAG',
|
|
2374
2371
|
context: (data || '').toLowerCase() === 'all' ? 'default' : (data || '').toLowerCase(),
|
|
2375
2372
|
embedded: 'full',
|
|
2376
|
-
liquidFlow:this.liquidFlow
|
|
2377
2373
|
};
|
|
2378
2374
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
2379
2375
|
}
|
|
@@ -3138,6 +3134,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3138
3134
|
moduleType={moduleType}
|
|
3139
3135
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
3140
3136
|
eventContextTags={this.props?.eventContextTags}
|
|
3137
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
3141
3138
|
forwardedTags={this.props?.forwardedTags}
|
|
3142
3139
|
isLoyaltyModule={this.props?.isLoyaltyModule}
|
|
3143
3140
|
isTestAndPreviewMode={this.state.isTestAndPreviewMode} // Add flag to prevent validation
|
|
@@ -15,7 +15,7 @@ import HTMLEditor from '../../../v2Components/HtmlEditor';
|
|
|
15
15
|
import CapTagListWithInput from '../../../v2Components/CapTagListWithInput';
|
|
16
16
|
import formBuilderMessages from '../../../v2Components/FormBuilder/messages';
|
|
17
17
|
import { validateLiquidTemplateContent } from '../../../utils/commonUtils';
|
|
18
|
-
import {
|
|
18
|
+
import { isEmailUnsubscribeTagOptional } from '../../../utils/common';
|
|
19
19
|
import history from '../../../utils/history';
|
|
20
20
|
import messages from '../messages';
|
|
21
21
|
import emailMessages from '../../Email/messages';
|
|
@@ -54,6 +54,7 @@ const EmailHTMLEditor = (props) => {
|
|
|
54
54
|
globalActions,
|
|
55
55
|
loadingTags,
|
|
56
56
|
eventContextTags,
|
|
57
|
+
waitEventContextTags,
|
|
57
58
|
forwardedTags,
|
|
58
59
|
selectedOfferDetails,
|
|
59
60
|
currentOrgDetails,
|
|
@@ -108,6 +109,21 @@ const EmailHTMLEditor = (props) => {
|
|
|
108
109
|
standardErrors: [],
|
|
109
110
|
});
|
|
110
111
|
|
|
112
|
+
// Merge tag validation errors (missing) into apiValidationErrors so they show in ValidationErrorDisplay
|
|
113
|
+
const mergedApiValidationErrors = useMemo(() => {
|
|
114
|
+
const tagMessages = [];
|
|
115
|
+
if (tagValidationError?.missingTags?.length && !isEmailUnsubscribeTagOptional()) {
|
|
116
|
+
tagMessages.push(`Missing tags are: ${tagValidationError.missingTags.join(', ')}`);
|
|
117
|
+
}
|
|
118
|
+
if (tagMessages.length === 0) {
|
|
119
|
+
return apiValidationErrors;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
liquidErrors: apiValidationErrors?.liquidErrors || [],
|
|
123
|
+
standardErrors: [...(apiValidationErrors?.standardErrors || []), ...tagMessages],
|
|
124
|
+
};
|
|
125
|
+
}, [apiValidationErrors, tagValidationError]);
|
|
126
|
+
|
|
111
127
|
// Refs for tracking initialization and previous values
|
|
112
128
|
const contentInitializedRef = useRef(false);
|
|
113
129
|
const subjectInitializedRef = useRef(false);
|
|
@@ -172,9 +188,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
172
188
|
},
|
|
173
189
|
}), [htmlContent, subject, currentOrgDetails]);
|
|
174
190
|
|
|
175
|
-
// Check if liquid support is enabled
|
|
176
|
-
const isLiquidEnabled = hasLiquidSupportFeature();
|
|
177
|
-
|
|
178
191
|
// Detect edit mode: when isEditEmail is false (create flow), never treat as edit or fetch template details
|
|
179
192
|
const hasParamsId = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
|
|
180
193
|
const currentTemplateId = isEditEmail
|
|
@@ -470,15 +483,27 @@ const EmailHTMLEditor = (props) => {
|
|
|
470
483
|
const handleContentChange = useCallback((content) => {
|
|
471
484
|
setHtmlContent(content);
|
|
472
485
|
|
|
486
|
+
// Clear previous liquid/API validation errors so Done button can be enabled after user fixes content
|
|
487
|
+
setApiValidationErrors({
|
|
488
|
+
liquidErrors: [],
|
|
489
|
+
standardErrors: [],
|
|
490
|
+
});
|
|
491
|
+
if (showLiquidErrorInFooter) {
|
|
492
|
+
showLiquidErrorInFooter({
|
|
493
|
+
STANDARD_ERROR_MSG: [],
|
|
494
|
+
LIQUID_ERROR_MSG: [],
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
473
498
|
// Validate tags
|
|
474
499
|
if (tags.length > 0 || !isEmpty(injectedTags)) {
|
|
475
500
|
const validationResult = validateTags({
|
|
476
501
|
content,
|
|
477
502
|
tagsParam: tags,
|
|
478
|
-
injectedTagsParams: injectedTags,
|
|
479
503
|
location,
|
|
480
504
|
tagModule: getDefaultTags,
|
|
481
|
-
|
|
505
|
+
isFullMode,
|
|
506
|
+
waitEventContextTags,
|
|
482
507
|
});
|
|
483
508
|
|
|
484
509
|
if (!validationResult.valid) {
|
|
@@ -487,7 +512,7 @@ const EmailHTMLEditor = (props) => {
|
|
|
487
512
|
setTagValidationError(null);
|
|
488
513
|
}
|
|
489
514
|
}
|
|
490
|
-
}, [tags, injectedTags, location, getDefaultTags, eventContextTags]);
|
|
515
|
+
}, [tags, injectedTags, location, getDefaultTags, eventContextTags, waitEventContextTags, showLiquidErrorInFooter]);
|
|
491
516
|
|
|
492
517
|
// Store the last validation state received from HTMLEditor
|
|
493
518
|
const lastValidationStateRef = useRef(null);
|
|
@@ -631,7 +656,7 @@ const EmailHTMLEditor = (props) => {
|
|
|
631
656
|
// IMPORTANT: Clear API validation errors FIRST before checking for validation errors
|
|
632
657
|
// This ensures that old API errors don't block the save when user fixes content and clicks Update again
|
|
633
658
|
// We'll re-validate with fresh API call anyway
|
|
634
|
-
if (
|
|
659
|
+
if (getLiquidTags) {
|
|
635
660
|
setApiValidationErrors({
|
|
636
661
|
liquidErrors: [],
|
|
637
662
|
standardErrors: [],
|
|
@@ -691,26 +716,27 @@ const EmailHTMLEditor = (props) => {
|
|
|
691
716
|
// 2. Validate Unsubscribe Tag when feature is OFF (when flag is false we require unsubscribe)
|
|
692
717
|
// When EMAIL_UNSUBSCRIBE_TAG_MANDATORY is true: do NOT validate for unsubscribe (aligned with FormBuilder).
|
|
693
718
|
// When EMAIL_UNSUBSCRIBE_TAG_MANDATORY is false: validate and require unsubscribe tag.
|
|
694
|
-
|
|
695
|
-
|
|
719
|
+
// Run for both library and full mode so liquid-enabled orgs also get the error (notification + ValidationErrorDisplay).
|
|
720
|
+
const isModuleTypeOutbound = (moduleType || '').toUpperCase() === OUTBOUND;
|
|
721
|
+
if (!isEmailUnsubscribeTagOptional() && isModuleTypeOutbound) {
|
|
696
722
|
const unsubscribeRegex = /{{unsubscribe(\(#[a-zA-Z\d]{6}\))?}}/g; // eslint-disable-line no-useless-escape
|
|
697
723
|
const hasUnsubscribeTag = unsubscribeRegex.test(htmlContent);
|
|
698
724
|
|
|
699
725
|
if (!hasUnsubscribeTag) {
|
|
700
|
-
|
|
726
|
+
setTagValidationError({ valid: false, missingTags: ['unsubscribe'] });
|
|
701
727
|
const missingTagsMsg = intl.formatMessage(formBuilderMessages.missingTags);
|
|
702
728
|
const errorMessage = `${missingTagsMsg} unsubscribe`;
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
729
|
+
setTimeout(() => {
|
|
730
|
+
CapNotification.error({
|
|
731
|
+
message: 'ERROR ! ! !',
|
|
732
|
+
description: errorMessage,
|
|
733
|
+
duration: 5,
|
|
734
|
+
});
|
|
735
|
+
}, 0);
|
|
708
736
|
|
|
709
|
-
// Reset parent state so next click is detected as a change
|
|
710
737
|
if (onValidationFail) {
|
|
711
738
|
onValidationFail();
|
|
712
739
|
}
|
|
713
|
-
// Block save - unsubscribe tag is required when validation is enabled
|
|
714
740
|
return;
|
|
715
741
|
}
|
|
716
742
|
}
|
|
@@ -718,56 +744,23 @@ const EmailHTMLEditor = (props) => {
|
|
|
718
744
|
// 3. Validate Content Tags
|
|
719
745
|
// For NON-liquid orgs: BLOCKING validation (matches CK/BEE behavior)
|
|
720
746
|
// For liquid orgs: Non-blocking (extractTags API will validate)
|
|
721
|
-
if
|
|
747
|
+
// In library mode, always validate when there is content (even if tags list is empty)
|
|
748
|
+
const shouldValidateTags = (tags.length > 0 || !isEmpty(injectedTags)) || (!isFullMode && !!htmlContent);
|
|
749
|
+
if (shouldValidateTags) {
|
|
722
750
|
const validationResult = validateTags({
|
|
723
751
|
content: htmlContent,
|
|
724
752
|
tagsParam: tags,
|
|
725
|
-
injectedTagsParams: injectedTags,
|
|
726
753
|
location,
|
|
727
754
|
tagModule: getDefaultTags,
|
|
728
|
-
|
|
755
|
+
isFullMode,
|
|
729
756
|
});
|
|
730
757
|
|
|
731
|
-
|
|
732
|
-
if (!validationResult?.valid || hasUnsupportedTags) {
|
|
758
|
+
if (!validationResult?.valid) {
|
|
733
759
|
setTagValidationError(validationResult);
|
|
734
|
-
|
|
735
|
-
// IMPORTANT: For non-liquid orgs, block save (like CK/BEE editor)
|
|
736
|
-
// For liquid orgs, continue (extractTags API will validate)
|
|
737
|
-
if (!isLiquidEnabled) {
|
|
738
|
-
// Show notification popup like CK/BEE editor
|
|
739
|
-
const baseLanguage = get(currentOrgDetails, 'basic_details.base_language', 'en');
|
|
740
|
-
|
|
741
|
-
const contentNotValidMsg = intl.formatMessage(formBuilderMessages.contentNotValidLanguage);
|
|
742
|
-
let errorMessage = `${contentNotValidMsg} ${baseLanguage}`;
|
|
743
|
-
|
|
744
|
-
if (hasUnsupportedTags) {
|
|
745
|
-
const unsupportedTagsMsg = intl.formatMessage(formBuilderMessages.unsupportedTags);
|
|
746
|
-
errorMessage += `\n${unsupportedTagsMsg} ${validationResult?.unsupportedTags?.join(', ')}`;
|
|
747
|
-
}
|
|
748
|
-
if (validationResult?.missingTags?.length > 0) {
|
|
749
|
-
const missingTagsMsg = intl.formatMessage(formBuilderMessages.missingTags);
|
|
750
|
-
errorMessage += `\n${missingTagsMsg} ${validationResult?.missingTags?.join(', ')}`;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
const type = 'error';
|
|
754
|
-
CapNotification[type]({
|
|
755
|
-
message: `${type.toUpperCase()} ! ! ! `,
|
|
756
|
-
description: errorMessage,
|
|
757
|
-
duration: 5,
|
|
758
|
-
});
|
|
759
|
-
|
|
760
|
-
// Reset parent state so next click is detected as a change
|
|
761
|
-
if (onValidationFail) {
|
|
762
|
-
onValidationFail();
|
|
763
|
-
}
|
|
764
|
-
// Block save for non-liquid orgs
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
// For liquid orgs, just show warning and continue
|
|
760
|
+
// For liquid orgs, show warning and continue (extractTags API will validate)
|
|
768
761
|
}
|
|
769
762
|
// Clear tag errors if valid
|
|
770
|
-
if (tagValidationError && validationResult?.valid
|
|
763
|
+
if (tagValidationError && validationResult?.valid) {
|
|
771
764
|
setTagValidationError(null);
|
|
772
765
|
}
|
|
773
766
|
}
|
|
@@ -934,13 +927,9 @@ const EmailHTMLEditor = (props) => {
|
|
|
934
927
|
}
|
|
935
928
|
};
|
|
936
929
|
|
|
937
|
-
//
|
|
938
|
-
if (
|
|
939
|
-
// Note: API validation errors are already cleared at the start of handleSave
|
|
940
|
-
// This ensures fresh validation on every save attempt
|
|
941
|
-
|
|
930
|
+
// Liquid validation (extractTags) only in library mode
|
|
931
|
+
if (getLiquidTags && !isFullMode) {
|
|
942
932
|
const onError = ({ standardErrors, liquidErrors }) => {
|
|
943
|
-
// Store API validation errors in state so they can be displayed in UI
|
|
944
933
|
setApiValidationErrors({
|
|
945
934
|
liquidErrors: liquidErrors || [],
|
|
946
935
|
standardErrors: standardErrors || [],
|
|
@@ -952,15 +941,12 @@ const EmailHTMLEditor = (props) => {
|
|
|
952
941
|
LIQUID_ERROR_MSG: liquidErrors || [],
|
|
953
942
|
});
|
|
954
943
|
}
|
|
955
|
-
// Don't reset ref here - liquid validation is async and resetting causes infinite loop
|
|
956
|
-
// The parent's isGetFormData will be reset by onValidationFail, and the next click will be detected
|
|
957
944
|
if (onValidationFail) {
|
|
958
945
|
onValidationFail();
|
|
959
946
|
}
|
|
960
947
|
};
|
|
961
948
|
|
|
962
949
|
const onSuccess = () => {
|
|
963
|
-
// Clear API validation errors on success
|
|
964
950
|
setApiValidationErrors({
|
|
965
951
|
liquidErrors: [],
|
|
966
952
|
standardErrors: [],
|
|
@@ -976,10 +962,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
976
962
|
messages: formBuilderMessages,
|
|
977
963
|
onError,
|
|
978
964
|
onSuccess,
|
|
979
|
-
tagLookupMap: metaEntities?.tagLookupMap,
|
|
980
|
-
eventContextTags,
|
|
981
|
-
isLiquidFlow: true,
|
|
982
|
-
forwardedTags: forwardedTags || {},
|
|
983
965
|
});
|
|
984
966
|
} else {
|
|
985
967
|
performSave();
|
|
@@ -991,7 +973,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
991
973
|
injectedTags,
|
|
992
974
|
location,
|
|
993
975
|
getDefaultTags,
|
|
994
|
-
eventContextTags,
|
|
995
976
|
formatMessage,
|
|
996
977
|
subjectError,
|
|
997
978
|
isFullMode,
|
|
@@ -1003,11 +984,8 @@ const EmailHTMLEditor = (props) => {
|
|
|
1003
984
|
emailActions,
|
|
1004
985
|
getFormdata,
|
|
1005
986
|
isGetFormData,
|
|
1006
|
-
isLiquidEnabled,
|
|
1007
987
|
getLiquidTags,
|
|
1008
988
|
showLiquidErrorInFooter,
|
|
1009
|
-
metaEntities,
|
|
1010
|
-
forwardedTags,
|
|
1011
989
|
globalActions,
|
|
1012
990
|
intl,
|
|
1013
991
|
extractedTemplateName,
|
|
@@ -1124,6 +1102,7 @@ const EmailHTMLEditor = (props) => {
|
|
|
1124
1102
|
injectedTags={injectedTags || {}}
|
|
1125
1103
|
selectedOfferDetails={selectedOfferDetails}
|
|
1126
1104
|
eventContextTags={eventContextTags}
|
|
1105
|
+
waitEventContextTags={waitEventContextTags}
|
|
1127
1106
|
showHeading
|
|
1128
1107
|
showTagList
|
|
1129
1108
|
showInput
|
|
@@ -1148,16 +1127,16 @@ const EmailHTMLEditor = (props) => {
|
|
|
1148
1127
|
injectedTags={injectedTags}
|
|
1149
1128
|
location={location}
|
|
1150
1129
|
eventContextTags={eventContextTags}
|
|
1130
|
+
waitEventContextTags={waitEventContextTags}
|
|
1151
1131
|
selectedOfferDetails={selectedOfferDetails}
|
|
1152
1132
|
channel={EMAIL}
|
|
1153
1133
|
userLocale={intl.locale || 'en'}
|
|
1154
1134
|
moduleFilterEnabled={location?.query?.type !== EMBEDDED}
|
|
1155
1135
|
onTagContextChange={handleOnTagsContextChange}
|
|
1156
|
-
isLiquidEnabled={isLiquidEnabled}
|
|
1157
1136
|
isFullMode={isFullMode}
|
|
1158
1137
|
onErrorAcknowledged={handleErrorAcknowledged}
|
|
1159
1138
|
onValidationChange={handleValidationChange}
|
|
1160
|
-
apiValidationErrors={
|
|
1139
|
+
apiValidationErrors={mergedApiValidationErrors}
|
|
1161
1140
|
/>
|
|
1162
1141
|
</CapColumn>
|
|
1163
1142
|
</CapRow>
|
|
@@ -1176,6 +1155,7 @@ EmailHTMLEditor.propTypes = {
|
|
|
1176
1155
|
globalActions: PropTypes.object,
|
|
1177
1156
|
loadingTags: PropTypes.bool,
|
|
1178
1157
|
eventContextTags: PropTypes.array,
|
|
1158
|
+
waitEventContextTags: PropTypes.object,
|
|
1179
1159
|
forwardedTags: PropTypes.object,
|
|
1180
1160
|
selectedOfferDetails: PropTypes.array,
|
|
1181
1161
|
currentOrgDetails: PropTypes.object,
|
|
@@ -1222,6 +1202,7 @@ EmailHTMLEditor.defaultProps = {
|
|
|
1222
1202
|
globalActions: {},
|
|
1223
1203
|
loadingTags: false,
|
|
1224
1204
|
eventContextTags: [],
|
|
1205
|
+
waitEventContextTags: {},
|
|
1225
1206
|
forwardedTags: {},
|
|
1226
1207
|
selectedOfferDetails: [],
|
|
1227
1208
|
currentOrgDetails: {},
|
|
@@ -173,6 +173,7 @@ const EmailWrapperView = ({
|
|
|
173
173
|
forwardedTags,
|
|
174
174
|
selectedOfferDetails,
|
|
175
175
|
eventContextTags,
|
|
176
|
+
waitEventContextTags,
|
|
176
177
|
getFormdata,
|
|
177
178
|
isGetFormData,
|
|
178
179
|
getLiquidTags,
|
|
@@ -246,6 +247,7 @@ const EmailWrapperView = ({
|
|
|
246
247
|
globalActions,
|
|
247
248
|
loadingTags,
|
|
248
249
|
eventContextTags,
|
|
250
|
+
waitEventContextTags,
|
|
249
251
|
forwardedTags,
|
|
250
252
|
selectedOfferDetails,
|
|
251
253
|
currentOrgDetails,
|
|
@@ -371,6 +373,7 @@ EmailWrapperView.propTypes = {
|
|
|
371
373
|
forwardedTags: PropTypes.object,
|
|
372
374
|
selectedOfferDetails: PropTypes.array,
|
|
373
375
|
eventContextTags: PropTypes.array,
|
|
376
|
+
waitEventContextTags: PropTypes.object,
|
|
374
377
|
emailActions: PropTypes.object,
|
|
375
378
|
Email: PropTypes.object,
|
|
376
379
|
templateData: PropTypes.object,
|