@capillarytech/creatives-library 7.12.115 → 7.12.117

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.12.115",
4
+ "version": "7.12.117",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -2,8 +2,11 @@ import cloneDeep from "lodash/cloneDeep";
2
2
  import isEmpty from "lodash/isEmpty";
3
3
  import forOwn from "lodash/forOwn";
4
4
  import isNumber from "lodash/isNumber";
5
+ import Bugsnag from '@bugsnag/js';
6
+
5
7
  /* eslint-disable no-unused-expressions */
6
8
  import { parse } from "node-html-parser";
9
+ import { EMAIL } from '../v2Containers/CreativesContainer/constants';
7
10
 
8
11
  // example cdn url
9
12
  // https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=100,height=100,quality=75,format=auto/intouch_creative_assets/005710a7-6412-44fe-a19f-e72456b1.jpg
@@ -232,7 +235,10 @@ export const getCdnUrl = ({
232
235
  break;
233
236
  }
234
237
  } catch (e) {
235
- console.error("some error occured while applying transformation",e);
238
+ Bugsnag.leaveBreadcrumb("some error occured while applying transformation")
239
+ Bugsnag.notify(e, (event) => {
240
+ event.severity = "error";
241
+ });
236
242
  }
237
243
  })
238
244
  }
@@ -240,7 +246,10 @@ export const getCdnUrl = ({
240
246
  return newUrl;
241
247
 
242
248
  }catch(e){
243
- console.error('Some exception occurred in getCdnUrl',e);
249
+ Bugsnag.leaveBreadcrumb("Some exception occurred in getCdnUrl");
250
+ Bugsnag.notify(e, (event) => {
251
+ event.severity = "error";
252
+ });
244
253
  return url;
245
254
  }
246
255
  };
@@ -262,13 +271,16 @@ export const updateImagesInHtml = (htmlContents) => {
262
271
  url: imageSrc,
263
272
  height,
264
273
  width,
265
- channelName: "EMAIL",
274
+ channelName: EMAIL,
266
275
  });
267
276
  element.setAttribute("src", newUrl);
268
277
  });
269
278
  return root.toString();
270
279
  } catch (e) {
271
- console.error("An error occured while updating images in html", e);
280
+ Bugsnag.leaveBreadcrumb("An error occured while updating images in html")
281
+ Bugsnag.notify(e, (event) => {
282
+ event.severity = "error";
283
+ });
272
284
  return copiedHtmlContents; //return received input directly in case an exception is thrown
273
285
  }
274
286
  };
@@ -291,7 +303,12 @@ export const transformEmailTemplates = (contents) => {
291
303
  });
292
304
  return contentsCopy;
293
305
  } catch (e) {
294
- console.error("Some error has occured while transforming email templates", e);
306
+ Bugsnag.leaveBreadcrumb(
307
+ "Some error has occured while transforming email templates"
308
+ );
309
+ Bugsnag.notify(e, (event) => {
310
+ event.severity = "error";
311
+ });
295
312
  return contents; //return received input directly in case an exception is thrown
296
313
  }
297
314
  };
@@ -329,7 +346,10 @@ export function removeAllCdnLocalStorageItems() {
329
346
  removeLocalStorageItem(CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX_KEY);
330
347
  removeLocalStorageItem(CREATIVES_S3_BUCKET_PATH_KEY);
331
348
  }catch(e){
332
- console.error('some error occured while deleting all keys for cdn', e);
349
+ Bugsnag.leaveBreadcrumb("some error occured while deleting all keys for cdn");
350
+ Bugsnag.notify(e, (event) => {
351
+ event.severity = "error";
352
+ });
333
353
  }
334
354
  }
335
355
 
@@ -388,6 +408,9 @@ export function saveCdnConfigs(configsResponse) {
388
408
  removeLocalStorageItem(CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX_KEY);
389
409
  }
390
410
  } catch (e) {
391
- console.error("some error while setting localstorage cdn configs");
411
+ Bugsnag.leaveBreadcrumb("some error while setting localstorage cdn configs");
412
+ Bugsnag.notify(e, (event) => {
413
+ event.severity = "error";
414
+ });
392
415
  }
393
416
  }
@@ -100,7 +100,7 @@ describe("cdnTransformationTests", () => {
100
100
  expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
101
101
  });
102
102
 
103
- it.only("Should replace s3 url with cdn url for email when bucket name is other than intouch_creatives_assets in case of prod. It should remove leading/trailing forward slashes from bucket path", () => {
103
+ it("Should replace s3 url with cdn url for email when bucket name is other than intouch_creatives_assets in case of prod. It should remove leading/trailing forward slashes from bucket path", () => {
104
104
  localStorage.setItem("CREATIVES_S3_BUCKET_PATH", "/fileservice.in/intouch_creative_assets/");
105
105
  const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/fileservice.in/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
106
106
  const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
@@ -93,6 +93,8 @@ function* getCdnTransformationConfig() {
93
93
  if (res?.success && res?.status?.code === 200) {
94
94
  const cdnConfigs = res?.response;
95
95
  saveCdnConfigs(cdnConfigs);
96
+ } else {
97
+ removeAllCdnLocalStorageItems();
96
98
  }
97
99
  } catch (error) {
98
100
  console.log("some error occured during getCdnTransformationConfig call");