@capillarytech/creatives-library 9.0.13-alpha.0 → 9.0.13-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 (60) hide show
  1. package/constants/unified.js +0 -3
  2. package/package.json +1 -1
  3. package/utils/common.js +0 -8
  4. package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +132 -0
  5. package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +108 -15
  6. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +141 -1
  7. package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +132 -0
  8. package/v2Components/CommonTestAndPreview/index.js +244 -26
  9. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +364 -0
  10. package/v2Components/FormBuilder/_formBuilder.scss +0 -8
  11. package/v2Components/FormBuilder/index.js +4479 -41
  12. package/v2Containers/Templates/_templates.scss +83 -0
  13. package/v2Containers/Templates/index.js +90 -10
  14. package/v2Containers/Viber/constants.js +21 -0
  15. package/v2Containers/Viber/index.js +719 -49
  16. package/v2Containers/Viber/index.scss +175 -0
  17. package/v2Containers/Viber/messages.js +121 -0
  18. package/v2Containers/Viber/tests/index.test.js +80 -0
  19. package/v2Components/FormBuilder/Classic.js +0 -4487
  20. package/v2Components/FormBuilder/Functional/FormBuilderShell.js +0 -369
  21. package/v2Components/FormBuilder/Functional/channels/registry.js +0 -17
  22. package/v2Components/FormBuilder/Functional/channels/sms/buildSubmitPayload.js +0 -9
  23. package/v2Components/FormBuilder/Functional/channels/sms/config.js +0 -30
  24. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -46
  25. package/v2Components/FormBuilder/Functional/channels/sms/getLiquidContent.js +0 -13
  26. package/v2Components/FormBuilder/Functional/channels/sms/index.js +0 -22
  27. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -52
  28. package/v2Components/FormBuilder/Functional/channels/sms/tests/getLiquidContent.test.js +0 -25
  29. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -87
  30. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +0 -89
  31. package/v2Components/FormBuilder/Functional/constants.js +0 -39
  32. package/v2Components/FormBuilder/Functional/core/schema/fieldRegistry.js +0 -38
  33. package/v2Components/FormBuilder/Functional/core/schema/initializeFormState.js +0 -85
  34. package/v2Components/FormBuilder/Functional/core/store/formReducer.js +0 -81
  35. package/v2Components/FormBuilder/Functional/core/store/selectors.js +0 -30
  36. package/v2Components/FormBuilder/Functional/core/store/toLegacyFormData.js +0 -91
  37. package/v2Components/FormBuilder/Functional/index.js +0 -26
  38. package/v2Components/FormBuilder/Functional/layout/FieldSlot.js +0 -59
  39. package/v2Components/FormBuilder/Functional/layout/SchemaForm.js +0 -32
  40. package/v2Components/FormBuilder/Functional/layout/Section.js +0 -118
  41. package/v2Components/FormBuilder/Functional/renderers/smsRenderers.js +0 -265
  42. package/v2Components/FormBuilder/Functional/tests/channelRegistry.test.js +0 -21
  43. package/v2Components/FormBuilder/Functional/tests/fieldRegistry.test.js +0 -65
  44. package/v2Components/FormBuilder/Functional/tests/fieldSlot.test.js +0 -97
  45. package/v2Components/FormBuilder/Functional/tests/fixtures/smsParityCases.js +0 -192
  46. package/v2Components/FormBuilder/Functional/tests/formReducer.test.js +0 -129
  47. package/v2Components/FormBuilder/Functional/tests/initializeFormState.test.js +0 -132
  48. package/v2Components/FormBuilder/Functional/tests/schemaForm.test.js +0 -40
  49. package/v2Components/FormBuilder/Functional/tests/section.test.js +0 -99
  50. package/v2Components/FormBuilder/Functional/tests/selectors.test.js +0 -67
  51. package/v2Components/FormBuilder/Functional/tests/sms.crossFlowParity.test.js +0 -155
  52. package/v2Components/FormBuilder/Functional/tests/sms.liquid.test.js +0 -172
  53. package/v2Components/FormBuilder/Functional/tests/sms.rollout.test.js +0 -122
  54. package/v2Components/FormBuilder/Functional/tests/sms.shell.parity.test.js +0 -329
  55. package/v2Components/FormBuilder/Functional/tests/smsRenderers.test.js +0 -162
  56. package/v2Components/FormBuilder/Functional/tests/toLegacyFormData.test.js +0 -95
  57. package/v2Components/FormBuilder/tests/__snapshots__/sms.characterization.test.js.snap +0 -114
  58. package/v2Components/FormBuilder/tests/entryGate.test.js +0 -106
  59. package/v2Components/FormBuilder/tests/sms.characterization.test.js +0 -336
  60. package/v2Components/TemplatePreview/coderabbits_comments +0 -171
@@ -106,3 +106,178 @@
106
106
  .test-and-preview-button {
107
107
  margin-left: 6.25rem;
108
108
  }
109
+
110
+ .viber-remove-row-btn {
111
+ margin-top: $CAP_SPACE_24;
112
+ }
113
+
114
+ .viber-add-row-btn {
115
+ margin-top: $CAP_SPACE_08;
116
+ color: $FONT_COLOR_05;
117
+ background: transparent;
118
+ border: none;
119
+ box-shadow: none;
120
+
121
+ &:hover,
122
+ &:focus,
123
+ &:active {
124
+ color: $FONT_COLOR_05;
125
+ background: transparent;
126
+ border: none;
127
+ }
128
+ }
129
+
130
+ .viber-carousel-section {
131
+ margin-top: $CAP_SPACE_16;
132
+ }
133
+
134
+ .viber-carousel-card {
135
+ border: 1px solid $CAP_G06;
136
+ border-radius: $CAP_SPACE_04;
137
+ padding: $CAP_SPACE_16;
138
+ margin-bottom: $CAP_SPACE_16;
139
+ }
140
+
141
+ .viber-carousel-card-selector {
142
+ margin-bottom: $CAP_SPACE_16;
143
+ border-bottom: 1px solid $CAP_G07;
144
+ }
145
+
146
+ .viber-carousel-card-selector-btn {
147
+ min-width: 2.5rem;
148
+ padding: $CAP_SPACE_12 $CAP_SPACE_20;
149
+ border: none;
150
+ background: transparent;
151
+ color: $FONT_COLOR_04;
152
+ font-size: $CAP_SPACE_40;
153
+ cursor: pointer;
154
+ border-bottom: 3px solid transparent;
155
+ }
156
+
157
+ .viber-carousel-card-selector-btn.active {
158
+ color: $FONT_COLOR_01;
159
+ border-bottom-color: currentColor;
160
+ }
161
+
162
+ .viber-carousel-add-btn {
163
+ border-left: 1px solid $CAP_G07;
164
+ margin-left: $CAP_SPACE_16;
165
+ padding-left: $CAP_SPACE_24;
166
+ padding-right: $CAP_SPACE_24;
167
+ }
168
+
169
+ .viber-carousel-image-recommendation {
170
+ display: block;
171
+ margin: $CAP_SPACE_08 0 $CAP_SPACE_16 0;
172
+ color: $FONT_COLOR_03;
173
+ }
174
+
175
+ .viber-carousel-card-title-header {
176
+ align-items: center;
177
+ }
178
+
179
+ .viber-carousel-button {
180
+ border-top: 1px dashed $CAP_G06;
181
+ margin-top: $CAP_SPACE_12;
182
+ padding-top: $CAP_SPACE_12;
183
+ }
184
+
185
+ .viber-carousel-button-label {
186
+ margin-top: $CAP_SPACE_16;
187
+ }
188
+
189
+ .viber-carousel-button-title-header {
190
+ align-items: center;
191
+ }
192
+
193
+ .viber-carousel-url-type-select {
194
+ .ant-select-selection-selected-value {
195
+ max-width: none;
196
+ overflow: visible;
197
+ text-overflow: unset;
198
+ }
199
+
200
+ .ant-select-selection__rendered {
201
+ margin-right: $CAP_SPACE_24;
202
+ }
203
+ }
204
+
205
+ .viber-carousel-url-type-dropdown.ant-select-dropdown {
206
+ min-width: 12rem;
207
+ }
208
+
209
+ .viber-carousel-url-type-dropdown .ant-select-dropdown-menu-item {
210
+ white-space: normal;
211
+ word-break: break-word;
212
+ height: auto;
213
+ line-height: 1.25rem;
214
+ padding-top: $CAP_SPACE_06;
215
+ padding-bottom: $CAP_SPACE_06;
216
+ }
217
+
218
+ .viber-carousel-saved-button {
219
+ display: flex;
220
+ align-items: center;
221
+ border: 1px solid $CAP_G06;
222
+ border-radius: $CAP_SPACE_04;
223
+ padding: $CAP_SPACE_12 $CAP_SPACE_16;
224
+ margin-top: $CAP_SPACE_12;
225
+ min-height: 2.75rem;
226
+ box-sizing: border-box;
227
+ }
228
+
229
+ .viber-carousel-saved-button-icon {
230
+ margin-right: $CAP_SPACE_12;
231
+ color: $FONT_COLOR_01;
232
+ flex-shrink: 0;
233
+ line-height: 1;
234
+ }
235
+
236
+ .viber-carousel-saved-button-text {
237
+ flex: 1;
238
+ margin-right: $CAP_SPACE_12;
239
+ min-width: 0;
240
+ line-height: 1.25rem;
241
+ }
242
+
243
+ .viber-carousel-saved-button-actions {
244
+ display: flex;
245
+ align-items: center;
246
+ gap: $CAP_SPACE_24;
247
+ margin-left: auto;
248
+ flex-shrink: 0;
249
+ min-height: 1.5rem;
250
+
251
+ .button-edit-icon {
252
+ margin-left: 0;
253
+ display: flex;
254
+ align-items: center;
255
+ justify-content: center;
256
+ line-height: 1;
257
+ }
258
+ }
259
+
260
+ .viber-carousel-delete-icon {
261
+ margin-left: 0;
262
+ }
263
+
264
+ .viber-carousel-delete-icon-btn {
265
+ margin-left: $CAP_SPACE_08;
266
+ }
267
+
268
+ .viber-carousel-tab-label-disabled {
269
+ color: $FONT_COLOR_04;
270
+ cursor: not-allowed;
271
+ }
272
+
273
+ .viber-carousel-field-length-top {
274
+ display: block;
275
+ text-align: right;
276
+ margin-top: $CAP_SPACE_04;
277
+ }
278
+
279
+ .viber-form-error {
280
+ color: $CAP_RED;
281
+ display: block;
282
+ margin-top: $CAP_SPACE_08;
283
+ }
@@ -154,6 +154,10 @@ export default defineMessages({
154
154
  id: `${scope}.mediaVideo`,
155
155
  defaultMessage: 'Video',
156
156
  },
157
+ mediaCarousel: {
158
+ id: `${scope}.mediaCarousel`,
159
+ defaultMessage: 'Carousel',
160
+ },
157
161
  videoErrorMessage: {
158
162
  id: `${scope}.videoErrorMessage`,
159
163
  defaultMessage: 'Please upload the video with allowed file extension, size, dimension and aspect ratio',
@@ -214,4 +218,121 @@ export default defineMessages({
214
218
  id: `${scope}.assetIdMissingError`,
215
219
  defaultMessage: 'Asset upload initiated but no asset ID was returned from the server. Unable to track processing status.',
216
220
  },
221
+ carouselCardsLabel: {
222
+ id: `${scope}.carouselCardsLabel`,
223
+ defaultMessage: 'Carousel cards',
224
+ },
225
+ carouselCardHeading: {
226
+ id: `${scope}.carouselCardHeading`,
227
+ defaultMessage: 'Card {index}',
228
+ },
229
+ carouselCardTextLabel: {
230
+ id: `${scope}.carouselCardTextLabel`,
231
+ defaultMessage: 'Title',
232
+ },
233
+ carouselCardTextPlaceholder: {
234
+ id: `${scope}.carouselCardTextPlaceholder`,
235
+ defaultMessage: 'Enter title',
236
+ },
237
+ carouselMediaUrlLabel: {
238
+ id: `${scope}.carouselMediaUrlLabel`,
239
+ defaultMessage: 'Card media URL',
240
+ },
241
+ carouselMediaUrlPlaceholder: {
242
+ id: `${scope}.carouselMediaUrlPlaceholder`,
243
+ defaultMessage: 'https://example.com/image.jpg',
244
+ },
245
+ carouselImageRecommendation: {
246
+ id: `${scope}.carouselImageRecommendation`,
247
+ defaultMessage:
248
+ 'Supported image types are .jpg, .jpeg, .png. Max size: 10 MB. Recommended resolution: 696 px x 600 px.',
249
+ },
250
+ carouselButtonTitleLabel: {
251
+ id: `${scope}.carouselButtonTitleLabel`,
252
+ defaultMessage: 'Button title',
253
+ },
254
+ carouselButtonTitlePlaceholder: {
255
+ id: `${scope}.carouselButtonTitlePlaceholder`,
256
+ defaultMessage: 'Enter button title',
257
+ },
258
+ carouselButtonActionLabel: {
259
+ id: `${scope}.carouselButtonActionLabel`,
260
+ defaultMessage: 'Button action URL',
261
+ },
262
+ carouselButtonUrlTypeLabel: {
263
+ id: `${scope}.carouselButtonUrlTypeLabel`,
264
+ defaultMessage: 'URL type',
265
+ },
266
+ carouselUrlTypeStatic: {
267
+ id: `${scope}.carouselUrlTypeStatic`,
268
+ defaultMessage: 'Static',
269
+ },
270
+ carouselUrlTypeDynamic: {
271
+ id: `${scope}.carouselUrlTypeDynamic`,
272
+ defaultMessage: 'Dynamic',
273
+ },
274
+ carouselButtonActionPlaceholder: {
275
+ id: `${scope}.carouselButtonActionPlaceholder`,
276
+ defaultMessage: 'https://example.com/action',
277
+ },
278
+ addCarouselCard: {
279
+ id: `${scope}.addCarouselCard`,
280
+ defaultMessage: 'Add card',
281
+ },
282
+ removeCarouselCard: {
283
+ id: `${scope}.removeCarouselCard`,
284
+ defaultMessage: 'Remove card',
285
+ },
286
+ addCarouselButton: {
287
+ id: `${scope}.addCarouselButton`,
288
+ defaultMessage: 'Add button',
289
+ },
290
+ removeCarouselButton: {
291
+ id: `${scope}.removeCarouselButton`,
292
+ defaultMessage: 'Remove button',
293
+ },
294
+ carouselCardsLimitError: {
295
+ id: `${scope}.carouselCardsLimitError`,
296
+ defaultMessage: 'Carousel message requires 2 to 5 cards',
297
+ },
298
+ carouselCardError: {
299
+ id: `${scope}.carouselCardError`,
300
+ defaultMessage: 'Each card needs text and a valid media URL',
301
+ },
302
+ carouselButtonError: {
303
+ id: `${scope}.carouselButtonError`,
304
+ defaultMessage: 'Each button needs title and a valid action URL',
305
+ },
306
+ characterLimitExceededError: {
307
+ id: `${scope}.characterLimitExceededError`,
308
+ defaultMessage: 'Character limit exceeded',
309
+ },
310
+ textCannotBeEmptyError: {
311
+ id: `${scope}.textCannotBeEmptyError`,
312
+ defaultMessage: "Text can't be empty",
313
+ },
314
+ urlCannotBeEmptyError: {
315
+ id: `${scope}.urlCannotBeEmptyError`,
316
+ defaultMessage: "URL can't be empty",
317
+ },
318
+ carouselButtonUrlMaxLengthError: {
319
+ id: `${scope}.carouselButtonUrlMaxLengthError`,
320
+ defaultMessage: 'URL can not exceed 1000 characters',
321
+ },
322
+ carouselFirstButtonTitleMaxLengthError: {
323
+ id: `${scope}.carouselFirstButtonTitleMaxLengthError`,
324
+ defaultMessage: 'Button text should not exceed 10',
325
+ },
326
+ carouselSecondButtonTitleMaxLengthError: {
327
+ id: `${scope}.carouselSecondButtonTitleMaxLengthError`,
328
+ defaultMessage: 'Button text should not exceed 12',
329
+ },
330
+ carouselCardTitleMinLengthError: {
331
+ id: `${scope}.carouselCardTitleMinLengthError`,
332
+ defaultMessage: 'Minimum 2 characters required',
333
+ },
334
+ carouselCardTitleMaxLengthError: {
335
+ id: `${scope}.carouselCardTitleMaxLengthError`,
336
+ defaultMessage: 'Title can not be more than 38 characters',
337
+ },
217
338
  });
@@ -389,4 +389,84 @@ describe('Test Viber container', () => {
389
389
  const doneBtn = screen.getByRole('button', { name: /done/i });
390
390
  expect(doneBtn).toBeEnabled();
391
391
  });
392
+
393
+ it('does not show empty URL error on focus or while typing in carousel button action', async () => {
394
+ renderComponent({
395
+ actions: mockActions,
396
+ globalActions: mockGlobalActions,
397
+ templateData: { mode: 'create' },
398
+ viber: {
399
+ uploadedAssetData: {},
400
+ createTemplateInProgress: false,
401
+ },
402
+ location: {
403
+ pathname: '/sms/edit',
404
+ query: { type: false, module: 'default' },
405
+ search: '',
406
+ },
407
+ isFullMode: true,
408
+ handleClose: jest.fn(),
409
+ });
410
+
411
+ fireEvent.click(screen.getByRole('radio', { name: /carousel/i }));
412
+ const actionInput = await screen.findByPlaceholderText('https://example.com/action');
413
+
414
+ fireEvent.focus(actionInput);
415
+ expect(screen.queryByText("URL can't be empty")).not.toBeInTheDocument();
416
+
417
+ fireEvent.change(actionInput, { target: { value: 'https://' } });
418
+ expect(screen.queryByText("URL can't be empty")).not.toBeInTheDocument();
419
+ });
420
+
421
+ it('shows empty URL error on blur when carousel button action is left empty', async () => {
422
+ renderComponent({
423
+ actions: mockActions,
424
+ globalActions: mockGlobalActions,
425
+ templateData: { mode: 'create' },
426
+ viber: {
427
+ uploadedAssetData: {},
428
+ createTemplateInProgress: false,
429
+ },
430
+ location: {
431
+ pathname: '/sms/edit',
432
+ query: { type: false, module: 'default' },
433
+ search: '',
434
+ },
435
+ isFullMode: true,
436
+ handleClose: jest.fn(),
437
+ });
438
+
439
+ fireEvent.click(screen.getByRole('radio', { name: /carousel/i }));
440
+ const actionInput = await screen.findByPlaceholderText('https://example.com/action');
441
+
442
+ fireEvent.focus(actionInput);
443
+ fireEvent.blur(actionInput);
444
+
445
+ expect(await screen.findByText("URL can't be empty")).toBeInTheDocument();
446
+ });
447
+
448
+ it('shows empty URL error on save when carousel button action is empty', async () => {
449
+ renderComponent({
450
+ actions: mockActions,
451
+ globalActions: mockGlobalActions,
452
+ templateData: { mode: 'create' },
453
+ viber: {
454
+ uploadedAssetData: {},
455
+ createTemplateInProgress: false,
456
+ },
457
+ location: {
458
+ pathname: '/sms/edit',
459
+ query: { type: false, module: 'default' },
460
+ search: '',
461
+ },
462
+ isFullMode: true,
463
+ handleClose: jest.fn(),
464
+ });
465
+
466
+ fireEvent.click(screen.getByRole('radio', { name: /carousel/i }));
467
+ await screen.findByPlaceholderText('https://example.com/action');
468
+ fireEvent.click(screen.getByRole('button', { name: /save/i }));
469
+
470
+ expect(await screen.findByText("URL can't be empty")).toBeInTheDocument();
471
+ });
392
472
  });