@commercetools-frontend/fullstory 2.4.0 → 2.4.2

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.
@@ -71,12 +71,22 @@ function useTrackingEffect() {
71
71
  project = _useApplicationContex.project,
72
72
  user = _useApplicationContex.user,
73
73
  cloudEnvironment = _useApplicationContex.cloudEnvironment;
74
+ const getUserRole = () => {
75
+ switch (project === null || project === void 0 ? void 0 : project.isUserAdminOfCurrentProject) {
76
+ case true:
77
+ return 'admin';
78
+ case false:
79
+ return 'regular';
80
+ default:
81
+ return 'unknown';
82
+ }
83
+ };
74
84
  react.useEffect(() => {
75
85
  // It's not safe to invoke any FullStory SDK methods.
76
86
  if (!browser.isInitialized() || disable) {
77
87
  return;
78
88
  }
79
- if (!user?.id) {
89
+ if (!(user !== null && user !== void 0 && user.id)) {
80
90
  browser.FullStory('setIdentity', {
81
91
  anonymous: true
82
92
  });
@@ -85,13 +95,14 @@ function useTrackingEffect() {
85
95
  uid: user.id,
86
96
  properties: _objectSpread$1({
87
97
  environment: cloudEnvironment,
88
- projectKey: project?.key,
98
+ projectKey: project === null || project === void 0 ? void 0 : project.key,
89
99
  userBusinessRole: user.businessRole,
90
- userLocale: user.locale
100
+ userLocale: user.locale,
101
+ userRole: getUserRole()
91
102
  }, additionalUserVars)
92
103
  });
93
104
  }
94
- }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
105
+ }, [disable, additionalUserVars, cloudEnvironment, project === null || project === void 0 ? void 0 : project.key, user === null || user === void 0 ? void 0 : user.businessRole, user === null || user === void 0 ? void 0 : user.id, user === null || user === void 0 ? void 0 : user.locale]);
95
106
  return null;
96
107
  }
97
108
 
@@ -71,12 +71,22 @@ function useTrackingEffect() {
71
71
  project = _useApplicationContex.project,
72
72
  user = _useApplicationContex.user,
73
73
  cloudEnvironment = _useApplicationContex.cloudEnvironment;
74
+ const getUserRole = () => {
75
+ switch (project === null || project === void 0 ? void 0 : project.isUserAdminOfCurrentProject) {
76
+ case true:
77
+ return 'admin';
78
+ case false:
79
+ return 'regular';
80
+ default:
81
+ return 'unknown';
82
+ }
83
+ };
74
84
  react.useEffect(() => {
75
85
  // It's not safe to invoke any FullStory SDK methods.
76
86
  if (!browser.isInitialized() || disable) {
77
87
  return;
78
88
  }
79
- if (!user?.id) {
89
+ if (!(user !== null && user !== void 0 && user.id)) {
80
90
  browser.FullStory('setIdentity', {
81
91
  anonymous: true
82
92
  });
@@ -85,13 +95,14 @@ function useTrackingEffect() {
85
95
  uid: user.id,
86
96
  properties: _objectSpread$1({
87
97
  environment: cloudEnvironment,
88
- projectKey: project?.key,
98
+ projectKey: project === null || project === void 0 ? void 0 : project.key,
89
99
  userBusinessRole: user.businessRole,
90
- userLocale: user.locale
100
+ userLocale: user.locale,
101
+ userRole: getUserRole()
91
102
  }, additionalUserVars)
92
103
  });
93
104
  }
94
- }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
105
+ }, [disable, additionalUserVars, cloudEnvironment, project === null || project === void 0 ? void 0 : project.key, user === null || user === void 0 ? void 0 : user.businessRole, user === null || user === void 0 ? void 0 : user.id, user === null || user === void 0 ? void 0 : user.locale]);
95
106
  return null;
96
107
  }
97
108
 
@@ -56,12 +56,22 @@ function useTrackingEffect() {
56
56
  project = _useApplicationContex.project,
57
57
  user = _useApplicationContex.user,
58
58
  cloudEnvironment = _useApplicationContex.cloudEnvironment;
59
+ const getUserRole = () => {
60
+ switch (project === null || project === void 0 ? void 0 : project.isUserAdminOfCurrentProject) {
61
+ case true:
62
+ return 'admin';
63
+ case false:
64
+ return 'regular';
65
+ default:
66
+ return 'unknown';
67
+ }
68
+ };
59
69
  useEffect(() => {
60
70
  // It's not safe to invoke any FullStory SDK methods.
61
71
  if (!isInitialized() || disable) {
62
72
  return;
63
73
  }
64
- if (!user?.id) {
74
+ if (!(user !== null && user !== void 0 && user.id)) {
65
75
  FullStory('setIdentity', {
66
76
  anonymous: true
67
77
  });
@@ -70,13 +80,14 @@ function useTrackingEffect() {
70
80
  uid: user.id,
71
81
  properties: _objectSpread$1({
72
82
  environment: cloudEnvironment,
73
- projectKey: project?.key,
83
+ projectKey: project === null || project === void 0 ? void 0 : project.key,
74
84
  userBusinessRole: user.businessRole,
75
- userLocale: user.locale
85
+ userLocale: user.locale,
86
+ userRole: getUserRole()
76
87
  }, additionalUserVars)
77
88
  });
78
89
  }
79
- }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
90
+ }, [disable, additionalUserVars, cloudEnvironment, project === null || project === void 0 ? void 0 : project.key, user === null || user === void 0 ? void 0 : user.businessRole, user === null || user === void 0 ? void 0 : user.id, user === null || user === void 0 ? void 0 : user.locale]);
80
91
  return null;
81
92
  }
82
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/fullstory",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "A package integrating with the FullStory SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/commercetools-frontend-fullstory.cjs.js",
@@ -16,32 +16,32 @@
16
16
  "@babel/core": "^7.22.11",
17
17
  "@babel/runtime": "^7.21.0",
18
18
  "@babel/runtime-corejs3": "^7.21.0",
19
- "@fullstory/browser": "2.0.3"
19
+ "@fullstory/browser": "2.0.4"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@apollo/client": "3.7.10",
23
- "@commercetools-frontend/application-shell": "22.17.1",
24
- "@commercetools-frontend/application-shell-connectors": "22.17.1",
25
- "@commercetools-frontend/constants": "22.17.1",
23
+ "@commercetools-frontend/application-shell": "22.27.0",
24
+ "@commercetools-frontend/application-shell-connectors": "22.27.0",
25
+ "@commercetools-frontend/constants": "22.27.0",
26
26
  "@emotion/react": "^11.11.1",
27
27
  "@testing-library/react": "12.1.5",
28
28
  "@testing-library/react-hooks": "8.0.1",
29
29
  "@types/jest": "^29.5.2",
30
- "@types/node": "20.11.5",
31
- "@types/react": "17.0.75",
30
+ "@types/node": "20.12.12",
31
+ "@types/react": "17.0.80",
32
32
  "@types/testing-library__jest-dom": "^5.14.6",
33
33
  "graphql": "16.8.1",
34
34
  "react": "17.0.2",
35
35
  "react-dom": "17.0.2",
36
- "react-intl": "6.6.2",
36
+ "react-intl": "6.6.8",
37
37
  "react-redux": "7.2.9",
38
38
  "react-router-dom": "5.3.4",
39
39
  "redux": "4.2.1",
40
40
  "typescript": "5.2.2"
41
41
  },
42
42
  "peerDependencies": {
43
- "@commercetools-frontend/application-shell-connectors": "22.x",
44
- "@commercetools-frontend/constants": "22.x",
43
+ "@commercetools-frontend/application-shell-connectors": "22.27.0",
44
+ "@commercetools-frontend/constants": "22.27.0",
45
45
  "@emotion/react": "11.x",
46
46
  "react": "17.x",
47
47
  "react-intl": "6.x"