@miso.ai/client-sdk-core 1.10.2-beta.8 → 1.10.2-beta.9

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.
@@ -96,24 +96,17 @@ class UserPlugin extends _commons.Component {
96
96
  exports.default = UserPlugin;
97
97
  let _pageBasedAutoAnonymousId;
98
98
  function getAutoAnonymousId() {
99
- try {
100
- return (0, _commons.getOrComputeFromStorage)('miso_anonymous_id', _commons.uuidv4);
101
- } catch (e) {
102
- // if the SDK is loaded as a 3rd party script, accessing cookie/localStorage may throw a SecurityError
103
- // in this case, abort getting the auto anonymous id
104
- if (e.name !== 'SecurityError') {
105
- throw e;
106
- }
107
- }
108
- // fallback to page-based auto anonymous id
109
- return _pageBasedAutoAnonymousId || (_pageBasedAutoAnonymousId = (0, _commons.uuidv4)());
99
+ // 1. Cache the value for the page
100
+ // 2. Get and set the value from cookies/localStorage is possible
101
+ // 3. In case cookies/localStorage are disabled, generate a new value for each page
102
+ return _pageBasedAutoAnonymousId || (_pageBasedAutoAnonymousId = (0, _commons.getOrComputeFromStorage)('miso_anonymous_id', _commons.uuidv4));
110
103
  }
111
104
  class UserContext {
112
105
  constructor(plugin) {
113
106
  this._plugin = plugin;
114
107
  }
115
108
  get anonymous_id() {
116
- return this._anonymousId || this._autoAnonymousId || (this._autoAnonymousId = getAutoAnonymousId());
109
+ return this._anonymousId || getAutoAnonymousId();
117
110
  }
118
111
  set anonymous_id(value) {
119
112
  value = (0, _commons.asString)(value);
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '1.10.2-beta.8';
7
+ var _default = exports.default = '1.10.2-beta.9';
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@miso.ai/commons": "1.10.2-beta.8"
32
+ "@miso.ai/commons": "1.10.2-beta.9"
33
33
  },
34
- "version": "1.10.2-beta.8"
34
+ "version": "1.10.2-beta.9"
35
35
  }
@@ -64,17 +64,10 @@ export default class UserPlugin extends Component {
64
64
  let _pageBasedAutoAnonymousId;
65
65
 
66
66
  function getAutoAnonymousId() {
67
- try {
68
- return getOrComputeFromStorage('miso_anonymous_id', uuidv4);
69
- } catch (e) {
70
- // if the SDK is loaded as a 3rd party script, accessing cookie/localStorage may throw a SecurityError
71
- // in this case, abort getting the auto anonymous id
72
- if (e.name !== 'SecurityError') {
73
- throw e;
74
- }
75
- }
76
- // fallback to page-based auto anonymous id
77
- return _pageBasedAutoAnonymousId || (_pageBasedAutoAnonymousId = uuidv4());
67
+ // 1. Cache the value for the page
68
+ // 2. Get and set the value from cookies/localStorage is possible
69
+ // 3. In case cookies/localStorage are disabled, generate a new value for each page
70
+ return _pageBasedAutoAnonymousId || (_pageBasedAutoAnonymousId = getOrComputeFromStorage('miso_anonymous_id', uuidv4));
78
71
  }
79
72
 
80
73
  class UserContext {
@@ -84,7 +77,7 @@ class UserContext {
84
77
  }
85
78
 
86
79
  get anonymous_id() {
87
- return this._anonymousId || this._autoAnonymousId || (this._autoAnonymousId = getAutoAnonymousId());
80
+ return this._anonymousId || getAutoAnonymousId();
88
81
  }
89
82
 
90
83
  set anonymous_id(value) {
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.10.2-beta.8';
1
+ export default '1.10.2-beta.9';