@capillarytech/creatives-library 8.0.201-alpha.0 → 8.0.202

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.
@@ -1,486 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Test SlideBoxContent container Additional Channel Coverage Should handle Zalo channel 1`] = `
4
- <SlideBoxContent__CreativesWrapper>
5
- <ForwardRef
6
- getDefaultTags=""
7
- hostName=""
8
- location={
9
- Object {
10
- "pathname": "/zalo/edit",
11
- "query": Object {
12
- "isEditFromCampaigns": undefined,
13
- "module": "library",
14
- "type": "embedded",
15
- },
16
- "search": "",
17
- }
18
- }
19
- templateData={
20
- Object {
21
- "type": "ZALO",
22
- "versions": Object {
23
- "base": Object {
24
- "content": Object {
25
- "message": "Zalo message",
26
- },
27
- },
28
- },
29
- }
30
- }
31
- />
32
- </SlideBoxContent__CreativesWrapper>
33
- `;
34
-
35
- exports[`Test SlideBoxContent container Additional Channel Coverage Should handle complex LINE template with multiple message types 1`] = `
36
- <SlideBoxContent__CreativesWrapper>
37
- <InjectIntl(TemplatePreview)
38
- channel="line"
39
- charCounterEnabled={false}
40
- content={
41
- Array [
42
- Object {
43
- "actionUrl": undefined,
44
- "baseUrl": undefined,
45
- "imageCarousel": Array [
46
- Object {
47
- "actionLabel": undefined,
48
- "imageUrl": undefined,
49
- },
50
- ],
51
- "messageContent": "Hello",
52
- "previewImageUrl": "https://example.com/image.jpg",
53
- "selectedSticker": Object {
54
- "animatedStickerUrl": undefined,
55
- "packageId": undefined,
56
- "stickerId": undefined,
57
- "stickerUrl": undefined,
58
- },
59
- "type": "text",
60
- "video": undefined,
61
- },
62
- Object {
63
- "actionUrl": undefined,
64
- "baseUrl": undefined,
65
- "imageCarousel": Array [
66
- Object {
67
- "actionLabel": undefined,
68
- "imageUrl": undefined,
69
- },
70
- ],
71
- "messageContent": undefined,
72
- "previewImageUrl": undefined,
73
- "selectedSticker": Object {
74
- "packageId": "456",
75
- "stickerId": "123",
76
- "stickerUrl": "https://example.com/sticker.png",
77
- },
78
- "type": "sticker",
79
- "video": undefined,
80
- },
81
- Object {
82
- "actionUrl": undefined,
83
- "baseUrl": "https://example.com/map",
84
- "imageCarousel": Array [
85
- Object {
86
- "actionLabel": undefined,
87
- "imageUrl": undefined,
88
- },
89
- ],
90
- "messageContent": undefined,
91
- "previewImageUrl": undefined,
92
- "selectedSticker": Object {
93
- "animatedStickerUrl": undefined,
94
- "packageId": undefined,
95
- "stickerId": undefined,
96
- "stickerUrl": undefined,
97
- },
98
- "type": "imagemap",
99
- "video": undefined,
100
- },
101
- ]
102
- }
103
- showCount={true}
104
- templateData={
105
- Object {
106
- "type": "LINE",
107
- "versions": Object {
108
- "base": Object {
109
- "content": Object {
110
- "messages": Array [
111
- Object {
112
- "previewImageUrl": "https://example.com/image.jpg",
113
- "text": "Hello",
114
- },
115
- Object {
116
- "selectedSticker": Object {
117
- "packageId": "456",
118
- "stickerId": "123",
119
- "stickerUrl": "https://example.com/sticker.png",
120
- },
121
- },
122
- Object {
123
- "baseUrl": "https://example.com/map",
124
- },
125
- ],
126
- },
127
- },
128
- },
129
- }
130
- }
131
- viberBrandName=""
132
- />
133
- <Connect(Connect(UserIsAuthenticated(InjectIntl(CreativesCommon))))
134
- location={
135
- Object {
136
- "pathname": "/sms/edit",
137
- "query": Object {
138
- "isEditFromCampaigns": undefined,
139
- "module": "library",
140
- "type": "embedded",
141
- },
142
- "search": "",
143
- }
144
- }
145
- onCreateComplete={[MockFunction]}
146
- params={
147
- Object {
148
- "id": undefined,
149
- "mode": undefined,
150
- }
151
- }
152
- route={
153
- Object {
154
- "name": "edit_text",
155
- }
156
- }
157
- templateData={
158
- Object {
159
- "type": "LINE",
160
- "versions": Object {
161
- "base": Object {
162
- "content": Object {
163
- "messages": Array [
164
- Object {
165
- "previewImageUrl": "https://example.com/image.jpg",
166
- "text": "Hello",
167
- },
168
- Object {
169
- "selectedSticker": Object {
170
- "packageId": "456",
171
- "stickerId": "123",
172
- "stickerUrl": "https://example.com/sticker.png",
173
- },
174
- },
175
- Object {
176
- "baseUrl": "https://example.com/map",
177
- },
178
- ],
179
- },
180
- },
181
- },
182
- }
183
- }
184
- />
185
- </SlideBoxContent__CreativesWrapper>
186
- `;
187
-
188
- exports[`Test SlideBoxContent container Additional Channel Coverage Should handle createTemplate mode with different options 1`] = `
189
- <SlideBoxContent__CreativesWrapper>
190
- <SmsWrapper
191
- getDefaultTags=""
192
- isComponent={true}
193
- isCreateSms={true}
194
- isFullMode={true}
195
- location={
196
- Object {
197
- "pathname": "/sms/edit",
198
- "query": Object {
199
- "isEditFromCampaigns": undefined,
200
- "module": "default",
201
- "type": false,
202
- },
203
- "search": "",
204
- }
205
- }
206
- onCreateComplete={[MockFunction]}
207
- route={
208
- Object {
209
- "name": "sms",
210
- }
211
- }
212
- smsRegister="DLT"
213
- />
214
- </SlideBoxContent__CreativesWrapper>
215
- `;
216
-
217
- exports[`Test SlideBoxContent container Additional Channel Coverage Should handle templates mode for various channels 1`] = `
218
- <SlideBoxContent__CreativesWrapper>
219
- <Connect(UserIsAuthenticated(Connect(InjectIntl(withStyles__StyledComponent))))
220
- FTPMode="create"
221
- channel=""
222
- loyaltyMetaData={Object {}}
223
- messageDetails={Object {}}
224
- onCreateComplete={[MockFunction]}
225
- slidBoxContent="templates"
226
- />
227
- </SlideBoxContent__CreativesWrapper>
228
- `;
229
-
230
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle Call Task channel 1`] = `
231
- <SlideBoxContent__CreativesWrapper>
232
- <ForwardRef
233
- messageDetails={Object {}}
234
- mode="edit"
235
- templateData={
236
- Object {
237
- "type": "CALL_TASK",
238
- "versions": Object {
239
- "base": Object {
240
- "content": Object {
241
- "message": "Call task message",
242
- },
243
- },
244
- },
245
- }
246
- }
247
- />
248
- </SlideBoxContent__CreativesWrapper>
249
- `;
250
-
251
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle Email channel with different modes 1`] = `
252
- <SlideBoxContent__CreativesWrapper>
253
- <ForwardRef
254
- getDefaultTags=""
255
- isFullMode={true}
256
- key="cretives-container-email-edit"
257
- location={
258
- Object {
259
- "pathname": "/email/edit",
260
- "query": Object {
261
- "module": "library",
262
- "type": "embedded",
263
- },
264
- }
265
- }
266
- params={
267
- Object {
268
- "id": "email-123",
269
- }
270
- }
271
- route={
272
- Object {
273
- "name": "email",
274
- }
275
- }
276
- templateData={
277
- Object {
278
- "_id": "email-123",
279
- "type": "EMAIL",
280
- "versions": Object {
281
- "base": Object {
282
- "content": Object {
283
- "html_content": "<p>Test content</p>",
284
- "subject": "Test Email",
285
- },
286
- },
287
- },
288
- }
289
- }
290
- />
291
- </SlideBoxContent__CreativesWrapper>
292
- `;
293
-
294
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle FTP channel 1`] = `
295
- <SlideBoxContent__CreativesWrapper>
296
- <ForwardRef
297
- messageDetails={Object {}}
298
- mode="edit"
299
- />
300
- </SlideBoxContent__CreativesWrapper>
301
- `;
302
-
303
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle InApp channel preview 1`] = `
304
- <SlideBoxContent__CreativesWrapper>
305
- <MobilePushPreviewV2
306
- channel="INAPP"
307
- templateData={
308
- Object {
309
- "type": "INAPP",
310
- "versions": Object {
311
- "base": Object {
312
- "content": Object {
313
- "message": "Test InApp message",
314
- },
315
- },
316
- },
317
- }
318
- }
319
- />
320
- </SlideBoxContent__CreativesWrapper>
321
- `;
322
-
323
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle LINE channel with video content 1`] = `
324
- <SlideBoxContent__CreativesWrapper>
325
- <InjectIntl(TemplatePreview)
326
- channel="line"
327
- charCounterEnabled={false}
328
- content={
329
- Array [
330
- Object {
331
- "actionUrl": "https://example.com/link",
332
- "baseUrl": undefined,
333
- "imageCarousel": Array [
334
- Object {
335
- "actionLabel": undefined,
336
- "imageUrl": undefined,
337
- },
338
- ],
339
- "messageContent": undefined,
340
- "previewImageUrl": undefined,
341
- "selectedSticker": Object {
342
- "animatedStickerUrl": undefined,
343
- "packageId": undefined,
344
- "stickerId": undefined,
345
- "stickerUrl": undefined,
346
- },
347
- "type": "image_carousel",
348
- "video": "https://example.com/video.mp4",
349
- },
350
- ]
351
- }
352
- showCount={true}
353
- templateData={
354
- Object {
355
- "type": "LINE",
356
- "versions": Object {
357
- "base": Object {
358
- "content": Object {
359
- "messages": Array [
360
- Object {
361
- "video": Object {
362
- "externalLink": Object {
363
- "linkUri": "https://example.com/link",
364
- },
365
- "originalContentUrl": "https://example.com/video.mp4",
366
- },
367
- },
368
- ],
369
- },
370
- },
371
- },
372
- }
373
- }
374
- viberBrandName=""
375
- />
376
- <Connect(Connect(UserIsAuthenticated(InjectIntl(CreativesCommon))))
377
- location={
378
- Object {
379
- "pathname": "/sms/edit",
380
- "query": Object {
381
- "isEditFromCampaigns": undefined,
382
- "module": "library",
383
- "type": "embedded",
384
- },
385
- "search": "",
386
- }
387
- }
388
- onCreateComplete={[MockFunction]}
389
- params={
390
- Object {
391
- "id": undefined,
392
- "mode": undefined,
393
- }
394
- }
395
- route={
396
- Object {
397
- "name": "edit_text",
398
- }
399
- }
400
- templateData={
401
- Object {
402
- "type": "LINE",
403
- "versions": Object {
404
- "base": Object {
405
- "content": Object {
406
- "messages": Array [
407
- Object {
408
- "video": Object {
409
- "externalLink": Object {
410
- "linkUri": "https://example.com/link",
411
- },
412
- "originalContentUrl": "https://example.com/video.mp4",
413
- },
414
- },
415
- ],
416
- },
417
- },
418
- },
419
- }
420
- }
421
- />
422
- </SlideBoxContent__CreativesWrapper>
423
- `;
424
-
425
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle SMS channel with DLT content processing 1`] = `
426
- <SlideBoxContent__CreativesWrapper>
427
- <InjectIntl(TemplatePreview)
428
- channel="sms"
429
- charCounterEnabled={true}
430
- content="Fallback SMS content"
431
- showCount={true}
432
- templateData={
433
- Object {
434
- "type": "SMS",
435
- "versions": Object {
436
- "base": Object {
437
- "sms-editor": "Fallback SMS content",
438
- "updated-sms-editor": Array [
439
- "Line 1",
440
- "Line 2",
441
- "Line 3",
442
- ],
443
- },
444
- },
445
- }
446
- }
447
- viberBrandName=""
448
- />
449
- </SlideBoxContent__CreativesWrapper>
450
- `;
451
-
452
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle WeChat channel in different modes 1`] = `
453
- <SlideBoxContent__CreativesWrapper>
454
- <Connect(InjectIntl(Wrapper))
455
- mode="editTemplate"
456
- query={
457
- Object {
458
- "isEditFromCampaigns": undefined,
459
- "module": "library",
460
- "type": "embedded",
461
- }
462
- }
463
- templateData={
464
- Object {
465
- "type": "WECHAT",
466
- "versions": Object {
467
- "base": Object {
468
- "content": Object {
469
- "msgcontent": "RICH_MEDIA_WECHAT",
470
- },
471
- },
472
- },
473
- }
474
- }
475
- templateType="mapTemplate"
476
- />
477
- </SlideBoxContent__CreativesWrapper>
478
- `;
479
-
480
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle default case in getChannelPreviewContent 1`] = `<SlideBoxContent__CreativesWrapper />`;
481
-
482
- exports[`Test SlideBoxContent container Edge Cases for Uncovered Lines Should handle getLineType with LINE channel and empty templateData 1`] = `<SlideBoxContent__CreativesWrapper />`;
483
-
484
3
  exports[`Test SlideBoxContent container Email component isTestAndPreviewMode IIFE Should handle isTestAndPreviewMode IIFE in Email edit mode with ID 1`] = `
485
4
  <SlideBoxContent__CreativesWrapper>
486
5
  <ForwardRef
@@ -683,18 +202,6 @@ exports[`Test SlideBoxContent container Email component isTestAndPreviewMode IIF
683
202
  </SlideBoxContent__CreativesWrapper>
684
203
  `;
685
204
 
686
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobilePushNew for loyalty module in full mode (create) 1`] = `<SlideBoxContent__CreativesWrapper />`;
687
-
688
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobilePushNew for loyalty module in full mode (edit) 1`] = `<SlideBoxContent__CreativesWrapper />`;
689
-
690
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobilePushNew for non-loyalty module in library mode (create) 1`] = `<SlideBoxContent__CreativesWrapper />`;
691
-
692
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobilePushNew for non-loyalty module in library mode (edit) 1`] = `<SlideBoxContent__CreativesWrapper />`;
693
-
694
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobilepushWrapper for loyalty module in library mode (create) 1`] = `<SlideBoxContent__CreativesWrapper />`;
695
-
696
- exports[`Test SlideBoxContent container Mobile Push with Loyalty Module Should render MobliPushEdit for loyalty module in library mode (edit) 1`] = `<SlideBoxContent__CreativesWrapper />`;
697
-
698
205
  exports[`Test SlideBoxContent container Should handle isTestAndPreviewMode IIFE implementation correctly 1`] = `
699
206
  <SlideBoxContent__CreativesWrapper>
700
207
  <ForwardRef
@@ -207,9 +207,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
207
207
  {
208
208
  formData: newFormData,
209
209
  tabCount,
210
- isSchemaChanged:
211
- compareValue?.toLowerCase() === EXTERNAL_LINK_LOWERCASE ||
212
- !this.state?.isSchemaChanged,
213
210
  },
214
211
  () => {
215
212
  if (isFullMode && showTemplateName) {
@@ -220,6 +217,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
220
217
  }
221
218
  }
222
219
  );
220
+ this.setState({isSchemaChanged:
221
+ compareValue?.toLowerCase() === EXTERNAL_LINK_LOWERCASE ||
222
+ !this.state?.isSchemaChanged});
223
223
  };
224
224
 
225
225
  onTagSelect = (data, currentTab, srcComp) => {
@@ -20,7 +20,6 @@ import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
20
20
  import CapSelect from "@capillarytech/cap-ui-library/CapSelect";
21
21
  import CapInput from "@capillarytech/cap-ui-library/CapInput";
22
22
  import CapError from "@capillarytech/cap-ui-library/CapError";
23
- import CapTooltip from "@capillarytech/cap-ui-library/CapTooltip";
24
23
  import CapImageUpload from "../../../v2Components/CapImageUpload";
25
24
  import CapVideoUpload from "../../../v2Components/CapVideoUpload";
26
25
  import {
@@ -601,19 +600,13 @@ const MediaUploaders = ({
601
600
  <FormattedMessage {...messages.optionalText} />
602
601
  </CapLabel>
603
602
  </CapRow>
604
- <CapTooltip
605
- title={<FormattedMessage {...messages.carouselActionDisabledMessage} />}
606
- placement="topLeft"
603
+ <CapCheckbox
604
+ checked={button.actionOnClick}
605
+ onChange={(e) => handleCarouselActionOnClickChange(cardIndex, e.target.checked)}
606
+ className="action-on-click-checkbox"
607
607
  >
608
- <CapCheckbox
609
- checked={button.actionOnClick}
610
- onChange={(e) => handleCarouselActionOnClickChange(cardIndex, e.target.checked)}
611
- className="action-on-click-checkbox"
612
- disabled={true}
613
- >
614
- <FormattedMessage {...messages.actionOnClickBody} />
615
- </CapCheckbox>
616
- </CapTooltip>
608
+ <FormattedMessage {...messages.actionOnClickBody} />
609
+ </CapCheckbox>
617
610
  <CapRow>
618
611
  <CapLabel className="action-description">
619
612
  <FormattedMessage {...messages.actionDescription} />
@@ -1132,7 +1132,7 @@ describe('MediaUploaders', () => {
1132
1132
  });
1133
1133
 
1134
1134
  describe('Carousel action link handlers', () => {
1135
- it('should render carousel action on click checkbox as disabled with tooltip', () => {
1135
+ it('should handle carousel action on click change', () => {
1136
1136
  const onCarouselDataChange = jest.fn();
1137
1137
  renderComponent({
1138
1138
  mediaType: 'CAROUSEL',
@@ -1151,10 +1151,22 @@ describe('MediaUploaders', () => {
1151
1151
  onCarouselDataChange,
1152
1152
  });
1153
1153
 
1154
- // Verify checkbox is disabled
1154
+ // Find checkbox by class name since it renders with cap-checkbox-v2
1155
1155
  const checkbox = document.querySelector('.cap-checkbox-v2 input[type="checkbox"]');
1156
1156
  if (checkbox) {
1157
- expect(checkbox).toBeDisabled();
1157
+ fireEvent.click(checkbox);
1158
+ expect(onCarouselDataChange).toHaveBeenCalledWith(
1159
+ ANDROID,
1160
+ expect.arrayContaining([
1161
+ expect.objectContaining({
1162
+ buttons: expect.arrayContaining([
1163
+ expect.objectContaining({
1164
+ actionOnClick: true,
1165
+ })
1166
+ ])
1167
+ })
1168
+ ])
1169
+ );
1158
1170
  } else {
1159
1171
  // If checkbox not found, just verify component renders
1160
1172
  expect(screen.getByTestId('cap-image-upload')).toBeInTheDocument();