@capillarytech/creatives-library 8.0.345-alpha.13 → 8.0.345-alpha.15
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 +29 -0
- package/package.json +1 -1
- package/services/api.js +0 -20
- package/services/tests/api.test.js +13 -59
- package/utils/commonUtils.js +19 -1
- package/utils/rcsPayloadUtils.js +92 -0
- package/utils/templateVarUtils.js +201 -0
- package/utils/tests/templateVarUtils.test.js +204 -0
- package/v2Components/CapActionButton/constants.js +7 -0
- package/v2Components/CapActionButton/index.js +167 -109
- package/v2Components/CapActionButton/index.scss +157 -6
- package/v2Components/CapActionButton/messages.js +19 -3
- package/v2Components/CapActionButton/tests/index.test.js +41 -17
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
- package/v2Components/CapTagList/index.js +10 -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 +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +160 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +18 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +341 -76
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -2
- package/v2Components/CommonTestAndPreview/index.js +676 -186
- package/v2Components/CommonTestAndPreview/messages.js +49 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +308 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +231 -65
- 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/PreviewSection.test.js +8 -1
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +34 -13
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
- 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 +8 -10
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +955 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +118 -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 +277 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +33 -23
- package/v2Components/TemplatePreview/constants.js +2 -0
- package/v2Components/TemplatePreview/index.js +143 -28
- package/v2Components/TemplatePreview/tests/index.test.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +13 -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/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +11 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +9 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +300 -108
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +78 -34
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +79 -16
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +357 -98
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -18
- 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/Rcs/constants.js +119 -8
- package/v2Containers/Rcs/index.js +2379 -807
- package/v2Containers/Rcs/index.js.rej +1336 -0
- package/v2Containers/Rcs/index.scss +276 -6
- package/v2Containers/Rcs/index.scss.rej +74 -0
- package/v2Containers/Rcs/messages.js +38 -3
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +225 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +98018 -70073
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +128 -0
- package/v2Containers/Rcs/tests/index.test.js +152 -121
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +318 -0
- package/v2Containers/Rcs/tests/utils.test.js +646 -30
- package/v2Containers/Rcs/utils.js +478 -11
- package/v2Containers/Sms/Create/index.js +100 -40
- 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 +636 -130
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +14 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4328 -2375
- package/v2Containers/SmsWrapper/index.js +37 -8
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/ChannelTypeIllustration.js +6 -23
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +181 -126
- package/v2Containers/Templates/actions.js +11 -36
- package/v2Containers/Templates/constants.js +2 -23
- package/v2Containers/Templates/index.js +142 -333
- package/v2Containers/Templates/messages.js +0 -68
- package/v2Containers/Templates/reducer.js +0 -68
- package/v2Containers/Templates/sagas.js +55 -98
- package/v2Containers/Templates/selectors.js +0 -12
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +0 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1042 -1256
- package/v2Containers/Templates/tests/index.test.js +0 -6
- package/v2Containers/Templates/tests/reducer.test.js +0 -178
- package/v2Containers/Templates/tests/sagas.test.js +200 -436
- package/v2Containers/Templates/tests/selector.test.js +0 -32
- 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/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
- package/v2Containers/Assets/images/archive_Empty_Illustration.svg +0 -9
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', () => {
|
|
@@ -886,105 +915,242 @@ describe('ModifyDeliverySettings', () => {
|
|
|
886
915
|
});
|
|
887
916
|
});
|
|
888
917
|
|
|
889
|
-
describe('
|
|
890
|
-
|
|
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', () => {
|
|
891
951
|
const onSave = jest.fn();
|
|
892
952
|
|
|
893
953
|
renderComponent({
|
|
894
|
-
channel: CHANNELS.
|
|
895
|
-
senderDetailsOptions:
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
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,
|
|
904
986
|
deliverySettings: {
|
|
905
|
-
domainId:
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
cdmaSenderId: '',
|
|
987
|
+
domainId: 51,
|
|
988
|
+
gsmSenderId: 'not-a-valid-composite',
|
|
989
|
+
smsFallbackDomainId: 61,
|
|
990
|
+
cdmaSenderId: '61|SMS_FB_1',
|
|
909
991
|
},
|
|
910
992
|
onSaveDeliverySettings: onSave,
|
|
911
993
|
});
|
|
912
994
|
|
|
913
|
-
fireEvent.change(getSelects()[0], { target: { value: '99' } });
|
|
914
995
|
fireEvent.click(screen.getByText('Done'));
|
|
915
996
|
|
|
916
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
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,
|
|
921
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
|
+
);
|
|
922
1031
|
});
|
|
923
1032
|
|
|
924
|
-
it('should
|
|
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
|
+
];
|
|
925
1046
|
const onSave = jest.fn();
|
|
926
1047
|
|
|
927
1048
|
renderComponent({
|
|
928
|
-
channel: CHANNELS.
|
|
929
|
-
senderDetailsOptions:
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
// no dgmId
|
|
934
|
-
emailSenders: [{ value: 'sender@test.com', label: 'Sender', default: true }],
|
|
935
|
-
emailRepliers: [{ value: 'reply@test.com', default: true }],
|
|
936
|
-
},
|
|
937
|
-
],
|
|
1049
|
+
channel: CHANNELS.RCS,
|
|
1050
|
+
senderDetailsOptions: rcsDomains,
|
|
1051
|
+
smsFallbackSenderDetailsOptions: fallbackDlt,
|
|
1052
|
+
smsTraiDltEnabled: true,
|
|
1053
|
+
registeredSenderIds: ['REG_OK'],
|
|
938
1054
|
deliverySettings: {
|
|
939
|
-
domainId:
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
senderReplyTo: '',
|
|
1055
|
+
domainId: 51,
|
|
1056
|
+
gsmSenderId: '51|RCS_GSM_1',
|
|
1057
|
+
smsFallbackDomainId: 71,
|
|
1058
|
+
cdmaSenderId: '71|REG_OK',
|
|
944
1059
|
},
|
|
945
1060
|
onSaveDeliverySettings: onSave,
|
|
946
1061
|
});
|
|
947
1062
|
|
|
948
|
-
fireEvent.change(getSelects()[0], { target: { value: '55' } });
|
|
949
1063
|
fireEvent.click(screen.getByText('Done'));
|
|
950
1064
|
|
|
951
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
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,
|
|
957
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
|
+
);
|
|
958
1103
|
});
|
|
959
|
-
});
|
|
960
1104
|
|
|
961
|
-
|
|
962
|
-
it('should use first gsm/cdma sender when none has default:true flag', () => {
|
|
1105
|
+
it('should only list RCS sender options for the selected RCS domain', () => {
|
|
963
1106
|
const onSave = jest.fn();
|
|
964
1107
|
|
|
965
1108
|
renderComponent({
|
|
966
|
-
channel: CHANNELS.
|
|
967
|
-
senderDetailsOptions:
|
|
968
|
-
{
|
|
969
|
-
domainId: 77,
|
|
970
|
-
domainName: 'No Default Domain',
|
|
971
|
-
dgmId: 777,
|
|
972
|
-
gsmSenders: [{ value: 'FIRST_GSM' }, { value: 'SECOND_GSM' }],
|
|
973
|
-
cdmaSenders: [{ value: 'FIRST_CDMA' }, { value: 'SECOND_CDMA' }],
|
|
974
|
-
},
|
|
975
|
-
],
|
|
1109
|
+
channel: CHANNELS.RCS,
|
|
1110
|
+
senderDetailsOptions: rcsDomains,
|
|
976
1111
|
onSaveDeliverySettings: onSave,
|
|
1112
|
+
deliverySettings: {
|
|
1113
|
+
domainId: 52,
|
|
1114
|
+
gsmSenderId: '52|RCS_OTHER',
|
|
1115
|
+
},
|
|
977
1116
|
});
|
|
978
1117
|
|
|
979
|
-
fireEvent.change(getSelects()[0], { target: { value: '77' } });
|
|
980
1118
|
fireEvent.click(screen.getByText('Done'));
|
|
981
1119
|
|
|
982
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
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,
|
|
987
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
|
+
);
|
|
988
1154
|
});
|
|
989
1155
|
});
|
|
990
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(
|