@fullstory/browser 2.0.7 → 2.0.8

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/dist/index.d.ts CHANGED
@@ -11,17 +11,22 @@ import { FSApi } from '@fullstory/snippet';
11
11
  * - 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).
12
12
  * - 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).
13
13
  * - 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`.
14
+ * - sessionUid (beta): Sets the session UID passed to the `FS('init', ...)` v2 operation.
14
15
  */
15
16
  export interface SnippetOptions {
16
17
  orgId: string;
17
- namespace?: string;
18
+ appHost?: string;
19
+ assetMapId?: string;
20
+ cookieDomain?: string;
18
21
  debug?: boolean;
22
+ devMode?: boolean;
19
23
  host?: string;
20
- script?: string;
21
- cookieDomain?: string;
24
+ namespace?: string;
22
25
  recordCrossDomainIFrames?: boolean;
23
26
  recordOnlyThisIFrame?: boolean;
24
- devMode?: boolean;
27
+ sessionUid?: string;
28
+ script?: string;
29
+ startCaptureManually?: boolean;
25
30
  }
26
31
  /**
27
32
  * A callback that will be invoked when FullStory has begun a session.
@@ -35,6 +40,9 @@ type ReadyCallback = (data: {
35
40
  }) => void;
36
41
  declare global {
37
42
  interface Window {
43
+ _fs_app_host?: string;
44
+ _fs_asset_map_id?: string;
45
+ _fs_capture_on_startup?: boolean;
38
46
  _fs_cookie_domain?: string;
39
47
  _fs_debug?: boolean;
40
48
  _fs_dev_mode?: boolean;
@@ -47,7 +55,7 @@ declare global {
47
55
  _fs_script?: string;
48
56
  }
49
57
  }
50
- export declare const init: (inputOptions: SnippetOptions, readyCallback?: ReadyCallback) => void;
51
- export declare const isInitialized: () => boolean;
58
+ declare const init: (inputOptions: SnippetOptions, readyCallback?: ReadyCallback) => void;
59
+ declare const isInitialized: () => boolean;
52
60
  declare const FullStory: FSApi;
53
- export default FullStory;
61
+ export { FullStory, init, isInitialized };
package/dist/index.esm.js CHANGED
@@ -14,6 +14,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
14
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
15
  PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
+ /* global Reflect, Promise */
18
+
17
19
 
18
20
  var __assign = function() {
19
21
  __assign = Object.assign || function __assign(t) {
@@ -50,6 +52,15 @@ var _init = function (inputOptions, readyCallback) {
50
52
  if (options.recordCrossDomainIFrames) {
51
53
  window._fs_run_in_iframe = true;
52
54
  }
55
+ if (options.appHost) {
56
+ window._fs_app_host = options.appHost;
57
+ }
58
+ if (options.assetMapId) {
59
+ window._fs_asset_map_id = options.assetMapId;
60
+ }
61
+ if (options.startCaptureManually) {
62
+ window._fs_capture_on_startup = false;
63
+ }
53
64
  // record the contents of this iFrame when embedded in a parent site
54
65
  if (options.recordOnlyThisIFrame) {
55
66
  window._fs_is_outer_script = true;
@@ -69,9 +80,12 @@ var _init = function (inputOptions, readyCallback) {
69
80
  initFS(options);
70
81
  var fs = getFullStory();
71
82
  if (!fs) {
72
- console.warn('Trouble with fs');
83
+ console.warn('Failed to initialize FS snippet');
73
84
  return;
74
85
  }
86
+ if (options.sessionUid) {
87
+ fs('init', { env: { sessionUid: options.sessionUid } });
88
+ }
75
89
  if (readyCallback) {
76
90
  fs('observe', { type: 'start', callback: readyCallback });
77
91
  }
@@ -80,7 +94,7 @@ var _init = function (inputOptions, readyCallback) {
80
94
  fs('trackEvent', {
81
95
  name: 'FullStory Dev Mode',
82
96
  properties: {
83
- message_str: message,
97
+ message: message,
84
98
  }
85
99
  });
86
100
  fs('shutdown');
@@ -114,7 +128,7 @@ var guard = function (name) { return function () {
114
128
  args[_i] = arguments[_i];
115
129
  }
116
130
  if (window._fs_dev_mode) {
117
- var message = "FullStory is in dev mode and is not recording: ".concat(name, " method not executed");
131
+ var message = "FullStory is in dev mode and is not capturing: ".concat(name, " method not executed");
118
132
  console.warn(message);
119
133
  return message;
120
134
  }
@@ -125,27 +139,30 @@ var guard = function (name) { return function () {
125
139
  console.warn("FS.".concat(name, " not ready"));
126
140
  return null;
127
141
  }; };
128
- var FullStory = Object.assign(function (operation, options, source) {
129
- var fs = ensureSnippetLoaded();
130
- if (window._fs_dev_mode) {
131
- var message = 'FullStory is in dev mode and is not recording: method not executed';
132
- console.warn(message);
133
- return undefined;
134
- }
135
- return fs(operation, options, source);
136
- }, {
137
- anonymize: guard('anonymize'),
138
- consent: guard('consent'),
139
- disableConsole: guard('disableConsole'),
140
- enableConsole: guard('enableConsole'),
141
- event: guard('event'),
142
- getCurrentSessionURL: guard('getCurrentSessionURL'),
143
- identify: guard('identify'),
144
- log: guard('log'),
145
- restart: guard('restart'),
146
- setUserVars: guard('setUserVars'),
147
- setVars: guard('setVars'),
148
- shutdown: guard('shutdown'),
149
- });
142
+ var buildFullStoryShim = function () {
143
+ var FS = function (operation, options, source) {
144
+ var fs = ensureSnippetLoaded();
145
+ if (window._fs_dev_mode) {
146
+ var message = "FullStory is in dev mode and is not capturing: ".concat(operation, " not executed");
147
+ console.warn(message);
148
+ return undefined;
149
+ }
150
+ return fs(operation, options, source);
151
+ };
152
+ FS.anonymize = guard('anonymize');
153
+ FS.consent = guard('consent');
154
+ FS.disableConsole = guard('disableConsole');
155
+ FS.enableConsole = guard('enableConsole');
156
+ FS.event = guard('event');
157
+ FS.getCurrentSessionURL = guard('getCurrentSessionURL');
158
+ FS.identify = guard('identify');
159
+ FS.log = guard('log');
160
+ FS.restart = guard('restart');
161
+ FS.setUserVars = guard('setUserVars');
162
+ FS.setVars = guard('setVars');
163
+ FS.shutdown = guard('shutdown');
164
+ return FS;
165
+ };
166
+ var FullStory = buildFullStoryShim();
150
167
 
151
- export { FullStory as default, init, isInitialized };
168
+ export { FullStory, init, isInitialized };
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var snippet = require('@fullstory/snippet');
6
4
 
7
5
  /******************************************************************************
@@ -18,6 +16,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
16
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
17
  PERFORMANCE OF THIS SOFTWARE.
20
18
  ***************************************************************************** */
19
+ /* global Reflect, Promise */
20
+
21
21
 
22
22
  var __assign = function() {
23
23
  __assign = Object.assign || function __assign(t) {
@@ -54,6 +54,15 @@ var _init = function (inputOptions, readyCallback) {
54
54
  if (options.recordCrossDomainIFrames) {
55
55
  window._fs_run_in_iframe = true;
56
56
  }
57
+ if (options.appHost) {
58
+ window._fs_app_host = options.appHost;
59
+ }
60
+ if (options.assetMapId) {
61
+ window._fs_asset_map_id = options.assetMapId;
62
+ }
63
+ if (options.startCaptureManually) {
64
+ window._fs_capture_on_startup = false;
65
+ }
57
66
  // record the contents of this iFrame when embedded in a parent site
58
67
  if (options.recordOnlyThisIFrame) {
59
68
  window._fs_is_outer_script = true;
@@ -73,9 +82,12 @@ var _init = function (inputOptions, readyCallback) {
73
82
  snippet.initFS(options);
74
83
  var fs = getFullStory();
75
84
  if (!fs) {
76
- console.warn('Trouble with fs');
85
+ console.warn('Failed to initialize FS snippet');
77
86
  return;
78
87
  }
88
+ if (options.sessionUid) {
89
+ fs('init', { env: { sessionUid: options.sessionUid } });
90
+ }
79
91
  if (readyCallback) {
80
92
  fs('observe', { type: 'start', callback: readyCallback });
81
93
  }
@@ -84,7 +96,7 @@ var _init = function (inputOptions, readyCallback) {
84
96
  fs('trackEvent', {
85
97
  name: 'FullStory Dev Mode',
86
98
  properties: {
87
- message_str: message,
99
+ message: message,
88
100
  }
89
101
  });
90
102
  fs('shutdown');
@@ -118,7 +130,7 @@ var guard = function (name) { return function () {
118
130
  args[_i] = arguments[_i];
119
131
  }
120
132
  if (window._fs_dev_mode) {
121
- var message = "FullStory is in dev mode and is not recording: ".concat(name, " method not executed");
133
+ var message = "FullStory is in dev mode and is not capturing: ".concat(name, " method not executed");
122
134
  console.warn(message);
123
135
  return message;
124
136
  }
@@ -129,29 +141,32 @@ var guard = function (name) { return function () {
129
141
  console.warn("FS.".concat(name, " not ready"));
130
142
  return null;
131
143
  }; };
132
- var FullStory = Object.assign(function (operation, options, source) {
133
- var fs = ensureSnippetLoaded();
134
- if (window._fs_dev_mode) {
135
- var message = 'FullStory is in dev mode and is not recording: method not executed';
136
- console.warn(message);
137
- return undefined;
138
- }
139
- return fs(operation, options, source);
140
- }, {
141
- anonymize: guard('anonymize'),
142
- consent: guard('consent'),
143
- disableConsole: guard('disableConsole'),
144
- enableConsole: guard('enableConsole'),
145
- event: guard('event'),
146
- getCurrentSessionURL: guard('getCurrentSessionURL'),
147
- identify: guard('identify'),
148
- log: guard('log'),
149
- restart: guard('restart'),
150
- setUserVars: guard('setUserVars'),
151
- setVars: guard('setVars'),
152
- shutdown: guard('shutdown'),
153
- });
144
+ var buildFullStoryShim = function () {
145
+ var FS = function (operation, options, source) {
146
+ var fs = ensureSnippetLoaded();
147
+ if (window._fs_dev_mode) {
148
+ var message = "FullStory is in dev mode and is not capturing: ".concat(operation, " not executed");
149
+ console.warn(message);
150
+ return undefined;
151
+ }
152
+ return fs(operation, options, source);
153
+ };
154
+ FS.anonymize = guard('anonymize');
155
+ FS.consent = guard('consent');
156
+ FS.disableConsole = guard('disableConsole');
157
+ FS.enableConsole = guard('enableConsole');
158
+ FS.event = guard('event');
159
+ FS.getCurrentSessionURL = guard('getCurrentSessionURL');
160
+ FS.identify = guard('identify');
161
+ FS.log = guard('log');
162
+ FS.restart = guard('restart');
163
+ FS.setUserVars = guard('setUserVars');
164
+ FS.setVars = guard('setVars');
165
+ FS.shutdown = guard('shutdown');
166
+ return FS;
167
+ };
168
+ var FullStory = buildFullStoryShim();
154
169
 
155
- exports.default = FullStory;
170
+ exports.FullStory = FullStory;
156
171
  exports.init = init;
157
172
  exports.isInitialized = isInitialized;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstory/browser",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
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",
package/src/index.ts CHANGED
@@ -157,10 +157,10 @@ const initOnce = (message) => (inputOptions: SnippetOptions, readyCallback?: Rea
157
157
  window._fs_initialized = true;
158
158
  };
159
159
 
160
- export const init = initOnce('FullStory init has already been called once, additional invocations are ignored');
160
+ const init = initOnce('FullStory init has already been called once, additional invocations are ignored');
161
161
 
162
162
  // normalize undefined into boolean
163
- export const isInitialized = () => !!window._fs_initialized;
163
+ const isInitialized = () => !!window._fs_initialized;
164
164
 
165
165
  const hasFullStoryWithFunction = (...testNames) => {
166
166
  const fs = ensureSnippetLoaded();
@@ -210,4 +210,6 @@ const buildFullStoryShim = (): FSApi => {
210
210
  return FS as FSApi;
211
211
  };
212
212
 
213
- export const FullStory: FSApi = buildFullStoryShim();
213
+ const FullStory: FSApi = buildFullStoryShim();
214
+
215
+ export { FullStory, init, isInitialized };