@capillarytech/creatives-library 8.0.290-alpha.4 → 8.0.290

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 (80) hide show
  1. package/constants/unified.js +1 -3
  2. package/initialState.js +2 -0
  3. package/package.json +1 -1
  4. package/utils/common.js +8 -5
  5. package/utils/commonUtils.js +85 -4
  6. package/utils/tagValidations.js +223 -83
  7. package/utils/tests/commonUtil.test.js +124 -147
  8. package/utils/tests/tagValidations.test.js +358 -441
  9. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +33 -0
  10. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +397 -0
  11. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +35 -0
  12. package/v2Components/CommonTestAndPreview/DeliverySettings/TECH_DETAILING_DELIVERY_SETTINGS.md +725 -0
  13. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +92 -0
  14. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +243 -0
  15. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +111 -0
  16. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +91 -0
  17. package/v2Components/CommonTestAndPreview/SendTestMessage.js +33 -1
  18. package/v2Components/CommonTestAndPreview/actions.js +20 -0
  19. package/v2Components/CommonTestAndPreview/constants.js +10 -0
  20. package/v2Components/CommonTestAndPreview/index.js +133 -15
  21. package/v2Components/CommonTestAndPreview/reducer.js +47 -0
  22. package/v2Components/CommonTestAndPreview/sagas.js +60 -0
  23. package/v2Components/CommonTestAndPreview/selectors.js +51 -0
  24. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +782 -0
  25. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +200 -0
  26. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +235 -0
  27. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +127 -0
  28. package/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
  29. package/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -0
  30. package/v2Components/CommonTestAndPreview/tests/index.test.js +214 -1
  31. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
  32. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +145 -0
  33. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
  34. package/v2Components/ErrorInfoNote/index.js +5 -2
  35. package/v2Components/FormBuilder/index.js +201 -132
  36. package/v2Components/FormBuilder/messages.js +8 -0
  37. package/v2Components/HtmlEditor/HTMLEditor.js +5 -0
  38. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  39. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +15 -0
  40. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +2 -1
  41. package/v2Components/TestAndPreviewSlidebox/index.js +14 -0
  42. package/v2Containers/Cap/mockData.js +14 -0
  43. package/v2Containers/Cap/reducer.js +55 -3
  44. package/v2Containers/Cap/tests/reducer.test.js +102 -0
  45. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -5
  46. package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -13
  47. package/v2Containers/CreativesContainer/index.js +7 -30
  48. package/v2Containers/Email/index.js +5 -1
  49. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +70 -23
  50. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +137 -29
  51. package/v2Containers/FTP/index.js +51 -2
  52. package/v2Containers/FTP/messages.js +4 -0
  53. package/v2Containers/InApp/index.js +104 -4
  54. package/v2Containers/InApp/tests/index.test.js +6 -17
  55. package/v2Containers/InappAdvance/index.js +108 -4
  56. package/v2Containers/InappAdvance/tests/index.test.js +0 -2
  57. package/v2Containers/Line/Container/Text/index.js +1 -0
  58. package/v2Containers/MobilePush/Create/index.js +19 -42
  59. package/v2Containers/MobilePush/Edit/index.js +19 -42
  60. package/v2Containers/MobilePushNew/index.js +32 -12
  61. package/v2Containers/MobilepushWrapper/index.js +1 -3
  62. package/v2Containers/Rcs/index.js +37 -12
  63. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +649 -12
  64. package/v2Containers/Sms/Create/index.js +3 -39
  65. package/v2Containers/Sms/Create/messages.js +0 -4
  66. package/v2Containers/Sms/Edit/index.js +3 -35
  67. package/v2Containers/Sms/commonMethods.js +6 -3
  68. package/v2Containers/SmsTrai/Edit/index.js +47 -11
  69. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +147 -6
  70. package/v2Containers/SmsWrapper/index.js +0 -2
  71. package/v2Containers/Viber/index.js +1 -0
  72. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +3 -1
  73. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +7 -0
  74. package/v2Containers/WebPush/Create/index.js +2 -2
  75. package/v2Containers/WebPush/Create/utils/validation.js +2 -17
  76. package/v2Containers/WebPush/Create/utils/validation.test.js +24 -59
  77. package/v2Containers/Whatsapp/index.js +18 -10
  78. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26174 -4225
  79. package/v2Containers/Zalo/index.js +11 -3
  80. package/v2Containers/Sms/tests/commonMethods.test.js +0 -122
@@ -270,15 +270,23 @@ export const Zalo = (props) => {
270
270
  validateTags({
271
271
  content: message,
272
272
  tagsParam: tags,
273
+ injectedTagsParams: injectedTags,
273
274
  location,
274
275
  tagModule: getDefaultTags,
276
+ eventContextTags,
275
277
  isFullMode,
276
278
  }) || {};
277
- const { isBraceError } = tagValidationResponse;
279
+ const { unsupportedTags = [], isBraceError } = tagValidationResponse;
280
+ let tagError = '';
281
+ if (unsupportedTags.length > 0) {
282
+ tagError = formatMessage(globalMessages.unsupportedTagsValidationError, {
283
+ unsupportedTags,
284
+ });
285
+ }
278
286
  if (isBraceError) {
279
- return formatMessage(globalMessages.unbalanacedCurlyBraces);
287
+ tagError = formatMessage(globalMessages.unbalanacedCurlyBraces);
280
288
  }
281
- return '';
289
+ return tagError;
282
290
  };
283
291
 
284
292
  //this function is used for checking errror validation in this it validate tags error and length error
@@ -1,122 +0,0 @@
1
- import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
2
- import { showError } from '../commonMethods';
3
-
4
- jest.mock('@capillarytech/cap-ui-library/CapNotification', () => ({
5
- error: jest.fn(),
6
- }));
7
-
8
- jest.mock('../Create/messages', () => ({
9
- __esModule: true,
10
- default: {
11
- validationError: { defaultMessage: 'Validation error' },
12
- },
13
- }));
14
-
15
- describe('Sms commonMethods', () => {
16
- describe('showError', () => {
17
- beforeEach(() => {
18
- jest.clearAllMocks();
19
- });
20
-
21
- it('should call CapNotification.error when formData is not empty, isFormValid is false, and errorData has at least one true value', () => {
22
- const context = {
23
- props: {
24
- intl: { formatMessage: jest.fn((msg) => msg.defaultMessage || 'Validation error') },
25
- },
26
- state: {
27
- formData: { message: 'test' },
28
- isFormValid: false,
29
- errorData: [{ message: true }],
30
- },
31
- };
32
- showError.call(context);
33
- expect(CapNotification.error).toHaveBeenCalledWith({
34
- key: 'validation-error',
35
- message: 'Validation error',
36
- });
37
- });
38
-
39
- it('should not call CapNotification.error when formData is empty', () => {
40
- const context = {
41
- props: { intl: { formatMessage: jest.fn() } },
42
- state: {
43
- formData: {},
44
- isFormValid: false,
45
- errorData: [{ message: true }],
46
- },
47
- };
48
- showError.call(context);
49
- expect(CapNotification.error).not.toHaveBeenCalled();
50
- });
51
-
52
- it('should not call CapNotification.error when isFormValid is true', () => {
53
- const context = {
54
- props: { intl: { formatMessage: jest.fn() } },
55
- state: {
56
- formData: { message: 'test' },
57
- isFormValid: true,
58
- errorData: [{ message: true }],
59
- },
60
- };
61
- showError.call(context);
62
- expect(CapNotification.error).not.toHaveBeenCalled();
63
- });
64
-
65
- it('should not call CapNotification.error when no errorData entry has a true value', () => {
66
- const context = {
67
- props: { intl: { formatMessage: jest.fn() } },
68
- state: {
69
- formData: { message: 'test' },
70
- isFormValid: false,
71
- errorData: [{ message: false, title: false }],
72
- },
73
- };
74
- showError.call(context);
75
- expect(CapNotification.error).not.toHaveBeenCalled();
76
- });
77
-
78
- it('should not call CapNotification.error when errorData is empty', () => {
79
- const context = {
80
- props: { intl: { formatMessage: jest.fn() } },
81
- state: {
82
- formData: { message: 'test' },
83
- isFormValid: false,
84
- errorData: [],
85
- },
86
- };
87
- showError.call(context);
88
- expect(CapNotification.error).not.toHaveBeenCalled();
89
- });
90
-
91
- it('should not call CapNotification.error when errorData[0] is undefined', () => {
92
- const context = {
93
- props: { intl: { formatMessage: jest.fn() } },
94
- state: {
95
- formData: { message: 'test' },
96
- isFormValid: false,
97
- errorData: [],
98
- },
99
- };
100
- showError.call(context);
101
- expect(CapNotification.error).not.toHaveBeenCalled();
102
- });
103
-
104
- it('should call CapNotification.error when errorData[0] has multiple keys and one is true', () => {
105
- const context = {
106
- props: {
107
- intl: { formatMessage: jest.fn((msg) => msg.defaultMessage || 'Validation error') },
108
- },
109
- state: {
110
- formData: { message: 'hello' },
111
- isFormValid: false,
112
- errorData: [{ message: false, title: true }],
113
- },
114
- };
115
- showError.call(context);
116
- expect(CapNotification.error).toHaveBeenCalledWith({
117
- key: 'validation-error',
118
- message: 'Validation error',
119
- });
120
- });
121
- });
122
- });