@capillarytech/creatives-library 7.16.2 → 7.16.4

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 (29) hide show
  1. package/containers/Assets/Gallery/messages.js +1 -1
  2. package/containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
  3. package/containers/Email/messages.js +1 -1
  4. package/package.json +1 -1
  5. package/translations/en.json +4 -4
  6. package/utils/common.js +22 -0
  7. package/utils/tests/v2Common.test.js +44 -2
  8. package/v2Components/CapDocumentUpload/index.js +3 -6
  9. package/v2Components/CapImageUpload/index.js +2 -5
  10. package/v2Components/CapVideoUpload/index.js +2 -6
  11. package/v2Components/FormBuilder/index.js +5 -3
  12. package/v2Containers/App/constants.js +1 -0
  13. package/v2Containers/Assets/Gallery/index.js +28 -3
  14. package/v2Containers/Assets/Gallery/messages.js +1 -1
  15. package/v2Containers/Cap/messages.js +4 -0
  16. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
  17. package/v2Containers/Email/messages.js +1 -1
  18. package/v2Containers/Line/Container/Image/index.js +2 -5
  19. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3397 -12
  20. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
  21. package/v2Containers/Line/Container/ImageMap/index.js +4 -2
  22. package/v2Containers/Line/Container/Video/index.js +2 -5
  23. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +68 -68
  24. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +72 -72
  25. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +188 -188
  26. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +16 -16
  27. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +32 -32
  28. package/v2Containers/Viber/index.js +6 -5
  29. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +284 -284
@@ -305,7 +305,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
305
305
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
306
306
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
307
307
  "creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
308
- "creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
308
+ "creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
309
309
  "creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
310
310
  "creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
311
311
  "creatives.containers.Assets.Gallery.delete": "Delete",
@@ -452,7 +452,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
452
452
  "creatives.containers.Email.Tags": "Tags",
453
453
  "creatives.containers.Email.alphabetically": "Alphabetically",
454
454
  "creatives.containers.Email.alphabeticallyOption": "Alphabetically",
455
- "creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
455
+ "creatives.containers.Email.assetUploadFailed": "Image upload failed",
456
456
  "creatives.containers.Email.blankTemplate": "Blank template",
457
457
  "creatives.containers.Email.cancel": "Cancel",
458
458
  "creatives.containers.Email.createHeading": "Create email template",
@@ -857,7 +857,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
857
857
  "creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
858
858
  "creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
859
859
  "creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
860
- "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
860
+ "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
861
861
  "creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
862
862
  "creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
863
863
  "creatives.containersV2.Assets.Gallery.delete": "Delete",
@@ -1115,7 +1115,7 @@ exports[`line wrapper test/> should render line component new 1`] = `
1115
1115
  "creatives.containersV2.Email.alertMessage": "Alert",
1116
1116
  "creatives.containersV2.Email.alphabetically": "Alphabetically",
1117
1117
  "creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
1118
- "creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
1118
+ "creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
1119
1119
  "creatives.containersV2.Email.blankTemplate": "Blank template",
1120
1120
  "creatives.containersV2.Email.cancel": "Cancel",
1121
1121
  "creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
@@ -19334,7 +19334,7 @@ exports[`line wrapper test/> should render line component old 1`] = `
19334
19334
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
19335
19335
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
19336
19336
  "creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
19337
- "creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
19337
+ "creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
19338
19338
  "creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
19339
19339
  "creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
19340
19340
  "creatives.containers.Assets.Gallery.delete": "Delete",
@@ -19481,7 +19481,7 @@ exports[`line wrapper test/> should render line component old 1`] = `
19481
19481
  "creatives.containers.Email.Tags": "Tags",
19482
19482
  "creatives.containers.Email.alphabetically": "Alphabetically",
19483
19483
  "creatives.containers.Email.alphabeticallyOption": "Alphabetically",
19484
- "creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
19484
+ "creatives.containers.Email.assetUploadFailed": "Image upload failed",
19485
19485
  "creatives.containers.Email.blankTemplate": "Blank template",
19486
19486
  "creatives.containers.Email.cancel": "Cancel",
19487
19487
  "creatives.containers.Email.createHeading": "Create email template",
@@ -19886,7 +19886,7 @@ exports[`line wrapper test/> should render line component old 1`] = `
19886
19886
  "creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
19887
19887
  "creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
19888
19888
  "creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
19889
- "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
19889
+ "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
19890
19890
  "creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
19891
19891
  "creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
19892
19892
  "creatives.containersV2.Assets.Gallery.delete": "Delete",
@@ -20144,7 +20144,7 @@ exports[`line wrapper test/> should render line component old 1`] = `
20144
20144
  "creatives.containersV2.Email.alertMessage": "Alert",
20145
20145
  "creatives.containersV2.Email.alphabetically": "Alphabetically",
20146
20146
  "creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
20147
- "creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
20147
+ "creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
20148
20148
  "creatives.containersV2.Email.blankTemplate": "Blank template",
20149
20149
  "creatives.containersV2.Email.cancel": "Cancel",
20150
20150
  "creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
@@ -40,6 +40,7 @@ import {
40
40
 
41
41
  const { CapIconAvatar } = CapIcon;
42
42
  import { getCdnUrl } from '../../../../utils/cdnTransformation';
43
+ import { createNewFile } from '../../../../utils/common';
43
44
 
44
45
  export const LineImageMap = ({
45
46
  className,
@@ -233,13 +234,14 @@ export const LineImageMap = ({
233
234
  }
234
235
  const _URL = window.URL || window.webkitURL;
235
236
  let incorrectFile = false;
236
- const file = files[0];
237
+ const tempFile = files[0];
237
238
  if (supportedExtensions) {
238
239
  const allowedExtensions = /(\.bmp|\.jpeg|\.png|\.gif|\.jpg)$/i;
239
- if (!allowedExtensions.exec(file.name)) {
240
+ if (!allowedExtensions.exec(tempFile?.name)) {
240
241
  incorrectFile = true;
241
242
  }
242
243
  }
244
+ const [file] = createNewFile(files);
243
245
  const img = new Image();
244
246
  img.src = _URL.createObjectURL(file);
245
247
  img.onload = () => {
@@ -26,6 +26,7 @@ import {
26
26
  DISPLAY_ACTION_BUTTON,
27
27
  MAX_ACTION_LABEL_LENGTH,
28
28
  } from './constants';
29
+ import { createNewFile } from '../../../../utils/common';
29
30
 
30
31
  export const LineVideo = ({
31
32
  className,
@@ -254,11 +255,7 @@ export const LineVideo = ({
254
255
  e.preventDefault();
255
256
  }
256
257
  const _URL = window.URL || window.webkitURL;
257
- let incorrectFile = false;
258
- const file = files[0];
259
- if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
260
- incorrectFile = true;
261
- }
258
+ const [file, incorrectFile] = createNewFile(files, ALLOWED_EXTENSIONS_REGEX);
262
259
  const video = new FileReader();
263
260
  video.src = _URL.createObjectURL(file);
264
261
  const fileParams = {