@commercetools-frontend/fullstory 1.0.2 → 1.0.4
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 +20 -0
- package/constants/dist/commercetools-frontend-fullstory-constants.cjs.dev.js +1 -1
- package/constants/dist/commercetools-frontend-fullstory-constants.cjs.prod.js +1 -1
- package/constants/dist/commercetools-frontend-fullstory-constants.esm.js +1 -1
- package/dist/commercetools-frontend-fullstory.cjs.dev.js +38 -11
- package/dist/commercetools-frontend-fullstory.cjs.prod.js +38 -11
- package/dist/commercetools-frontend-fullstory.esm.js +38 -12
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/masking.d.ts +14 -0
- package/package.json +14 -8
package/README.md
CHANGED
|
@@ -107,6 +107,26 @@ setFullStoryUserVars({ email: user.email });
|
|
|
107
107
|
|
|
108
108
|
It's recommended to be mindful in what you send especially with Personal Identifiable Information.
|
|
109
109
|
|
|
110
|
+
### Masking
|
|
111
|
+
|
|
112
|
+
FullStory has a built-in way to [mask, unmask or exclude](https://help.fullstory.com/hc/en-us/articles/360020623574-How-do-I-protect-my-users-privacy-in-FullStory-) certain elements on a page. As FullStory should be used with the [Private By Default](https://help.fullstory.com/hc/en-us/articles/360044349073) settings, unmasking may be considered and carefully implemented when needed.
|
|
113
|
+
|
|
114
|
+
If an unmasking request occurs and has been deemed necessary and can not be accomplished via the "app-first" approach within FullStory's settings only then a "code-first" approach should be taken. The "code-first" approach can be implemented using one of three masking components from this package.
|
|
115
|
+
|
|
116
|
+
```jsx
|
|
117
|
+
import { Masking as FullStoryMasking } from '@commercetools-frontend/fullstory';
|
|
118
|
+
|
|
119
|
+
// Assuming some component three exists you can use one of:
|
|
120
|
+
|
|
121
|
+
<>
|
|
122
|
+
<FullStoryMasking.Unmask>{props.children}</FullStoryMasking.Unmask>
|
|
123
|
+
<FullStoryMasking.Mask>{props.children}</FullStoryMasking.Mask>
|
|
124
|
+
<FullStoryMasking.Exclude>{props.children}</FullStoryMasking.Exclude>
|
|
125
|
+
</>;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Each of the components above accepts an `as` `prop` which can be either `span` or `div` depending on your layout needs.
|
|
129
|
+
|
|
110
130
|
## FAQ
|
|
111
131
|
|
|
112
132
|
Question: _I want to disable FullStory on a specific environment_
|
|
@@ -14,6 +14,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
14
14
|
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
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
17
18
|
|
|
18
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
20
|
|
|
@@ -54,7 +55,7 @@ function assertValidFullstoryOrganizationId(fullstoryOrganizationId) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
function initialize() {
|
|
57
|
-
|
|
58
|
+
let fullstoryOrganizationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app.fullstoryOrganizationId;
|
|
58
59
|
try {
|
|
59
60
|
try {
|
|
60
61
|
assertValidFullstoryOrganizationId(fullstoryOrganizationId);
|
|
@@ -73,25 +74,23 @@ function initialize() {
|
|
|
73
74
|
|
|
74
75
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
75
76
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
76
|
-
|
|
77
|
+
const defaultTrackingArgs = {
|
|
77
78
|
disable: false,
|
|
78
79
|
additionalUserVars: undefined
|
|
79
80
|
};
|
|
80
81
|
function useTrackingEffect() {
|
|
81
|
-
|
|
82
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultTrackingArgs,
|
|
82
83
|
disable = _ref.disable,
|
|
83
84
|
additionalUserVars = _ref.additionalUserVars;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
}),
|
|
85
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
86
|
+
user: context.user,
|
|
87
|
+
project: context.project,
|
|
88
|
+
tenant: context.environment.tenant
|
|
89
|
+
})),
|
|
91
90
|
project = _useApplicationContex.project,
|
|
92
91
|
user = _useApplicationContex.user,
|
|
93
92
|
tenant = _useApplicationContex.tenant;
|
|
94
|
-
react.useEffect(
|
|
93
|
+
react.useEffect(() => {
|
|
95
94
|
// It's not safe to invoke any FullStory SDK methods.
|
|
96
95
|
if (!FullStory__namespace.isInitialized() || disable) {
|
|
97
96
|
return;
|
|
@@ -120,6 +119,34 @@ function setUserVars(userVars) {
|
|
|
120
119
|
FullStory__namespace.setUserVars(userVars);
|
|
121
120
|
}
|
|
122
121
|
|
|
122
|
+
function Exclude(props) {
|
|
123
|
+
const ExcludeElement = props.as || 'div';
|
|
124
|
+
return jsxRuntime.jsx(ExcludeElement, {
|
|
125
|
+
className: "fs-exclude",
|
|
126
|
+
children: props.children
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function Unmask(props) {
|
|
130
|
+
const UnmaskElement = props.as || 'div';
|
|
131
|
+
return jsxRuntime.jsx(UnmaskElement, {
|
|
132
|
+
className: "fs-unmask",
|
|
133
|
+
children: props.children
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function Mask(props) {
|
|
137
|
+
const MaskElement = props.as || 'div';
|
|
138
|
+
return jsxRuntime.jsx(MaskElement, {
|
|
139
|
+
className: "fs-mask",
|
|
140
|
+
children: props.children
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const Masking = {
|
|
144
|
+
Unmask,
|
|
145
|
+
Mask,
|
|
146
|
+
Exclude
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
exports.Masking = Masking;
|
|
123
150
|
exports.initialize = initialize;
|
|
124
151
|
exports.sendEvent = sendEvent;
|
|
125
152
|
exports.setUserVars = setUserVars;
|
|
@@ -14,6 +14,7 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
14
14
|
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
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
17
18
|
|
|
18
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
19
20
|
|
|
@@ -54,7 +55,7 @@ function assertValidFullstoryOrganizationId(fullstoryOrganizationId) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
function initialize() {
|
|
57
|
-
|
|
58
|
+
let fullstoryOrganizationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app.fullstoryOrganizationId;
|
|
58
59
|
try {
|
|
59
60
|
try {
|
|
60
61
|
assertValidFullstoryOrganizationId(fullstoryOrganizationId);
|
|
@@ -73,25 +74,23 @@ function initialize() {
|
|
|
73
74
|
|
|
74
75
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
75
76
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
76
|
-
|
|
77
|
+
const defaultTrackingArgs = {
|
|
77
78
|
disable: false,
|
|
78
79
|
additionalUserVars: undefined
|
|
79
80
|
};
|
|
80
81
|
function useTrackingEffect() {
|
|
81
|
-
|
|
82
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultTrackingArgs,
|
|
82
83
|
disable = _ref.disable,
|
|
83
84
|
additionalUserVars = _ref.additionalUserVars;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
}),
|
|
85
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
|
|
86
|
+
user: context.user,
|
|
87
|
+
project: context.project,
|
|
88
|
+
tenant: context.environment.tenant
|
|
89
|
+
})),
|
|
91
90
|
project = _useApplicationContex.project,
|
|
92
91
|
user = _useApplicationContex.user,
|
|
93
92
|
tenant = _useApplicationContex.tenant;
|
|
94
|
-
react.useEffect(
|
|
93
|
+
react.useEffect(() => {
|
|
95
94
|
// It's not safe to invoke any FullStory SDK methods.
|
|
96
95
|
if (!FullStory__namespace.isInitialized() || disable) {
|
|
97
96
|
return;
|
|
@@ -120,6 +119,34 @@ function setUserVars(userVars) {
|
|
|
120
119
|
FullStory__namespace.setUserVars(userVars);
|
|
121
120
|
}
|
|
122
121
|
|
|
122
|
+
function Exclude(props) {
|
|
123
|
+
const ExcludeElement = props.as || 'div';
|
|
124
|
+
return jsxRuntime.jsx(ExcludeElement, {
|
|
125
|
+
className: "fs-exclude",
|
|
126
|
+
children: props.children
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function Unmask(props) {
|
|
130
|
+
const UnmaskElement = props.as || 'div';
|
|
131
|
+
return jsxRuntime.jsx(UnmaskElement, {
|
|
132
|
+
className: "fs-unmask",
|
|
133
|
+
children: props.children
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function Mask(props) {
|
|
137
|
+
const MaskElement = props.as || 'div';
|
|
138
|
+
return jsxRuntime.jsx(MaskElement, {
|
|
139
|
+
className: "fs-mask",
|
|
140
|
+
children: props.children
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const Masking = {
|
|
144
|
+
Unmask,
|
|
145
|
+
Mask,
|
|
146
|
+
Exclude
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
exports.Masking = Masking;
|
|
123
150
|
exports.initialize = initialize;
|
|
124
151
|
exports.sendEvent = sendEvent;
|
|
125
152
|
exports.setUserVars = setUserVars;
|
|
@@ -10,6 +10,7 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
10
10
|
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
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
13
14
|
|
|
14
15
|
function assertValidFullstoryOrganizationId(fullstoryOrganizationId) {
|
|
15
16
|
if (typeof fullstoryOrganizationId !== 'string') {
|
|
@@ -20,7 +21,7 @@ function assertValidFullstoryOrganizationId(fullstoryOrganizationId) {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
function initialize() {
|
|
23
|
-
|
|
24
|
+
let fullstoryOrganizationId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app.fullstoryOrganizationId;
|
|
24
25
|
try {
|
|
25
26
|
try {
|
|
26
27
|
assertValidFullstoryOrganizationId(fullstoryOrganizationId);
|
|
@@ -39,25 +40,23 @@ function initialize() {
|
|
|
39
40
|
|
|
40
41
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
42
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
42
|
-
|
|
43
|
+
const defaultTrackingArgs = {
|
|
43
44
|
disable: false,
|
|
44
45
|
additionalUserVars: undefined
|
|
45
46
|
};
|
|
46
47
|
function useTrackingEffect() {
|
|
47
|
-
|
|
48
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultTrackingArgs,
|
|
48
49
|
disable = _ref.disable,
|
|
49
50
|
additionalUserVars = _ref.additionalUserVars;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
}),
|
|
51
|
+
const _useApplicationContex = useApplicationContext(context => ({
|
|
52
|
+
user: context.user,
|
|
53
|
+
project: context.project,
|
|
54
|
+
tenant: context.environment.tenant
|
|
55
|
+
})),
|
|
57
56
|
project = _useApplicationContex.project,
|
|
58
57
|
user = _useApplicationContex.user,
|
|
59
58
|
tenant = _useApplicationContex.tenant;
|
|
60
|
-
useEffect(
|
|
59
|
+
useEffect(() => {
|
|
61
60
|
// It's not safe to invoke any FullStory SDK methods.
|
|
62
61
|
if (!FullStory.isInitialized() || disable) {
|
|
63
62
|
return;
|
|
@@ -86,4 +85,31 @@ function setUserVars(userVars) {
|
|
|
86
85
|
FullStory.setUserVars(userVars);
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
function Exclude(props) {
|
|
89
|
+
const ExcludeElement = props.as || 'div';
|
|
90
|
+
return jsx(ExcludeElement, {
|
|
91
|
+
className: "fs-exclude",
|
|
92
|
+
children: props.children
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function Unmask(props) {
|
|
96
|
+
const UnmaskElement = props.as || 'div';
|
|
97
|
+
return jsx(UnmaskElement, {
|
|
98
|
+
className: "fs-unmask",
|
|
99
|
+
children: props.children
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function Mask(props) {
|
|
103
|
+
const MaskElement = props.as || 'div';
|
|
104
|
+
return jsx(MaskElement, {
|
|
105
|
+
className: "fs-mask",
|
|
106
|
+
children: props.children
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const Masking = {
|
|
110
|
+
Unmask,
|
|
111
|
+
Mask,
|
|
112
|
+
Exclude
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { Masking, initialize, sendEvent, setUserVars, useTrackingEffect };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type TMaskingProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
as?: 'div' | 'span';
|
|
5
|
+
};
|
|
6
|
+
declare function Exclude(props: TMaskingProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function Unmask(props: TMaskingProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function Mask(props: TMaskingProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const Masking: {
|
|
10
|
+
Unmask: typeof Unmask;
|
|
11
|
+
Mask: typeof Mask;
|
|
12
|
+
Exclude: typeof Exclude;
|
|
13
|
+
};
|
|
14
|
+
export { Masking };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/fullstory",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A package integrating with the FullStory SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/commercetools-frontend-fullstory.cjs.js",
|
|
@@ -12,20 +12,21 @@
|
|
|
12
12
|
"package.json",
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"typecheck": "tsc --noEmit"
|
|
17
|
-
},
|
|
18
15
|
"dependencies": {
|
|
16
|
+
"@babel/core": "^7.21.0",
|
|
19
17
|
"@babel/runtime": "^7.21.0",
|
|
20
18
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
21
19
|
"@fullstory/browser": "1.7.0"
|
|
22
20
|
},
|
|
23
21
|
"devDependencies": {
|
|
24
|
-
"@apollo/client": "3.7.
|
|
25
|
-
"@commercetools-frontend/application-shell": "21.
|
|
22
|
+
"@apollo/client": "3.7.10",
|
|
23
|
+
"@commercetools-frontend/application-shell": "21.24.1",
|
|
24
|
+
"@commercetools-frontend/application-shell-connectors": "21.24.1",
|
|
25
|
+
"@commercetools-frontend/constants": "21.24.1",
|
|
26
26
|
"@testing-library/react": "12.1.5",
|
|
27
27
|
"@testing-library/react-hooks": "8.0.1",
|
|
28
|
-
"@types/node": "18.
|
|
28
|
+
"@types/node": "18.15.10",
|
|
29
|
+
"@types/react": "17.0.54",
|
|
29
30
|
"graphql": "16.6.0",
|
|
30
31
|
"react": "17.0.2",
|
|
31
32
|
"react-dom": "17.0.2",
|
|
@@ -37,6 +38,8 @@
|
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"@commercetools-frontend/application-shell-connectors": "21.x",
|
|
41
|
+
"@commercetools-frontend/constants": "21.x",
|
|
42
|
+
"@emotion/react": "11.x",
|
|
40
43
|
"react": "17.x"
|
|
41
44
|
},
|
|
42
45
|
"publishConfig": {
|
|
@@ -47,5 +50,8 @@
|
|
|
47
50
|
"./index.ts",
|
|
48
51
|
"./constants.ts"
|
|
49
52
|
]
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"typecheck": "tsc --noEmit"
|
|
50
56
|
}
|
|
51
|
-
}
|
|
57
|
+
}
|