@fullstory/browser 1.6.1 → 1.6.2

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.2
4
+
5
+ - Load `fs-debug.js` capture script when `debug = true` option is used to match updated debug logging practices.
6
+
3
7
  ## 1.6.1
4
8
 
5
9
  - Fix a TypeScript type issue with the `readyCallback` API (#144)
package/README.md CHANGED
@@ -40,7 +40,7 @@ The only required option is `orgId`, all others are optional.
40
40
  The `init` function also accepts an optional `readyCallback` argument. If you provide a function, it will be invoked when the FullStory session has started. Your callback will be called with one parameter: an object containing information about the session. Currently the only property is `sessionUrl`, which is a string containing the URL to the session.
41
41
 
42
42
  ```javascript
43
- FullStory.init({ orgId, ({ sessionUrl }) => console.log(`Started session: ${sessionUrl}`));
43
+ FullStory.init({ orgId }, ({ sessionUrl }) => console.log(`Started session: ${sessionUrl}`));
44
44
  ```
45
45
 
46
46
  ### Initialization Examples
package/dist/index.esm.js CHANGED
@@ -1,9 +1,49 @@
1
+ function ownKeys(object, enumerableOnly) {
2
+ var keys = Object.keys(object);
3
+
4
+ if (Object.getOwnPropertySymbols) {
5
+ var symbols = Object.getOwnPropertySymbols(object);
6
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
7
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
8
+ })), keys.push.apply(keys, symbols);
9
+ }
10
+
11
+ return keys;
12
+ }
13
+
14
+ function _objectSpread2(target) {
15
+ for (var i = 1; i < arguments.length; i++) {
16
+ var source = null != arguments[i] ? arguments[i] : {};
17
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
18
+ _defineProperty(target, key, source[key]);
19
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
20
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21
+ });
22
+ }
23
+
24
+ return target;
25
+ }
26
+
27
+ function _defineProperty(obj, key, value) {
28
+ if (key in obj) {
29
+ Object.defineProperty(obj, key, {
30
+ value: value,
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true
34
+ });
35
+ } else {
36
+ obj[key] = value;
37
+ }
38
+
39
+ return obj;
40
+ }
41
+
1
42
  var snippet = function snippet(_ref) {
2
43
  var orgId = _ref.orgId,
3
44
  _ref$namespace = _ref.namespace,
4
45
  namespace = _ref$namespace === void 0 ? 'FS' : _ref$namespace,
5
46
  _ref$debug = _ref.debug,
6
- debug = _ref$debug === void 0 ? false : _ref$debug,
7
47
  _ref$host = _ref.host,
8
48
  host = _ref$host === void 0 ? 'fullstory.com' : _ref$host,
9
49
  _ref$script = _ref.script,
@@ -13,7 +53,6 @@ var snippet = function snippet(_ref) {
13
53
  throw new Error('FullStory orgId is a required parameter');
14
54
  }
15
55
 
16
- window['_fs_debug'] = debug;
17
56
  window['_fs_host'] = host;
18
57
  window['_fs_script'] = script;
19
58
  window['_fs_org'] = orgId;
@@ -157,7 +196,9 @@ var restart = guard('restart');
157
196
  var anonymize = guard('anonymize');
158
197
  var setVars = guard('setVars');
159
198
 
160
- var _init = function _init(options, readyCallback) {
199
+ var _init = function _init(inputOptions, readyCallback) {
200
+ var options = _objectSpread2({}, inputOptions);
201
+
161
202
  if (fs()) {
162
203
  console.warn('The FullStory snippet has already been defined elsewhere (likely in the <head> element)');
163
204
  return;
@@ -171,6 +212,14 @@ var _init = function _init(options, readyCallback) {
171
212
  window._fs_is_outer_script = true;
172
213
  }
173
214
 
215
+ if (options.debug === true) {
216
+ if (!options.script) {
217
+ options.script = 'edge.fullstory.com/s/fs-debug.js';
218
+ } else {
219
+ console.warn('Ignoring `debug = true` because `script` is set');
220
+ }
221
+ }
222
+
174
223
  snippet(options);
175
224
 
176
225
  if (readyCallback) {
package/dist/index.js CHANGED
@@ -2,12 +2,52 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ function ownKeys(object, enumerableOnly) {
6
+ var keys = Object.keys(object);
7
+
8
+ if (Object.getOwnPropertySymbols) {
9
+ var symbols = Object.getOwnPropertySymbols(object);
10
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
11
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
12
+ })), keys.push.apply(keys, symbols);
13
+ }
14
+
15
+ return keys;
16
+ }
17
+
18
+ function _objectSpread2(target) {
19
+ for (var i = 1; i < arguments.length; i++) {
20
+ var source = null != arguments[i] ? arguments[i] : {};
21
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
22
+ _defineProperty(target, key, source[key]);
23
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
24
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
25
+ });
26
+ }
27
+
28
+ return target;
29
+ }
30
+
31
+ function _defineProperty(obj, key, value) {
32
+ if (key in obj) {
33
+ Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
38
+ });
39
+ } else {
40
+ obj[key] = value;
41
+ }
42
+
43
+ return obj;
44
+ }
45
+
5
46
  var snippet = function snippet(_ref) {
6
47
  var orgId = _ref.orgId,
7
48
  _ref$namespace = _ref.namespace,
8
49
  namespace = _ref$namespace === void 0 ? 'FS' : _ref$namespace,
9
50
  _ref$debug = _ref.debug,
10
- debug = _ref$debug === void 0 ? false : _ref$debug,
11
51
  _ref$host = _ref.host,
12
52
  host = _ref$host === void 0 ? 'fullstory.com' : _ref$host,
13
53
  _ref$script = _ref.script,
@@ -17,7 +57,6 @@ var snippet = function snippet(_ref) {
17
57
  throw new Error('FullStory orgId is a required parameter');
18
58
  }
19
59
 
20
- window['_fs_debug'] = debug;
21
60
  window['_fs_host'] = host;
22
61
  window['_fs_script'] = script;
23
62
  window['_fs_org'] = orgId;
@@ -161,7 +200,9 @@ var restart = guard('restart');
161
200
  var anonymize = guard('anonymize');
162
201
  var setVars = guard('setVars');
163
202
 
164
- var _init = function _init(options, readyCallback) {
203
+ var _init = function _init(inputOptions, readyCallback) {
204
+ var options = _objectSpread2({}, inputOptions);
205
+
165
206
  if (fs()) {
166
207
  console.warn('The FullStory snippet has already been defined elsewhere (likely in the <head> element)');
167
208
  return;
@@ -175,6 +216,14 @@ var _init = function _init(options, readyCallback) {
175
216
  window._fs_is_outer_script = true;
176
217
  }
177
218
 
219
+ if (options.debug === true) {
220
+ if (!options.script) {
221
+ options.script = 'edge.fullstory.com/s/fs-debug.js';
222
+ } else {
223
+ console.warn('Ignoring `debug = true` because `script` is set');
224
+ }
225
+ }
226
+
178
227
  snippet(options);
179
228
 
180
229
  if (readyCallback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstory/browser",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
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.js CHANGED
@@ -17,14 +17,14 @@ const hasFullStoryWithFunction = (...testNames) => {
17
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
- console.warn(message); // eslint-disable-line no-console
20
+ console.warn(message);
21
21
  return message;
22
22
  }
23
23
 
24
24
  if (hasFullStoryWithFunction(name)) {
25
25
  return fs()[name](...args);
26
26
  }
27
- console.warn(`FS.${name} not ready`); // eslint-disable-line no-console
27
+ console.warn(`FS.${name} not ready`);
28
28
  return null;
29
29
  };
30
30
 
@@ -39,9 +39,10 @@ export const restart = guard('restart');
39
39
  export const anonymize = guard('anonymize');
40
40
  export const setVars = guard('setVars');
41
41
 
42
- const _init = (options, readyCallback) => {
42
+ const _init = (inputOptions, readyCallback) => {
43
+ // Make a copy so we can modify `options` if desired.
44
+ const options = { ...inputOptions };
43
45
  if (fs()) {
44
- // eslint-disable-next-line no-console
45
46
  console.warn('The FullStory snippet has already been defined elsewhere (likely in the <head> element)');
46
47
  return;
47
48
  }
@@ -56,6 +57,14 @@ const _init = (options, readyCallback) => {
56
57
  window._fs_is_outer_script = true;
57
58
  }
58
59
 
60
+ if (options.debug === true) {
61
+ if (!options.script) {
62
+ options.script = 'edge.fullstory.com/s/fs-debug.js';
63
+ } else {
64
+ console.warn('Ignoring `debug = true` because `script` is set');
65
+ }
66
+ }
67
+
59
68
  snippet(options);
60
69
 
61
70
  if (readyCallback) {
@@ -69,13 +78,12 @@ const _init = (options, readyCallback) => {
69
78
  });
70
79
  shutdown();
71
80
  window._fs_dev_mode = true;
72
- console.warn(message); // eslint-disable-line no-console
81
+ console.warn(message);
73
82
  }
74
83
  };
75
84
 
76
85
  const initOnce = (fn, message) => (...args) => {
77
86
  if (window._fs_initialized) {
78
- // eslint-disable-next-line no-console
79
87
  if (message) console.warn(message);
80
88
  return;
81
89
  }
package/src/snippet.js CHANGED
@@ -13,8 +13,7 @@ const snippet = (
13
13
  throw new Error('FullStory orgId is a required parameter');
14
14
  }
15
15
  /* begin FullStory snippet */
16
- window['_fs_debug'] = debug;
17
- window['_fs_host'] = host;
16
+ window['_fs_host'] = host;
18
17
  window['_fs_script'] = script;
19
18
  window['_fs_org'] = orgId;
20
19
  window['_fs_namespace'] = namespace;