@commercetools-frontend/fullstory 2.2.1 → 2.3.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,35 @@ 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
+ tenant: context.environment.tenant,
70
+ cloudEnvironment: context.environment.cloudEnvironment
89
71
  })),
90
72
  project = _useApplicationContex.project,
91
73
  user = _useApplicationContex.user,
92
- tenant = _useApplicationContex.tenant;
74
+ tenant = _useApplicationContex.tenant,
75
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
93
76
  react.useEffect(() => {
94
77
  // It's not safe to invoke any FullStory SDK methods.
95
- if (!FullStory__namespace.isInitialized() || disable) {
78
+ if (!browser.isInitialized() || disable) {
96
79
  return;
97
80
  }
98
81
  if (!user?.id) {
99
- FullStory__namespace.anonymize();
82
+ browser.FullStory('setIdentity', {
83
+ anonymous: true
84
+ });
100
85
  } 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));
86
+ browser.FullStory('setIdentity', {
87
+ uid: user.id,
88
+ properties: _objectSpread$1({
89
+ environment: tenant,
90
+ cloudEnvironment: cloudEnvironment,
91
+ projectKey: project?.key,
92
+ userBusinessRole: user.businessRole,
93
+ userLocale: user.locale
94
+ }, additionalUserVars)
95
+ });
107
96
  }
108
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
97
+ }, [disable, additionalUserVars, tenant, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
109
98
  return null;
110
99
  }
111
100
 
@@ -113,14 +102,20 @@ function useTrackingEffect() {
113
102
 
114
103
  function sendEvent(eventName, eventProperties) {
115
104
  // Don't send events if FullStory is not initialized.
116
- if (!FullStory__namespace.isInitialized()) {
105
+ if (!browser.isInitialized()) {
117
106
  return;
118
107
  }
119
- FullStory__namespace.event(eventName, eventProperties);
108
+ browser.FullStory('trackEvent', {
109
+ name: eventName,
110
+ properties: eventProperties
111
+ });
120
112
  }
121
113
 
122
114
  function setUserVars(userVars) {
123
- FullStory__namespace.setUserVars(userVars);
115
+ browser.FullStory('setProperties', {
116
+ type: 'user',
117
+ properties: userVars
118
+ });
124
119
  }
125
120
 
126
121
  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,35 @@ 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
+ tenant: context.environment.tenant,
70
+ cloudEnvironment: context.environment.cloudEnvironment
89
71
  })),
90
72
  project = _useApplicationContex.project,
91
73
  user = _useApplicationContex.user,
92
- tenant = _useApplicationContex.tenant;
74
+ tenant = _useApplicationContex.tenant,
75
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
93
76
  react.useEffect(() => {
94
77
  // It's not safe to invoke any FullStory SDK methods.
95
- if (!FullStory__namespace.isInitialized() || disable) {
78
+ if (!browser.isInitialized() || disable) {
96
79
  return;
97
80
  }
98
81
  if (!user?.id) {
99
- FullStory__namespace.anonymize();
82
+ browser.FullStory('setIdentity', {
83
+ anonymous: true
84
+ });
100
85
  } 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));
86
+ browser.FullStory('setIdentity', {
87
+ uid: user.id,
88
+ properties: _objectSpread$1({
89
+ environment: tenant,
90
+ cloudEnvironment: cloudEnvironment,
91
+ projectKey: project?.key,
92
+ userBusinessRole: user.businessRole,
93
+ userLocale: user.locale
94
+ }, additionalUserVars)
95
+ });
107
96
  }
108
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
97
+ }, [disable, additionalUserVars, tenant, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
109
98
  return null;
110
99
  }
111
100
 
@@ -113,14 +102,20 @@ function useTrackingEffect() {
113
102
 
114
103
  function sendEvent(eventName, eventProperties) {
115
104
  // Don't send events if FullStory is not initialized.
116
- if (!FullStory__namespace.isInitialized()) {
105
+ if (!browser.isInitialized()) {
117
106
  return;
118
107
  }
119
- FullStory__namespace.event(eventName, eventProperties);
108
+ browser.FullStory('trackEvent', {
109
+ name: eventName,
110
+ properties: eventProperties
111
+ });
120
112
  }
121
113
 
122
114
  function setUserVars(userVars) {
123
- FullStory__namespace.setUserVars(userVars);
115
+ browser.FullStory('setProperties', {
116
+ type: 'user',
117
+ properties: userVars
118
+ });
124
119
  }
125
120
 
126
121
  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,35 @@ function useTrackingEffect() {
51
51
  const _useApplicationContex = useApplicationContext(context => ({
52
52
  user: context.user,
53
53
  project: context.project,
54
- tenant: context.environment.tenant
54
+ tenant: context.environment.tenant,
55
+ cloudEnvironment: context.environment.cloudEnvironment
55
56
  })),
56
57
  project = _useApplicationContex.project,
57
58
  user = _useApplicationContex.user,
58
- tenant = _useApplicationContex.tenant;
59
+ tenant = _useApplicationContex.tenant,
60
+ cloudEnvironment = _useApplicationContex.cloudEnvironment;
59
61
  useEffect(() => {
60
62
  // It's not safe to invoke any FullStory SDK methods.
61
- if (!FullStory.isInitialized() || disable) {
63
+ if (!isInitialized() || disable) {
62
64
  return;
63
65
  }
64
66
  if (!user?.id) {
65
- FullStory.anonymize();
67
+ FullStory('setIdentity', {
68
+ anonymous: true
69
+ });
66
70
  } 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));
71
+ FullStory('setIdentity', {
72
+ uid: user.id,
73
+ properties: _objectSpread$1({
74
+ environment: tenant,
75
+ cloudEnvironment: cloudEnvironment,
76
+ projectKey: project?.key,
77
+ userBusinessRole: user.businessRole,
78
+ userLocale: user.locale
79
+ }, additionalUserVars)
80
+ });
73
81
  }
74
- }, [disable, additionalUserVars, tenant, project?.key, user?.businessRole, user?.id, user?.locale]);
82
+ }, [disable, additionalUserVars, tenant, cloudEnvironment, project?.key, user?.businessRole, user?.id, user?.locale]);
75
83
  return null;
76
84
  }
77
85
 
@@ -79,14 +87,20 @@ function useTrackingEffect() {
79
87
 
80
88
  function sendEvent(eventName, eventProperties) {
81
89
  // Don't send events if FullStory is not initialized.
82
- if (!FullStory.isInitialized()) {
90
+ if (!isInitialized()) {
83
91
  return;
84
92
  }
85
- FullStory.event(eventName, eventProperties);
93
+ FullStory('trackEvent', {
94
+ name: eventName,
95
+ properties: eventProperties
96
+ });
86
97
  }
87
98
 
88
99
  function setUserVars(userVars) {
89
- FullStory.setUserVars(userVars);
100
+ FullStory('setProperties', {
101
+ type: 'user',
102
+ properties: userVars
103
+ });
90
104
  }
91
105
 
92
106
  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.3.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.1"
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.16.0",
24
+ "@commercetools-frontend/application-shell-connectors": "22.16.0",
25
+ "@commercetools-frontend/constants": "22.16.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.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.1",
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"}