@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.
Files changed (116) hide show
  1. package/constants/unified.js +9 -4
  2. package/package.json +1 -1
  3. package/services/api.js +25 -4
  4. package/utils/common.js +0 -12
  5. package/utils/templateVarUtils.js +16 -0
  6. package/utils/tests/templateVarUtils.test.js +44 -0
  7. package/v2Components/CapActionButton/index.js +73 -60
  8. package/v2Components/CapActionButton/index.scss +44 -28
  9. package/v2Components/CapActionButton/messages.js +7 -3
  10. package/v2Components/CapActionButton/tests/index.test.js +17 -1
  11. package/v2Components/CapWhatsappCTA/messages.js +4 -0
  12. package/v2Components/CapWhatsappCarouselButton/index.js +42 -33
  13. package/v2Components/CapWhatsappCarouselButton/index.scss +44 -2
  14. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +13 -0
  15. package/v2Components/CommonTestAndPreview/actions.js +13 -0
  16. package/v2Components/CommonTestAndPreview/constants.js +8 -0
  17. package/v2Components/CommonTestAndPreview/index.js +55 -3
  18. package/v2Components/CommonTestAndPreview/reducer.js +20 -0
  19. package/v2Components/CommonTestAndPreview/sagas.js +28 -0
  20. package/v2Components/CommonTestAndPreview/selectors.js +6 -0
  21. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +106 -0
  22. package/v2Components/CommonTestAndPreview/tests/actions.test.js +15 -0
  23. package/v2Components/CommonTestAndPreview/tests/constants.test.js +9 -1
  24. package/v2Components/CommonTestAndPreview/tests/index.test.js +101 -0
  25. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +41 -0
  26. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +84 -0
  27. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +12 -0
  28. package/v2Components/FormBuilder/Functional/FormBuilderShell.js +46 -320
  29. package/v2Components/FormBuilder/Functional/channels/registry.js +0 -2
  30. package/v2Components/FormBuilder/Functional/constants.js +8 -43
  31. package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +28 -175
  32. package/v2Components/FormBuilder/Functional/core/store/formReducer.js +6 -75
  33. package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +20 -10
  34. package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +1 -9
  35. package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +3 -20
  36. package/v2Components/FormBuilder/Functional/layout/Section.js +1 -6
  37. package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +2 -9
  38. package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +0 -17
  39. package/v2Components/FormBuilder/index.js +12 -34
  40. package/v2Components/FormBuilder/tests/entryGate.test.js +7 -94
  41. package/v2Components/TestAndPreviewSlidebox/index.js +9 -0
  42. package/v2Containers/CommunicationFlow/CommunicationFlow.js +140 -75
  43. package/v2Containers/CommunicationFlow/CommunicationFlow.scss +18 -2
  44. package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +67 -28
  45. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +503 -51
  46. package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +98 -4
  47. package/v2Containers/CommunicationFlow/Tests/constants.test.js +85 -0
  48. package/v2Containers/CommunicationFlow/constants.js +65 -4
  49. package/v2Containers/CommunicationFlow/index.js +16 -23
  50. package/v2Containers/CommunicationFlow/messages.js +11 -3
  51. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +27 -11
  52. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +4 -0
  53. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +176 -4
  54. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +22 -4
  55. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +14 -4
  56. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +11 -0
  57. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +51 -0
  58. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +11 -4
  59. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +19 -5
  60. package/v2Containers/CreativesContainer/SlideBoxContent.js +15 -0
  61. package/v2Containers/CreativesContainer/SlideBoxFooter.js +6 -2
  62. package/v2Containers/CreativesContainer/index.js +29 -3
  63. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +29 -0
  64. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +18 -5
  65. package/v2Containers/CreativesContainer/tests/index.test.js +12 -0
  66. package/v2Containers/MobilePush/Create/index.js +18 -1
  67. package/v2Containers/MobilePush/Create/test/contentValidity.test.js +96 -0
  68. package/v2Containers/MobilePush/Edit/index.js +18 -1
  69. package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +116 -0
  70. package/v2Containers/MobilePush/commonMethods.js +49 -1
  71. package/v2Containers/MobilePushNew/index.js +29 -4
  72. package/v2Containers/MobilePushNew/tests/index.test.js +119 -0
  73. package/v2Containers/MobilePushNew/tests/utils.test.js +82 -0
  74. package/v2Containers/MobilePushNew/utils.js +34 -1
  75. package/v2Containers/MobilepushWrapper/index.js +3 -1
  76. package/v2Containers/Rcs/index.js +34 -0
  77. package/v2Containers/Rcs/index.scss +15 -0
  78. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +115 -19
  79. package/v2Containers/Rcs/tests/index.test.js +67 -0
  80. package/v2Containers/Sms/Create/index.js +3 -1
  81. package/v2Containers/Sms/Edit/index.js +25 -0
  82. package/v2Containers/Sms/Edit/tests/index.test.js +85 -0
  83. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +27 -3
  84. package/v2Containers/Viber/index.js +24 -1
  85. package/v2Containers/Viber/tests/index.test.js +103 -0
  86. package/v2Containers/WebPush/Create/index.js +19 -0
  87. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +17 -12
  88. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +5 -0
  89. package/v2Containers/WebPush/Create/tests/contentValidity.test.js +294 -0
  90. package/v2Containers/Whatsapp/index.js +25 -4
  91. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +306 -34
  92. package/v2Containers/Whatsapp/tests/index.test.js +115 -0
  93. package/v2Containers/Zalo/index.js +28 -1
  94. package/v2Containers/Zalo/tests/index.test.js +99 -0
  95. package/v2Containers/mockdata.js +25 -0
  96. package/v2Components/FormBuilder/Functional/channels/mobilepush/buildSubmitPayload.js +0 -10
  97. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -82
  98. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +0 -74
  99. package/v2Components/FormBuilder/Functional/channels/mobilepush/index.js +0 -28
  100. package/v2Components/FormBuilder/Functional/channels/mobilepush/modals.js +0 -19
  101. package/v2Components/FormBuilder/Functional/channels/mobilepush/runSubmitPipeline.js +0 -45
  102. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/getEditorErrorDescriptor.test.js +0 -162
  103. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/modals.test.js +0 -37
  104. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/runSubmitPipeline.test.js +0 -70
  105. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -274
  106. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +0 -251
  107. package/v2Components/FormBuilder/Functional/layout/TabsContainer.js +0 -89
  108. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -440
  109. package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +0 -430
  110. package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +0 -282
  111. package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +0 -141
  112. package/v2Components/FormBuilder/Functional/tests/mpush.engine.test.js +0 -306
  113. package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +0 -151
  114. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -342
  115. package/v2Components/FormBuilder/Functional/tests/tabsContainer.test.js +0 -110
  116. 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();