@capillarytech/creatives-library 9.0.56-alpha.7 → 9.0.56-betaa.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.
Files changed (82) hide show
  1. package/constants/unified.js +4 -2
  2. package/package.json +1 -1
  3. package/services/api.js +0 -20
  4. package/utils/common.js +12 -0
  5. package/utils/templateVarUtils.js +0 -16
  6. package/utils/tests/templateVarUtils.test.js +0 -44
  7. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +0 -13
  8. package/v2Components/CommonTestAndPreview/actions.js +0 -13
  9. package/v2Components/CommonTestAndPreview/constants.js +0 -8
  10. package/v2Components/CommonTestAndPreview/index.js +3 -55
  11. package/v2Components/CommonTestAndPreview/reducer.js +0 -20
  12. package/v2Components/CommonTestAndPreview/sagas.js +0 -28
  13. package/v2Components/CommonTestAndPreview/selectors.js +0 -6
  14. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +0 -106
  15. package/v2Components/CommonTestAndPreview/tests/actions.test.js +0 -15
  16. package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -9
  17. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -101
  18. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -41
  19. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -84
  20. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -12
  21. package/v2Components/FormBuilder/Functional/FormBuilderShell.js +320 -46
  22. package/v2Components/FormBuilder/Functional/channels/mobilepush/buildSubmitPayload.js +10 -0
  23. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +82 -0
  24. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +74 -0
  25. package/v2Components/FormBuilder/Functional/channels/mobilepush/index.js +28 -0
  26. package/v2Components/FormBuilder/Functional/channels/mobilepush/modals.js +19 -0
  27. package/v2Components/FormBuilder/Functional/channels/mobilepush/runSubmitPipeline.js +45 -0
  28. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/getEditorErrorDescriptor.test.js +162 -0
  29. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/modals.test.js +37 -0
  30. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/runSubmitPipeline.test.js +70 -0
  31. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +274 -0
  32. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +251 -0
  33. package/v2Components/FormBuilder/Functional/channels/registry.js +2 -0
  34. package/v2Components/FormBuilder/Functional/constants.js +43 -8
  35. package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +175 -28
  36. package/v2Components/FormBuilder/Functional/core/store/formReducer.js +75 -6
  37. package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +10 -20
  38. package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +9 -1
  39. package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +20 -3
  40. package/v2Components/FormBuilder/Functional/layout/Section.js +6 -1
  41. package/v2Components/FormBuilder/Functional/layout/TabsContainer.js +89 -0
  42. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +440 -0
  43. package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +9 -2
  44. package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +430 -0
  45. package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +282 -0
  46. package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +141 -0
  47. package/v2Components/FormBuilder/Functional/tests/mpush.engine.test.js +306 -0
  48. package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +151 -0
  49. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +342 -0
  50. package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +17 -0
  51. package/v2Components/FormBuilder/Functional/tests/tabsContainer.test.js +110 -0
  52. package/v2Components/FormBuilder/index.js +34 -12
  53. package/v2Components/FormBuilder/tests/entryGate.test.js +94 -7
  54. package/v2Components/FormBuilder/tests/mpush.characterization.test.js +459 -0
  55. package/v2Components/TestAndPreviewSlidebox/index.js +0 -9
  56. package/v2Containers/CommunicationFlow/CommunicationFlow.js +75 -140
  57. package/v2Containers/CommunicationFlow/CommunicationFlow.scss +2 -18
  58. package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +27 -58
  59. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +51 -503
  60. package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +4 -40
  61. package/v2Containers/CommunicationFlow/constants.js +4 -65
  62. package/v2Containers/CommunicationFlow/index.js +23 -16
  63. package/v2Containers/CommunicationFlow/messages.js +3 -11
  64. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +11 -24
  65. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +0 -4
  66. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +4 -176
  67. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +0 -3
  68. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +0 -6
  69. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +0 -25
  70. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +4 -11
  71. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +5 -19
  72. package/v2Containers/CreativesContainer/index.js +3 -2
  73. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +5 -5
  74. package/v2Containers/CreativesContainer/tests/index.test.js +0 -12
  75. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +19 -115
  76. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +3 -27
  77. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +12 -17
  78. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -5
  79. package/v2Containers/Whatsapp/index.js +3 -6
  80. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -306
  81. package/v2Containers/mockdata.js +0 -25
  82. package/v2Containers/CommunicationFlow/Tests/constants.test.js +0 -85
@@ -128,7 +128,6 @@ describe('CommonTestAndPreview', () => {
128
128
  extractTagsRequested: jest.fn(),
129
129
  updatePreviewRequested: jest.fn(),
130
130
  sendTestMessageRequested: jest.fn(),
131
- sendCcsTestMessageRequested: jest.fn(),
132
131
  clearCustomerSearchState: jest.fn(),
133
132
  getTestCustomersRequested: jest.fn(),
134
133
  getTestGroupsRequested: jest.fn(),
@@ -1687,106 +1686,6 @@ describe('CommonTestAndPreview', () => {
1687
1686
  });
1688
1687
  });
1689
1688
 
1690
- describe('CCS Test Message Sending (notify/ui)', () => {
1691
- it('dispatches sendCcsTestMessageRequested (not the legacy createMessageMeta/sendTestMessage flow) when ccsSendTransaction is set', async () => {
1692
- const props = {
1693
- ...defaultProps,
1694
- selectedTestEntities: ['user-1'],
1695
- testGroups: [],
1696
- ccsSendTransaction: { commDefinitionId: 'cd_123', referenceId: 'ORDER_PLACED' },
1697
- };
1698
-
1699
- render(
1700
- <TestWrapper>
1701
- <CommonTestAndPreview {...props} />
1702
- </TestWrapper>
1703
- );
1704
-
1705
- lastSendTestMessageProps.handleSendTestMessage();
1706
-
1707
- expect(mockActions.sendCcsTestMessageRequested).toHaveBeenCalledWith(
1708
- expect.objectContaining({
1709
- commDefinitionId: 'cd_123',
1710
- isTest: true,
1711
- recipient: expect.objectContaining({
1712
- identifiers: expect.any(Array),
1713
- }),
1714
- }),
1715
- expect.any(Function),
1716
- );
1717
- expect(mockActions.createMessageMetaRequested).not.toHaveBeenCalled();
1718
- expect(mockActions.sendTestMessageRequested).not.toHaveBeenCalled();
1719
- });
1720
-
1721
- it('falls back to referenceId when commDefinitionId is absent', async () => {
1722
- const props = {
1723
- ...defaultProps,
1724
- selectedTestEntities: ['user-1'],
1725
- testGroups: [],
1726
- ccsSendTransaction: { referenceId: 'ORDER_PLACED' },
1727
- };
1728
-
1729
- render(
1730
- <TestWrapper>
1731
- <CommonTestAndPreview {...props} />
1732
- </TestWrapper>
1733
- );
1734
-
1735
- lastSendTestMessageProps.handleSendTestMessage();
1736
-
1737
- expect(mockActions.sendCcsTestMessageRequested).toHaveBeenCalledWith(
1738
- expect.objectContaining({ referenceId: 'ORDER_PLACED' }),
1739
- expect.any(Function),
1740
- );
1741
- });
1742
-
1743
- it('shows a success notification when the callback receives true', async () => {
1744
- const CapNotification = require('@capillarytech/cap-ui-library/CapNotification');
1745
- mockActions.sendCcsTestMessageRequested.mockImplementation((payload, cb) => cb(true));
1746
- const props = {
1747
- ...defaultProps,
1748
- selectedTestEntities: ['user-1'],
1749
- testGroups: [],
1750
- ccsSendTransaction: { commDefinitionId: 'cd_123' },
1751
- };
1752
-
1753
- render(
1754
- <TestWrapper>
1755
- <CommonTestAndPreview {...props} />
1756
- </TestWrapper>
1757
- );
1758
-
1759
- lastSendTestMessageProps.handleSendTestMessage();
1760
-
1761
- await waitFor(() => {
1762
- expect(CapNotification.success).toHaveBeenCalled();
1763
- });
1764
- });
1765
-
1766
- it('shows an error notification when the callback receives false', async () => {
1767
- const CapNotification = require('@capillarytech/cap-ui-library/CapNotification');
1768
- mockActions.sendCcsTestMessageRequested.mockImplementation((payload, cb) => cb(false));
1769
- const props = {
1770
- ...defaultProps,
1771
- selectedTestEntities: ['user-1'],
1772
- testGroups: [],
1773
- ccsSendTransaction: { commDefinitionId: 'cd_123' },
1774
- };
1775
-
1776
- render(
1777
- <TestWrapper>
1778
- <CommonTestAndPreview {...props} />
1779
- </TestWrapper>
1780
- );
1781
-
1782
- lastSendTestMessageProps.handleSendTestMessage();
1783
-
1784
- await waitFor(() => {
1785
- expect(CapNotification.error).toHaveBeenCalled();
1786
- });
1787
- });
1788
- });
1789
-
1790
1689
  describe('Content Extraction', () => {
1791
1690
  it('should extract EMAIL content from formData', async () => {
1792
1691
  const props = {
@@ -19,9 +19,6 @@ 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,
25
22
  CLEAR_CUSTOMER_SEARCH_STATE,
26
23
  CLEAR_SEARCH_RESULTS,
27
24
  GET_TEST_CUSTOMERS_REQUESTED,
@@ -72,8 +69,6 @@ describe('previewAndTestReducer', () => {
72
69
  isSendingTestMessage: false,
73
70
  sendTestMessageError: null,
74
71
  testMessageResponse: null,
75
- isSendingCcsTestMessage: false,
76
- sendCcsTestMessageError: null,
77
72
  tags: {
78
73
  loading: false,
79
74
  error: null,
@@ -538,42 +533,6 @@ describe('previewAndTestReducer', () => {
538
533
  });
539
534
  });
540
535
 
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
-
577
536
  describe('CLEAR_SEARCH_RESULTS', () => {
578
537
  it('should clear search results and reset flags', () => {
579
538
  const stateWithResults = initialState
@@ -12,7 +12,6 @@ import {
12
12
  extractTagsSaga,
13
13
  updatePreviewSaga,
14
14
  sendTestMessageSaga,
15
- sendCcsTestMessageSaga,
16
15
  getBulkCustomerDetails,
17
16
  fetchTestCustomersSaga,
18
17
  fetchTestGroupsSaga,
@@ -46,8 +45,6 @@ import {
46
45
  UPDATE_PREVIEW_FAILURE,
47
46
  SEND_TEST_MESSAGE_SUCCESS,
48
47
  SEND_TEST_MESSAGE_FAILURE,
49
- SEND_CCS_TEST_MESSAGE_SUCCESS,
50
- SEND_CCS_TEST_MESSAGE_FAILURE,
51
48
  GET_TEST_CUSTOMERS_SUCCESS,
52
49
  GET_TEST_CUSTOMERS_FAILURE,
53
50
  GET_TEST_GROUPS_SUCCESS,
@@ -750,87 +747,6 @@ describe('CommonTestAndPreview Sagas', () => {
750
747
  });
751
748
  });
752
749
 
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
-
834
750
  describe('fetchTestCustomersSaga', () => {
835
751
  it('should fetch test customers successfully', () => {
836
752
  const response = {
@@ -28,7 +28,6 @@ import {
28
28
  makeSelectPrefilledValues,
29
29
  makeSelectTestMessageResponse,
30
30
  makeSelectIsSendingTestMessage,
31
- makeSelectIsSendingCcsTestMessage,
32
31
  makeSelectUpdatePreviewError,
33
32
  makeSelectUpdatePreviewErrors,
34
33
  makeSelectFetchPrefilledValuesError,
@@ -79,8 +78,6 @@ describe('CommonTestAndPreview Selectors', () => {
79
78
  isSendingTestEmail: false,
80
79
  sendTestMessageError: null,
81
80
  testMessageResponse: { messageId: '123', status: 'sent' },
82
- isSendingCcsTestMessage: false,
83
- sendCcsTestMessageError: null,
84
81
  tags: {
85
82
  loading: false,
86
83
  error: null,
@@ -473,15 +470,6 @@ describe('CommonTestAndPreview Selectors', () => {
473
470
  });
474
471
  });
475
472
 
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
-
485
473
  describe('makeSelectUpdatePreviewError', () => {
486
474
  it('should select updatePreviewError from state', () => {
487
475
  const selector = makeSelectUpdatePreviewError();