@capillarytech/creatives-library 9.0.56-betaa.0 → 9.0.56
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 +9 -4
- package/package.json +1 -1
- package/services/api.js +25 -4
- package/utils/common.js +0 -12
- package/utils/templateVarUtils.js +16 -0
- package/utils/tests/templateVarUtils.test.js +44 -0
- package/v2Components/CapActionButton/index.js +73 -60
- package/v2Components/CapActionButton/index.scss +44 -28
- package/v2Components/CapActionButton/messages.js +7 -3
- package/v2Components/CapActionButton/tests/index.test.js +17 -1
- package/v2Components/CapWhatsappCTA/messages.js +4 -0
- package/v2Components/CapWhatsappCarouselButton/index.js +42 -33
- package/v2Components/CapWhatsappCarouselButton/index.scss +44 -2
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +13 -0
- package/v2Components/CommonTestAndPreview/actions.js +13 -0
- package/v2Components/CommonTestAndPreview/constants.js +8 -0
- package/v2Components/CommonTestAndPreview/index.js +55 -3
- package/v2Components/CommonTestAndPreview/reducer.js +20 -0
- package/v2Components/CommonTestAndPreview/sagas.js +28 -0
- package/v2Components/CommonTestAndPreview/selectors.js +6 -0
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +106 -0
- package/v2Components/CommonTestAndPreview/tests/actions.test.js +15 -0
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +9 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +101 -0
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +41 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +84 -0
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +12 -0
- package/v2Components/FormBuilder/Functional/FormBuilderShell.js +46 -320
- package/v2Components/FormBuilder/Functional/channels/registry.js +0 -2
- package/v2Components/FormBuilder/Functional/constants.js +8 -43
- package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +28 -175
- package/v2Components/FormBuilder/Functional/core/store/formReducer.js +6 -75
- package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +20 -10
- package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +1 -9
- package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +3 -20
- package/v2Components/FormBuilder/Functional/layout/Section.js +1 -6
- package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +2 -9
- package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +0 -17
- package/v2Components/FormBuilder/index.js +12 -34
- package/v2Components/FormBuilder/tests/entryGate.test.js +7 -94
- package/v2Components/TestAndPreviewSlidebox/index.js +9 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +140 -75
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +18 -2
- package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +67 -28
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +503 -51
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +98 -4
- package/v2Containers/CommunicationFlow/Tests/constants.test.js +85 -0
- package/v2Containers/CommunicationFlow/constants.js +65 -4
- package/v2Containers/CommunicationFlow/index.js +16 -23
- package/v2Containers/CommunicationFlow/messages.js +11 -3
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +27 -11
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +4 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +176 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +22 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +14 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +11 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +51 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +11 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +19 -5
- package/v2Containers/CreativesContainer/SlideBoxContent.js +15 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +6 -2
- package/v2Containers/CreativesContainer/index.js +29 -3
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +29 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +18 -5
- package/v2Containers/CreativesContainer/tests/index.test.js +12 -0
- package/v2Containers/MobilePush/Create/index.js +18 -1
- package/v2Containers/MobilePush/Create/test/contentValidity.test.js +96 -0
- package/v2Containers/MobilePush/Edit/index.js +18 -1
- package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +116 -0
- package/v2Containers/MobilePush/commonMethods.js +49 -1
- package/v2Containers/MobilePushNew/index.js +29 -4
- package/v2Containers/MobilePushNew/tests/index.test.js +119 -0
- package/v2Containers/MobilePushNew/tests/utils.test.js +82 -0
- package/v2Containers/MobilePushNew/utils.js +34 -1
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +34 -0
- package/v2Containers/Rcs/index.scss +15 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +115 -19
- package/v2Containers/Rcs/tests/index.test.js +67 -0
- package/v2Containers/Sms/Create/index.js +3 -1
- package/v2Containers/Sms/Edit/index.js +25 -0
- package/v2Containers/Sms/Edit/tests/index.test.js +85 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +27 -3
- package/v2Containers/Viber/index.js +24 -1
- package/v2Containers/Viber/tests/index.test.js +103 -0
- package/v2Containers/WebPush/Create/index.js +19 -0
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +17 -12
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +5 -0
- package/v2Containers/WebPush/Create/tests/contentValidity.test.js +294 -0
- package/v2Containers/Whatsapp/index.js +25 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +306 -34
- package/v2Containers/Whatsapp/tests/index.test.js +115 -0
- package/v2Containers/Zalo/index.js +28 -1
- package/v2Containers/Zalo/tests/index.test.js +99 -0
- package/v2Containers/mockdata.js +25 -0
- package/v2Components/FormBuilder/Functional/channels/mobilepush/buildSubmitPayload.js +0 -10
- package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -82
- package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +0 -74
- package/v2Components/FormBuilder/Functional/channels/mobilepush/index.js +0 -28
- package/v2Components/FormBuilder/Functional/channels/mobilepush/modals.js +0 -19
- package/v2Components/FormBuilder/Functional/channels/mobilepush/runSubmitPipeline.js +0 -45
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/getEditorErrorDescriptor.test.js +0 -162
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/modals.test.js +0 -37
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/runSubmitPipeline.test.js +0 -70
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -274
- package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +0 -251
- package/v2Components/FormBuilder/Functional/layout/TabsContainer.js +0 -89
- package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -440
- package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +0 -430
- package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +0 -282
- package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +0 -141
- package/v2Components/FormBuilder/Functional/tests/mpush.engine.test.js +0 -306
- package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +0 -151
- package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -342
- package/v2Components/FormBuilder/Functional/tests/tabsContainer.test.js +0 -110
- package/v2Components/FormBuilder/tests/mpush.characterization.test.js +0 -459
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
SEND_TEST_MESSAGE_REQUESTED,
|
|
20
20
|
SEND_TEST_MESSAGE_SUCCESS,
|
|
21
21
|
SEND_TEST_MESSAGE_FAILURE,
|
|
22
|
+
SEND_CCS_TEST_MESSAGE_REQUESTED,
|
|
23
|
+
SEND_CCS_TEST_MESSAGE_SUCCESS,
|
|
24
|
+
SEND_CCS_TEST_MESSAGE_FAILURE,
|
|
22
25
|
CLEAR_CUSTOMER_SEARCH_STATE,
|
|
23
26
|
CLEAR_SEARCH_RESULTS,
|
|
24
27
|
GET_TEST_CUSTOMERS_REQUESTED,
|
|
@@ -69,6 +72,8 @@ describe('previewAndTestReducer', () => {
|
|
|
69
72
|
isSendingTestMessage: false,
|
|
70
73
|
sendTestMessageError: null,
|
|
71
74
|
testMessageResponse: null,
|
|
75
|
+
isSendingCcsTestMessage: false,
|
|
76
|
+
sendCcsTestMessageError: null,
|
|
72
77
|
tags: {
|
|
73
78
|
loading: false,
|
|
74
79
|
error: null,
|
|
@@ -533,6 +538,42 @@ describe('previewAndTestReducer', () => {
|
|
|
533
538
|
});
|
|
534
539
|
});
|
|
535
540
|
|
|
541
|
+
describe('SEND_CCS_TEST_MESSAGE_REQUESTED', () => {
|
|
542
|
+
it('should set the sending flag and clear errors', () => {
|
|
543
|
+
const action = { type: SEND_CCS_TEST_MESSAGE_REQUESTED };
|
|
544
|
+
const result = previewAndTestReducer(initialState, action);
|
|
545
|
+
|
|
546
|
+
expect(result.get('isSendingCcsTestMessage')).toBe(true);
|
|
547
|
+
expect(result.get('sendCcsTestMessageError')).toBeNull();
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
describe('SEND_CCS_TEST_MESSAGE_SUCCESS', () => {
|
|
552
|
+
it('should clear the sending flag and any error', () => {
|
|
553
|
+
const stateWhileSending = initialState
|
|
554
|
+
.set('isSendingCcsTestMessage', true)
|
|
555
|
+
.set('sendCcsTestMessageError', 'previous error');
|
|
556
|
+
const action = { type: SEND_CCS_TEST_MESSAGE_SUCCESS };
|
|
557
|
+
const result = previewAndTestReducer(stateWhileSending, action);
|
|
558
|
+
|
|
559
|
+
expect(result.get('isSendingCcsTestMessage')).toBe(false);
|
|
560
|
+
expect(result.get('sendCcsTestMessageError')).toBeNull();
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
describe('SEND_CCS_TEST_MESSAGE_FAILURE', () => {
|
|
565
|
+
it('should clear the sending flag and set the error', () => {
|
|
566
|
+
const action = {
|
|
567
|
+
type: SEND_CCS_TEST_MESSAGE_FAILURE,
|
|
568
|
+
payload: { error: 'NO_LIVE_VERSION' },
|
|
569
|
+
};
|
|
570
|
+
const result = previewAndTestReducer(initialState, action);
|
|
571
|
+
|
|
572
|
+
expect(result.get('isSendingCcsTestMessage')).toBe(false);
|
|
573
|
+
expect(result.get('sendCcsTestMessageError')).toBe('NO_LIVE_VERSION');
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
|
|
536
577
|
describe('CLEAR_SEARCH_RESULTS', () => {
|
|
537
578
|
it('should clear search results and reset flags', () => {
|
|
538
579
|
const stateWithResults = initialState
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
extractTagsSaga,
|
|
13
13
|
updatePreviewSaga,
|
|
14
14
|
sendTestMessageSaga,
|
|
15
|
+
sendCcsTestMessageSaga,
|
|
15
16
|
getBulkCustomerDetails,
|
|
16
17
|
fetchTestCustomersSaga,
|
|
17
18
|
fetchTestGroupsSaga,
|
|
@@ -45,6 +46,8 @@ import {
|
|
|
45
46
|
UPDATE_PREVIEW_FAILURE,
|
|
46
47
|
SEND_TEST_MESSAGE_SUCCESS,
|
|
47
48
|
SEND_TEST_MESSAGE_FAILURE,
|
|
49
|
+
SEND_CCS_TEST_MESSAGE_SUCCESS,
|
|
50
|
+
SEND_CCS_TEST_MESSAGE_FAILURE,
|
|
48
51
|
GET_TEST_CUSTOMERS_SUCCESS,
|
|
49
52
|
GET_TEST_CUSTOMERS_FAILURE,
|
|
50
53
|
GET_TEST_GROUPS_SUCCESS,
|
|
@@ -747,6 +750,87 @@ describe('CommonTestAndPreview Sagas', () => {
|
|
|
747
750
|
});
|
|
748
751
|
});
|
|
749
752
|
|
|
753
|
+
describe('sendCcsTestMessageSaga', () => {
|
|
754
|
+
it('should send the CCS test message successfully', () => {
|
|
755
|
+
const callback = jest.fn();
|
|
756
|
+
const action = {
|
|
757
|
+
payload: { commDefinitionId: 'cd_123', recipient: { identifiers: [] } },
|
|
758
|
+
callback,
|
|
759
|
+
};
|
|
760
|
+
const response = { response: { success: true, data: {} } };
|
|
761
|
+
|
|
762
|
+
const generator = sendCcsTestMessageSaga(action);
|
|
763
|
+
|
|
764
|
+
expect(generator.next().value).toEqual(
|
|
765
|
+
call(Api.sendTransactionalComm, action.payload)
|
|
766
|
+
);
|
|
767
|
+
|
|
768
|
+
expect(generator.next(response).value).toEqual(
|
|
769
|
+
put({ type: SEND_CCS_TEST_MESSAGE_SUCCESS })
|
|
770
|
+
);
|
|
771
|
+
|
|
772
|
+
generator.next();
|
|
773
|
+
expect(callback).toHaveBeenCalledWith(true);
|
|
774
|
+
expect(generator.next().done).toBe(true);
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
it('should handle a CCS envelope failure (success: false)', () => {
|
|
778
|
+
const callback = jest.fn();
|
|
779
|
+
const action = {
|
|
780
|
+
payload: { commDefinitionId: 'cd_123', recipient: { identifiers: [] } },
|
|
781
|
+
callback,
|
|
782
|
+
};
|
|
783
|
+
const response = {
|
|
784
|
+
response: { success: false, errors: [{ message: 'NO_LIVE_VERSION' }] },
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
const generator = sendCcsTestMessageSaga(action);
|
|
788
|
+
|
|
789
|
+
generator.next();
|
|
790
|
+
expect(generator.next(response).value).toEqual(
|
|
791
|
+
put({ type: SEND_CCS_TEST_MESSAGE_FAILURE, payload: { error: 'NO_LIVE_VERSION' } })
|
|
792
|
+
);
|
|
793
|
+
|
|
794
|
+
generator.next();
|
|
795
|
+
expect(callback).toHaveBeenCalledWith(false);
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
it('falls back to a default error message when the envelope carries none', () => {
|
|
799
|
+
const callback = jest.fn();
|
|
800
|
+
const action = {
|
|
801
|
+
payload: { commDefinitionId: 'cd_123', recipient: { identifiers: [] } },
|
|
802
|
+
callback,
|
|
803
|
+
};
|
|
804
|
+
const response = { response: { success: false, errors: [] } };
|
|
805
|
+
|
|
806
|
+
const generator = sendCcsTestMessageSaga(action);
|
|
807
|
+
|
|
808
|
+
generator.next();
|
|
809
|
+
expect(generator.next(response).value).toEqual(
|
|
810
|
+
put({ type: SEND_CCS_TEST_MESSAGE_FAILURE, payload: { error: 'Failed to send test message' } })
|
|
811
|
+
);
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
it('should handle network error', () => {
|
|
815
|
+
const callback = jest.fn();
|
|
816
|
+
const action = {
|
|
817
|
+
payload: { commDefinitionId: 'cd_123', recipient: { identifiers: [] } },
|
|
818
|
+
callback,
|
|
819
|
+
};
|
|
820
|
+
const error = new Error('Network error');
|
|
821
|
+
|
|
822
|
+
const generator = sendCcsTestMessageSaga(action);
|
|
823
|
+
|
|
824
|
+
generator.next();
|
|
825
|
+
expect(generator.throw(error).value).toEqual(
|
|
826
|
+
put({ type: SEND_CCS_TEST_MESSAGE_FAILURE, payload: { error: 'Network error' } })
|
|
827
|
+
);
|
|
828
|
+
|
|
829
|
+
generator.next();
|
|
830
|
+
expect(callback).toHaveBeenCalledWith(false);
|
|
831
|
+
});
|
|
832
|
+
});
|
|
833
|
+
|
|
750
834
|
describe('fetchTestCustomersSaga', () => {
|
|
751
835
|
it('should fetch test customers successfully', () => {
|
|
752
836
|
const response = {
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
makeSelectPrefilledValues,
|
|
29
29
|
makeSelectTestMessageResponse,
|
|
30
30
|
makeSelectIsSendingTestMessage,
|
|
31
|
+
makeSelectIsSendingCcsTestMessage,
|
|
31
32
|
makeSelectUpdatePreviewError,
|
|
32
33
|
makeSelectUpdatePreviewErrors,
|
|
33
34
|
makeSelectFetchPrefilledValuesError,
|
|
@@ -78,6 +79,8 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
78
79
|
isSendingTestEmail: false,
|
|
79
80
|
sendTestMessageError: null,
|
|
80
81
|
testMessageResponse: { messageId: '123', status: 'sent' },
|
|
82
|
+
isSendingCcsTestMessage: false,
|
|
83
|
+
sendCcsTestMessageError: null,
|
|
81
84
|
tags: {
|
|
82
85
|
loading: false,
|
|
83
86
|
error: null,
|
|
@@ -470,6 +473,15 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
470
473
|
});
|
|
471
474
|
});
|
|
472
475
|
|
|
476
|
+
describe('makeSelectIsSendingCcsTestMessage', () => {
|
|
477
|
+
it('should select isSendingCcsTestMessage flag', () => {
|
|
478
|
+
const selector = makeSelectIsSendingCcsTestMessage();
|
|
479
|
+
const result = selector(mockState);
|
|
480
|
+
|
|
481
|
+
expect(result).toBe(false);
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
|
|
473
485
|
describe('makeSelectUpdatePreviewError', () => {
|
|
474
486
|
it('should select updatePreviewError from state', () => {
|
|
475
487
|
const selector = makeSelectUpdatePreviewError();
|