@usermaven/nextjs 1.4.2 → 1.4.4

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.
Files changed (2) hide show
  1. package/lib/index.es.js +20 -11
  2. package/package.json +1 -1
package/lib/index.es.js CHANGED
@@ -1547,8 +1547,8 @@ var FormTracking = /** @class */ (function () {
1547
1547
 
1548
1548
  var VERSION_INFO = {
1549
1549
  env: 'production',
1550
- date: '2024-11-15T06:39:44.205Z',
1551
- version: '1.4.2'
1550
+ date: '2024-11-19T12:36:28.908Z',
1551
+ version: '1.4.4'
1552
1552
  };
1553
1553
  var USERMAVEN_VERSION = VERSION_INFO.version + "/" + VERSION_INFO.env + "@" + VERSION_INFO.date;
1554
1554
  var MAX_AGE_TEN_YEARS = 31622400 * 10;
@@ -1655,7 +1655,12 @@ var browserEnv = {
1655
1655
  doc_encoding: document.characterSet,
1656
1656
  }); },
1657
1657
  getAnonymousId: function (_a) {
1658
- var name = _a.name, domain = _a.domain, _b = _a.crossDomainLinking, crossDomainLinking = _b === void 0 ? true : _b;
1658
+ var name = _a.name, domain = _a.domain, _b = _a.crossDomainLinking, crossDomainLinking = _b === void 0 ? true : _b, _c = _a.cookiePolicy, cookiePolicy = _c === void 0 ? 'keep' : _c;
1659
+ // In strict mode (cookiePolicy === 'strict'), don't use cookies at all
1660
+ if (cookiePolicy === 'strict') {
1661
+ // Return an empty string to indicate that we don't want to use cookies
1662
+ return "";
1663
+ }
1659
1664
  expireNonRootCookies(name);
1660
1665
  // Check if cross domain linking is enabled
1661
1666
  if (crossDomainLinking) {
@@ -1731,10 +1736,15 @@ function httpApi(req, res, opts) {
1731
1736
  };
1732
1737
  return {
1733
1738
  getAnonymousId: function (_a) {
1734
- var name = _a.name, domain = _a.domain;
1739
+ var name = _a.name, domain = _a.domain, _b = _a.cookiePolicy, cookiePolicy = _b === void 0 ? 'keep' : _b;
1735
1740
  if (opts === null || opts === void 0 ? void 0 : opts.disableCookies) {
1736
1741
  return "";
1737
1742
  }
1743
+ // In strict mode (cookiePolicy === 'strict'), don't use cookies at all
1744
+ if (cookiePolicy === 'strict') {
1745
+ // Return an empty string to indicate that we don't want to use cookies
1746
+ return "";
1747
+ }
1738
1748
  var cookie = parseCookieString(req.headers["cookie"])[name];
1739
1749
  if (!cookie) {
1740
1750
  var cookieOpts = {
@@ -2164,13 +2174,12 @@ var UsermavenClientImpl = /** @class */ (function () {
2164
2174
  var user = __assign({}, this.userProperties);
2165
2175
  var company = user['company'] || {};
2166
2176
  delete user['company'];
2167
- var payload = __assign(__assign({ event_id: "", user: __assign(__assign({}, user), { anonymous_id: this.cookiePolicy !== "strict"
2168
- ? env.getAnonymousId({
2169
- name: this.idCookieName,
2170
- domain: this.cookieDomain,
2171
- crossDomainLinking: this.crossDomainLinking,
2172
- })
2173
- : "" }), ids: this._getIds(), utc_time: reformatDate(now.toISOString()), local_tz_offset: now.getTimezoneOffset() }, props), getDataFromParams(parseQuery(props.doc_search)));
2177
+ var payload = __assign(__assign({ event_id: "", user: __assign(__assign({}, user), { anonymous_id: env.getAnonymousId({
2178
+ name: this.idCookieName,
2179
+ domain: this.cookieDomain,
2180
+ crossDomainLinking: this.crossDomainLinking,
2181
+ cookiePolicy: this.cookiePolicy
2182
+ }) }), ids: this._getIds(), utc_time: reformatDate(now.toISOString()), local_tz_offset: now.getTimezoneOffset() }, props), getDataFromParams(parseQuery(props.doc_search)));
2174
2183
  // id and name attributes will be checked on backend
2175
2184
  if (Object.keys(company).length) {
2176
2185
  payload['company'] = company;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usermaven/nextjs",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Usermaven JavaScript SDK for NextJS",
5
5
  "author": "Usermaven <hello@usermaven.com>",
6
6
  "license": "MIT",