@capillarytech/creatives-library 8.0.329 → 8.0.330-alpha.1

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 (89) hide show
  1. package/constants/unified.js +4 -0
  2. package/package.json +1 -1
  3. package/utils/commonUtils.js +19 -1
  4. package/utils/templateVarUtils.js +35 -6
  5. package/utils/tests/tagValidations.test.js +20 -0
  6. package/utils/tests/templateVarUtils.test.js +44 -0
  7. package/v2Components/CapActionButton/constants.js +7 -0
  8. package/v2Components/CapActionButton/index.js +167 -109
  9. package/v2Components/CapActionButton/index.scss +157 -6
  10. package/v2Components/CapActionButton/messages.js +19 -3
  11. package/v2Components/CapActionButton/tests/index.test.js +41 -17
  12. package/v2Components/CapTagList/index.js +28 -23
  13. package/v2Components/CapTagList/style.scss +29 -0
  14. package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
  15. package/v2Components/CapTagListWithInput/index.js +4 -0
  16. package/v2Components/CapWhatsappCTA/index.js +2 -0
  17. package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +1 -0
  18. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +160 -15
  19. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +18 -0
  20. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +323 -77
  21. package/v2Components/CommonTestAndPreview/index.js +49 -57
  22. package/v2Components/CommonTestAndPreview/messages.js +8 -0
  23. package/v2Components/CommonTestAndPreview/reducer.js +3 -1
  24. package/v2Components/CommonTestAndPreview/sagas.js +2 -1
  25. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
  26. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
  27. package/v2Components/FormBuilder/index.js +1 -0
  28. package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
  29. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  30. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
  31. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
  32. package/v2Components/SmsFallback/smsFallbackUtils.js +14 -3
  33. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +16 -0
  34. package/v2Components/TemplatePreview/_templatePreview.scss +33 -23
  35. package/v2Components/TemplatePreview/constants.js +2 -0
  36. package/v2Components/TemplatePreview/index.js +143 -28
  37. package/v2Components/TemplatePreview/tests/index.test.js +142 -0
  38. package/v2Components/TestAndPreviewSlidebox/index.js +5 -0
  39. package/v2Components/mockdata.js +1 -0
  40. package/v2Containers/BeeEditor/index.js +19 -1
  41. package/v2Containers/CreativesContainer/SlideBoxContent.js +28 -1
  42. package/v2Containers/CreativesContainer/index.js +9 -3
  43. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +5 -0
  44. package/v2Containers/Email/index.js +78 -39
  45. package/v2Containers/Email/reducer.js +2 -2
  46. package/v2Containers/Email/sagas.js +3 -1
  47. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -2
  48. package/v2Containers/Email/tests/sagas.test.js +230 -0
  49. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +6 -1
  50. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
  51. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
  52. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
  53. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -1
  54. package/v2Containers/EmailWrapper/index.js +4 -0
  55. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
  56. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
  57. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +1 -0
  58. package/v2Containers/MobilePush/Create/index.js +2 -0
  59. package/v2Containers/MobilePush/Edit/index.js +2 -0
  60. package/v2Containers/MobilepushWrapper/index.js +3 -1
  61. package/v2Containers/Rcs/constants.js +85 -7
  62. package/v2Containers/Rcs/index.js +1592 -156
  63. package/v2Containers/Rcs/index.js.rej +1336 -0
  64. package/v2Containers/Rcs/index.scss +191 -0
  65. package/v2Containers/Rcs/index.scss.rej +74 -0
  66. package/v2Containers/Rcs/messages.js +28 -2
  67. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +20 -0
  68. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +69178 -117691
  69. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +128 -0
  70. package/v2Containers/Rcs/tests/index.test.js +132 -94
  71. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +67 -0
  72. package/v2Containers/Rcs/tests/utils.test.js +276 -38
  73. package/v2Containers/Rcs/utils.js +130 -7
  74. package/v2Containers/Sms/Edit/index.js +2 -0
  75. package/v2Containers/SmsTrai/Edit/index.js +27 -0
  76. package/v2Containers/SmsTrai/Edit/messages.js +5 -0
  77. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -6
  78. package/v2Containers/SmsWrapper/index.js +2 -0
  79. package/v2Containers/TagList/index.js +73 -20
  80. package/v2Containers/TagList/messages.js +4 -0
  81. package/v2Containers/TagList/tests/TagList.test.js +124 -20
  82. package/v2Containers/TagList/tests/mockdata.js +17 -0
  83. package/v2Containers/Templates/_templates.scss +99 -0
  84. package/v2Containers/Templates/index.js +29 -14
  85. package/v2Containers/Viber/index.js +3 -0
  86. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
  87. package/v2Containers/WebPush/Create/index.js +10 -2
  88. package/v2Containers/Whatsapp/index.js +5 -0
  89. package/v2Containers/Zalo/index.js +2 -0
@@ -141,9 +141,11 @@
141
141
  overflow: hidden;
142
142
  &.title{
143
143
  -webkit-line-clamp: 1;
144
+ line-clamp: 1;
144
145
  }
145
146
  &.desc{
146
147
  -webkit-line-clamp: 5;
148
+ line-clamp: 5;
147
149
  }
148
150
  &.rcs-button-text{
149
151
  padding-top: 13px;
@@ -155,11 +157,66 @@
155
157
  width: 220px;
156
158
  height: 103px;
157
159
  }
160
+
161
+ // Templates listing preview (RCS): carousel should show a "peek" of next card like WhatsApp listing.
162
+ &.rcs-template-listing-preview {
163
+ &.is-carousel {
164
+ .rcs-listing-carousel-scroll {
165
+ overflow-x: auto;
166
+ display: flex;
167
+ padding-top: $CAP_SPACE_06;
168
+ padding-right: $CAP_SPACE_06;
169
+ white-space: nowrap;
170
+ scrollbar-width: none;
171
+ &::-webkit-scrollbar {
172
+ display: none;
173
+ }
174
+ // Listing should show a peek (no horizontal scroll interaction needed)
175
+ overflow: hidden;
176
+ }
177
+
178
+ .rcs-listing-carousel-card {
179
+ padding: $CAP_SPACE_04 0 $CAP_SPACE_08;
180
+ border-radius: $CAP_SPACE_06;
181
+ background-color: $CAP_WHITE;
182
+ width: 80%;
183
+ flex-shrink: 0;
184
+ margin-right: $CAP_SPACE_04;
185
+ white-space: normal;
186
+ text-align: left;
187
+ }
188
+
189
+ .rcs-listing-carousel-img {
190
+ width: 100%;
191
+ height: 6.4375rem; // match rcs-listing-image height (103px)
192
+ object-fit: cover;
193
+ display: block;
194
+ margin-bottom: $CAP_SPACE_08;
195
+ }
196
+
197
+ .rcs-listing-carousel-title,
198
+ .rcs-listing-carousel-desc {
199
+ display: block;
200
+ padding: 0 $CAP_SPACE_12;
201
+ }
202
+ .rcs-listing-carousel-desc {
203
+ margin-top: $CAP_SPACE_04;
204
+ }
205
+ }
206
+ }
158
207
  .fallback-sms-length {
159
208
  margin-top: 13px;
160
209
  float: right;
161
210
  }
211
+ .rcs-character-count {
212
+ color: $FONT_COLOR_03;
213
+ }
162
214
 
215
+ .rcs-carousel-character-count-row {
216
+ display: flex;
217
+ justify-content: flex-end;
218
+ margin-top: $CAP_SPACE_08;
219
+ }
163
220
  .rcs-fallback-len-error{
164
221
  margin-top: 8px;
165
222
  }
@@ -193,6 +250,140 @@
193
250
  #rcs-dimension-select{
194
251
  width: 100%;
195
252
  }
253
+
254
+ .rcs-carousel-section {
255
+ margin-top: $CAP_SPACE_12;
256
+ }
257
+
258
+ .rcs-carousel-dimension-section {
259
+ margin-top: 1.25rem;
260
+ }
261
+
262
+ .rcs-carousel-selected-dimension {
263
+ display: block;
264
+ margin-top: 8px;
265
+ color: $FONT_COLOR_03;
266
+ }
267
+
268
+ .rcs-carousel-dimension-label {
269
+ display: inline-block;
270
+ margin-bottom: 6px;
271
+ }
272
+
273
+ #rcs-carousel-height-select,
274
+ #rcs-carousel-width-select {
275
+ width: 100%;
276
+ }
277
+
278
+ .rcs-carousel-tab {
279
+ margin-top: 12px;
280
+ }
281
+
282
+ .rcs-carousel-card {
283
+ margin-top: 12px;
284
+
285
+ // Match carousel card header: title left, icon-only delete right (Figma / product reference).
286
+ &.cap-card-v2.ant-card {
287
+ .ant-card-head {
288
+ min-height: 48px;
289
+ padding: 0 $CAP_SPACE_16;
290
+ border-bottom: 1px solid #e8e8e8;
291
+ }
292
+
293
+ .ant-card-head-title {
294
+ padding: $CAP_SPACE_12 0;
295
+ font-weight: 600;
296
+ color: $CAP_G01;
297
+ }
298
+
299
+ .ant-card-extra {
300
+ padding: $CAP_SPACE_08 0;
301
+ }
302
+ }
303
+
304
+ .rcs-carousel-card-delete.ant-btn.cap-button-v2 {
305
+ display: inline-flex;
306
+ align-items: center;
307
+ justify-content: center;
308
+ min-width: auto;
309
+ width: 2rem;
310
+ height: 2rem;
311
+ padding: 0;
312
+ border: none;
313
+ box-shadow: none;
314
+ color: $CAP_G01;
315
+
316
+ &:not(:disabled):hover {
317
+ // Match $CAP_SECONDARY base from cap-ui-library (avoid map-get — node-sass can mis-resolve imported maps).
318
+ color: #2466ea;
319
+ background-color: rgba(0, 0, 0, 0.04);
320
+ }
321
+
322
+ &:disabled {
323
+ color: rgba(0, 0, 0, 0.25);
324
+ background: transparent;
325
+ }
326
+ }
327
+
328
+ .rcs-carousel-delete-tooltip-wrap.button-disabled-tooltip-wrapper {
329
+ display: inline-flex;
330
+ align-items: center;
331
+ cursor: not-allowed;
332
+ }
333
+ }
334
+
335
+ .rcs-carousel-card-row {
336
+ margin-bottom: 12px;
337
+ }
338
+
339
+ .rcs-carousel-media-selection {
340
+ margin-top: 0.75rem;
341
+ margin-bottom: 0.75rem;
342
+ align-items: center;
343
+ }
344
+
345
+ // Carousel upload previews: keep media preview compact (CapImageUpload uses height=400 by default)
346
+ .rcs-carousel-media-upload {
347
+ padding-top: $CAP_SPACE_20;
348
+ .image-container {
349
+ background-image: none;
350
+ border: 0;
351
+ width: 100%;
352
+ max-width: 560px;
353
+ }
354
+
355
+ .image-container img {
356
+ width: 100%;
357
+ height: auto !important;
358
+ max-height: 240px;
359
+ object-fit: contain;
360
+ display: block;
361
+ }
362
+ }
363
+
364
+ .rcs-carousel-card-divider {
365
+ margin: $CAP_SPACE_24 0;
366
+ }
367
+
368
+ .rcs-content-section-divider {
369
+ margin: $CAP_SPACE_28 0;
370
+ }
371
+
372
+ .rcs-edit-template-message-static-textarea {
373
+ background: #fafafa;
374
+ color: #888;
375
+
376
+ // Ensure styles apply to underlying textarea/input for CapInput TextArea.
377
+ textarea,
378
+ .ant-input {
379
+ background: #fafafa;
380
+ color: #888;
381
+ }
382
+ }
383
+
384
+ .add-carousel-content-button {
385
+ padding: 0 $CAP_SPACE_08;
386
+ }
196
387
  }
197
388
  .rcs-fallback-preview > .cap-slide-box-v2-container.size-r{
198
389
  min-width: 430px;
@@ -0,0 +1,74 @@
1
+ diff a/app/v2Containers/Rcs/index.scss b/app/v2Containers/Rcs/index.scss (rejected hunks)
2
+ @@ -5,109 +5,54 @@
3
+ position: fixed;
4
+ bottom: 0;
5
+ width: 100%;
6
+ + margin-left: -32px;
7
+ padding: $CAP_SPACE_32 $CAP_SPACE_24;
8
+ + margin-top: 40px;
9
+ z-index: 1;
10
+ .ant-btn {
11
+ margin-right: $CAP_SPACE_16;
12
+ }
13
+ -
14
+ .rcs-test-preview-btn {
15
+ margin-left: $CAP_SPACE_08;
16
+ }
17
+ }
18
+
19
+ .cap-rcs-creatives {
20
+ -
21
+ -
22
+ -
23
+ -
24
+ + .template-status-container {
25
+ + width: 100%;
26
+ + display: flex;
27
+ + flex-direction: column;
28
+ + align-items: flex-start;
29
+ + margin-bottom: 1.25rem; // match spacing used across label sections (eg title/message labels)
30
+
31
+ + .ant-alert {
32
+ + width: 100%;
33
+ + margin-top: $CAP_SPACE_08; // match label -> field spacing like other sections
34
+ }
35
+ }
36
+
37
+ + .rcs-scroll-div {
38
+ + margin-bottom: 150px;
39
+ }
40
+ + // Match WhatsApp visual spacing between editor column and preview column
41
+ .rcs-preview-container {
42
+ + padding-left: $CAP_SPACE_24;
43
+ + display: flex;
44
+ + justify-content: center;
45
+ }
46
+ .rcs-optional-label {
47
+ + margin-left: 8px;
48
+ color: $FONT_COLOR_03;
49
+ font-weight: normal;
50
+ }
51
+ .rcs_text_area_wrapper {
52
+ position: relative;
53
+ }
54
+ .rcs-button{
55
+ display: inline-grid;
56
+ }
57
+ -
58
+ -
59
+ -
60
+ -
61
+ + .rcs-button-label{
62
+ + margin-bottom: 17px;
63
+ }
64
+ .disabled-button{
65
+ opacity: 0.5;
66
+ @@ -202,12 +288,6 @@
67
+ width: 430px;
68
+ }
69
+
70
+ -
71
+ -
72
+ .rcs-fallback-preview {
73
+ &__header {
74
+ color: $CAP_G01;
@@ -6,6 +6,14 @@ export default defineMessages({
6
6
  id: `${prefix}.mediaLabel`,
7
7
  defaultMessage: 'Media',
8
8
  },
9
+ mediaTypeLabel: {
10
+ id: `${prefix}.mediaTypeLabel`,
11
+ defaultMessage: 'Media type',
12
+ },
13
+ carouselMediaVideoOption: {
14
+ id: `${prefix}.carouselMediaVideoOption`,
15
+ defaultMessage: 'Video',
16
+ },
9
17
  approvedStatusMsg: {
10
18
  id: `${prefix}.approvedStatusMsg`,
11
19
  defaultMessage: 'This template has been approved',
@@ -39,6 +47,10 @@ export default defineMessages({
39
47
  id: `${prefix}.btnLabel`,
40
48
  defaultMessage: 'Buttons',
41
49
  },
50
+ carouselMediaVideoOption:{
51
+ id: `${prefix}.carouselMediaVideoOption`,
52
+ defaultMessage: 'Video',
53
+ },
42
54
  btnTypeNone: {
43
55
  id: `${prefix}.btnTypeNone`,
44
56
  defaultMessage: 'None',
@@ -194,6 +206,10 @@ export default defineMessages({
194
206
  id: `${prefix}.disabledCarouselTooltip`,
195
207
  defaultMessage: 'Not yet enabled. Coming soon!',
196
208
  },
209
+ rcsCarouselMinCardDeleteTooltip: {
210
+ id: `${prefix}.rcsCarouselMinCardDeleteTooltip`,
211
+ defaultMessage: 'At least 1 card needs to be added in the carousel template',
212
+ },
197
213
  templateNamePlaceholder: {
198
214
  id: `${prefix}.templateNamePlaceholder`,
199
215
  defaultMessage: 'Enter template name',
@@ -466,7 +482,8 @@ export default defineMessages({
466
482
  },
467
483
  unknownCharactersError: {
468
484
  id: `${prefix}.unknownCharactersError`,
469
- defaultMessage: 'Only alphanumeric characters and underscore are allowed in custom param. Spaces/other special characters are not allowed.',
485
+ defaultMessage:
486
+ 'Only letters, numbers, underscores, and dots are allowed in custom param (e.g. tag.FORMAT_1). Spaces and other special characters are not allowed.',
470
487
  },
471
488
  emptyVariableError: {
472
489
  id: `${prefix}.emptyVariableError`,
@@ -496,4 +513,13 @@ export default defineMessages({
496
513
  id: `${prefix}.rcsTestPreviewDisabledTooltip`,
497
514
  defaultMessage: 'Preview and test is only available after the template is approved.',
498
515
  },
499
- });
516
+ reUpload: {
517
+ id: `${prefix}.reUpload`,
518
+ defaultMessage: 'Reupload',
519
+ },
520
+ /** Carousel video card thumbnail size label (see RCS_CAROUSEL_VIDEO_THUMBNAIL_DIMENSIONS). */
521
+ rcsCarouselVideoThumbnailLabel: {
522
+ id: `${prefix}.rcsCarouselVideoThumbnailLabel`,
523
+ defaultMessage: 'Thumbnail ({width} × {height})',
524
+ },
525
+ });
@@ -1,6 +1,24 @@
1
1
  import isEmpty from 'lodash/isEmpty';
2
2
  import get from 'lodash/get';
3
3
  import { RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from '../../v2Components/CommonTestAndPreview/constants';
4
+ import {
5
+ RCS_NUMERIC_VAR_NAME_REGEX,
6
+ RCS_CARD_VAR_MAPPED_SEMANTIC_KEY_REGEX,
7
+ } from './constants';
8
+
9
+ /** RCS card `cardVarMapped` / `rcsCardVarMapped` only (SMS fallback slot keys stay on `smsFallBackContent`). */
10
+ export function pickRcsCardVarMappedEntries(record) {
11
+ if (record == null || typeof record !== 'object' || Array.isArray(record)) return {};
12
+ return Object.fromEntries(
13
+ Object.entries(record).filter(([k]) => {
14
+ const key = String(k);
15
+ return (
16
+ RCS_NUMERIC_VAR_NAME_REGEX.test(key)
17
+ || RCS_CARD_VAR_MAPPED_SEMANTIC_KEY_REGEX.test(key)
18
+ );
19
+ }),
20
+ );
21
+ }
4
22
 
5
23
  /**
6
24
  * Nested `versions…smsFallBackContent` and root `smsFallBackContent` (CreativesContainer mirror)
@@ -88,6 +106,8 @@ export function getLibrarySmsFallbackApiBaselineFromTemplateData(templateData) {
88
106
  };
89
107
  }
90
108
 
109
+ export { extractRegisteredSenderIdsFromSmsFallbackRecord } from '../../utils/commonUtils';
110
+
91
111
  export function pickFirstSmsFallbackTemplateString(sms = {}) {
92
112
  if (!sms || typeof sms !== 'object') return '';
93
113
  const keys = [