@usermaven/sdk-js 1.0.1 → 1.0.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/dist/npm/usermaven.cjs.js +12 -3
- package/dist/npm/usermaven.d.ts +12 -2
- package/dist/npm/usermaven.es.js +12 -3
- package/package.json +1 -1
|
@@ -1719,8 +1719,8 @@ class SessionIdManager {
|
|
|
1719
1719
|
|
|
1720
1720
|
var VERSION_INFO = {
|
|
1721
1721
|
env: 'production',
|
|
1722
|
-
date: '2022-01-
|
|
1723
|
-
version: '1.0.
|
|
1722
|
+
date: '2022-01-29T08:33:18.619Z',
|
|
1723
|
+
version: '1.0.2'
|
|
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,7 +1898,16 @@ 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
|
-
|
|
1901
|
+
// extract account details from identity payload
|
|
1902
|
+
var user = __assign({ anonymous_id: this.anonymousId }, this.userProperties);
|
|
1903
|
+
var account = user['account'] || {};
|
|
1904
|
+
delete user['account'];
|
|
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
|
+
// id and name attributes will be checked on backend
|
|
1907
|
+
if (Object.keys(account).length) {
|
|
1908
|
+
payload['account'] = account;
|
|
1909
|
+
}
|
|
1910
|
+
return payload;
|
|
1902
1911
|
};
|
|
1903
1912
|
UsermavenClientImpl.prototype._getIds = function () {
|
|
1904
1913
|
var cookies = getCookies(false);
|
package/dist/npm/usermaven.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type UsermavenClient = {
|
|
|
27
27
|
rawTrack: (payload: any) => void
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Sets a user data
|
|
30
|
+
* Sets a user data including organization/account 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
|
|
@@ -59,7 +59,6 @@ export type UsermavenClient = {
|
|
|
59
59
|
* User
|
|
60
60
|
*/
|
|
61
61
|
unset(propertyName: string, opts: { eventType?: string, persist?: boolean });
|
|
62
|
-
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
/**
|
|
@@ -202,6 +201,15 @@ export type UsermavenOptions = {
|
|
|
202
201
|
//NOTE: If any property is added here, please make sure it's added to browser.ts usermavenProps as well
|
|
203
202
|
};
|
|
204
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Account Attributes
|
|
206
|
+
*/
|
|
207
|
+
export interface AccountProps {
|
|
208
|
+
id: string; // Account ID
|
|
209
|
+
name: string; // Account Name
|
|
210
|
+
custom: any; // Optional attributes such as industry, website, employee count etc.
|
|
211
|
+
}
|
|
212
|
+
|
|
205
213
|
/**
|
|
206
214
|
* User properties (ids).
|
|
207
215
|
*/
|
|
@@ -210,6 +218,7 @@ export interface UserProps {
|
|
|
210
218
|
id?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
|
|
211
219
|
email?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
|
|
212
220
|
[propName: string]: any //any other forms of ids
|
|
221
|
+
account?: AccountProps
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
/**
|
|
@@ -238,6 +247,7 @@ export type Conversion = {
|
|
|
238
247
|
export type EventCtx = {
|
|
239
248
|
event_id: string //unique event id or empty string for generating id on the backend side
|
|
240
249
|
user: UserProps //user properties
|
|
250
|
+
account?: AccountProps //account properties
|
|
241
251
|
ids?: ThirdpartyIds //user ids from external systems
|
|
242
252
|
user_agent: string //user
|
|
243
253
|
utc_time: string //current UTC time in ISO 8601
|
package/dist/npm/usermaven.es.js
CHANGED
|
@@ -1715,8 +1715,8 @@ class SessionIdManager {
|
|
|
1715
1715
|
|
|
1716
1716
|
var VERSION_INFO = {
|
|
1717
1717
|
env: 'production',
|
|
1718
|
-
date: '2022-01-
|
|
1719
|
-
version: '1.0.
|
|
1718
|
+
date: '2022-01-29T08:33:18.619Z',
|
|
1719
|
+
version: '1.0.2'
|
|
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,7 +1894,16 @@ 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
|
-
|
|
1897
|
+
// extract account details from identity payload
|
|
1898
|
+
var user = __assign({ anonymous_id: this.anonymousId }, this.userProperties);
|
|
1899
|
+
var account = user['account'] || {};
|
|
1900
|
+
delete user['account'];
|
|
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
|
+
// id and name attributes will be checked on backend
|
|
1903
|
+
if (Object.keys(account).length) {
|
|
1904
|
+
payload['account'] = account;
|
|
1905
|
+
}
|
|
1906
|
+
return payload;
|
|
1898
1907
|
};
|
|
1899
1908
|
UsermavenClientImpl.prototype._getIds = function () {
|
|
1900
1909
|
var cookies = getCookies(false);
|