@fullstory/browser 1.4.9 → 1.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.1
4
+
5
+ - Updating README to include `host` and `script` configuration options
6
+
7
+ ## 1.5.0
8
+
9
+ - Adding the `setVars` API function
10
+
11
+ ## 1.4.10
12
+
13
+ - Adding docs to the types file (index.d.ts)
14
+
3
15
  ## 1.4.8
4
16
 
5
17
  - Updating README to better describe the behavior of the `recordCrossDomainIFrames` option
package/README.md CHANGED
@@ -28,6 +28,8 @@ The only required option is `orgId`, all others are optional.
28
28
 
29
29
  * `orgId` - Sets your FullStory Org Id. Find out how to get your Org Id [here](https://help.fullstory.com/hc/en-us/articles/360047075853).
30
30
  * `debug` - When set to `true`, enables FullStory debug messages; defaults to `false`.
31
+ * `host` - The recording server host domain. Can be set to direct recorded events to a proxy that you host. Defaults to `fullstory.com`.
32
+ * `script` - FullStory script host domain. FullStory hosts the `fs.js` recording script on a CDN, but you can choose to host a copy yourself. Defaults to `edge.fullstory.com`.
31
33
  * `namespace` - Sets the global identifier for FullStory when conflicts with `FS` arise; see [help](https://help.fullstory.com/hc/en-us/articles/360020624694-What-if-the-identifier-FS-is-used-by-another-script-on-my-site-).
32
34
  * `recordCrossDomainIFrames` - Defaults to `false`. FullStory can record cross-domain iFrames if: 1. The FullStory Browser SDK is running in the cross-domain iFrame and 2. `recordCrossDomainIFrames` is set to `true` in the cross-domain iFrame and 3. The FullStory Browser SDK is running in the parent page of the cross-domain iFrame. Click [here](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) for a detailed explanation of what "cross-domain" means. Before using, you should understand the security implications, and configure your [Content Security Policy](https://www.html5rocks.com/en/tutorials/security/content-security-policy/) (CSP) HTTP headers accordingly - specifically the frame-ancestors directive. Failure to configure your CSP headers while using this setting can bypass IFrames security protections that are included in modern browsers. More information about cross-domain iFrame recording can be found on our [Knowledge Base](https://help.fullstory.com/hc/en-us/articles/360020622514-Can-FullStory-capture-content-that-is-presented-in-iframes-#2-the-outer-page-is-running-fullstory-and-you-have-iframes-runni). Note: the `recordCrossDomainIFrames` parameter is the same as the `window['_fs_run_in_iframe']` referenced in the KB article.
33
35
  * `recordOnlyThisIFrame` - When set to `true`, this tells FullStory that the IFrame is the "root" of the recording and should be its own session; defaults to `false`. Use this when your app is embedded in an IFrame on a site not running FullStory or when the site *is* running FullStory, but you want your content sent to a different FullStory org.
@@ -123,3 +125,16 @@ FullStory.event('Subscribed', {
123
125
  const startOfPlayback = FullStory.getCurrentSessionURL();
124
126
  const playbackAtThisMomentInTime = FullStory.getCurrentSessionURL(true);
125
127
  ```
128
+
129
+ ### Sending custom page data
130
+ ```JavaScript
131
+ FullStory.setVars('page', {
132
+ pageName : 'Checkout', // what is the name of the page?
133
+ cart_size_int : 10, // how many items were in the cart?
134
+ used_coupon_bool : true, // was a coupon used?
135
+ });
136
+ ```
137
+ For more information on setting page vars, view the FullStory help article on [Sending custom page data to FullStory](https://help.fullstory.com/hc/en-us/articles/1500004101581-FS-setVars-API-Sending-custom-page-data-to-FullStory).
138
+
139
+ #### Note
140
+ `FullStory.setVars(<scope>, <payload>)` currently only supports a string value of "page" for the scope. Using arbitrary strings for the scope parameter will result in an Error that will be logged to the browser console or discarded, depending on whether devMode or debug is enabled.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ /**
2
+ * FullStory Client SDK snippet options.
3
+ *
4
+ * - orgId: Reference for your [Org Id](https://help.fullstory.com/hc/en-us/articles/360047075853) listed in FullStory.
5
+ * - namespace: Global object name that contains the FullStory browser API methods and properties. Defaults to `FS`.
6
+ * - debug: Debug mode with extra browser console logging.
7
+ * - host: The recording server host domain. Can be set to direct recorded events to a proxy that you host. Defaults to `fullstory.com`.
8
+ * - script: FullStory script host domain. FullStory hosts the `fs.js` recording script on a CDN, but you can choose to host a copy yourself. Defaults to `edge.fullstory.com`.
9
+ * - recordCrossDomainIFrames: FullStory can record cross-domain iFrames. Defaults to `false`. Certain limitations apply and can be found [here](https://help.fullstory.com/hc/en-us/articles/360020622514-Can-FullStory-capture-content-that-is-presented-in-iframes-#h_01F1G333PYKPGZ4B42WDBV3YKV).
10
+ * - recordOnlyThisIFrame: FullStory can record the iFrame as its own unique session. Defaults to `false`. Additional conditions apply and can be found [here](https://help.fullstory.com/hc/en-us/articles/360020622514-Can-FullStory-capture-content-that-is-presented-in-iframes-#h_01F1G33B40Q2TPQA8MA7SF8Y5P).
11
+ * - devMode: In dev mode FullStory won't record sessions. Any calls to SDK methods will `console.warn` that FullStory is in `devMode`. Defaults to `false`.
12
+ */
1
13
  interface SnippetOptions {
2
14
  orgId: string;
3
15
  namespace?: string;
@@ -5,7 +17,7 @@ interface SnippetOptions {
5
17
  host?: string;
6
18
  script?: string;
7
19
  recordCrossDomainIFrames?: boolean;
8
- recordOnlyThisIFrame?: boolean; // see README for details
20
+ recordOnlyThisIFrame?: boolean;
9
21
  devMode?: boolean;
10
22
  }
11
23
 
@@ -17,6 +29,8 @@ interface UserVars {
17
29
 
18
30
  type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
19
31
 
32
+ type VarScope = 'page';
33
+
20
34
  // API functions that are available as soon as the snippet has executed.
21
35
  export function anonymize(): void;
22
36
  export function consent(userConsents?: boolean): void;
@@ -28,6 +42,7 @@ export function log(msg: string): void;
28
42
  export function restart(): void;
29
43
  export function setUserVars(customVars: UserVars): void;
30
44
  export function shutdown(): void;
45
+ export function setVars(varScope: VarScope, properties?: { [key: string]: any }): void;
31
46
 
32
47
  // API functions that are available after /rec/page returns.
33
48
  // FullStory bootstrapping details: https://help.fullstory.com/hc/en-us/articles/360032975773
package/dist/index.esm.js CHANGED
@@ -155,6 +155,7 @@ var consent = guard('consent');
155
155
  var shutdown = guard('shutdown');
156
156
  var restart = guard('restart');
157
157
  var anonymize = guard('anonymize');
158
+ var setVars = guard('setVars');
158
159
 
159
160
  var _init = function _init(options) {
160
161
  if (fs()) {
@@ -197,4 +198,4 @@ var initOnce = function initOnce(fn, message) {
197
198
 
198
199
  var init = initOnce(_init, 'FullStory init has already been called once, additional invocations are ignored');
199
200
 
200
- export { anonymize, consent, event, getCurrentSessionURL, identify, init, log, restart, setUserVars, shutdown };
201
+ export { anonymize, consent, event, getCurrentSessionURL, identify, init, log, restart, setUserVars, setVars, shutdown };
package/dist/index.js CHANGED
@@ -159,6 +159,7 @@ var consent = guard('consent');
159
159
  var shutdown = guard('shutdown');
160
160
  var restart = guard('restart');
161
161
  var anonymize = guard('anonymize');
162
+ var setVars = guard('setVars');
162
163
 
163
164
  var _init = function _init(options) {
164
165
  if (fs()) {
@@ -210,4 +211,5 @@ exports.init = init;
210
211
  exports.log = log;
211
212
  exports.restart = restart;
212
213
  exports.setUserVars = setUserVars;
214
+ exports.setVars = setVars;
213
215
  exports.shutdown = shutdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstory/browser",
3
- "version": "1.4.9",
3
+ "version": "1.5.1",
4
4
  "description": "The official FullStory browser SDK",
5
5
  "repository": "git://github.com/fullstorydev/fullstory-browser-sdk.git",
6
6
  "homepage": "https://github.com/fullstorydev/fullstory-browser-sdk",
@@ -27,28 +27,27 @@
27
27
  ],
28
28
  "devDependencies": {
29
29
  "@babel/core": "^7.8.7",
30
+ "@babel/eslint-parser": "^7.16.5",
30
31
  "@babel/preset-env": "^7.10.4",
31
32
  "@babel/register": "^7.8.6",
32
- "babel-eslint": "^10.1.0",
33
+ "@rollup/plugin-babel": "^5.3.0",
33
34
  "chai": "^4.1.2",
34
- "eslint": "^5.16.0",
35
- "eslint-config-airbnb": "^17.1.0",
35
+ "eslint": "^8.6.0",
36
+ "eslint-config-airbnb": "^19.0.4",
36
37
  "eslint-plugin-import": "^2.20.1",
37
- "eslint-plugin-jsx-a11y": "^6.0.2",
38
- "eslint-plugin-react": "^7.19.0",
38
+ "eslint-plugin-jsx-a11y": "^6.5.1",
39
+ "eslint-plugin-react": "^7.28.0",
39
40
  "karma": "^6.1.1",
40
41
  "karma-chai": "^0.1.0",
41
42
  "karma-chrome-launcher": "^3.1.0",
42
43
  "karma-mocha": "^2.0.1",
43
44
  "karma-spec-reporter": "0.0.32",
44
- "karma-webpack": "^4.0.2",
45
- "mocha": "^7.1.2",
45
+ "karma-webpack": "^5.0.0",
46
+ "mocha": "^9.2.0",
46
47
  "rimraf": "^2.7.1",
47
48
  "rollup": "^1.32.1",
48
- "rollup-plugin-babel": "^4.4.0",
49
49
  "rollup-plugin-copy": "^3.3.0",
50
50
  "typescript": "^3.8.3",
51
- "webpack": "^4.42.0"
52
- },
53
- "dependencies": {}
51
+ "webpack": "^5.38.1"
52
+ }
54
53
  }
package/src/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ /**
2
+ * FullStory Client SDK snippet options.
3
+ *
4
+ * - orgId: Reference for your [Org Id](https://help.fullstory.com/hc/en-us/articles/360047075853) listed in FullStory.
5
+ * - namespace: Global object name that contains the FullStory browser API methods and properties. Defaults to `FS`.
6
+ * - debug: Debug mode with extra browser console logging.
7
+ * - host: The recording server host domain. Can be set to direct recorded events to a proxy that you host. Defaults to `fullstory.com`.
8
+ * - script: FullStory script host domain. FullStory hosts the `fs.js` recording script on a CDN, but you can choose to host a copy yourself. Defaults to `edge.fullstory.com`.
9
+ * - recordCrossDomainIFrames: FullStory can record cross-domain iFrames. Defaults to `false`. Certain limitations apply and can be found [here](https://help.fullstory.com/hc/en-us/articles/360020622514-Can-FullStory-capture-content-that-is-presented-in-iframes-#h_01F1G333PYKPGZ4B42WDBV3YKV).
10
+ * - recordOnlyThisIFrame: FullStory can record the iFrame as its own unique session. Defaults to `false`. Additional conditions apply and can be found [here](https://help.fullstory.com/hc/en-us/articles/360020622514-Can-FullStory-capture-content-that-is-presented-in-iframes-#h_01F1G33B40Q2TPQA8MA7SF8Y5P).
11
+ * - devMode: In dev mode FullStory won't record sessions. Any calls to SDK methods will `console.warn` that FullStory is in `devMode`. Defaults to `false`.
12
+ */
1
13
  interface SnippetOptions {
2
14
  orgId: string;
3
15
  namespace?: string;
@@ -5,7 +17,7 @@ interface SnippetOptions {
5
17
  host?: string;
6
18
  script?: string;
7
19
  recordCrossDomainIFrames?: boolean;
8
- recordOnlyThisIFrame?: boolean; // see README for details
20
+ recordOnlyThisIFrame?: boolean;
9
21
  devMode?: boolean;
10
22
  }
11
23
 
@@ -17,6 +29,8 @@ interface UserVars {
17
29
 
18
30
  type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
19
31
 
32
+ type VarScope = 'page';
33
+
20
34
  // API functions that are available as soon as the snippet has executed.
21
35
  export function anonymize(): void;
22
36
  export function consent(userConsents?: boolean): void;
@@ -28,6 +42,7 @@ export function log(msg: string): void;
28
42
  export function restart(): void;
29
43
  export function setUserVars(customVars: UserVars): void;
30
44
  export function shutdown(): void;
45
+ export function setVars(varScope: VarScope, properties?: { [key: string]: any }): void;
31
46
 
32
47
  // API functions that are available after /rec/page returns.
33
48
  // FullStory bootstrapping details: https://help.fullstory.com/hc/en-us/articles/360032975773
package/src/index.js CHANGED
@@ -11,10 +11,10 @@ const ensureSnippetLoaded = () => {
11
11
 
12
12
  const hasFullStoryWithFunction = (...testNames) => {
13
13
  ensureSnippetLoaded();
14
- return testNames.every(current => fs()[current]);
14
+ return testNames.every((current) => fs()[current]);
15
15
  };
16
16
 
17
- const guard = name => (...args) => {
17
+ const guard = (name) => (...args) => {
18
18
  if (window._fs_dev_mode) {
19
19
  const message = `FullStory is in dev mode and is not recording: ${name} method not executed`;
20
20
  console.warn(message); // eslint-disable-line no-console
@@ -37,6 +37,7 @@ export const consent = guard('consent');
37
37
  export const shutdown = guard('shutdown');
38
38
  export const restart = guard('restart');
39
39
  export const anonymize = guard('anonymize');
40
+ export const setVars = guard('setVars');
40
41
 
41
42
  const _init = (options) => {
42
43
  if (fs()) {