@commercetools-frontend/fullstory 2.4.4 → 2.5.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/README.md
CHANGED
|
@@ -143,6 +143,8 @@ import { Marking as FullStoryMarking } from '@commercetools-frontend/fullstory';
|
|
|
143
143
|
</FullStoryMarking.Section>;
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
You can also pass additional props to the `FullStoryMarking.Section` component, such as a `className`. These will be forwarded to the underlying `section` HTML element.
|
|
147
|
+
|
|
146
148
|
Please do not wrap individual elements. If you need to mark individual elements such as a unlabelled input you can use `applyMarker`:
|
|
147
149
|
|
|
148
150
|
```jsx
|
|
@@ -15,6 +15,7 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
15
15
|
var react = require('react');
|
|
16
16
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
17
17
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
18
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
18
19
|
|
|
19
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -66,27 +67,32 @@ function useTrackingEffect() {
|
|
|
66
67
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
67
68
|
user: context.user,
|
|
68
69
|
project: context.project,
|
|
69
|
-
cloudEnvironment: context.environment.cloudEnvironment
|
|
70
|
+
cloudEnvironment: context.environment.cloudEnvironment,
|
|
71
|
+
organizationId: context.project?.ownerId,
|
|
72
|
+
isProductionProject: context.project?.isProductionProject
|
|
70
73
|
})),
|
|
71
74
|
project = _useApplicationContex.project,
|
|
72
75
|
user = _useApplicationContex.user,
|
|
73
|
-
cloudEnvironment = _useApplicationContex.cloudEnvironment
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case true:
|
|
77
|
-
return 'admin';
|
|
78
|
-
case false:
|
|
79
|
-
return 'regular';
|
|
80
|
-
default:
|
|
81
|
-
return 'unknown';
|
|
82
|
-
}
|
|
83
|
-
};
|
|
76
|
+
cloudEnvironment = _useApplicationContex.cloudEnvironment,
|
|
77
|
+
organizationId = _useApplicationContex.organizationId,
|
|
78
|
+
isProductionProject = _useApplicationContex.isProductionProject;
|
|
84
79
|
react.useEffect(() => {
|
|
80
|
+
function getUserRole() {
|
|
81
|
+
switch (project?.isUserAdminOfCurrentProject) {
|
|
82
|
+
case true:
|
|
83
|
+
return 'admin';
|
|
84
|
+
case false:
|
|
85
|
+
return 'regular';
|
|
86
|
+
default:
|
|
87
|
+
return 'unknown';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
// It's not safe to invoke any FullStory SDK methods.
|
|
86
92
|
if (!browser.isInitialized() || disable) {
|
|
87
93
|
return;
|
|
88
94
|
}
|
|
89
|
-
if (!
|
|
95
|
+
if (!user?.id) {
|
|
90
96
|
browser.FullStory('setIdentity', {
|
|
91
97
|
anonymous: true
|
|
92
98
|
});
|
|
@@ -95,14 +101,16 @@ function useTrackingEffect() {
|
|
|
95
101
|
uid: user.id,
|
|
96
102
|
properties: _objectSpread$1({
|
|
97
103
|
environment: cloudEnvironment,
|
|
98
|
-
projectKey: project
|
|
104
|
+
projectKey: project?.key,
|
|
105
|
+
isProductionProject,
|
|
106
|
+
organizationId,
|
|
99
107
|
userBusinessRole: user.businessRole,
|
|
100
108
|
userLocale: user.locale,
|
|
101
109
|
userRole: getUserRole()
|
|
102
110
|
}, additionalUserVars)
|
|
103
111
|
});
|
|
104
112
|
}
|
|
105
|
-
}, [disable, additionalUserVars, cloudEnvironment, project
|
|
113
|
+
}, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale, isProductionProject, organizationId, project?.isUserAdminOfCurrentProject]);
|
|
106
114
|
return null;
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -153,6 +161,7 @@ const Masking = {
|
|
|
153
161
|
Exclude
|
|
154
162
|
};
|
|
155
163
|
|
|
164
|
+
const _excluded = ["children", "name"];
|
|
156
165
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
157
166
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
158
167
|
function applyMarker(name) {
|
|
@@ -160,9 +169,12 @@ function applyMarker(name) {
|
|
|
160
169
|
'data-tracking': name
|
|
161
170
|
};
|
|
162
171
|
}
|
|
163
|
-
function Section(
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
function Section(_ref) {
|
|
173
|
+
let children = _ref.children,
|
|
174
|
+
name = _ref.name,
|
|
175
|
+
additionalProps = _objectWithoutProperties(_ref, _excluded);
|
|
176
|
+
return jsxRuntime.jsx("section", _objectSpread(_objectSpread(_objectSpread({}, additionalProps), applyMarker(name)), {}, {
|
|
177
|
+
children: children
|
|
166
178
|
}));
|
|
167
179
|
}
|
|
168
180
|
const Marking = {
|
|
@@ -15,6 +15,7 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
15
15
|
var react = require('react');
|
|
16
16
|
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
17
17
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
18
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
18
19
|
|
|
19
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -66,27 +67,32 @@ function useTrackingEffect() {
|
|
|
66
67
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
67
68
|
user: context.user,
|
|
68
69
|
project: context.project,
|
|
69
|
-
cloudEnvironment: context.environment.cloudEnvironment
|
|
70
|
+
cloudEnvironment: context.environment.cloudEnvironment,
|
|
71
|
+
organizationId: context.project?.ownerId,
|
|
72
|
+
isProductionProject: context.project?.isProductionProject
|
|
70
73
|
})),
|
|
71
74
|
project = _useApplicationContex.project,
|
|
72
75
|
user = _useApplicationContex.user,
|
|
73
|
-
cloudEnvironment = _useApplicationContex.cloudEnvironment
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case true:
|
|
77
|
-
return 'admin';
|
|
78
|
-
case false:
|
|
79
|
-
return 'regular';
|
|
80
|
-
default:
|
|
81
|
-
return 'unknown';
|
|
82
|
-
}
|
|
83
|
-
};
|
|
76
|
+
cloudEnvironment = _useApplicationContex.cloudEnvironment,
|
|
77
|
+
organizationId = _useApplicationContex.organizationId,
|
|
78
|
+
isProductionProject = _useApplicationContex.isProductionProject;
|
|
84
79
|
react.useEffect(() => {
|
|
80
|
+
function getUserRole() {
|
|
81
|
+
switch (project?.isUserAdminOfCurrentProject) {
|
|
82
|
+
case true:
|
|
83
|
+
return 'admin';
|
|
84
|
+
case false:
|
|
85
|
+
return 'regular';
|
|
86
|
+
default:
|
|
87
|
+
return 'unknown';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
// It's not safe to invoke any FullStory SDK methods.
|
|
86
92
|
if (!browser.isInitialized() || disable) {
|
|
87
93
|
return;
|
|
88
94
|
}
|
|
89
|
-
if (!
|
|
95
|
+
if (!user?.id) {
|
|
90
96
|
browser.FullStory('setIdentity', {
|
|
91
97
|
anonymous: true
|
|
92
98
|
});
|
|
@@ -95,14 +101,16 @@ function useTrackingEffect() {
|
|
|
95
101
|
uid: user.id,
|
|
96
102
|
properties: _objectSpread$1({
|
|
97
103
|
environment: cloudEnvironment,
|
|
98
|
-
projectKey: project
|
|
104
|
+
projectKey: project?.key,
|
|
105
|
+
isProductionProject,
|
|
106
|
+
organizationId,
|
|
99
107
|
userBusinessRole: user.businessRole,
|
|
100
108
|
userLocale: user.locale,
|
|
101
109
|
userRole: getUserRole()
|
|
102
110
|
}, additionalUserVars)
|
|
103
111
|
});
|
|
104
112
|
}
|
|
105
|
-
}, [disable, additionalUserVars, cloudEnvironment, project
|
|
113
|
+
}, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale, isProductionProject, organizationId, project?.isUserAdminOfCurrentProject]);
|
|
106
114
|
return null;
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -153,6 +161,7 @@ const Masking = {
|
|
|
153
161
|
Exclude
|
|
154
162
|
};
|
|
155
163
|
|
|
164
|
+
const _excluded = ["children", "name"];
|
|
156
165
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
157
166
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
158
167
|
function applyMarker(name) {
|
|
@@ -160,9 +169,12 @@ function applyMarker(name) {
|
|
|
160
169
|
'data-tracking': name
|
|
161
170
|
};
|
|
162
171
|
}
|
|
163
|
-
function Section(
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
function Section(_ref) {
|
|
173
|
+
let children = _ref.children,
|
|
174
|
+
name = _ref.name,
|
|
175
|
+
additionalProps = _objectWithoutProperties(_ref, _excluded);
|
|
176
|
+
return jsxRuntime.jsx("section", _objectSpread(_objectSpread(_objectSpread({}, additionalProps), applyMarker(name)), {}, {
|
|
177
|
+
children: children
|
|
166
178
|
}));
|
|
167
179
|
}
|
|
168
180
|
const Marking = {
|
|
@@ -11,6 +11,7 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
13
13
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
14
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
14
15
|
|
|
15
16
|
function assertValidFullstoryOrganizationId(fullstoryOrganizationId) {
|
|
16
17
|
if (typeof fullstoryOrganizationId !== 'string') {
|
|
@@ -51,27 +52,32 @@ function useTrackingEffect() {
|
|
|
51
52
|
const _useApplicationContex = useApplicationContext(context => ({
|
|
52
53
|
user: context.user,
|
|
53
54
|
project: context.project,
|
|
54
|
-
cloudEnvironment: context.environment.cloudEnvironment
|
|
55
|
+
cloudEnvironment: context.environment.cloudEnvironment,
|
|
56
|
+
organizationId: context.project?.ownerId,
|
|
57
|
+
isProductionProject: context.project?.isProductionProject
|
|
55
58
|
})),
|
|
56
59
|
project = _useApplicationContex.project,
|
|
57
60
|
user = _useApplicationContex.user,
|
|
58
|
-
cloudEnvironment = _useApplicationContex.cloudEnvironment
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
case true:
|
|
62
|
-
return 'admin';
|
|
63
|
-
case false:
|
|
64
|
-
return 'regular';
|
|
65
|
-
default:
|
|
66
|
-
return 'unknown';
|
|
67
|
-
}
|
|
68
|
-
};
|
|
61
|
+
cloudEnvironment = _useApplicationContex.cloudEnvironment,
|
|
62
|
+
organizationId = _useApplicationContex.organizationId,
|
|
63
|
+
isProductionProject = _useApplicationContex.isProductionProject;
|
|
69
64
|
useEffect(() => {
|
|
65
|
+
function getUserRole() {
|
|
66
|
+
switch (project?.isUserAdminOfCurrentProject) {
|
|
67
|
+
case true:
|
|
68
|
+
return 'admin';
|
|
69
|
+
case false:
|
|
70
|
+
return 'regular';
|
|
71
|
+
default:
|
|
72
|
+
return 'unknown';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
70
76
|
// It's not safe to invoke any FullStory SDK methods.
|
|
71
77
|
if (!isInitialized() || disable) {
|
|
72
78
|
return;
|
|
73
79
|
}
|
|
74
|
-
if (!
|
|
80
|
+
if (!user?.id) {
|
|
75
81
|
FullStory('setIdentity', {
|
|
76
82
|
anonymous: true
|
|
77
83
|
});
|
|
@@ -80,14 +86,16 @@ function useTrackingEffect() {
|
|
|
80
86
|
uid: user.id,
|
|
81
87
|
properties: _objectSpread$1({
|
|
82
88
|
environment: cloudEnvironment,
|
|
83
|
-
projectKey: project
|
|
89
|
+
projectKey: project?.key,
|
|
90
|
+
isProductionProject,
|
|
91
|
+
organizationId,
|
|
84
92
|
userBusinessRole: user.businessRole,
|
|
85
93
|
userLocale: user.locale,
|
|
86
94
|
userRole: getUserRole()
|
|
87
95
|
}, additionalUserVars)
|
|
88
96
|
});
|
|
89
97
|
}
|
|
90
|
-
}, [disable, additionalUserVars, cloudEnvironment, project
|
|
98
|
+
}, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale, isProductionProject, organizationId, project?.isUserAdminOfCurrentProject]);
|
|
91
99
|
return null;
|
|
92
100
|
}
|
|
93
101
|
|
|
@@ -138,6 +146,7 @@ const Masking = {
|
|
|
138
146
|
Exclude
|
|
139
147
|
};
|
|
140
148
|
|
|
149
|
+
const _excluded = ["children", "name"];
|
|
141
150
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
142
151
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
143
152
|
function applyMarker(name) {
|
|
@@ -145,9 +154,12 @@ function applyMarker(name) {
|
|
|
145
154
|
'data-tracking': name
|
|
146
155
|
};
|
|
147
156
|
}
|
|
148
|
-
function Section(
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
function Section(_ref) {
|
|
158
|
+
let children = _ref.children,
|
|
159
|
+
name = _ref.name,
|
|
160
|
+
additionalProps = _objectWithoutProperties(_ref, _excluded);
|
|
161
|
+
return jsx("section", _objectSpread(_objectSpread(_objectSpread({}, additionalProps), applyMarker(name)), {}, {
|
|
162
|
+
children: children
|
|
151
163
|
}));
|
|
152
164
|
}
|
|
153
165
|
const Marking = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export type TMarkingProps = {
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type TMarkingProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
3
|
name: string;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
};
|
|
6
6
|
declare function applyMarker(name: TMarkingProps['name']): {
|
|
7
7
|
'data-tracking': string;
|
|
8
8
|
};
|
|
9
|
-
declare function Section(
|
|
9
|
+
declare function Section({ children, name, ...additionalProps }: TMarkingProps): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
10
10
|
declare const Marking: {
|
|
11
11
|
Section: typeof Section;
|
|
12
12
|
applyMarker: typeof applyMarker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/fullstory",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A package integrating with the FullStory SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/commercetools-frontend-fullstory.cjs.js",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@apollo/client": "3.7.10",
|
|
23
|
-
"@commercetools-frontend/application-shell": "22.
|
|
24
|
-
"@commercetools-frontend/application-shell-connectors": "22.
|
|
25
|
-
"@commercetools-frontend/constants": "22.
|
|
26
|
-
"@emotion/react": "
|
|
23
|
+
"@commercetools-frontend/application-shell": "22.35.0",
|
|
24
|
+
"@commercetools-frontend/application-shell-connectors": "22.35.0",
|
|
25
|
+
"@commercetools-frontend/constants": "22.35.0",
|
|
26
|
+
"@emotion/react": "11.13.3",
|
|
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.
|
|
30
|
+
"@types/node": "20.16.10",
|
|
31
31
|
"@types/react": "17.0.80",
|
|
32
32
|
"@types/testing-library__jest-dom": "^5.14.6",
|
|
33
33
|
"graphql": "16.9.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"typescript": "5.2.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@commercetools-frontend/application-shell-connectors": "22.
|
|
44
|
-
"@commercetools-frontend/constants": "22.
|
|
43
|
+
"@commercetools-frontend/application-shell-connectors": "^22.35.0",
|
|
44
|
+
"@commercetools-frontend/constants": "^22.35.0",
|
|
45
45
|
"@emotion/react": "11.x",
|
|
46
46
|
"react": "17.x",
|
|
47
47
|
"react-intl": "6.x"
|