@capillarytech/creatives-library 8.0.345-alpha.13 → 8.0.345-alpha.15

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 (138) hide show
  1. package/constants/unified.js +29 -0
  2. package/package.json +1 -1
  3. package/services/api.js +0 -20
  4. package/services/tests/api.test.js +13 -59
  5. package/utils/commonUtils.js +19 -1
  6. package/utils/rcsPayloadUtils.js +92 -0
  7. package/utils/templateVarUtils.js +201 -0
  8. package/utils/tests/templateVarUtils.test.js +204 -0
  9. package/v2Components/CapActionButton/constants.js +7 -0
  10. package/v2Components/CapActionButton/index.js +167 -109
  11. package/v2Components/CapActionButton/index.scss +157 -6
  12. package/v2Components/CapActionButton/messages.js +19 -3
  13. package/v2Components/CapActionButton/tests/index.test.js +41 -17
  14. package/v2Components/CapCustomSkeleton/index.js +1 -1
  15. package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
  16. package/v2Components/CapTagList/index.js +10 -0
  17. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
  18. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
  19. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
  20. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
  21. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
  22. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
  23. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
  24. package/v2Components/CommonTestAndPreview/SendTestMessage.js +10 -5
  25. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +160 -15
  26. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +18 -0
  27. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +341 -76
  28. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
  29. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
  30. package/v2Components/CommonTestAndPreview/constants.js +38 -2
  31. package/v2Components/CommonTestAndPreview/index.js +676 -186
  32. package/v2Components/CommonTestAndPreview/messages.js +49 -3
  33. package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
  34. package/v2Components/CommonTestAndPreview/sagas.js +15 -6
  35. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +308 -284
  36. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +231 -65
  37. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
  38. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
  39. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
  40. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +34 -13
  41. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
  42. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
  43. package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
  44. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
  45. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
  46. package/v2Components/FormBuilder/index.js +8 -10
  47. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
  48. package/v2Components/SmsFallback/constants.js +73 -0
  49. package/v2Components/SmsFallback/index.js +955 -0
  50. package/v2Components/SmsFallback/index.scss +265 -0
  51. package/v2Components/SmsFallback/messages.js +78 -0
  52. package/v2Components/SmsFallback/smsFallbackUtils.js +118 -0
  53. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
  54. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
  55. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
  56. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
  57. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +277 -0
  58. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
  59. package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
  60. package/v2Components/TemplatePreview/_templatePreview.scss +33 -23
  61. package/v2Components/TemplatePreview/constants.js +2 -0
  62. package/v2Components/TemplatePreview/index.js +143 -28
  63. package/v2Components/TemplatePreview/tests/index.test.js +142 -0
  64. package/v2Components/TestAndPreviewSlidebox/index.js +13 -1
  65. package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
  66. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
  67. package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
  68. package/v2Components/VarSegmentMessageEditor/index.js +125 -0
  69. package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
  70. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
  71. package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
  72. package/v2Containers/CreativesContainer/SlideBoxFooter.js +11 -4
  73. package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
  74. package/v2Containers/CreativesContainer/constants.js +9 -0
  75. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
  76. package/v2Containers/CreativesContainer/index.js +300 -108
  77. package/v2Containers/CreativesContainer/index.scss +51 -1
  78. package/v2Containers/CreativesContainer/messages.js +0 -4
  79. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
  80. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +78 -34
  81. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +79 -16
  82. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
  83. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +357 -98
  84. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -18
  85. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
  86. package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
  87. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
  88. package/v2Containers/Rcs/constants.js +119 -8
  89. package/v2Containers/Rcs/index.js +2379 -807
  90. package/v2Containers/Rcs/index.js.rej +1336 -0
  91. package/v2Containers/Rcs/index.scss +276 -6
  92. package/v2Containers/Rcs/index.scss.rej +74 -0
  93. package/v2Containers/Rcs/messages.js +38 -3
  94. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +225 -0
  95. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +98018 -70073
  96. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
  97. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +128 -0
  98. package/v2Containers/Rcs/tests/index.test.js +152 -121
  99. package/v2Containers/Rcs/tests/mockData.js +38 -0
  100. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +318 -0
  101. package/v2Containers/Rcs/tests/utils.test.js +646 -30
  102. package/v2Containers/Rcs/utils.js +478 -11
  103. package/v2Containers/Sms/Create/index.js +100 -40
  104. package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
  105. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
  106. package/v2Containers/SmsTrai/Create/index.js +9 -4
  107. package/v2Containers/SmsTrai/Edit/constants.js +2 -0
  108. package/v2Containers/SmsTrai/Edit/index.js +636 -130
  109. package/v2Containers/SmsTrai/Edit/index.scss +121 -0
  110. package/v2Containers/SmsTrai/Edit/messages.js +14 -4
  111. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4328 -2375
  112. package/v2Containers/SmsWrapper/index.js +37 -8
  113. package/v2Containers/TagList/index.js +6 -0
  114. package/v2Containers/Templates/ChannelTypeIllustration.js +6 -23
  115. package/v2Containers/Templates/TemplatesActionBar.js +101 -0
  116. package/v2Containers/Templates/_templates.scss +181 -126
  117. package/v2Containers/Templates/actions.js +11 -36
  118. package/v2Containers/Templates/constants.js +2 -23
  119. package/v2Containers/Templates/index.js +142 -333
  120. package/v2Containers/Templates/messages.js +0 -68
  121. package/v2Containers/Templates/reducer.js +0 -68
  122. package/v2Containers/Templates/sagas.js +55 -98
  123. package/v2Containers/Templates/selectors.js +0 -12
  124. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +0 -12
  125. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
  126. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1042 -1256
  127. package/v2Containers/Templates/tests/index.test.js +0 -6
  128. package/v2Containers/Templates/tests/reducer.test.js +0 -178
  129. package/v2Containers/Templates/tests/sagas.test.js +200 -436
  130. package/v2Containers/Templates/tests/selector.test.js +0 -32
  131. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
  132. package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
  133. package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
  134. package/v2Containers/TemplatesV2/index.js +86 -23
  135. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
  136. package/v2Containers/Whatsapp/index.js +3 -20
  137. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
  138. package/v2Containers/Assets/images/archive_Empty_Illustration.svg +0 -9
@@ -23,9 +23,6 @@ describe('Test Templates container', () => {
23
23
  const getUserList = jest.fn();
24
24
  const getSenderDetails = jest.fn();
25
25
  const resetTemplate = jest.fn();
26
- const setArchivedMode = jest.fn();
27
- const clearTemplateSelection = jest.fn();
28
- const toggleTemplateSelection = jest.fn();
29
26
  let renderedComponent;
30
27
 
31
28
  beforeEach(() => {
@@ -59,9 +56,6 @@ describe('Test Templates container', () => {
59
56
  getUserList,
60
57
  getSenderDetails,
61
58
  resetTemplate,
62
- setArchivedMode,
63
- clearTemplateSelection,
64
- toggleTemplateSelection,
65
59
  }}
66
60
  location={{
67
61
  pathname: `/${channel}`,
@@ -353,181 +353,3 @@ describe("test reducer - SET account actions clear templates", () => {
353
353
  expect(result.templates).toEqual([]);
354
354
  });
355
355
  });
356
-
357
- describe("test reducer - archive actions", () => {
358
- afterEach(() => {
359
- jest.clearAllMocks();
360
- });
361
-
362
- it("should handle SET_ARCHIVE_FILTER", () => {
363
- const action = { type: types.SET_ARCHIVE_FILTER, filter: 'archived' };
364
- const result = reducer(initialState, action).toJS();
365
- expect(result.archiveFilter).toBe('archived');
366
- expect(result.templates).toEqual([]);
367
- expect(result.selectedTemplateIds).toEqual([]);
368
- });
369
-
370
- it("should handle SET_ARCHIVED_MODE with isArchived true", () => {
371
- const action = { type: types.SET_ARCHIVED_MODE, isArchived: true };
372
- const result = reducer(initialState, action).toJS();
373
- expect(result.isArchivedMode).toBe(true);
374
- expect(result.archiveFilter).toBe('archived');
375
- expect(result.templates).toEqual([]);
376
- expect(result.selectedTemplateIds).toEqual([]);
377
- });
378
-
379
- it("should handle SET_ARCHIVED_MODE with isArchived false", () => {
380
- const action = { type: types.SET_ARCHIVED_MODE, isArchived: false };
381
- const result = reducer(initialState, action).toJS();
382
- expect(result.isArchivedMode).toBe(false);
383
- expect(result.archiveFilter).toBe('active');
384
- });
385
-
386
- it("should handle TOGGLE_TEMPLATE_SELECTION - add id", () => {
387
- const action = { type: types.TOGGLE_TEMPLATE_SELECTION, id: 'id1' };
388
- const result = reducer(initialState, action).toJS();
389
- expect(result.selectedTemplateIds).toEqual(['id1']);
390
- });
391
-
392
- it("should handle TOGGLE_TEMPLATE_SELECTION - remove id if already selected", () => {
393
- const { fromJS } = require('immutable');
394
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1', 'id2']));
395
- const action = { type: types.TOGGLE_TEMPLATE_SELECTION, id: 'id1' };
396
- const result = reducer(stateWithSelected, action).toJS();
397
- expect(result.selectedTemplateIds).toEqual(['id2']);
398
- });
399
-
400
- it("should handle TOGGLE_TEMPLATE_SELECTION - add id when selectedTemplateIds is a plain array (legacy state)", () => {
401
- // Covers the Array.isArray branch of the defensive fallback
402
- const stateWithPlainArray = initialState.set('selectedTemplateIds', ['id1']);
403
- const action = { type: types.TOGGLE_TEMPLATE_SELECTION, id: 'id2' };
404
- const result = reducer(stateWithPlainArray, action).toJS();
405
- expect(result.selectedTemplateIds).toEqual(['id1', 'id2']);
406
- });
407
-
408
- it("should handle TOGGLE_TEMPLATE_SELECTION - remove id when selectedTemplateIds is a plain array (legacy state)", () => {
409
- // Covers the Array.isArray branch of the defensive fallback
410
- const stateWithPlainArray = initialState.set('selectedTemplateIds', ['id1', 'id2']);
411
- const action = { type: types.TOGGLE_TEMPLATE_SELECTION, id: 'id1' };
412
- const result = reducer(stateWithPlainArray, action).toJS();
413
- expect(result.selectedTemplateIds).toEqual(['id2']);
414
- });
415
-
416
- it("should handle TOGGLE_TEMPLATE_SELECTION - add id when selectedTemplateIds is undefined (stale persisted state)", () => {
417
- // Covers the final fallback to [] when rawSelected is neither Immutable nor Array
418
- const stateWithUndefined = initialState.set('selectedTemplateIds', undefined);
419
- const action = { type: types.TOGGLE_TEMPLATE_SELECTION, id: 'id1' };
420
- const result = reducer(stateWithUndefined, action).toJS();
421
- expect(result.selectedTemplateIds).toEqual(['id1']);
422
- });
423
-
424
- it("should handle SELECT_ALL_TEMPLATES", () => {
425
- const action = { type: types.SELECT_ALL_TEMPLATES, ids: ['id1', 'id2', 'id3'] };
426
- const result = reducer(initialState, action).toJS();
427
- expect(result.selectedTemplateIds).toEqual(['id1', 'id2', 'id3']);
428
- });
429
-
430
- it("should handle CLEAR_TEMPLATE_SELECTION", () => {
431
- const { fromJS } = require('immutable');
432
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1', 'id2']));
433
- const action = { type: types.CLEAR_TEMPLATE_SELECTION };
434
- const result = reducer(stateWithSelected, action).toJS();
435
- expect(result.selectedTemplateIds).toEqual([]);
436
- });
437
-
438
- it("should handle ARCHIVE_TEMPLATE_REQUEST", () => {
439
- const action = { type: types.ARCHIVE_TEMPLATE_REQUEST };
440
- const result = reducer(initialState, action).toJS();
441
- expect(result.archiveInProgress).toBe(true);
442
- });
443
-
444
- it("should handle ARCHIVE_TEMPLATE_SUCCESS", () => {
445
- const action = { type: types.ARCHIVE_TEMPLATE_SUCCESS };
446
- const result = reducer(initialState, action).toJS();
447
- expect(result.archiveInProgress).toBe(false);
448
- });
449
-
450
- it("should remove archived template id from selectedTemplateIds on ARCHIVE_TEMPLATE_SUCCESS", () => {
451
- const { fromJS } = require('immutable');
452
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1', 'id2', 'id3']));
453
- const action = { type: types.ARCHIVE_TEMPLATE_SUCCESS, id: 'id2' };
454
- const result = reducer(stateWithSelected, action).toJS();
455
- expect(result.archiveInProgress).toBe(false);
456
- expect(result.selectedTemplateIds).toEqual(['id1', 'id3']);
457
- });
458
-
459
- it("should handle ARCHIVE_TEMPLATE_FAILURE", () => {
460
- const action = { type: types.ARCHIVE_TEMPLATE_FAILURE };
461
- const result = reducer(initialState, action).toJS();
462
- expect(result.archiveInProgress).toBe(false);
463
- });
464
-
465
- it("should handle UNARCHIVE_TEMPLATE_REQUEST", () => {
466
- const action = { type: types.UNARCHIVE_TEMPLATE_REQUEST };
467
- const result = reducer(initialState, action).toJS();
468
- expect(result.unarchiveInProgress).toBe(true);
469
- });
470
-
471
- it("should handle UNARCHIVE_TEMPLATE_SUCCESS", () => {
472
- const action = { type: types.UNARCHIVE_TEMPLATE_SUCCESS };
473
- const result = reducer(initialState, action).toJS();
474
- expect(result.unarchiveInProgress).toBe(false);
475
- });
476
-
477
- it("should remove unarchived template id from selectedTemplateIds on UNARCHIVE_TEMPLATE_SUCCESS", () => {
478
- const { fromJS } = require('immutable');
479
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1', 'id2', 'id3']));
480
- const action = { type: types.UNARCHIVE_TEMPLATE_SUCCESS, id: 'id1' };
481
- const result = reducer(stateWithSelected, action).toJS();
482
- expect(result.unarchiveInProgress).toBe(false);
483
- expect(result.selectedTemplateIds).toEqual(['id2', 'id3']);
484
- });
485
-
486
- it("should handle UNARCHIVE_TEMPLATE_FAILURE", () => {
487
- const action = { type: types.UNARCHIVE_TEMPLATE_FAILURE };
488
- const result = reducer(initialState, action).toJS();
489
- expect(result.unarchiveInProgress).toBe(false);
490
- });
491
-
492
- it("should handle BULK_ARCHIVE_REQUEST", () => {
493
- const action = { type: types.BULK_ARCHIVE_REQUEST };
494
- const result = reducer(initialState, action).toJS();
495
- expect(result.bulkArchiveInProgress).toBe(true);
496
- });
497
-
498
- it("should handle BULK_ARCHIVE_SUCCESS", () => {
499
- const { fromJS } = require('immutable');
500
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1']));
501
- const action = { type: types.BULK_ARCHIVE_SUCCESS };
502
- const result = reducer(stateWithSelected, action).toJS();
503
- expect(result.bulkArchiveInProgress).toBe(false);
504
- expect(result.selectedTemplateIds).toEqual([]);
505
- });
506
-
507
- it("should handle BULK_ARCHIVE_FAILURE", () => {
508
- const action = { type: types.BULK_ARCHIVE_FAILURE };
509
- const result = reducer(initialState, action).toJS();
510
- expect(result.bulkArchiveInProgress).toBe(false);
511
- });
512
-
513
- it("should handle BULK_UNARCHIVE_REQUEST", () => {
514
- const action = { type: types.BULK_UNARCHIVE_REQUEST };
515
- const result = reducer(initialState, action).toJS();
516
- expect(result.bulkUnarchiveInProgress).toBe(true);
517
- });
518
-
519
- it("should handle BULK_UNARCHIVE_SUCCESS", () => {
520
- const { fromJS } = require('immutable');
521
- const stateWithSelected = initialState.set('selectedTemplateIds', fromJS(['id1']));
522
- const action = { type: types.BULK_UNARCHIVE_SUCCESS };
523
- const result = reducer(stateWithSelected, action).toJS();
524
- expect(result.bulkUnarchiveInProgress).toBe(false);
525
- expect(result.selectedTemplateIds).toEqual([]);
526
- });
527
-
528
- it("should handle BULK_UNARCHIVE_FAILURE", () => {
529
- const action = { type: types.BULK_UNARCHIVE_FAILURE };
530
- const result = reducer(initialState, action).toJS();
531
- expect(result.bulkUnarchiveInProgress).toBe(false);
532
- });
533
- });