@usermaven/sdk-js 1.0.2 → 1.0.3

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.
@@ -1719,8 +1719,8 @@ class SessionIdManager {
1719
1719
 
1720
1720
  var VERSION_INFO = {
1721
1721
  env: 'production',
1722
- date: '2022-01-29T08:33:18.619Z',
1723
- version: '1.0.2'
1722
+ date: '2022-02-08T08:25:18.822Z',
1723
+ version: '1.0.3'
1724
1724
  };
1725
1725
  var USERMAVEN_VERSION = "".concat(VERSION_INFO.version, "/").concat(VERSION_INFO.env, "@").concat(VERSION_INFO.date);
1726
1726
  var beaconTransport = function (url, json) {
@@ -1898,14 +1898,14 @@ var UsermavenClientImpl = /** @class */ (function () {
1898
1898
  UsermavenClientImpl.prototype.getCtx = function () {
1899
1899
  var now = new Date();
1900
1900
  var _a = this.sessionManager.getSessionAndWindowId(), sessionId = _a.sessionId, windowId = _a.windowId;
1901
- // extract account details from identity payload
1901
+ // extract company details from identity payload
1902
1902
  var user = __assign({ anonymous_id: this.anonymousId }, this.userProperties);
1903
- var account = user['account'] || {};
1904
- delete user['account'];
1903
+ var company = user['company'] || {};
1904
+ delete user['company'];
1905
1905
  var payload = __assign({ event_id: '', session_id: sessionId, window_id: windowId, user: user, ids: this._getIds(), user_agent: navigator.userAgent, utc_time: reformatDate(now.toISOString()), local_tz_offset: now.getTimezoneOffset(), referer: document.referrer, url: window.location.href, page_title: document.title, doc_path: document.location.pathname, doc_host: document.location.hostname, doc_search: window.location.search, screen_resolution: screen.width + 'x' + screen.height, vp_size: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) + 'x' + Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0), user_language: navigator.language, doc_encoding: document.characterSet }, getDataFromParams(parseQuery()));
1906
1906
  // id and name attributes will be checked on backend
1907
- if (Object.keys(account).length) {
1908
- payload['account'] = account;
1907
+ if (Object.keys(company).length) {
1908
+ payload['company'] = company;
1909
1909
  }
1910
1910
  return payload;
1911
1911
  };
@@ -27,7 +27,7 @@ export type UsermavenClient = {
27
27
  rawTrack: (payload: any) => void
28
28
 
29
29
  /**
30
- * Sets a user data including organization/account data
30
+ * Sets a user data including organization/company data
31
31
  * @param userData user data (as map id_type --> value, such as "email": "a@bcd.com"
32
32
  * @param doNotSendEvent if true (false by default), separate "id" event won't be sent to server
33
33
  * @return Promise, see _send3p documentation
@@ -198,15 +198,21 @@ export type UsermavenOptions = {
198
198
  */
199
199
  persistence_name?: string;
200
200
 
201
+ /**
202
+ * Persistent connection version
203
+ */
204
+ project_id?: string;
205
+
201
206
  //NOTE: If any property is added here, please make sure it's added to browser.ts usermavenProps as well
207
+
202
208
  };
203
209
 
204
210
  /**
205
- * Account Attributes
211
+ * Company Attributes
206
212
  */
207
- export interface AccountProps {
208
- id: string; // Account ID
209
- name: string; // Account Name
213
+ export interface CompanyProps {
214
+ id: string; // Company ID
215
+ name: string; // Company Name
210
216
  custom: any; // Optional attributes such as industry, website, employee count etc.
211
217
  }
212
218
 
@@ -218,7 +224,7 @@ export interface UserProps {
218
224
  id?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
219
225
  email?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
220
226
  [propName: string]: any //any other forms of ids
221
- account?: AccountProps
227
+ company?: CompanyProps
222
228
  }
223
229
 
224
230
  /**
@@ -247,7 +253,7 @@ export type Conversion = {
247
253
  export type EventCtx = {
248
254
  event_id: string //unique event id or empty string for generating id on the backend side
249
255
  user: UserProps //user properties
250
- account?: AccountProps //account properties
256
+ company?: CompanyProps //company properties
251
257
  ids?: ThirdpartyIds //user ids from external systems
252
258
  user_agent: string //user
253
259
  utc_time: string //current UTC time in ISO 8601
@@ -1715,8 +1715,8 @@ class SessionIdManager {
1715
1715
 
1716
1716
  var VERSION_INFO = {
1717
1717
  env: 'production',
1718
- date: '2022-01-29T08:33:18.619Z',
1719
- version: '1.0.2'
1718
+ date: '2022-02-08T08:25:18.822Z',
1719
+ version: '1.0.3'
1720
1720
  };
1721
1721
  var USERMAVEN_VERSION = "".concat(VERSION_INFO.version, "/").concat(VERSION_INFO.env, "@").concat(VERSION_INFO.date);
1722
1722
  var beaconTransport = function (url, json) {
@@ -1894,14 +1894,14 @@ var UsermavenClientImpl = /** @class */ (function () {
1894
1894
  UsermavenClientImpl.prototype.getCtx = function () {
1895
1895
  var now = new Date();
1896
1896
  var _a = this.sessionManager.getSessionAndWindowId(), sessionId = _a.sessionId, windowId = _a.windowId;
1897
- // extract account details from identity payload
1897
+ // extract company details from identity payload
1898
1898
  var user = __assign({ anonymous_id: this.anonymousId }, this.userProperties);
1899
- var account = user['account'] || {};
1900
- delete user['account'];
1899
+ var company = user['company'] || {};
1900
+ delete user['company'];
1901
1901
  var payload = __assign({ event_id: '', session_id: sessionId, window_id: windowId, user: user, ids: this._getIds(), user_agent: navigator.userAgent, utc_time: reformatDate(now.toISOString()), local_tz_offset: now.getTimezoneOffset(), referer: document.referrer, url: window.location.href, page_title: document.title, doc_path: document.location.pathname, doc_host: document.location.hostname, doc_search: window.location.search, screen_resolution: screen.width + 'x' + screen.height, vp_size: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) + 'x' + Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0), user_language: navigator.language, doc_encoding: document.characterSet }, getDataFromParams(parseQuery()));
1902
1902
  // id and name attributes will be checked on backend
1903
- if (Object.keys(account).length) {
1904
- payload['account'] = account;
1903
+ if (Object.keys(company).length) {
1904
+ payload['company'] = company;
1905
1905
  }
1906
1906
  return payload;
1907
1907
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usermaven/sdk-js",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Usermaven JavaScript SDK.",
5
5
  "main": "dist/npm/usermaven.cjs.js",
6
6
  "module": "dist/npm/dist/usermaven.esm.js",