@capillarytech/creatives-library 8.0.316 → 8.0.317-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants/unified.js +15 -0
- package/package.json +1 -1
- package/services/api.js +6 -0
- package/services/tests/api.test.js +7 -0
- package/utils/common.js +6 -1
- package/utils/templateVarUtils.js +172 -0
- package/utils/tests/tagValidations.test.js +34 -0
- package/utils/tests/templateVarUtils.test.js +160 -0
- package/v2Components/CapTagList/index.js +25 -22
- package/v2Components/CapTagList/style.scss +48 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapWhatsappCTA/index.js +2 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +11 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +12 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -0
- package/v2Components/CommonTestAndPreview/index.js +693 -155
- package/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +269 -1
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +14 -1
- package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +956 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +8 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/v2Containers/CommunicationFlow/constants.js +200 -0
- package/v2Containers/CommunicationFlow/index.js +102 -0
- package/v2Containers/CommunicationFlow/messages.js +346 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -5
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +12 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +289 -93
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +104 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +7 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/v2Containers/InAppWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/constants.js +32 -1
- package/v2Containers/Rcs/index.js +951 -873
- package/v2Containers/Rcs/index.scss +85 -6
- package/v2Containers/Rcs/messages.js +10 -1
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +40834 -1963
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/index.test.js +41 -38
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/v2Containers/Rcs/utils.js +358 -10
- package/v2Containers/Sms/Create/index.js +83 -36
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +611 -128
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4327 -2374
- package/v2Containers/SmsWrapper/index.js +39 -8
- package/v2Containers/TagList/index.js +47 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +61 -2
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +90 -40
- package/v2Containers/Templates/sagas.js +57 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/Viber/index.js +5 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/Whatsapp/index.js +8 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +598 -34
- package/v2Containers/Zalo/index.js +2 -0
package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js
CHANGED
|
@@ -187,7 +187,7 @@ describe('ModifyDeliverySettings', () => {
|
|
|
187
187
|
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
188
188
|
|
|
189
189
|
renderComponent({
|
|
190
|
-
channel: '
|
|
190
|
+
channel: 'UNSUPPORTED_CHANNEL',
|
|
191
191
|
onSaveDeliverySettings: onSave,
|
|
192
192
|
});
|
|
193
193
|
|
|
@@ -614,6 +614,22 @@ describe('ModifyDeliverySettings', () => {
|
|
|
614
614
|
expect(senderNameOptions).toEqual(expect.arrayContaining(['fallback@test.com']));
|
|
615
615
|
expect(replyToOptions).toEqual(expect.arrayContaining(['Reply Label']));
|
|
616
616
|
});
|
|
617
|
+
|
|
618
|
+
it('should use reply-to label when value is empty in reply-to options', () => {
|
|
619
|
+
renderComponent({
|
|
620
|
+
channel: CHANNELS.EMAIL,
|
|
621
|
+
senderDetailsOptions: [{
|
|
622
|
+
domainId: 90,
|
|
623
|
+
domainName: 'Reply Label Domain',
|
|
624
|
+
emailSenders: [{ value: 'a@test.com' }],
|
|
625
|
+
emailRepliers: [{ label: 'OnlyLabel', value: '' }],
|
|
626
|
+
}],
|
|
627
|
+
deliverySettings: { domainId: 90, domainGatewayMapId: 1 },
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
const replyToOptions = Array.from(getSelects()[3].querySelectorAll('option')).map((opt) => opt.textContent);
|
|
631
|
+
expect(replyToOptions).toEqual(expect.arrayContaining(['OnlyLabel']));
|
|
632
|
+
});
|
|
617
633
|
});
|
|
618
634
|
|
|
619
635
|
describe('WHATSAPP flow', () => {
|
|
@@ -838,6 +854,19 @@ describe('ModifyDeliverySettings', () => {
|
|
|
838
854
|
sourceAccountIdentifier: 'waba-1',
|
|
839
855
|
});
|
|
840
856
|
});
|
|
857
|
+
|
|
858
|
+
it('should render disabled CapLabel with label3 for locked WhatsApp account row', () => {
|
|
859
|
+
renderComponent({
|
|
860
|
+
channel: CHANNELS.WHATSAPP,
|
|
861
|
+
senderDetailsOptions: whatsappDomains,
|
|
862
|
+
wecrmAccounts,
|
|
863
|
+
whatsappAccountFromForm: { accountName: 'Account One' },
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
const labels = screen.getAllByTestId('cap-label');
|
|
867
|
+
const disabledHint = labels.find((el) => el.getAttribute('data-type') === 'label3');
|
|
868
|
+
expect(disabledHint).toBeTruthy();
|
|
869
|
+
});
|
|
841
870
|
});
|
|
842
871
|
|
|
843
872
|
describe('Done and close handling', () => {
|
|
@@ -885,4 +914,243 @@ describe('ModifyDeliverySettings', () => {
|
|
|
885
914
|
expect(onSave).toHaveBeenCalled();
|
|
886
915
|
});
|
|
887
916
|
});
|
|
917
|
+
|
|
918
|
+
describe('RCS flow', () => {
|
|
919
|
+
const rcsDomains = [
|
|
920
|
+
{
|
|
921
|
+
domainId: 51,
|
|
922
|
+
domainName: 'RCS Domain A',
|
|
923
|
+
dgmId: 511,
|
|
924
|
+
gsmSenders: [{ value: 'RCS_GSM_1' }, { value: 'RCS_GSM_2' }],
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
domainId: 52,
|
|
928
|
+
domainName: 'RCS Domain B',
|
|
929
|
+
dgmId: 522,
|
|
930
|
+
gsmSenders: [{ value: 'RCS_OTHER' }],
|
|
931
|
+
},
|
|
932
|
+
];
|
|
933
|
+
|
|
934
|
+
const smsFallbackDomains = [
|
|
935
|
+
{
|
|
936
|
+
domainId: 61,
|
|
937
|
+
domainName: 'SMS Fallback',
|
|
938
|
+
gsmSenders: [{ value: 'SMS_FB_1' }],
|
|
939
|
+
},
|
|
940
|
+
];
|
|
941
|
+
|
|
942
|
+
it('should render RCS domain and sender selects', () => {
|
|
943
|
+
renderComponent({
|
|
944
|
+
channel: CHANNELS.RCS,
|
|
945
|
+
senderDetailsOptions: rcsDomains,
|
|
946
|
+
});
|
|
947
|
+
expect(getSelects()).toHaveLength(2);
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
it('should set composite gsm sender id when RCS domain changes', () => {
|
|
951
|
+
const onSave = jest.fn();
|
|
952
|
+
|
|
953
|
+
renderComponent({
|
|
954
|
+
channel: CHANNELS.RCS,
|
|
955
|
+
senderDetailsOptions: rcsDomains,
|
|
956
|
+
onSaveDeliverySettings: onSave,
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
fireEvent.change(getSelects()[0], { target: { value: '51' } });
|
|
960
|
+
fireEvent.click(screen.getByText('Done'));
|
|
961
|
+
|
|
962
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
963
|
+
expect.objectContaining({
|
|
964
|
+
domainId: 51,
|
|
965
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
966
|
+
}),
|
|
967
|
+
);
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
it('should render SMS fallback domain and sender when fallback options exist', () => {
|
|
971
|
+
renderComponent({
|
|
972
|
+
channel: CHANNELS.RCS,
|
|
973
|
+
senderDetailsOptions: rcsDomains,
|
|
974
|
+
smsFallbackSenderDetailsOptions: smsFallbackDomains,
|
|
975
|
+
});
|
|
976
|
+
expect(getSelects()).toHaveLength(4);
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
it('should strip gsm and fallback sender ids that are not in current options on Done', () => {
|
|
980
|
+
const onSave = jest.fn();
|
|
981
|
+
|
|
982
|
+
renderComponent({
|
|
983
|
+
channel: CHANNELS.RCS,
|
|
984
|
+
senderDetailsOptions: rcsDomains,
|
|
985
|
+
smsFallbackSenderDetailsOptions: smsFallbackDomains,
|
|
986
|
+
deliverySettings: {
|
|
987
|
+
domainId: 51,
|
|
988
|
+
gsmSenderId: 'not-a-valid-composite',
|
|
989
|
+
smsFallbackDomainId: 61,
|
|
990
|
+
cdmaSenderId: '61|SMS_FB_1',
|
|
991
|
+
},
|
|
992
|
+
onSaveDeliverySettings: onSave,
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
fireEvent.click(screen.getByText('Done'));
|
|
996
|
+
|
|
997
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
998
|
+
expect.objectContaining({
|
|
999
|
+
domainId: 51,
|
|
1000
|
+
gsmSenderId: '',
|
|
1001
|
+
smsFallbackDomainId: 61,
|
|
1002
|
+
cdmaSenderId: '61|SMS_FB_1',
|
|
1003
|
+
}),
|
|
1004
|
+
);
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
it('should strip invalid SMS fallback composite sender on Done', () => {
|
|
1008
|
+
const onSave = jest.fn();
|
|
1009
|
+
|
|
1010
|
+
renderComponent({
|
|
1011
|
+
channel: CHANNELS.RCS,
|
|
1012
|
+
senderDetailsOptions: rcsDomains,
|
|
1013
|
+
smsFallbackSenderDetailsOptions: smsFallbackDomains,
|
|
1014
|
+
deliverySettings: {
|
|
1015
|
+
domainId: 51,
|
|
1016
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
1017
|
+
smsFallbackDomainId: 61,
|
|
1018
|
+
cdmaSenderId: 'bogus|value',
|
|
1019
|
+
},
|
|
1020
|
+
onSaveDeliverySettings: onSave,
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
fireEvent.click(screen.getByText('Done'));
|
|
1024
|
+
|
|
1025
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
1026
|
+
expect.objectContaining({
|
|
1027
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
1028
|
+
cdmaSenderId: '',
|
|
1029
|
+
}),
|
|
1030
|
+
);
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
it('should filter SMS fallback domains and GSM senders when TRAI DLT and registered sender IDs apply', () => {
|
|
1034
|
+
const fallbackDlt = [
|
|
1035
|
+
{
|
|
1036
|
+
domainId: 71,
|
|
1037
|
+
domainName: 'Has Registered GSM',
|
|
1038
|
+
gsmSenders: [{ value: 'REG_OK' }, { value: 'NOT_ON_DLT' }],
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
domainId: 72,
|
|
1042
|
+
domainName: 'No Match',
|
|
1043
|
+
gsmSenders: [{ value: 'UNMATCHED' }],
|
|
1044
|
+
},
|
|
1045
|
+
];
|
|
1046
|
+
const onSave = jest.fn();
|
|
1047
|
+
|
|
1048
|
+
renderComponent({
|
|
1049
|
+
channel: CHANNELS.RCS,
|
|
1050
|
+
senderDetailsOptions: rcsDomains,
|
|
1051
|
+
smsFallbackSenderDetailsOptions: fallbackDlt,
|
|
1052
|
+
smsTraiDltEnabled: true,
|
|
1053
|
+
registeredSenderIds: ['REG_OK'],
|
|
1054
|
+
deliverySettings: {
|
|
1055
|
+
domainId: 51,
|
|
1056
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
1057
|
+
smsFallbackDomainId: 71,
|
|
1058
|
+
cdmaSenderId: '71|REG_OK',
|
|
1059
|
+
},
|
|
1060
|
+
onSaveDeliverySettings: onSave,
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
fireEvent.click(screen.getByText('Done'));
|
|
1064
|
+
|
|
1065
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
1066
|
+
expect.objectContaining({
|
|
1067
|
+
smsFallbackDomainId: 71,
|
|
1068
|
+
cdmaSenderId: '71|REG_OK',
|
|
1069
|
+
}),
|
|
1070
|
+
);
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
it('should set SMS fallback composite to first GSM after skipping domain-name echo row', () => {
|
|
1074
|
+
const fallbackEcho = [
|
|
1075
|
+
{
|
|
1076
|
+
domainId: 80,
|
|
1077
|
+
domainName: 'Echo',
|
|
1078
|
+
gsmSenders: [{ value: 'Echo' }, { value: 'REAL_SENDER' }],
|
|
1079
|
+
},
|
|
1080
|
+
];
|
|
1081
|
+
const onSave = jest.fn();
|
|
1082
|
+
|
|
1083
|
+
renderComponent({
|
|
1084
|
+
channel: CHANNELS.RCS,
|
|
1085
|
+
senderDetailsOptions: rcsDomains,
|
|
1086
|
+
smsFallbackSenderDetailsOptions: fallbackEcho,
|
|
1087
|
+
deliverySettings: {
|
|
1088
|
+
domainId: 51,
|
|
1089
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
1090
|
+
},
|
|
1091
|
+
onSaveDeliverySettings: onSave,
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
fireEvent.change(getSelects()[2], { target: { value: '80' } });
|
|
1095
|
+
fireEvent.click(screen.getByText('Done'));
|
|
1096
|
+
|
|
1097
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
1098
|
+
expect.objectContaining({
|
|
1099
|
+
smsFallbackDomainId: 80,
|
|
1100
|
+
cdmaSenderId: '80|REAL_SENDER',
|
|
1101
|
+
}),
|
|
1102
|
+
);
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
it('should only list RCS sender options for the selected RCS domain', () => {
|
|
1106
|
+
const onSave = jest.fn();
|
|
1107
|
+
|
|
1108
|
+
renderComponent({
|
|
1109
|
+
channel: CHANNELS.RCS,
|
|
1110
|
+
senderDetailsOptions: rcsDomains,
|
|
1111
|
+
onSaveDeliverySettings: onSave,
|
|
1112
|
+
deliverySettings: {
|
|
1113
|
+
domainId: 52,
|
|
1114
|
+
gsmSenderId: '52|RCS_OTHER',
|
|
1115
|
+
},
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
fireEvent.click(screen.getByText('Done'));
|
|
1119
|
+
|
|
1120
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
1121
|
+
expect.objectContaining({
|
|
1122
|
+
domainId: 52,
|
|
1123
|
+
gsmSenderId: '52|RCS_OTHER',
|
|
1124
|
+
}),
|
|
1125
|
+
);
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
it('should set composite RCS gsm when domain id is numeric zero', () => {
|
|
1129
|
+
const rcsWithZero = [
|
|
1130
|
+
{
|
|
1131
|
+
domainId: 0,
|
|
1132
|
+
domainName: 'Zero Id',
|
|
1133
|
+
dgmId: 1,
|
|
1134
|
+
gsmSenders: [{ value: 'Z_GSM' }],
|
|
1135
|
+
},
|
|
1136
|
+
];
|
|
1137
|
+
const onSave = jest.fn();
|
|
1138
|
+
|
|
1139
|
+
renderComponent({
|
|
1140
|
+
channel: CHANNELS.RCS,
|
|
1141
|
+
senderDetailsOptions: rcsWithZero,
|
|
1142
|
+
onSaveDeliverySettings: onSave,
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
fireEvent.change(getSelects()[0], { target: { value: '0' } });
|
|
1146
|
+
fireEvent.click(screen.getByText('Done'));
|
|
1147
|
+
|
|
1148
|
+
expect(onSave).toHaveBeenCalledWith(
|
|
1149
|
+
expect.objectContaining({
|
|
1150
|
+
domainId: 0,
|
|
1151
|
+
gsmSenderId: '0|Z_GSM',
|
|
1152
|
+
}),
|
|
1153
|
+
);
|
|
1154
|
+
});
|
|
1155
|
+
});
|
|
888
1156
|
});
|
|
@@ -40,7 +40,7 @@ describe('DeliverySettings', () => {
|
|
|
40
40
|
const defaultProps = {
|
|
41
41
|
channel: CHANNELS.SMS,
|
|
42
42
|
deliverySettings: {},
|
|
43
|
-
|
|
43
|
+
senderDetailsByChannel: {},
|
|
44
44
|
wecrmAccounts: [],
|
|
45
45
|
onSaveDeliverySettings: jest.fn(),
|
|
46
46
|
isLoadingSenderDetails: false,
|
|
@@ -85,14 +85,14 @@ describe('DeliverySettings', () => {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('should show summary values for SMS when deliverySettings and senderDetailsOptions match', () => {
|
|
88
|
-
const
|
|
88
|
+
const senderDetailsByChannel = { [CHANNELS.SMS]: [{ domainId: 1, domainName: 'SMS Domain' }] };
|
|
89
89
|
const deliverySettings = { domainId: 1, gsmSenderId: 'SENDER1' };
|
|
90
90
|
render(
|
|
91
91
|
<DeliverySettings
|
|
92
92
|
{...defaultProps}
|
|
93
93
|
channel={CHANNELS.SMS}
|
|
94
94
|
deliverySettings={deliverySettings}
|
|
95
|
-
|
|
95
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
96
96
|
/>
|
|
97
97
|
);
|
|
98
98
|
expect(screen.getAllByText(/SMS Domain/).length).toBeGreaterThan(0);
|
|
@@ -105,7 +105,7 @@ describe('DeliverySettings', () => {
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
it('should show summary for EMAIL when has domain and sender', () => {
|
|
108
|
-
const
|
|
108
|
+
const senderDetailsByChannel = { [CHANNELS.EMAIL]: [{ domainId: 2, domainName: 'Email Domain' }] };
|
|
109
109
|
const deliverySettings = {
|
|
110
110
|
domainId: 2,
|
|
111
111
|
senderEmail: 'noreply@test.com',
|
|
@@ -117,7 +117,7 @@ describe('DeliverySettings', () => {
|
|
|
117
117
|
{...defaultProps}
|
|
118
118
|
channel={CHANNELS.EMAIL}
|
|
119
119
|
deliverySettings={deliverySettings}
|
|
120
|
-
|
|
120
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
121
121
|
/>
|
|
122
122
|
);
|
|
123
123
|
expect(screen.getAllByText(/Email Domain/).length).toBeGreaterThan(0);
|
|
@@ -141,6 +141,76 @@ describe('DeliverySettings', () => {
|
|
|
141
141
|
expect(screen.getAllByText(/WABA One/).length).toBeGreaterThan(0);
|
|
142
142
|
expect(screen.getAllByText(/\+1234567890/).length).toBeGreaterThan(0);
|
|
143
143
|
});
|
|
144
|
+
|
|
145
|
+
it('RCS: when isChannelSmsFallbackPreviewEnabled is false, summary omits fallback SMS sender even if cdma is set', () => {
|
|
146
|
+
const rcsDomain = {
|
|
147
|
+
domainId: 10,
|
|
148
|
+
domainName: 'RCS D',
|
|
149
|
+
gsmSenders: [{ value: 'R1', default: true }],
|
|
150
|
+
};
|
|
151
|
+
const smsDomain = {
|
|
152
|
+
domainId: 20,
|
|
153
|
+
domainName: 'SMS D',
|
|
154
|
+
gsmSenders: [{ value: 'F1', default: true }],
|
|
155
|
+
};
|
|
156
|
+
const senderDetailsByChannel = {
|
|
157
|
+
[CHANNELS.RCS]: [rcsDomain],
|
|
158
|
+
[CHANNELS.SMS]: [smsDomain],
|
|
159
|
+
};
|
|
160
|
+
const deliverySettings = {
|
|
161
|
+
gsmSenderId: '10|R1',
|
|
162
|
+
cdmaSenderId: '20|F1',
|
|
163
|
+
};
|
|
164
|
+
render(
|
|
165
|
+
<IntlProvider locale="en" messages={{}}>
|
|
166
|
+
<DeliverySettings
|
|
167
|
+
{...defaultProps}
|
|
168
|
+
channel={CHANNELS.RCS}
|
|
169
|
+
deliverySettings={deliverySettings}
|
|
170
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
171
|
+
isChannelSmsFallbackPreviewEnabled={false}
|
|
172
|
+
formatMessage={(m) => m?.defaultMessage || m?.id || ''}
|
|
173
|
+
/>
|
|
174
|
+
</IntlProvider>,
|
|
175
|
+
);
|
|
176
|
+
expect(screen.getAllByText(/R1/).length).toBeGreaterThan(0);
|
|
177
|
+
expect(screen.queryByText(/F1/)).toBeNull();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('RCS: when isChannelSmsFallbackPreviewEnabled is true, summary includes fallback SMS sender', () => {
|
|
181
|
+
const rcsDomain = {
|
|
182
|
+
domainId: 10,
|
|
183
|
+
domainName: 'RCS D',
|
|
184
|
+
gsmSenders: [{ value: 'R1', default: true }],
|
|
185
|
+
};
|
|
186
|
+
const smsDomain = {
|
|
187
|
+
domainId: 20,
|
|
188
|
+
domainName: 'SMS D',
|
|
189
|
+
gsmSenders: [{ value: 'F1', default: true }],
|
|
190
|
+
};
|
|
191
|
+
const senderDetailsByChannel = {
|
|
192
|
+
[CHANNELS.RCS]: [rcsDomain],
|
|
193
|
+
[CHANNELS.SMS]: [smsDomain],
|
|
194
|
+
};
|
|
195
|
+
const deliverySettings = {
|
|
196
|
+
gsmSenderId: '10|R1',
|
|
197
|
+
cdmaSenderId: '20|F1',
|
|
198
|
+
};
|
|
199
|
+
render(
|
|
200
|
+
<IntlProvider locale="en" messages={{}}>
|
|
201
|
+
<DeliverySettings
|
|
202
|
+
{...defaultProps}
|
|
203
|
+
channel={CHANNELS.RCS}
|
|
204
|
+
deliverySettings={deliverySettings}
|
|
205
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
206
|
+
isChannelSmsFallbackPreviewEnabled
|
|
207
|
+
formatMessage={(m) => m?.defaultMessage || m?.id || ''}
|
|
208
|
+
/>
|
|
209
|
+
</IntlProvider>,
|
|
210
|
+
);
|
|
211
|
+
expect(screen.getAllByText(/R1/).length).toBeGreaterThan(0);
|
|
212
|
+
expect(screen.getAllByText(/F1/).length).toBeGreaterThan(0);
|
|
213
|
+
});
|
|
144
214
|
});
|
|
145
215
|
|
|
146
216
|
describe('edit and slidebox', () => {
|
|
@@ -169,6 +239,49 @@ describe('DeliverySettings', () => {
|
|
|
169
239
|
);
|
|
170
240
|
});
|
|
171
241
|
|
|
242
|
+
it('RCS: should not pass smsFallbackSenderDetailsOptions when isChannelSmsFallbackPreviewEnabled is false', () => {
|
|
243
|
+
render(
|
|
244
|
+
<DeliverySettings
|
|
245
|
+
{...defaultProps}
|
|
246
|
+
channel={CHANNELS.RCS}
|
|
247
|
+
senderDetailsByChannel={{
|
|
248
|
+
[CHANNELS.RCS]: [{ domainId: 1, domainName: 'R', gsmSenders: [] }],
|
|
249
|
+
[CHANNELS.SMS]: [{ domainId: 2, domainName: 'S', gsmSenders: [] }],
|
|
250
|
+
}}
|
|
251
|
+
isChannelSmsFallbackPreviewEnabled={false}
|
|
252
|
+
/>,
|
|
253
|
+
);
|
|
254
|
+
fireEvent.click(screen.getByTestId('delivery-settings-edit'));
|
|
255
|
+
expect(mockModifyDeliverySettings).toHaveBeenCalledWith(
|
|
256
|
+
expect.objectContaining({
|
|
257
|
+
channel: CHANNELS.RCS,
|
|
258
|
+
smsFallbackSenderDetailsOptions: undefined,
|
|
259
|
+
}),
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('RCS: should pass smsFallbackSenderDetailsOptions when isChannelSmsFallbackPreviewEnabled is true', () => {
|
|
264
|
+
const smsDomains = [{ domainId: 2, domainName: 'S', gsmSenders: [] }];
|
|
265
|
+
render(
|
|
266
|
+
<DeliverySettings
|
|
267
|
+
{...defaultProps}
|
|
268
|
+
channel={CHANNELS.RCS}
|
|
269
|
+
senderDetailsByChannel={{
|
|
270
|
+
[CHANNELS.RCS]: [{ domainId: 1, domainName: 'R', gsmSenders: [] }],
|
|
271
|
+
[CHANNELS.SMS]: smsDomains,
|
|
272
|
+
}}
|
|
273
|
+
isChannelSmsFallbackPreviewEnabled
|
|
274
|
+
/>,
|
|
275
|
+
);
|
|
276
|
+
fireEvent.click(screen.getByTestId('delivery-settings-edit'));
|
|
277
|
+
expect(mockModifyDeliverySettings).toHaveBeenCalledWith(
|
|
278
|
+
expect.objectContaining({
|
|
279
|
+
channel: CHANNELS.RCS,
|
|
280
|
+
smsFallbackSenderDetailsOptions: smsDomains,
|
|
281
|
+
}),
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
|
|
172
285
|
it('should call onSaveDeliverySettings and close slidebox when Done is clicked', () => {
|
|
173
286
|
const onSave = jest.fn();
|
|
174
287
|
render(
|