@fullstory/browser 1.4.7 → 1.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/CHANGELOG.md +13 -1
- package/README.md +15 -2
- package/dist/index.d.ts +16 -1
- package/dist/index.esm.js +2 -1
- package/dist/index.js +2 -0
- package/package.json +12 -13
- package/src/index.d.ts +16 -1
- package/src/index.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
- Adding the `setVars` API function
|
|
6
|
+
|
|
7
|
+
## 1.4.10
|
|
8
|
+
|
|
9
|
+
- Adding docs to the types file (index.d.ts)
|
|
10
|
+
|
|
11
|
+
## 1.4.8
|
|
12
|
+
|
|
13
|
+
- Updating README to better describe the behavior of the `recordCrossDomainIFrames` option
|
|
14
|
+
|
|
15
|
+
## 1.4.7
|
|
4
16
|
- Updating README to include vue 3
|
|
5
17
|
- `npm audit fix` to clean up npm audit warnings
|
|
6
18
|
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ The only required option is `orgId`, all others are optional.
|
|
|
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
31
|
* `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
|
-
* `recordCrossDomainIFrames` -
|
|
32
|
+
* `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
33
|
* `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.
|
|
34
34
|
* `devMode` - Set to `true` if you want to deactivate FullStory in your development environment. When set to `true`, FullStory will shutdown recording and all subsequent SDK method calls will be no-ops. At the time `init` is called with `devMode: true`, a single `event` call will be sent to FullStory to indicate that the SDK is in `devMode`; this is to help trouble-shoot the case that the SDK was accidentally set to `devMode: true` in a production environment. Additionally, any calls to SDK methods will `console.warn` that FullStory is in `devMode`. Defaults to `false`.
|
|
35
35
|
|
|
@@ -122,4 +122,17 @@ FullStory.event('Subscribed', {
|
|
|
122
122
|
```JavaScript
|
|
123
123
|
const startOfPlayback = FullStory.getCurrentSessionURL();
|
|
124
124
|
const playbackAtThisMomentInTime = FullStory.getCurrentSessionURL(true);
|
|
125
|
-
```
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Sending custom page data
|
|
128
|
+
```JavaScript
|
|
129
|
+
FullStory.setVars('page', {
|
|
130
|
+
pageName : 'Checkout', // what is the name of the page?
|
|
131
|
+
cart_size_int : 10, // how many items were in the cart?
|
|
132
|
+
used_coupon_bool : true, // was a coupon used?
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
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).
|
|
136
|
+
|
|
137
|
+
#### Note
|
|
138
|
+
`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;
|
|
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.
|
|
3
|
+
"version": "1.5.0",
|
|
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
|
|
33
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
33
34
|
"chai": "^4.1.2",
|
|
34
|
-
"eslint": "^
|
|
35
|
-
"eslint-config-airbnb": "^
|
|
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.
|
|
38
|
-
"eslint-plugin-react": "^7.
|
|
39
|
-
"karma": "^
|
|
38
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
39
|
+
"eslint-plugin-react": "^7.28.0",
|
|
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": "^
|
|
45
|
-
"mocha": "^
|
|
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": "^
|
|
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;
|
|
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()) {
|
|
@@ -45,7 +46,7 @@ const _init = (options) => {
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
//
|
|
49
|
+
// see README for details on the recordCrossDomainIFrames option
|
|
49
50
|
if (options.recordCrossDomainIFrames) {
|
|
50
51
|
window._fs_run_in_iframe = true;
|
|
51
52
|
}
|