@capillarytech/cap-ui-utils 1.0.12 → 1.2.0

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/GA/index.js CHANGED
@@ -14,7 +14,7 @@ const _initialize = (GAConfigs) => {
14
14
  return;
15
15
  }
16
16
  if(GAConfigs.accessKey) {
17
- ReactGA.initialize(GAConfigs.accessKey,{debug: true,}); //UA-152081629-1
17
+ ReactGA.initialize(GAConfigs.accessKey,{debug: true,});
18
18
  }
19
19
  if(GAConfigs.trackError){
20
20
  //Track Error
@@ -25,6 +25,9 @@ const _initialize = (GAConfigs) => {
25
25
  eventsAfterInitialize();
26
26
  log("Cap GA initialized");
27
27
  }
28
+ const setCustomDimension= value => {
29
+ ReactGA.set(value);
30
+ }
28
31
  const initialize = (GAConfigs) =>{
29
32
  if (isEmpty(GAConfigs)) {
30
33
  warn("Cannot initialize empty object");
@@ -82,5 +85,6 @@ export default{
82
85
  initialize,
83
86
  timeTracker,
84
87
  tracker,
85
- routeTrackerWrapper
88
+ routeTrackerWrapper,
89
+ setCustomDimension
86
90
  }
package/auth/index.js CHANGED
@@ -13,36 +13,30 @@ import authHoc from './authHoc';
13
13
  import hasRole from './hasRole';
14
14
  import isCapUser from './isCapUser';
15
15
 
16
- const KEYS_EXEMPTED_FROM_VALIDATION = ['isCapUser']
17
16
  /**
18
17
  * Function to initialize the capAuth configurations to the document
19
18
  * @param {*} authConfigs
20
19
  */
21
20
  function _initialize(authConfigs) {
22
21
  const capAuth = {};
23
- try {
24
- if (!authConfigs.permissions) {
25
- warn("Cannot initialize auth without permissions");
26
- return;
27
- }
28
- if(authConfigs.permissions) {
29
- capAuth.permissions = Object.freeze(authConfigs.permissions);
30
- }
31
- if(authConfigs.orgFeatures) {
32
- capAuth.orgFeatures = Object.freeze(authConfigs.orgFeatures);
33
- }
34
- if(authConfigs.roles) {
35
- capAuth.roles = Object.freeze(authConfigs.roles);
36
- }
37
- if(authConfigs.isCapUser) {
38
- capAuth.isCapUser = true;
39
- }
40
- log("Cap auth initialized");
41
- window.capAuth = Object.freeze(capAuth);
22
+ if (!authConfigs.permissions) {
23
+ warn("Cannot initialize auth without permissions");
24
+ return;
25
+ }
26
+ if(authConfigs.permissions) {
27
+ capAuth.permissions = Object.freeze(authConfigs.permissions);
28
+ }
29
+ if(authConfigs.orgFeatures) {
30
+ capAuth.orgFeatures = Object.freeze(authConfigs.orgFeatures);
42
31
  }
43
- catch(error) {
44
- warn(error);
32
+ if(authConfigs.roles) {
33
+ capAuth.roles = Object.freeze(authConfigs.roles);
45
34
  }
35
+ if(authConfigs.isCapUser) {
36
+ capAuth.isCapUser = true;
37
+ }
38
+ log("Cap auth initialized");
39
+ window.capAuth = Object.freeze(capAuth);
46
40
  }
47
41
 
48
42
  /**
@@ -59,11 +53,7 @@ function initialize(authConfigs, authOptions) {
59
53
  return;
60
54
  }
61
55
  for ( const config in authConfigs) {
62
- if(KEYS_EXEMPTED_FROM_VALIDATION.includes(config)) {
63
- //Skip validation
64
- continue;
65
- }
66
- if(!["object"].includes(typeof authConfigs[config])) {
56
+ if(typeof authConfigs[config] !== "object") {
67
57
  warn("Config must be an object");
68
58
  return;
69
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.0.12",
3
+ "version": "1.2.0",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {