@capillarytech/creatives-library 7.16.9-alpha.1 → 7.16.9

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 (35) 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 +0 -22
  7. package/utils/tests/v2Common.test.js +2 -44
  8. package/v2Components/CapDocumentUpload/index.js +6 -3
  9. package/v2Components/CapImageUpload/index.js +5 -2
  10. package/v2Components/CapVideoUpload/index.js +6 -2
  11. package/v2Components/FormBuilder/index.js +3 -5
  12. package/v2Containers/Assets/Gallery/index.js +3 -28
  13. package/v2Containers/Assets/Gallery/messages.js +1 -1
  14. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +4 -4
  15. package/v2Containers/Email/index.js +2 -4
  16. package/v2Containers/Email/messages.js +1 -1
  17. package/v2Containers/LanguageProvider/index.js +0 -3
  18. package/v2Containers/Line/Container/Image/index.js +5 -2
  19. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +12 -3397
  20. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
  21. package/v2Containers/Line/Container/ImageMap/index.js +2 -4
  22. package/v2Containers/Line/Container/Video/index.js +7 -4
  23. package/v2Containers/Line/Container/Video/messages.js +0 -9
  24. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +68 -68
  25. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +72 -72
  26. package/v2Containers/MobilePush/Create/index.js +3 -21
  27. package/v2Containers/MobilePush/Create/messages.js +0 -48
  28. package/v2Containers/MobilePush/Edit/index.js +1 -19
  29. package/v2Containers/MobilePush/Edit/messages.js +0 -16
  30. package/v2Containers/MobilePush/commonMethods.js +2 -2
  31. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +188 -188
  32. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +16 -16
  33. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +32 -32
  34. package/v2Containers/Viber/index.js +5 -2
  35. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +284 -284
@@ -76,7 +76,7 @@ export default defineMessages({
76
76
  },
77
77
  assetUploadFailed: {
78
78
  id: 'creatives.containers.Assets.Gallery.assetUploadFailed',
79
- defaultMessage: 'Image upload failed',
79
+ defaultMessage: 'Image uploaded failed',
80
80
  },
81
81
  assetDeleteSuccess: {
82
82
  id: 'creatives.containers.Assets.Gallery.assetDeleteSuccess',
@@ -323,7 +323,7 @@ exports[`<Cap /> should render its children 1`] = `
323
323
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
324
324
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
325
325
  "creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
326
- "creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
326
+ "creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
327
327
  "creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
328
328
  "creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
329
329
  "creatives.containers.Assets.Gallery.delete": "Delete",
@@ -470,7 +470,7 @@ exports[`<Cap /> should render its children 1`] = `
470
470
  "creatives.containers.Email.Tags": "Tags",
471
471
  "creatives.containers.Email.alphabetically": "Alphabetically",
472
472
  "creatives.containers.Email.alphabeticallyOption": "Alphabetically",
473
- "creatives.containers.Email.assetUploadFailed": "Image upload failed",
473
+ "creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
474
474
  "creatives.containers.Email.blankTemplate": "Blank template",
475
475
  "creatives.containers.Email.cancel": "Cancel",
476
476
  "creatives.containers.Email.createHeading": "Create email template",
@@ -875,7 +875,7 @@ exports[`<Cap /> should render its children 1`] = `
875
875
  "creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
876
876
  "creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
877
877
  "creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
878
- "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
878
+ "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
879
879
  "creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
880
880
  "creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
881
881
  "creatives.containersV2.Assets.Gallery.delete": "Delete",
@@ -1133,7 +1133,7 @@ exports[`<Cap /> should render its children 1`] = `
1133
1133
  "creatives.containersV2.Email.alertMessage": "Alert",
1134
1134
  "creatives.containersV2.Email.alphabetically": "Alphabetically",
1135
1135
  "creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
1136
- "creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
1136
+ "creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
1137
1137
  "creatives.containersV2.Email.blankTemplate": "Blank template",
1138
1138
  "creatives.containersV2.Email.cancel": "Cancel",
1139
1139
  "creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
@@ -228,7 +228,7 @@ export default defineMessages({
228
228
  },
229
229
  "assetUploadFailed": {
230
230
  id: 'creatives.containers.Email.assetUploadFailed',
231
- defaultMessage: 'Image upload failed',
231
+ defaultMessage: 'Image uploaded failed',
232
232
  },
233
233
  "goBackConfirmation": {
234
234
  id: 'creatives.containers.Email.Create.goBackConfirmation',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.16.9-alpha.1",
4
+ "version": "7.16.9",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -281,7 +281,7 @@
281
281
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
282
282
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
283
283
  "creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
284
- "creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
284
+ "creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
285
285
  "creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
286
286
  "creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
287
287
  "creatives.containers.Assets.Gallery.delete": "Delete",
@@ -428,7 +428,7 @@
428
428
  "creatives.containers.Email.Tags": "Tags",
429
429
  "creatives.containers.Email.alphabetically": "Alphabetically",
430
430
  "creatives.containers.Email.alphabeticallyOption": "Alphabetically",
431
- "creatives.containers.Email.assetUploadFailed": "Image upload failed",
431
+ "creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
432
432
  "creatives.containers.Email.blankTemplate": "Blank template",
433
433
  "creatives.containers.Email.cancel": "Cancel",
434
434
  "creatives.containers.Email.createHeading": "Create email template",
@@ -833,7 +833,7 @@
833
833
  "creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
834
834
  "creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
835
835
  "creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
836
- "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
836
+ "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
837
837
  "creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
838
838
  "creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
839
839
  "creatives.containersV2.Assets.Gallery.delete": "Delete",
@@ -1091,7 +1091,7 @@
1091
1091
  "creatives.containersV2.Email.alertMessage": "Alert",
1092
1092
  "creatives.containersV2.Email.alphabetically": "Alphabetically",
1093
1093
  "creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
1094
- "creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
1094
+ "creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
1095
1095
  "creatives.containersV2.Email.blankTemplate": "Blank template",
1096
1096
  "creatives.containersV2.Email.cancel": "Cancel",
1097
1097
  "creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
package/utils/common.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import _ from 'lodash';
2
2
  import { Auth } from '@capillarytech/cap-ui-utils';
3
-
4
3
  import {
5
4
  STORE2DOOR_PLUS_ENABLED,
6
5
  TRAI_DLT,
@@ -263,24 +262,3 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
263
262
  const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
264
263
  return isTraiDltFeature;
265
264
  };
266
-
267
- /* function used to encode filename and check file name
268
- pattern based on the given regex */
269
- export function createNewFile(Files, allowedExtensionsRegex) {
270
- const fileObject = Files[0];
271
- let incorrectFile = false;
272
-
273
- if (allowedExtensionsRegex && !allowedExtensionsRegex.test(fileObject?.name)) {
274
- incorrectFile = true;
275
- return [fileObject, incorrectFile];
276
- }
277
- const encodedName = fileObject?.name.replace(/(.+?)(\.[^.]*$|$)/, (match, name, extension) => {
278
- const filename = encodeURIComponent(name);
279
- return filename + extension;
280
- });
281
- const { type, ...rest } = fileObject;
282
- const newFile = new File([fileObject], encodedName, { type, ...rest });
283
- newFile.uid = fileObject.uid;
284
- return [newFile, incorrectFile];
285
- }
286
-
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { getObjFromQueryParams} from '../v2common';
3
- import {createNewFile} from '../common';
2
+ import { getObjFromQueryParams } from '../v2common';
3
+
4
4
  describe('Test v2common container', () => {
5
5
  it('test getObjFromQueryParams', () => {
6
6
  expect(getObjFromQueryParams("?channel=WHATSAPP&mode=CREATE")).toEqual({
@@ -9,45 +9,3 @@ describe('Test v2common container', () => {
9
9
  });
10
10
  });
11
11
  });
12
-
13
- describe('Test createNewFile function', () => {
14
- const allowedExtensionsRegex = /(\.png|\.jpg)$/i;
15
- const tempFile = [{
16
- name: '#image.png',
17
- type: 'image/jpeg',
18
- size: 2048,
19
- uid: 'def456',
20
- }];
21
- const expectedFile = new File([tempFile], '%23image.png', {
22
- type: 'image/jpeg',
23
- size: 2048,
24
- uid: 'def456',
25
- });
26
- it('should create a new file with encoded name', () => {
27
- const [resultFile, incorrectFile] = createNewFile(tempFile, allowedExtensionsRegex);
28
- expect(resultFile).toMatchObject(expectedFile);
29
- expect(incorrectFile).toBe(false);
30
- });
31
- it('should return incorrect file true', () => {
32
- const tempFileWrong = [{
33
- name: '#song.mov',
34
- type: 'video/mov',
35
- size: 2048,
36
- uid: 'def4516',
37
- }];
38
-
39
- const expectedFileWrong = new File([tempFileWrong], '%23song.mov', {
40
- type: 'video/mov',
41
- size: 2048,
42
- uid: 'def4516',
43
- });
44
- const [resultFile, incorrectFile] = createNewFile(tempFileWrong, allowedExtensionsRegex);
45
- expect(resultFile).toMatchObject(expectedFileWrong);
46
- expect(incorrectFile).toBe(true);
47
- });
48
- it('should return only the updated file as the validation is handled differently for some channels', () => {
49
- const resultFile = createNewFile(tempFile)[0];
50
- expect(resultFile).toMatchObject(expectedFile);
51
- });
52
- });
53
-
@@ -13,7 +13,6 @@ import isEmpty from 'lodash/isEmpty';
13
13
  import './index.scss';
14
14
  import messages from './messages';
15
15
  import { convertPdfToImages } from '../WhatsappDocumentPreview/index';
16
- import { createNewFile } from '../../utils/common';
17
16
 
18
17
  function CapDocumentUpload(props) {
19
18
  const {
@@ -40,7 +39,7 @@ function CapDocumentUpload(props) {
40
39
  const { secure_file_path = '', karixFileHandle = '', name = '', file_size = ''} = get(docDataObj, 'metaInfo', {});
41
40
  setWhatsappDocParams({
42
41
  ...whatsappDocParams,
43
- whatsappDocName: `${decodeURIComponent(name.slice(0, -13))}.pdf`,
42
+ whatsappDocName: `${name.slice(0, -13)}.pdf`,
44
43
  //sliced to show the actual name of the pdf to the user and in the preview, this remove suffix appended to the name on creatives node side
45
44
  whatsappDocSize: file_size,
46
45
  });
@@ -70,7 +69,11 @@ function CapDocumentUpload(props) {
70
69
  e.preventDefault();
71
70
  }
72
71
  const _URL = window.URL || window.webkitURL;
73
- const [file, incorrectFile] = createNewFile(files, allowedExtensionsRegex);
72
+ let incorrectFile = false;
73
+ const file = files[0];
74
+ if (!allowedExtensionsRegex.test(file.name)) {
75
+ incorrectFile = true;
76
+ }
74
77
  const doc = new FileReader();
75
78
  doc.src = _URL.createObjectURL(file);
76
79
  const fileParams = {
@@ -23,7 +23,6 @@ import Gallery from '../../v2Containers/Assets/Gallery';
23
23
  import { FACEBOOK, RCS, WHATSAPP } from "../../v2Containers/CreativesContainer/constants";
24
24
 
25
25
  import messages from './messages';
26
- import { createNewFile } from '../../utils/common';
27
26
  function CapImageUpload(props) {
28
27
  const {
29
28
  intl,
@@ -79,7 +78,11 @@ function CapImageUpload(props) {
79
78
  e.preventDefault();
80
79
  }
81
80
  const _URL = window.URL || window.webkitURL;
82
- const [file, incorrectFile] = createNewFile(files, allowedExtensionsRegex);
81
+ let incorrectFile = false;
82
+ const file = files[0];
83
+ if (!allowedExtensionsRegex.test(file.name)) {
84
+ incorrectFile = true;
85
+ }
83
86
  const img = new Image();
84
87
  img.src = _URL.createObjectURL(file);
85
88
  img.onload = () => {
@@ -18,7 +18,7 @@ import {
18
18
  CapSpin,
19
19
  } from '@capillarytech/cap-ui-library';
20
20
  import messages from './messages';
21
- import {bytes2Size, createNewFile} from '../../utils/common';
21
+ import {bytes2Size} from '../../utils/common';
22
22
  import { WHATSAPP } from './constants';
23
23
  import './index.scss';
24
24
 
@@ -64,7 +64,11 @@ function CapVideoUpload(props) {
64
64
  e.preventDefault();
65
65
  }
66
66
  const _URL = window.URL || window.webkitURL;
67
- const [file, incorrectFile] = createNewFile(files, allowedExtensionsRegex);
67
+ let incorrectFile = false;
68
+ const file = files[0];
69
+ if (!allowedExtensionsRegex.test(file.name)) {
70
+ incorrectFile = true;
71
+ }
68
72
  const video = new FileReader();
69
73
  video.src = _URL.createObjectURL(file);
70
74
  const fileParams = {
@@ -30,7 +30,6 @@ import { SMS, LINE } from '../../v2Containers/CreativesContainer/constants';
30
30
  import { validateIfTagClosed } from '../../utils/tagValidations';
31
31
  import globalMessages from '../../v2Containers/Cap/messages';
32
32
  import { convert } from 'html-to-text';
33
- import { createNewFile } from '../../utils/common';
34
33
  const TabPane = Tabs.TabPane;
35
34
  const {Column} = Table;
36
35
  const {TextArea} = CapInput;
@@ -2162,14 +2161,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2162
2161
  e.preventDefault();
2163
2162
  }
2164
2163
  const _URL = window.URL || window.webkitURL;
2165
- const tempFile = files[0];
2164
+ const file = files[0];
2166
2165
  if (val.supportedExtensions) {
2167
2166
  const allowedExtensions = /(\.bmp|\.jpeg|\.png|\.gif|\.jpg)$/i;
2168
- if (!allowedExtensions.exec(tempFile?.name)) {
2169
- this.callChildEvent({tempFile, type: 'wrong file'}, val, val.submitAction);
2167
+ if (!allowedExtensions.exec(file.name)) {
2168
+ this.callChildEvent({file, type: 'wrong file'}, val, val.submitAction);
2170
2169
  }
2171
2170
  }
2172
- const file = createNewFile(files)[0];
2173
2171
  const img = new Image();
2174
2172
  img.src = _URL.createObjectURL(file);
2175
2173
  img.onload = () => {
@@ -13,10 +13,8 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
13
13
  import { createStructuredSelector } from 'reselect';
14
14
  import moment from "moment";
15
15
  import _ from "lodash";
16
- import Bugsnag from '@bugsnag/js';
17
16
  import { CapHeading, CapHeader, CapInput, CapButton, CapSpin, CapIcon, CapDropdown, CapMenu, CapCustomCard, CapSlideBox, CapLabel, CapIllustration} from '@capillarytech/cap-ui-library';
18
17
  import { Popover } from 'antd';
19
- import { createNewFile } from '../../../utils/common';
20
18
  import makeSelectGallery from './selectors';
21
19
  import messages from './messages';
22
20
  import * as actions from './actions';
@@ -233,18 +231,16 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
233
231
  const _URL = window.URL || window.webkitURL;
234
232
  for (const file in files) {
235
233
  if (files.hasOwnProperty(file)) {
236
- const tempFile = files[file];
237
- const [uploadFile] = createNewFile([tempFile]);
238
234
  const img = new Image();
239
235
  const that = this;
240
- img.src = _URL.createObjectURL(uploadFile);
236
+ img.src = _URL.createObjectURL(files[file]);
241
237
  img.onload = function () {
242
238
  const fileParams = {
243
239
  width: this.width,
244
240
  height: this.height,
245
241
  isGeneratePreview: true,
246
242
  };
247
- that.props.actions.uploadAsset(uploadFile, 'image', fileParams);
243
+ that.props.actions.uploadAsset(files[file], 'image', fileParams);
248
244
  };
249
245
  }
250
246
  }
@@ -311,10 +307,6 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
311
307
  const currentChannel = 'gallery';
312
308
  const { searchLoader, searchText } = this.state;
313
309
  const cardDataList = templates?.length ? _.map(templates, (template) => {
314
- const nameParts = template.name.split('.');
315
- if (encodeURIComponent(decodeURIComponent(nameParts[0])) === nameParts[0]) {
316
- template.name = `${decodeURIComponent(nameParts[0])}.${nameParts[1]}`;
317
- }
318
310
  const templateData =
319
311
  {
320
312
  key: `${currentChannel}-card-${template.name}`,
@@ -398,26 +390,9 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
398
390
  const by = commonUtil.getUserNameById(parseInt(this.state.selectedAsset.updatedBy, 10), commonUtil.getMergedUserList(this.props.Gallery.userList));
399
391
  const width = this.state.selectedAsset.metaInfo.width;
400
392
  const height = this.state.selectedAsset.metaInfo.height;
401
- /*
402
- splitting the name on . and verifying
403
- whether the filename is already encoded or not,
404
- if yes decoding it ,to be shown on ui
405
- */
406
- const nameParts = this.state.selectedAsset.name.split('.');
407
- let updatedTitle = this.state.selectedAsset.name;
408
- try {
409
- if (encodeURIComponent(decodeURIComponent(nameParts[0])) === nameParts[0]) {
410
- updatedTitle = `${decodeURIComponent(nameParts[0])}.${nameParts[1]}`;
411
- }
412
- } catch (error) {
413
- Bugsnag.leaveBreadcrumb("Error decoding the string:", error);
414
- Bugsnag.notify(error, (event) => {
415
- event.severity = "error";
416
- });
417
- }
418
393
  const slideboxHeader = (<div>
419
394
  <CapHeader
420
- title={updatedTitle}
395
+ title={this.state.selectedAsset.name}
421
396
  description={<FormattedMessage
422
397
  {...messages.lastUpdated}
423
398
  values={{on, by }}
@@ -80,7 +80,7 @@ export default defineMessages({
80
80
  },
81
81
  assetUploadFailed: {
82
82
  id: 'creatives.containersV2.Assets.Gallery.assetUploadFailed',
83
- defaultMessage: 'Image upload failed',
83
+ defaultMessage: 'Image uploaded failed',
84
84
  },
85
85
  assetDeleteSuccess: {
86
86
  id: 'creatives.containersV2.Assets.Gallery.assetDeleteSuccess',
@@ -356,7 +356,7 @@ exports[`<Cap /> should render correct component 1`] = `
356
356
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
357
357
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
358
358
  "creatives.containers.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
359
- "creatives.containers.Assets.Gallery.assetUploadFailed": "Image upload failed",
359
+ "creatives.containers.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
360
360
  "creatives.containers.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
361
361
  "creatives.containers.Assets.Gallery.backToGallery": "Back to image gallery",
362
362
  "creatives.containers.Assets.Gallery.delete": "Delete",
@@ -503,7 +503,7 @@ exports[`<Cap /> should render correct component 1`] = `
503
503
  "creatives.containers.Email.Tags": "Tags",
504
504
  "creatives.containers.Email.alphabetically": "Alphabetically",
505
505
  "creatives.containers.Email.alphabeticallyOption": "Alphabetically",
506
- "creatives.containers.Email.assetUploadFailed": "Image upload failed",
506
+ "creatives.containers.Email.assetUploadFailed": "Image uploaded failed",
507
507
  "creatives.containers.Email.blankTemplate": "Blank template",
508
508
  "creatives.containers.Email.cancel": "Cancel",
509
509
  "creatives.containers.Email.createHeading": "Create email template",
@@ -908,7 +908,7 @@ exports[`<Cap /> should render correct component 1`] = `
908
908
  "creatives.containersV2.Assets.Gallery.alphabetically": "Alphabetically",
909
909
  "creatives.containersV2.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
910
910
  "creatives.containersV2.Assets.Gallery.assetDeleteSuccess": "Image deleted successfully.",
911
- "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image upload failed",
911
+ "creatives.containersV2.Assets.Gallery.assetUploadFailed": "Image uploaded failed",
912
912
  "creatives.containersV2.Assets.Gallery.assetUploadSuccess": "Image uploaded successfully",
913
913
  "creatives.containersV2.Assets.Gallery.backToGallery": "Back to image gallery",
914
914
  "creatives.containersV2.Assets.Gallery.delete": "Delete",
@@ -1166,7 +1166,7 @@ exports[`<Cap /> should render correct component 1`] = `
1166
1166
  "creatives.containersV2.Email.alertMessage": "Alert",
1167
1167
  "creatives.containersV2.Email.alphabetically": "Alphabetically",
1168
1168
  "creatives.containersV2.Email.alphabeticallyOption": "Alphabetically",
1169
- "creatives.containersV2.Email.assetUploadFailed": "Image upload failed",
1169
+ "creatives.containersV2.Email.assetUploadFailed": "Image uploaded failed",
1170
1170
  "creatives.containersV2.Email.blankTemplate": "Blank template",
1171
1171
  "creatives.containersV2.Email.cancel": "Cancel",
1172
1172
  "creatives.containersV2.Email.copyPrimaryLanguage": "Copy Primary Language",
@@ -36,7 +36,6 @@ import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
36
36
  import { gtmPush } from '../../utils/gtmTrackers';
37
37
  const {CapCustomCardList} = CapCustomCard;
38
38
  import {transformEmailTemplates, storeS3FileSizeDetails, CREATIVES_S3_ASSET_FILESIZES} from '../../utils/cdnTransformation';
39
- import { createNewFile } from '../../utils/common';
40
39
 
41
40
  export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
42
41
  constructor(props) {
@@ -1151,15 +1150,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1151
1150
  uploadImages(e, {files}) {
1152
1151
  e.preventDefault();
1153
1152
  const _URL = window.URL || window.webkitURL;
1154
- const tempFile = files[0];
1155
- const fileSize = tempFile && (tempFile.size / ( 1024 * 1024 ));
1153
+ const file = files[0];
1154
+ const fileSize = file && (file.size / ( 1024 * 1024 ));
1156
1155
  if (fileSize > 5) {
1157
1156
  const message = this.props.intl.formatMessage(messages.uploadSizeError);
1158
1157
  CapNotification.error({key: 'uploadImageIssue', message});
1159
1158
  document.getElementById("fileName").value = "";
1160
1159
  return;
1161
1160
  }
1162
- const [file] = createNewFile(files);
1163
1161
  const img = new Image();
1164
1162
  const that = this;
1165
1163
  img.src = _URL.createObjectURL(file);
@@ -232,7 +232,7 @@ export default defineMessages({
232
232
  },
233
233
  "assetUploadFailed": {
234
234
  id: 'creatives.containersV2.Email.assetUploadFailed',
235
- defaultMessage: 'Image upload failed',
235
+ defaultMessage: 'Image uploaded failed',
236
236
  },
237
237
  "noImgInGallery": {
238
238
  id: 'creatives.containersV2.Email.noImgInGallery',
@@ -12,7 +12,6 @@ import React from 'react';
12
12
  import { ConfigProvider } from 'antd';
13
13
  import enUS from 'antd/es/locale-provider/en_US';
14
14
  import zhCN from 'antd/es/locale-provider/zh_CN';
15
- import jaJP from 'antd/es/locale-provider/ja_JP';
16
15
  import { connect } from 'react-redux';
17
16
  import { createStructuredSelector } from 'reselect';
18
17
  import { IntlProvider } from 'react-intl';
@@ -38,7 +37,6 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
38
37
  'zh-cn': 'zh',
39
38
  'zh': 'zh',
40
39
  'en-US': 'en-US',
41
- 'ja-JP': 'ja-JP',
42
40
  };
43
41
  return map[locale];
44
42
  };
@@ -59,7 +57,6 @@ export class LanguageProvider extends React.PureComponent { // eslint-disable-li
59
57
  'zh-cn': zhCN,
60
58
  'en-US': enUS,
61
59
  'zh': zhCN,
62
- 'ja-JP': jaJP,
63
60
  };
64
61
  const jLocale = localStorage.getItem('jlocale') || 'en';
65
62
  const file = mappedLocale[jLocale];
@@ -24,7 +24,6 @@ import {
24
24
  LINE_IMG_SIZE,
25
25
  ALLOWED_EXTENSIONS_REGEX,
26
26
  } from './constants';
27
- import { createNewFile } from '../../../../utils/common';
28
27
 
29
28
  export const LineImage = ({
30
29
  className,
@@ -172,7 +171,11 @@ export const LineImage = ({
172
171
  e.preventDefault();
173
172
  }
174
173
  const _URL = window.URL || window.webkitURL;
175
- const [file, incorrectFile] = createNewFile(files, ALLOWED_EXTENSIONS_REGEX);
174
+ let incorrectFile = false;
175
+ const file = files[0];
176
+ if (!ALLOWED_EXTENSIONS_REGEX.test(file.name)) {
177
+ incorrectFile = true;
178
+ }
176
179
  const img = new Image();
177
180
  img.src = _URL.createObjectURL(file);
178
181
  img.onload = () => {