@capillarytech/creatives-library 9.0.56-alpha.6 → 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 -32
  6. package/utils/tests/templateVarUtils.test.js +0 -44
  7. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +0 -14
  8. package/v2Components/CommonTestAndPreview/actions.js +0 -13
  9. package/v2Components/CommonTestAndPreview/constants.js +0 -8
  10. package/v2Components/CommonTestAndPreview/index.js +2 -57
  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 -128
  57. package/v2Containers/CommunicationFlow/CommunicationFlow.scss +2 -30
  58. package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +27 -58
  59. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +51 -471
  60. package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +4 -40
  61. package/v2Containers/CommunicationFlow/constants.js +4 -67
  62. package/v2Containers/CommunicationFlow/index.js +23 -16
  63. package/v2Containers/CommunicationFlow/messages.js +3 -7
  64. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +10 -22
  65. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +0 -4
  66. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +4 -112
  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 -8
  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
@@ -12707,7 +12707,6 @@ FREE GIFTS-
12707
12707
  "getTestGroupsRequested": [Function],
12708
12708
  "getWeCrmAccountsRequested": [Function],
12709
12709
  "searchCustomersRequested": [Function],
12710
- "sendCcsTestMessageRequested": [Function],
12711
12710
  "sendTestMessageRequested": [Function],
12712
12711
  "updatePreviewRequested": [Function],
12713
12712
  }
@@ -12753,7 +12752,6 @@ FREE GIFTS-
12753
12752
  isFetchingTestGroups={false}
12754
12753
  isLoadingSenderDetails={false}
12755
12754
  isSearchingCustomer={false}
12756
- isSendingCcsTestMessage={false}
12757
12755
  isSendingTestMessage={false}
12758
12756
  isUpdatingPreview={false}
12759
12757
  messageMetaConfigId={null}
@@ -12790,13 +12788,11 @@ FREE GIFTS-
12790
12788
  "getTestGroupsRequested": [Function],
12791
12789
  "getWeCrmAccountsRequested": [Function],
12792
12790
  "searchCustomersRequested": [Function],
12793
- "sendCcsTestMessageRequested": [Function],
12794
12791
  "sendTestMessageRequested": [Function],
12795
12792
  "updatePreviewRequested": [Function],
12796
12793
  }
12797
12794
  }
12798
12795
  beeInstance={null}
12799
- ccsSendTransaction={null}
12800
12796
  channel={null}
12801
12797
  content="LATEST FASHION@VISHAL
12802
12798
  {#var#}
@@ -15085,7 +15081,6 @@ new message content.",
15085
15081
  isFetchingTestGroups={false}
15086
15082
  isLoadingSenderDetails={false}
15087
15083
  isSearchingCustomer={false}
15088
- isSendingCcsTestMessage={false}
15089
15084
  isSendingTestMessage={false}
15090
15085
  isUpdatingPreview={false}
15091
15086
  messageMetaConfigId={null}
@@ -15124,13 +15119,11 @@ new message content.",
15124
15119
  "getTestGroupsRequested": [Function],
15125
15120
  "getWeCrmAccountsRequested": [Function],
15126
15121
  "searchCustomersRequested": [Function],
15127
- "sendCcsTestMessageRequested": [Function],
15128
15122
  "sendTestMessageRequested": [Function],
15129
15123
  "updatePreviewRequested": [Function],
15130
15124
  }
15131
15125
  }
15132
15126
  beeInstance={null}
15133
- ccsSendTransaction={null}
15134
15127
  channel="SMS"
15135
15128
  config={
15136
15129
  Object {
@@ -17426,7 +17419,6 @@ new message content.",
17426
17419
  isFetchingTestGroups={false}
17427
17420
  isLoadingSenderDetails={false}
17428
17421
  isSearchingCustomer={false}
17429
- isSendingCcsTestMessage={false}
17430
17422
  isSendingTestMessage={false}
17431
17423
  isUpdatingPreview={false}
17432
17424
  messageMetaConfigId={null}
@@ -17646,7 +17638,7 @@ FREE GIFTS-
17646
17638
  </CapRow>
17647
17639
  }
17648
17640
  show={false}
17649
- size="size-l"
17641
+ size="size-xl"
17650
17642
  />
17651
17643
  </CommonTestAndPreview>
17652
17644
  </TestAndPreviewSlidebox>
@@ -31835,7 +31827,6 @@ FREE GIFTS-
31835
31827
  "getTestGroupsRequested": [Function],
31836
31828
  "getWeCrmAccountsRequested": [Function],
31837
31829
  "searchCustomersRequested": [Function],
31838
- "sendCcsTestMessageRequested": [Function],
31839
31830
  "sendTestMessageRequested": [Function],
31840
31831
  "updatePreviewRequested": [Function],
31841
31832
  }
@@ -31881,7 +31872,6 @@ FREE GIFTS-
31881
31872
  isFetchingTestGroups={false}
31882
31873
  isLoadingSenderDetails={false}
31883
31874
  isSearchingCustomer={false}
31884
- isSendingCcsTestMessage={false}
31885
31875
  isSendingTestMessage={false}
31886
31876
  isUpdatingPreview={false}
31887
31877
  messageMetaConfigId={null}
@@ -31918,13 +31908,11 @@ FREE GIFTS-
31918
31908
  "getTestGroupsRequested": [Function],
31919
31909
  "getWeCrmAccountsRequested": [Function],
31920
31910
  "searchCustomersRequested": [Function],
31921
- "sendCcsTestMessageRequested": [Function],
31922
31911
  "sendTestMessageRequested": [Function],
31923
31912
  "updatePreviewRequested": [Function],
31924
31913
  }
31925
31914
  }
31926
31915
  beeInstance={null}
31927
- ccsSendTransaction={null}
31928
31916
  channel={null}
31929
31917
  content="LATEST FASHION@VISHAL
31930
31918
  test1
@@ -34213,7 +34201,6 @@ new message content.",
34213
34201
  isFetchingTestGroups={false}
34214
34202
  isLoadingSenderDetails={false}
34215
34203
  isSearchingCustomer={false}
34216
- isSendingCcsTestMessage={false}
34217
34204
  isSendingTestMessage={false}
34218
34205
  isUpdatingPreview={false}
34219
34206
  messageMetaConfigId={null}
@@ -34252,13 +34239,11 @@ new message content.",
34252
34239
  "getTestGroupsRequested": [Function],
34253
34240
  "getWeCrmAccountsRequested": [Function],
34254
34241
  "searchCustomersRequested": [Function],
34255
- "sendCcsTestMessageRequested": [Function],
34256
34242
  "sendTestMessageRequested": [Function],
34257
34243
  "updatePreviewRequested": [Function],
34258
34244
  }
34259
34245
  }
34260
34246
  beeInstance={null}
34261
- ccsSendTransaction={null}
34262
34247
  channel="SMS"
34263
34248
  config={
34264
34249
  Object {
@@ -36554,7 +36539,6 @@ new message content.",
36554
36539
  isFetchingTestGroups={false}
36555
36540
  isLoadingSenderDetails={false}
36556
36541
  isSearchingCustomer={false}
36557
- isSendingCcsTestMessage={false}
36558
36542
  isSendingTestMessage={false}
36559
36543
  isUpdatingPreview={false}
36560
36544
  messageMetaConfigId={null}
@@ -36774,7 +36758,7 @@ FREE GIFTS-
36774
36758
  </CapRow>
36775
36759
  }
36776
36760
  show={false}
36777
- size="size-l"
36761
+ size="size-xl"
36778
36762
  />
36779
36763
  </CommonTestAndPreview>
36780
36764
  </TestAndPreviewSlidebox>
@@ -49499,7 +49483,6 @@ FREE GIFTS-
49499
49483
  "getTestGroupsRequested": [Function],
49500
49484
  "getWeCrmAccountsRequested": [Function],
49501
49485
  "searchCustomersRequested": [Function],
49502
- "sendCcsTestMessageRequested": [Function],
49503
49486
  "sendTestMessageRequested": [Function],
49504
49487
  "updatePreviewRequested": [Function],
49505
49488
  }
@@ -49545,7 +49528,6 @@ FREE GIFTS-
49545
49528
  isFetchingTestGroups={false}
49546
49529
  isLoadingSenderDetails={false}
49547
49530
  isSearchingCustomer={false}
49548
- isSendingCcsTestMessage={false}
49549
49531
  isSendingTestMessage={false}
49550
49532
  isUpdatingPreview={false}
49551
49533
  messageMetaConfigId={null}
@@ -49582,13 +49564,11 @@ FREE GIFTS-
49582
49564
  "getTestGroupsRequested": [Function],
49583
49565
  "getWeCrmAccountsRequested": [Function],
49584
49566
  "searchCustomersRequested": [Function],
49585
- "sendCcsTestMessageRequested": [Function],
49586
49567
  "sendTestMessageRequested": [Function],
49587
49568
  "updatePreviewRequested": [Function],
49588
49569
  }
49589
49570
  }
49590
49571
  beeInstance={null}
49591
- ccsSendTransaction={null}
49592
49572
  channel={null}
49593
49573
  content="LATEST FASHION@VISHAL
49594
49574
  {#var#}
@@ -51877,7 +51857,6 @@ new message content.",
51877
51857
  isFetchingTestGroups={false}
51878
51858
  isLoadingSenderDetails={false}
51879
51859
  isSearchingCustomer={false}
51880
- isSendingCcsTestMessage={false}
51881
51860
  isSendingTestMessage={false}
51882
51861
  isUpdatingPreview={false}
51883
51862
  messageMetaConfigId={null}
@@ -51916,13 +51895,11 @@ new message content.",
51916
51895
  "getTestGroupsRequested": [Function],
51917
51896
  "getWeCrmAccountsRequested": [Function],
51918
51897
  "searchCustomersRequested": [Function],
51919
- "sendCcsTestMessageRequested": [Function],
51920
51898
  "sendTestMessageRequested": [Function],
51921
51899
  "updatePreviewRequested": [Function],
51922
51900
  }
51923
51901
  }
51924
51902
  beeInstance={null}
51925
- ccsSendTransaction={null}
51926
51903
  channel="SMS"
51927
51904
  config={
51928
51905
  Object {
@@ -54218,7 +54195,6 @@ new message content.",
54218
54195
  isFetchingTestGroups={false}
54219
54196
  isLoadingSenderDetails={false}
54220
54197
  isSearchingCustomer={false}
54221
- isSendingCcsTestMessage={false}
54222
54198
  isSendingTestMessage={false}
54223
54199
  isUpdatingPreview={false}
54224
54200
  messageMetaConfigId={null}
@@ -54438,7 +54414,7 @@ FREE GIFTS-
54438
54414
  </CapRow>
54439
54415
  }
54440
54416
  show={false}
54441
- size="size-l"
54417
+ size="size-xl"
54442
54418
  />
54443
54419
  </CommonTestAndPreview>
54444
54420
  </TestAndPreviewSlidebox>
@@ -33,7 +33,6 @@ const WebPushPreview = ({
33
33
  brandIconSrc,
34
34
  buttons,
35
35
  onClickShowInAllDevices,
36
- showPreviewInAllDevices,
37
36
  }) => {
38
37
  const [selectedOS, setSelectedOS] = useState(DEFAULT_OS);
39
38
  const [selectedBrowser, setSelectedBrowser] = useState(DEFAULT_BROWSER);
@@ -94,20 +93,18 @@ const WebPushPreview = ({
94
93
  buttons={buttons}
95
94
  />
96
95
  <PreviewDisclaimer />
97
- {showPreviewInAllDevices && (
98
- <CapRow className="preview-all-devices-button">
99
- <CapColumn span={24}>
100
- <CapButton
101
- type="link"
102
- onClick={handleOpenPreviewSlideBox}
103
- className="preview-all-devices-trigger"
104
- data-test-id="webpush-preview-toggle"
105
- >
106
- <FormattedMessage {...messages.previewInAllDevices} />
107
- </CapButton>
108
- </CapColumn>
109
- </CapRow>
110
- )}
96
+ <CapRow className="preview-all-devices-button">
97
+ <CapColumn span={24}>
98
+ <CapButton
99
+ type="link"
100
+ onClick={handleOpenPreviewSlideBox}
101
+ className="preview-all-devices-trigger"
102
+ data-test-id="webpush-preview-toggle"
103
+ >
104
+ <FormattedMessage {...messages.previewInAllDevices} />
105
+ </CapButton>
106
+ </CapColumn>
107
+ </CapRow>
111
108
  </CapColumn>
112
109
  <CapSlideBox
113
110
  header={<FormattedMessage {...messages.webPushNotificationPreview} />}
@@ -144,7 +141,6 @@ WebPushPreview.propTypes = {
144
141
  })
145
142
  ),
146
143
  onClickShowInAllDevices: PropTypes.func,
147
- showPreviewInAllDevices: PropTypes.bool,
148
144
  };
149
145
 
150
146
  WebPushPreview.defaultProps = {
@@ -154,7 +150,6 @@ WebPushPreview.defaultProps = {
154
150
  imageSrc: '',
155
151
  brandIconSrc: '',
156
152
  buttons: [],
157
- showPreviewInAllDevices: true,
158
153
  };
159
154
 
160
155
  export default WebPushPreview;
@@ -109,11 +109,6 @@ describe('WebPushPreview', () => {
109
109
  expect(button.hasClass('preview-all-devices-trigger')).toBe(true);
110
110
  });
111
111
 
112
- it('should hide "Preview in all devices" button when showPreviewInAllDevices is false', () => {
113
- const wrapper = mountWithIntl(<WebPushPreview {...defaultProps} showPreviewInAllDevices={false} />);
114
- expect(wrapper.find('.preview-all-devices-button').exists()).toBe(false);
115
- });
116
-
117
112
  it('should render CapSlideBox component', () => {
118
113
  const wrapper = mountWithIntl(<WebPushPreview {...defaultProps} />);
119
114
  const allSlideBoxes = wrapper.find(CapSlideBox);
@@ -119,7 +119,7 @@ import { ANDROID } from '../../v2Components/CommonTestAndPreview/constants';
119
119
  import CapImageUpload from '../../v2Components/CapImageUpload';
120
120
  import TagList from '../TagList';
121
121
  import { validateTags } from '../../utils/tagValidations';
122
- import { splitContentByOrderedVarTokens, reconcileVarMapToSlotFormat } from '../../utils/templateVarUtils';
122
+ import { splitContentByOrderedVarTokens } from '../../utils/templateVarUtils';
123
123
  import { capitalizeString } from '../../utils/Formatter';
124
124
  import CapWhatsappCTA from '../../v2Components/CapWhatsappCTA';
125
125
  import {
@@ -504,10 +504,7 @@ export const Whatsapp = (props) => {
504
504
  if (templateHeaderArray?.length !== 0) {
505
505
  let clonedVarMap = {};
506
506
  if (!isEmpty(varMap)) {
507
- // CCS's varMapped can use plain sequential occurrence indices ("0","1",...)
508
- // rather than this UI's own `${token}_${index}` slot keys — reconcile so
509
- // values land on the right segment instead of silently missing.
510
- clonedVarMap = reconcileVarMapToSlotFormat(varMap, templateHeaderArray, regex);
507
+ clonedVarMap = cloneDeep(varMap);
511
508
  } else {
512
509
  templateHeaderArray?.forEach((headerValue, i) => {
513
510
  if (headerValue?.match(regex)?.length > 0) {
@@ -565,9 +562,7 @@ export const Whatsapp = (props) => {
565
562
  if (tempMsgArray.length !== 0) {
566
563
  const { varMapped = {} } = editContent;
567
564
  if (!isEmpty(varMapped)) {
568
- // CCS's varMapped can use plain sequential occurrence indices ("0","1",...)
569
- // rather than this UI's own `${token}_${index}` slot keys
570
- varMap = reconcileVarMapToSlotFormat(varMapped, tempMsgArray, validVarRegex);
565
+ varMap = cloneDeep(varMapped);
571
566
  } else {
572
567
  //computing and setting varMap for first edit
573
568
  for (let i = 0; i < tempMsgArray.length; i += 1) {