@capillarytech/creatives-library 8.0.329 → 8.0.330
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 +0 -14
- package/package.json +1 -1
- package/services/api.js +0 -17
- package/services/tests/api.test.js +0 -85
- package/utils/commonUtils.js +0 -10
- package/utils/tests/commonUtil.test.js +0 -169
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +53 -87
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -20
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -145
- package/v2Components/CommonTestAndPreview/actions.js +0 -10
- package/v2Components/CommonTestAndPreview/constants.js +1 -53
- package/v2Components/CommonTestAndPreview/index.js +168 -1006
- package/v2Components/CommonTestAndPreview/messages.js +3 -147
- package/v2Components/CommonTestAndPreview/reducer.js +0 -10
- package/v2Components/CommonTestAndPreview/sagas.js +6 -15
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +286 -328
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +24 -65
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -168
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
- package/v2Components/FormBuilder/index.js +1 -7
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -8
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -10
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
- package/v2Containers/CreativesContainer/constants.js +0 -9
- package/v2Containers/CreativesContainer/index.js +93 -286
- package/v2Containers/CreativesContainer/index.scss +1 -51
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +10 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/Rcs/constants.js +1 -34
- package/v2Containers/Rcs/index.js +884 -999
- package/v2Containers/Rcs/index.scss +6 -85
- package/v2Containers/Rcs/messages.js +1 -10
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +2453 -41456
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
- package/v2Containers/Rcs/tests/index.test.js +38 -41
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +1 -379
- package/v2Containers/Rcs/utils.js +10 -358
- package/v2Containers/Sms/Create/index.js +38 -100
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +128 -609
- package/v2Containers/SmsTrai/Edit/messages.js +4 -9
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2600 -4586
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +2 -63
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +40 -90
- package/v2Containers/Templates/sagas.js +12 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1079 -1043
- package/v2Containers/Templates/tests/sagas.test.js +123 -193
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
- package/v2Containers/TemplatesV2/index.js +23 -86
- package/v2Containers/Whatsapp/index.js +20 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5790
- package/utils/templateVarUtils.js +0 -172
- package/utils/tests/templateVarUtils.test.js +0 -160
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -155
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -93
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -648
- package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -174
- package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
- package/v2Components/SmsFallback/constants.js +0 -73
- package/v2Components/SmsFallback/index.js +0 -955
- package/v2Components/SmsFallback/index.scss +0 -265
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -107
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -261
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -205
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -251
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -121
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
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: 'RCS',
|
|
191
191
|
onSaveDeliverySettings: onSave,
|
|
192
192
|
});
|
|
193
193
|
|
|
@@ -614,22 +614,6 @@ 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
|
-
});
|
|
633
617
|
});
|
|
634
618
|
|
|
635
619
|
describe('WHATSAPP flow', () => {
|
|
@@ -854,19 +838,6 @@ describe('ModifyDeliverySettings', () => {
|
|
|
854
838
|
sourceAccountIdentifier: 'waba-1',
|
|
855
839
|
});
|
|
856
840
|
});
|
|
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
|
-
});
|
|
870
841
|
});
|
|
871
842
|
|
|
872
843
|
describe('Done and close handling', () => {
|
|
@@ -915,242 +886,105 @@ describe('ModifyDeliverySettings', () => {
|
|
|
915
886
|
});
|
|
916
887
|
});
|
|
917
888
|
|
|
918
|
-
describe('
|
|
919
|
-
|
|
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', () => {
|
|
889
|
+
describe('onDomainChange — dgmId edge cases', () => {
|
|
890
|
+
it('should not update domainGatewayMapId when selected SMS domain has no dgmId', () => {
|
|
951
891
|
const onSave = jest.fn();
|
|
952
892
|
|
|
953
893
|
renderComponent({
|
|
954
|
-
channel: CHANNELS.
|
|
955
|
-
senderDetailsOptions:
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
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,
|
|
894
|
+
channel: CHANNELS.SMS,
|
|
895
|
+
senderDetailsOptions: [
|
|
896
|
+
{
|
|
897
|
+
domainId: 99,
|
|
898
|
+
domainName: 'No DGM Domain',
|
|
899
|
+
// dgmId intentionally absent
|
|
900
|
+
gsmSenders: [{ value: 'GSM_99', default: true }],
|
|
901
|
+
cdmaSenders: [{ value: 'CDMA_99', default: true }],
|
|
902
|
+
},
|
|
903
|
+
],
|
|
986
904
|
deliverySettings: {
|
|
987
|
-
domainId:
|
|
988
|
-
|
|
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,
|
|
905
|
+
domainId: null,
|
|
906
|
+
domainGatewayMapId: 555,
|
|
1000
907
|
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
908
|
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
909
|
},
|
|
1060
910
|
onSaveDeliverySettings: onSave,
|
|
1061
911
|
});
|
|
1062
912
|
|
|
913
|
+
fireEvent.change(getSelects()[0], { target: { value: '99' } });
|
|
1063
914
|
fireEvent.click(screen.getByText('Done'));
|
|
1064
915
|
|
|
1065
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
);
|
|
916
|
+
expect(onSave).toHaveBeenCalledWith({
|
|
917
|
+
domainId: 99,
|
|
918
|
+
domainGatewayMapId: 555, // unchanged — domain has no dgmId
|
|
919
|
+
gsmSenderId: 'GSM_99',
|
|
920
|
+
cdmaSenderId: 'CDMA_99',
|
|
921
|
+
});
|
|
1071
922
|
});
|
|
1072
923
|
|
|
1073
|
-
it('should
|
|
1074
|
-
const fallbackEcho = [
|
|
1075
|
-
{
|
|
1076
|
-
domainId: 80,
|
|
1077
|
-
domainName: 'Echo',
|
|
1078
|
-
gsmSenders: [{ value: 'Echo' }, { value: 'REAL_SENDER' }],
|
|
1079
|
-
},
|
|
1080
|
-
];
|
|
924
|
+
it('should not update domainGatewayMapId when selected EMAIL domain has no dgmId', () => {
|
|
1081
925
|
const onSave = jest.fn();
|
|
1082
926
|
|
|
1083
927
|
renderComponent({
|
|
1084
|
-
channel: CHANNELS.
|
|
1085
|
-
senderDetailsOptions:
|
|
1086
|
-
|
|
928
|
+
channel: CHANNELS.EMAIL,
|
|
929
|
+
senderDetailsOptions: [
|
|
930
|
+
{
|
|
931
|
+
domainId: 55,
|
|
932
|
+
domainName: 'No DGM Email Domain',
|
|
933
|
+
// no dgmId
|
|
934
|
+
emailSenders: [{ value: 'sender@test.com', label: 'Sender', default: true }],
|
|
935
|
+
emailRepliers: [{ value: 'reply@test.com', default: true }],
|
|
936
|
+
},
|
|
937
|
+
],
|
|
1087
938
|
deliverySettings: {
|
|
1088
|
-
domainId:
|
|
1089
|
-
|
|
939
|
+
domainId: null,
|
|
940
|
+
domainGatewayMapId: 777,
|
|
941
|
+
senderEmail: '',
|
|
942
|
+
senderLabel: '',
|
|
943
|
+
senderReplyTo: '',
|
|
1090
944
|
},
|
|
1091
945
|
onSaveDeliverySettings: onSave,
|
|
1092
946
|
});
|
|
1093
947
|
|
|
1094
|
-
fireEvent.change(getSelects()[
|
|
948
|
+
fireEvent.change(getSelects()[0], { target: { value: '55' } });
|
|
1095
949
|
fireEvent.click(screen.getByText('Done'));
|
|
1096
950
|
|
|
1097
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
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
|
-
},
|
|
951
|
+
expect(onSave).toHaveBeenCalledWith({
|
|
952
|
+
domainId: 55,
|
|
953
|
+
domainGatewayMapId: 777, // unchanged — domain has no dgmId
|
|
954
|
+
senderEmail: 'sender@test.com',
|
|
955
|
+
senderLabel: 'Sender',
|
|
956
|
+
senderReplyTo: 'reply@test.com',
|
|
1116
957
|
});
|
|
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
958
|
});
|
|
959
|
+
});
|
|
1127
960
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
{
|
|
1131
|
-
domainId: 0,
|
|
1132
|
-
domainName: 'Zero Id',
|
|
1133
|
-
dgmId: 1,
|
|
1134
|
-
gsmSenders: [{ value: 'Z_GSM' }],
|
|
1135
|
-
},
|
|
1136
|
-
];
|
|
961
|
+
describe('findDefault fallback — first item used when no default:true', () => {
|
|
962
|
+
it('should use first gsm/cdma sender when none has default:true flag', () => {
|
|
1137
963
|
const onSave = jest.fn();
|
|
1138
964
|
|
|
1139
965
|
renderComponent({
|
|
1140
|
-
channel: CHANNELS.
|
|
1141
|
-
senderDetailsOptions:
|
|
966
|
+
channel: CHANNELS.SMS,
|
|
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
|
+
],
|
|
1142
976
|
onSaveDeliverySettings: onSave,
|
|
1143
977
|
});
|
|
1144
978
|
|
|
1145
|
-
fireEvent.change(getSelects()[0], { target: { value: '
|
|
979
|
+
fireEvent.change(getSelects()[0], { target: { value: '77' } });
|
|
1146
980
|
fireEvent.click(screen.getByText('Done'));
|
|
1147
981
|
|
|
1148
|
-
expect(onSave).toHaveBeenCalledWith(
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
);
|
|
982
|
+
expect(onSave).toHaveBeenCalledWith({
|
|
983
|
+
domainId: 77,
|
|
984
|
+
domainGatewayMapId: 777,
|
|
985
|
+
gsmSenderId: 'FIRST_GSM',
|
|
986
|
+
cdmaSenderId: 'FIRST_CDMA',
|
|
987
|
+
});
|
|
1154
988
|
});
|
|
1155
989
|
});
|
|
1156
990
|
});
|
|
@@ -40,7 +40,7 @@ describe('DeliverySettings', () => {
|
|
|
40
40
|
const defaultProps = {
|
|
41
41
|
channel: CHANNELS.SMS,
|
|
42
42
|
deliverySettings: {},
|
|
43
|
-
|
|
43
|
+
senderDetailsOptions: [],
|
|
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 senderDetailsOptions = [{ 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
|
+
senderDetailsOptions={senderDetailsOptions}
|
|
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 senderDetailsOptions = [{ 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
|
+
senderDetailsOptions={senderDetailsOptions}
|
|
121
121
|
/>
|
|
122
122
|
);
|
|
123
123
|
expect(screen.getAllByText(/Email Domain/).length).toBeGreaterThan(0);
|
|
@@ -141,76 +141,6 @@ 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
|
-
});
|
|
214
144
|
});
|
|
215
145
|
|
|
216
146
|
describe('edit and slidebox', () => {
|
|
@@ -239,49 +169,6 @@ describe('DeliverySettings', () => {
|
|
|
239
169
|
);
|
|
240
170
|
});
|
|
241
171
|
|
|
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
|
-
|
|
285
172
|
it('should call onSaveDeliverySettings and close slidebox when Done is clicked', () => {
|
|
286
173
|
const onSave = jest.fn();
|
|
287
174
|
render(
|