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
|
@@ -32,6 +32,12 @@ import {
|
|
|
32
32
|
makeSelectUpdatePreviewErrors,
|
|
33
33
|
makeSelectFetchPrefilledValuesError,
|
|
34
34
|
makeSelectFetchPrefilledValuesErrors,
|
|
35
|
+
makeSelectSenderDetailsForChannel,
|
|
36
|
+
makeSelectSenderDetailsByChannel,
|
|
37
|
+
makeSelectWeCrmAccounts,
|
|
38
|
+
makeSelectIsLoadingSenderDetails,
|
|
39
|
+
makeSelectFetchSenderDetailsError,
|
|
40
|
+
makeSelectFetchWeCrmAccountsError,
|
|
35
41
|
} from '../selectors';
|
|
36
42
|
|
|
37
43
|
describe('CommonTestAndPreview Selectors', () => {
|
|
@@ -101,6 +107,19 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
101
107
|
fetchPrefilledValuesErrors: [
|
|
102
108
|
{ code: 7078, message: 'User profile not found' },
|
|
103
109
|
],
|
|
110
|
+
senderDetailsByChannel: {
|
|
111
|
+
SMS: [
|
|
112
|
+
{ domainId: 1, domainName: 'SMS Domain', gsmSenders: [{ value: 'sender1' }] },
|
|
113
|
+
],
|
|
114
|
+
EMAIL: [],
|
|
115
|
+
WHATSAPP: [],
|
|
116
|
+
},
|
|
117
|
+
wecrmAccounts: [
|
|
118
|
+
{ name: 'WeCRM Account 1', sourceAccountIdentifier: 'waba-1' },
|
|
119
|
+
],
|
|
120
|
+
isLoadingSenderDetails: false,
|
|
121
|
+
fetchSenderDetailsError: null,
|
|
122
|
+
fetchWeCrmAccountsError: null,
|
|
104
123
|
},
|
|
105
124
|
});
|
|
106
125
|
|
|
@@ -550,6 +569,133 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
550
569
|
});
|
|
551
570
|
});
|
|
552
571
|
|
|
572
|
+
describe('makeSelectSenderDetailsForChannel', () => {
|
|
573
|
+
it('should select sender details for given channel as JS array', () => {
|
|
574
|
+
const selector = makeSelectSenderDetailsForChannel('SMS');
|
|
575
|
+
const result = selector(mockState);
|
|
576
|
+
|
|
577
|
+
expect(result).toBeDefined();
|
|
578
|
+
expect(Array.isArray(result)).toBe(true);
|
|
579
|
+
expect(result.length).toBe(1);
|
|
580
|
+
expect(result[0].domainName).toBe('SMS Domain');
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
it('should return empty array for channel with no data', () => {
|
|
584
|
+
const selector = makeSelectSenderDetailsForChannel('EMAIL');
|
|
585
|
+
const result = selector(mockState);
|
|
586
|
+
|
|
587
|
+
expect(result).toEqual([]);
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
it('should return empty array when substate or byChannel missing', () => {
|
|
591
|
+
const emptyState = fromJS({});
|
|
592
|
+
const selector = makeSelectSenderDetailsForChannel('SMS');
|
|
593
|
+
const result = selector(emptyState);
|
|
594
|
+
|
|
595
|
+
expect(result).toEqual([]);
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
describe('makeSelectSenderDetailsByChannel', () => {
|
|
600
|
+
it('should select senderDetailsByChannel and convert to JS object', () => {
|
|
601
|
+
const selector = makeSelectSenderDetailsByChannel();
|
|
602
|
+
const result = selector(mockState);
|
|
603
|
+
|
|
604
|
+
expect(result).toBeDefined();
|
|
605
|
+
expect(result.SMS).toBeDefined();
|
|
606
|
+
expect(Array.isArray(result.SMS)).toBe(true);
|
|
607
|
+
expect(result.SMS[0].domainName).toBe('SMS Domain');
|
|
608
|
+
expect(result.EMAIL).toEqual([]);
|
|
609
|
+
expect(result.WHATSAPP).toEqual([]);
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
it('should return empty object when domain is missing', () => {
|
|
613
|
+
const emptyState = fromJS({});
|
|
614
|
+
const selector = makeSelectSenderDetailsByChannel();
|
|
615
|
+
const result = selector(emptyState);
|
|
616
|
+
|
|
617
|
+
expect(result).toEqual({});
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
describe('makeSelectWeCrmAccounts', () => {
|
|
622
|
+
it('should select wecrmAccounts and convert to JS array', () => {
|
|
623
|
+
const selector = makeSelectWeCrmAccounts();
|
|
624
|
+
const result = selector(mockState);
|
|
625
|
+
|
|
626
|
+
expect(result).toBeDefined();
|
|
627
|
+
expect(Array.isArray(result)).toBe(true);
|
|
628
|
+
expect(result.length).toBe(1);
|
|
629
|
+
expect(result[0].name).toBe('WeCRM Account 1');
|
|
630
|
+
expect(result[0].sourceAccountIdentifier).toBe('waba-1');
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
it('should return empty array when wecrmAccounts is missing', () => {
|
|
634
|
+
const emptyState = fromJS({ commonTestAndPreview: {} });
|
|
635
|
+
const selector = makeSelectWeCrmAccounts();
|
|
636
|
+
const result = selector(emptyState);
|
|
637
|
+
|
|
638
|
+
expect(result).toEqual([]);
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
describe('makeSelectIsLoadingSenderDetails', () => {
|
|
643
|
+
it('should select isLoadingSenderDetails flag', () => {
|
|
644
|
+
const selector = makeSelectIsLoadingSenderDetails();
|
|
645
|
+
const result = selector(mockState);
|
|
646
|
+
|
|
647
|
+
expect(result).toBe(false);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
it('should return true when loading', () => {
|
|
651
|
+
const loadingState = fromJS({
|
|
652
|
+
commonTestAndPreview: { isLoadingSenderDetails: true },
|
|
653
|
+
});
|
|
654
|
+
const selector = makeSelectIsLoadingSenderDetails();
|
|
655
|
+
const result = selector(loadingState);
|
|
656
|
+
|
|
657
|
+
expect(result).toBe(true);
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
describe('makeSelectFetchSenderDetailsError', () => {
|
|
662
|
+
it('should select fetchSenderDetailsError from state', () => {
|
|
663
|
+
const selector = makeSelectFetchSenderDetailsError();
|
|
664
|
+
const result = selector(mockState);
|
|
665
|
+
|
|
666
|
+
expect(result).toBeNull();
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
it('should return error when present', () => {
|
|
670
|
+
const errorState = fromJS({
|
|
671
|
+
commonTestAndPreview: { fetchSenderDetailsError: 'Sender fetch failed' },
|
|
672
|
+
});
|
|
673
|
+
const selector = makeSelectFetchSenderDetailsError();
|
|
674
|
+
const result = selector(errorState);
|
|
675
|
+
|
|
676
|
+
expect(result).toBe('Sender fetch failed');
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
describe('makeSelectFetchWeCrmAccountsError', () => {
|
|
681
|
+
it('should select fetchWeCrmAccountsError from state', () => {
|
|
682
|
+
const selector = makeSelectFetchWeCrmAccountsError();
|
|
683
|
+
const result = selector(mockState);
|
|
684
|
+
|
|
685
|
+
expect(result).toBeNull();
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
it('should return error when present', () => {
|
|
689
|
+
const errorState = fromJS({
|
|
690
|
+
commonTestAndPreview: { fetchWeCrmAccountsError: 'WeCRM fetch failed' },
|
|
691
|
+
});
|
|
692
|
+
const selector = makeSelectFetchWeCrmAccountsError();
|
|
693
|
+
const result = selector(errorState);
|
|
694
|
+
|
|
695
|
+
expect(result).toBe('WeCRM fetch failed');
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
|
|
553
699
|
describe('Edge Cases', () => {
|
|
554
700
|
it('should handle undefined state gracefully', () => {
|
|
555
701
|
const selector = makeSelectCustomers();
|
|
@@ -186,7 +186,6 @@ export const ErrorInfoNote = (props) => {
|
|
|
186
186
|
errorMessages,
|
|
187
187
|
onErrorClick,
|
|
188
188
|
onClose,
|
|
189
|
-
isLiquidEnabled = true,
|
|
190
189
|
intl,
|
|
191
190
|
useLegacyDisplay = false, // Use simple list display instead of tabs (for BEE Editor)
|
|
192
191
|
} = props;
|
|
@@ -205,6 +204,28 @@ export const ErrorInfoNote = (props) => {
|
|
|
205
204
|
const isNotArray = !Array.isArray(rawLiquidErrors);
|
|
206
205
|
const hasPlatformKeys = isObject && isNotArray && [ANDROID, IOS, GENERIC].some((key) => key in rawLiquidErrors);
|
|
207
206
|
|
|
207
|
+
// Hooks must execute on every render before any conditional return.
|
|
208
|
+
// Group into Errors (blocking) and Warnings (non-blocking)
|
|
209
|
+
const { errors: errorIssues, warnings: warningIssues } = useMemo(() => groupByErrorsAndWarnings(
|
|
210
|
+
Array.isArray(rawStandardErrors) ? rawStandardErrors : [],
|
|
211
|
+
Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [],
|
|
212
|
+
Array.isArray(rawStandardWarnings) ? rawStandardWarnings : [],
|
|
213
|
+
), [rawStandardErrors, rawLiquidErrors, rawStandardWarnings]);
|
|
214
|
+
|
|
215
|
+
const errorsCount = errorIssues?.length;
|
|
216
|
+
const warningsCount = warningIssues?.length;
|
|
217
|
+
const totalCount = errorsCount + warningsCount;
|
|
218
|
+
const hasLiquidErrors = Array.isArray(rawLiquidErrors) && rawLiquidErrors.length > 0;
|
|
219
|
+
|
|
220
|
+
// Default active tab: errors if any, else warnings
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (errorsCount > 0) {
|
|
223
|
+
setActiveKey(ERROR_TAB_KEYS.ERRORS);
|
|
224
|
+
} else if (warningsCount > 0) {
|
|
225
|
+
setActiveKey(ERROR_TAB_KEYS.WARNINGS);
|
|
226
|
+
}
|
|
227
|
+
}, [errorsCount, warningsCount]);
|
|
228
|
+
|
|
208
229
|
// For platform-specific errors or when useLegacyDisplay is true, use the legacy renderer
|
|
209
230
|
if (hasPlatformKeys) {
|
|
210
231
|
// Process errors for both platforms - they use the same structure but different platform parameters
|
|
@@ -230,7 +251,7 @@ export const ErrorInfoNote = (props) => {
|
|
|
230
251
|
const standardErrors = Array.isArray(rawStandardErrors) ? rawStandardErrors : [];
|
|
231
252
|
const liquidErrors = Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [];
|
|
232
253
|
const hasStandardErrors = standardErrors.length > 0;
|
|
233
|
-
const hasLiquidErrors = liquidErrors.length > 0
|
|
254
|
+
const hasLiquidErrors = liquidErrors.length > 0;
|
|
234
255
|
|
|
235
256
|
if (!hasStandardErrors && !hasLiquidErrors) {
|
|
236
257
|
return null;
|
|
@@ -256,27 +277,6 @@ export const ErrorInfoNote = (props) => {
|
|
|
256
277
|
);
|
|
257
278
|
}
|
|
258
279
|
|
|
259
|
-
// Group into Errors (blocking) and Warnings (non-blocking)
|
|
260
|
-
const { errors: errorIssues, warnings: warningIssues } = useMemo(() => groupByErrorsAndWarnings(
|
|
261
|
-
Array.isArray(rawStandardErrors) ? rawStandardErrors : [],
|
|
262
|
-
Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [],
|
|
263
|
-
Array.isArray(rawStandardWarnings) ? rawStandardWarnings : [],
|
|
264
|
-
), [rawStandardErrors, rawLiquidErrors, rawStandardWarnings]);
|
|
265
|
-
|
|
266
|
-
const errorsCount = errorIssues.length;
|
|
267
|
-
const warningsCount = warningIssues.length;
|
|
268
|
-
const totalCount = errorsCount + warningsCount;
|
|
269
|
-
const hasLiquidErrors = Array.isArray(rawLiquidErrors) && rawLiquidErrors.length > 0;
|
|
270
|
-
|
|
271
|
-
// Default active tab: errors if any, else warnings
|
|
272
|
-
useEffect(() => {
|
|
273
|
-
if (errorsCount > 0) {
|
|
274
|
-
setActiveKey(ERROR_TAB_KEYS.ERRORS);
|
|
275
|
-
} else if (warningsCount > 0) {
|
|
276
|
-
setActiveKey(ERROR_TAB_KEYS.WARNINGS);
|
|
277
|
-
}
|
|
278
|
-
}, [errorsCount, warningsCount]);
|
|
279
|
-
|
|
280
280
|
// Handle close
|
|
281
281
|
const handleClose = () => {
|
|
282
282
|
setIsDismissed(true);
|
|
@@ -357,7 +357,7 @@ export const ErrorInfoNote = (props) => {
|
|
|
357
357
|
className="error-info-note__tabs"
|
|
358
358
|
/>
|
|
359
359
|
<CapRow className="error-info-note__actions">
|
|
360
|
-
{hasLiquidErrors &&
|
|
360
|
+
{hasLiquidErrors && (
|
|
361
361
|
<CapButton
|
|
362
362
|
type="flat"
|
|
363
363
|
className="error-info-note__liquid-doc"
|
|
@@ -452,7 +452,6 @@ ErrorInfoNote.defaultProps = {
|
|
|
452
452
|
},
|
|
453
453
|
onErrorClick: null,
|
|
454
454
|
onClose: null,
|
|
455
|
-
isLiquidEnabled: true,
|
|
456
455
|
intl: null,
|
|
457
456
|
useLegacyDisplay: false, // Use simple list display for BEE Editor
|
|
458
457
|
};
|
|
@@ -479,7 +478,6 @@ ErrorInfoNote.propTypes = {
|
|
|
479
478
|
}),
|
|
480
479
|
onErrorClick: PropTypes.func,
|
|
481
480
|
onClose: PropTypes.func,
|
|
482
|
-
isLiquidEnabled: PropTypes.bool,
|
|
483
481
|
intl: PropTypes.object,
|
|
484
482
|
useLegacyDisplay: PropTypes.bool, // Use simple list display for BEE Editor
|
|
485
483
|
};
|