@commercetools-frontend/fullstory 2.2.1 → 2.4.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.
@@ -1,2 +1,2 @@
1
1
  export * from "../../dist/declarations/src/constants";
2
- //# sourceMappingURL=commercetools-frontend-fullstory-constants.cjs.d.ts.map
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1mdWxsc3RvcnktY29uc3RhbnRzLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL2NvbnN0YW50cy5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -1,2 +1,2 @@
1
1
  export * from "./declarations/src/index";
2
- //# sourceMappingURL=commercetools-frontend-fullstory.cjs.d.ts.map
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1mdWxsc3RvcnkuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FullStory = require('@fullstory/browser');
5
+ var browser = require('@fullstory/browser');
6
6
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
7
7
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
8
8
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
@@ -18,25 +18,6 @@ var jsxRuntime = require('@emotion/react/jsx-runtime');
18
18
 
19
19
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
20
20
 
21
- function _interopNamespace(e) {
22
- if (e && e.__esModule) return e;
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- if (k !== 'default') {
27
- var d = Object.getOwnPropertyDescriptor(e, k);
28
- Object.defineProperty(n, k, d.get ? d : {
29
- enumerable: true,
30
- get: function () { return e[k]; }
31
- });
32
- }
33
- });
34
- }
35
- n["default"] = e;
36
- return Object.freeze(n);
37
- }
38
-
39
- var FullStory__namespace = /*#__PURE__*/_interopNamespace(FullStory);
40
21
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
41
22
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
42
23
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
@@ -63,7 +44,7 @@ function initialize() {
63
44
  console.warn('[@commercetools-frontend/fullstory]: No valid `fullstoryOrganizationId` passed. Not initializing FullStory.');
64
45
  return;
65
46
  }
66
- FullStory__namespace.init({
47
+ browser.init({
67
48
  orgId: fullstoryOrganizationId,
68
49
  devMode: process.env.NODE_ENV !== 'production'
69
50
  });
@@ -85,27 +66,32 @@ function useTrackingEffect() {
85
66
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
86
67
  user: context.user,
87
68
  project: context.project,
88
- tenant: context.environment.tenant
69
+ cloudEnvironment: context.environment.cloudEnvironment
89
70
  })),
90
71
  project = _useApplicationContex.project,
91
72
  user = _useApplicationContex.user,
92
- tenant = _useApplicationContex.tenant;
73
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
93
74
  react.useEffect(() => {
94
75
  // It's not safe to invoke any FullStory SDK methods.
95
- if (!FullStory__namespace.isInitialized() || disable) {
76
+ if (!browser.isInitialized() || disable) {
96
77
  return;
97
78
  }
98
79
  if (!user?.id) {
99
- FullStory__namespace.anonymize();
80
+ browser.FullStory('setIdentity', {
81
+ anonymous: true
82
+ });
100
83
  } else {
101
- FullStory__namespace.identify(user.id, _objectSpread$1({
102
- environment: tenant,
103
- projectKey: project?.key,
104
- userBusinessRole: user.businessRole,
105
- userLocale: user.locale
106
- }, additionalUserVars));
84
+ browser.FullStory('setIdentity', {
85
+ uid: user.id,
86
+ properties: _objectSpread$1({
87
+ environment: cloudEnvironment,
88
+ projectKey: project?.key,
89
+ userBusinessRole: user.businessRole,
90
+ userLocale: user.locale
91
+ }, additionalUserVars)
92
+ });
107
93
  }
108
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
94
+ }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
109
95
  return null;
110
96
  }
111
97
 
@@ -113,14 +99,20 @@ function useTrackingEffect() {
113
99
 
114
100
  function sendEvent(eventName, eventProperties) {
115
101
  // Don't send events if FullStory is not initialized.
116
- if (!FullStory__namespace.isInitialized()) {
102
+ if (!browser.isInitialized()) {
117
103
  return;
118
104
  }
119
- FullStory__namespace.event(eventName, eventProperties);
105
+ browser.FullStory('trackEvent', {
106
+ name: eventName,
107
+ properties: eventProperties
108
+ });
120
109
  }
121
110
 
122
111
  function setUserVars(userVars) {
123
- FullStory__namespace.setUserVars(userVars);
112
+ browser.FullStory('setProperties', {
113
+ type: 'user',
114
+ properties: userVars
115
+ });
124
116
  }
125
117
 
126
118
  function Exclude(props) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FullStory = require('@fullstory/browser');
5
+ var browser = require('@fullstory/browser');
6
6
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
7
7
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
8
8
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
@@ -18,25 +18,6 @@ var jsxRuntime = require('@emotion/react/jsx-runtime');
18
18
 
19
19
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
20
20
 
21
- function _interopNamespace(e) {
22
- if (e && e.__esModule) return e;
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- if (k !== 'default') {
27
- var d = Object.getOwnPropertyDescriptor(e, k);
28
- Object.defineProperty(n, k, d.get ? d : {
29
- enumerable: true,
30
- get: function () { return e[k]; }
31
- });
32
- }
33
- });
34
- }
35
- n["default"] = e;
36
- return Object.freeze(n);
37
- }
38
-
39
- var FullStory__namespace = /*#__PURE__*/_interopNamespace(FullStory);
40
21
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
41
22
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
42
23
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
@@ -63,7 +44,7 @@ function initialize() {
63
44
  console.warn('[@commercetools-frontend/fullstory]: No valid `fullstoryOrganizationId` passed. Not initializing FullStory.');
64
45
  return;
65
46
  }
66
- FullStory__namespace.init({
47
+ browser.init({
67
48
  orgId: fullstoryOrganizationId,
68
49
  devMode: "production" !== 'production'
69
50
  });
@@ -85,27 +66,32 @@ function useTrackingEffect() {
85
66
  const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => ({
86
67
  user: context.user,
87
68
  project: context.project,
88
- tenant: context.environment.tenant
69
+ cloudEnvironment: context.environment.cloudEnvironment
89
70
  })),
90
71
  project = _useApplicationContex.project,
91
72
  user = _useApplicationContex.user,
92
- tenant = _useApplicationContex.tenant;
73
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
93
74
  react.useEffect(() => {
94
75
  // It's not safe to invoke any FullStory SDK methods.
95
- if (!FullStory__namespace.isInitialized() || disable) {
76
+ if (!browser.isInitialized() || disable) {
96
77
  return;
97
78
  }
98
79
  if (!user?.id) {
99
- FullStory__namespace.anonymize();
80
+ browser.FullStory('setIdentity', {
81
+ anonymous: true
82
+ });
100
83
  } else {
101
- FullStory__namespace.identify(user.id, _objectSpread$1({
102
- environment: tenant,
103
- projectKey: project?.key,
104
- userBusinessRole: user.businessRole,
105
- userLocale: user.locale
106
- }, additionalUserVars));
84
+ browser.FullStory('setIdentity', {
85
+ uid: user.id,
86
+ properties: _objectSpread$1({
87
+ environment: cloudEnvironment,
88
+ projectKey: project?.key,
89
+ userBusinessRole: user.businessRole,
90
+ userLocale: user.locale
91
+ }, additionalUserVars)
92
+ });
107
93
  }
108
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
94
+ }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
109
95
  return null;
110
96
  }
111
97
 
@@ -113,14 +99,20 @@ function useTrackingEffect() {
113
99
 
114
100
  function sendEvent(eventName, eventProperties) {
115
101
  // Don't send events if FullStory is not initialized.
116
- if (!FullStory__namespace.isInitialized()) {
102
+ if (!browser.isInitialized()) {
117
103
  return;
118
104
  }
119
- FullStory__namespace.event(eventName, eventProperties);
105
+ browser.FullStory('trackEvent', {
106
+ name: eventName,
107
+ properties: eventProperties
108
+ });
120
109
  }
121
110
 
122
111
  function setUserVars(userVars) {
123
- FullStory__namespace.setUserVars(userVars);
112
+ browser.FullStory('setProperties', {
113
+ type: 'user',
114
+ properties: userVars
115
+ });
124
116
  }
125
117
 
126
118
  function Exclude(props) {
@@ -1,4 +1,4 @@
1
- import * as FullStory from '@fullstory/browser';
1
+ import { init, isInitialized, FullStory } from '@fullstory/browser';
2
2
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
3
3
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
4
4
  import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
@@ -29,7 +29,7 @@ function initialize() {
29
29
  console.warn('[@commercetools-frontend/fullstory]: No valid `fullstoryOrganizationId` passed. Not initializing FullStory.');
30
30
  return;
31
31
  }
32
- FullStory.init({
32
+ init({
33
33
  orgId: fullstoryOrganizationId,
34
34
  devMode: process.env.NODE_ENV !== 'production'
35
35
  });
@@ -51,27 +51,32 @@ function useTrackingEffect() {
51
51
  const _useApplicationContex = useApplicationContext(context => ({
52
52
  user: context.user,
53
53
  project: context.project,
54
- tenant: context.environment.tenant
54
+ cloudEnvironment: context.environment.cloudEnvironment
55
55
  })),
56
56
  project = _useApplicationContex.project,
57
57
  user = _useApplicationContex.user,
58
- tenant = _useApplicationContex.tenant;
58
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
59
59
  useEffect(() => {
60
60
  // It's not safe to invoke any FullStory SDK methods.
61
- if (!FullStory.isInitialized() || disable) {
61
+ if (!isInitialized() || disable) {
62
62
  return;
63
63
  }
64
64
  if (!user?.id) {
65
- FullStory.anonymize();
65
+ FullStory('setIdentity', {
66
+ anonymous: true
67
+ });
66
68
  } else {
67
- FullStory.identify(user.id, _objectSpread$1({
68
- environment: tenant,
69
- projectKey: project?.key,
70
- userBusinessRole: user.businessRole,
71
- userLocale: user.locale
72
- }, additionalUserVars));
69
+ FullStory('setIdentity', {
70
+ uid: user.id,
71
+ properties: _objectSpread$1({
72
+ environment: cloudEnvironment,
73
+ projectKey: project?.key,
74
+ userBusinessRole: user.businessRole,
75
+ userLocale: user.locale
76
+ }, additionalUserVars)
77
+ });
73
78
  }
74
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
79
+ }, [disable, additionalUserVars, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
75
80
  return null;
76
81
  }
77
82
 
@@ -79,14 +84,20 @@ function useTrackingEffect() {
79
84
 
80
85
  function sendEvent(eventName, eventProperties) {
81
86
  // Don't send events if FullStory is not initialized.
82
- if (!FullStory.isInitialized()) {
87
+ if (!isInitialized()) {
83
88
  return;
84
89
  }
85
- FullStory.event(eventName, eventProperties);
90
+ FullStory('trackEvent', {
91
+ name: eventName,
92
+ properties: eventProperties
93
+ });
86
94
  }
87
95
 
88
96
  function setUserVars(userVars) {
89
- FullStory.setUserVars(userVars);
97
+ FullStory('setProperties', {
98
+ type: 'user',
99
+ properties: userVars
100
+ });
90
101
  }
91
102
 
92
103
  function Exclude(props) {
@@ -1,3 +1,2 @@
1
- import type { UserVars } from '@fullstory/browser';
2
- declare function setUserVars(userVars: UserVars): void;
1
+ declare function setUserVars(userVars: object): void;
3
2
  export { setUserVars };
@@ -1,7 +1,8 @@
1
- import type { UserVars } from '@fullstory/browser';
1
+ /// <reference types="node" />
2
+ import { KeyObject } from 'crypto';
2
3
  type TTrackingArgs = {
3
4
  disable?: boolean;
4
- additionalUserVars?: UserVars;
5
+ additionalUserVars?: KeyObject;
5
6
  };
6
7
  declare function useTrackingEffect({ disable, additionalUserVars, }?: TTrackingArgs): null;
7
8
  export { useTrackingEffect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/fullstory",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
4
4
  "description": "A package integrating with the FullStory SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/commercetools-frontend-fullstory.cjs.js",
@@ -16,24 +16,24 @@
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": "1.7.1"
19
+ "@fullstory/browser": "2.0.3"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@apollo/client": "3.7.10",
23
- "@commercetools-frontend/application-shell": "22.11.0",
24
- "@commercetools-frontend/application-shell-connectors": "22.11.0",
25
- "@commercetools-frontend/constants": "22.11.0",
23
+ "@commercetools-frontend/application-shell": "22.17.1",
24
+ "@commercetools-frontend/application-shell-connectors": "22.17.1",
25
+ "@commercetools-frontend/constants": "22.17.1",
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.8.0",
31
- "@types/react": "17.0.67",
30
+ "@types/node": "20.11.5",
31
+ "@types/react": "17.0.75",
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.4.7",
36
+ "react-intl": "6.6.2",
37
37
  "react-redux": "7.2.9",
38
38
  "react-router-dom": "5.3.4",
39
39
  "redux": "4.2.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercetools-frontend-fullstory-constants.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/constants.d.ts"],"names":[],"mappings":"AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercetools-frontend-fullstory.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}