@fullstory/browser 1.4.10 → 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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0
4
+
5
+ - Adding the `setVars` API function
6
+
3
7
  ## 1.4.10
4
8
 
5
9
  - Adding docs to the types file (index.d.ts)
package/README.md CHANGED
@@ -123,3 +123,16 @@ FullStory.event('Subscribed', {
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
@@ -29,6 +29,8 @@ interface UserVars {
29
29
 
30
30
  type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
31
31
 
32
+ type VarScope = 'page';
33
+
32
34
  // API functions that are available as soon as the snippet has executed.
33
35
  export function anonymize(): void;
34
36
  export function consent(userConsents?: boolean): void;
@@ -40,6 +42,7 @@ export function log(msg: string): void;
40
42
  export function restart(): void;
41
43
  export function setUserVars(customVars: UserVars): void;
42
44
  export function shutdown(): void;
45
+ export function setVars(varScope: VarScope, properties?: { [key: string]: any }): void;
43
46
 
44
47
  // API functions that are available after /rec/page returns.
45
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.10",
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",
@@ -43,7 +43,7 @@
43
43
  "karma-mocha": "^2.0.1",
44
44
  "karma-spec-reporter": "0.0.32",
45
45
  "karma-webpack": "^5.0.0",
46
- "mocha": "^9.0.0",
46
+ "mocha": "^9.2.0",
47
47
  "rimraf": "^2.7.1",
48
48
  "rollup": "^1.32.1",
49
49
  "rollup-plugin-copy": "^3.3.0",
package/src/index.d.ts CHANGED
@@ -29,6 +29,8 @@ interface UserVars {
29
29
 
30
30
  type LogLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
31
31
 
32
+ type VarScope = 'page';
33
+
32
34
  // API functions that are available as soon as the snippet has executed.
33
35
  export function anonymize(): void;
34
36
  export function consent(userConsents?: boolean): void;
@@ -40,6 +42,7 @@ export function log(msg: string): void;
40
42
  export function restart(): void;
41
43
  export function setUserVars(customVars: UserVars): void;
42
44
  export function shutdown(): void;
45
+ export function setVars(varScope: VarScope, properties?: { [key: string]: any }): void;
43
46
 
44
47
  // API functions that are available after /rec/page returns.
45
48
  // FullStory bootstrapping details: https://help.fullstory.com/hc/en-us/articles/360032975773
package/src/index.js CHANGED
@@ -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()) {