@miso.ai/client-sdk-core 1.5.1 → 1.6.0-beta.1

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 (50) hide show
  1. package/dist/cjs/api/base.js +1 -15
  2. package/dist/cjs/api/helpers.js +2 -31
  3. package/dist/cjs/api/index.js +0 -9
  4. package/dist/cjs/api/interactions.js +7 -24
  5. package/dist/cjs/api/recommendation.js +0 -11
  6. package/dist/cjs/api/search.js +0 -8
  7. package/dist/cjs/classes.js +0 -9
  8. package/dist/cjs/client.js +0 -21
  9. package/dist/cjs/cmd.js +4 -8
  10. package/dist/cjs/context.js +0 -4
  11. package/dist/cjs/index.js +4 -8
  12. package/dist/cjs/plugin/anonymous.js +0 -4
  13. package/dist/cjs/plugin/auto-events.js +0 -28
  14. package/dist/cjs/plugin/index.js +0 -12
  15. package/dist/cjs/plugin/page-info.js +0 -12
  16. package/dist/cjs/plugin/plugin-root.js +7 -55
  17. package/dist/cjs/plugin/user.js +0 -26
  18. package/dist/cjs/root.js +4 -13
  19. package/dist/cjs/utils.js +7 -37
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/es/api/base.js +1 -12
  22. package/dist/es/api/helpers.js +2 -27
  23. package/dist/es/api/index.js +0 -1
  24. package/dist/es/api/interactions.js +7 -20
  25. package/dist/es/api/recommendation.js +0 -7
  26. package/dist/es/api/search.js +0 -4
  27. package/dist/es/client.js +0 -13
  28. package/dist/es/cmd.js +4 -7
  29. package/dist/es/context.js +0 -1
  30. package/dist/es/index.js +4 -4
  31. package/dist/es/plugin/anonymous.js +0 -1
  32. package/dist/es/plugin/auto-events.js +0 -24
  33. package/dist/es/plugin/index.js +1 -2
  34. package/dist/es/plugin/page-info.js +0 -8
  35. package/dist/es/plugin/plugin-root.js +7 -48
  36. package/dist/es/plugin/user.js +0 -22
  37. package/dist/es/root.js +5 -7
  38. package/dist/es/utils.js +1 -34
  39. package/dist/es/version.js +1 -1
  40. package/package.json +2 -2
  41. package/dist/cjs/plugin/units/constants.js +0 -10
  42. package/dist/cjs/plugin/units/index.js +0 -41
  43. package/dist/cjs/plugin/units/tracker.js +0 -365
  44. package/dist/cjs/plugin/units/unit.js +0 -63
  45. package/dist/cjs/plugin/units/units.js +0 -70
  46. package/dist/es/plugin/units/constants.js +0 -2
  47. package/dist/es/plugin/units/index.js +0 -27
  48. package/dist/es/plugin/units/tracker.js +0 -353
  49. package/dist/es/plugin/units/unit.js +0 -50
  50. package/dist/es/plugin/units/units.js +0 -56
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  class ApiBase extends _commons.Component {
11
9
  // TODO: use private fields (may encounter issues with rollup)
10
+
12
11
  constructor(api, apiPath) {
13
12
  super(apiPath, api);
14
13
  this._apiPath = apiPath;
@@ -16,7 +15,6 @@ class ApiBase extends _commons.Component {
16
15
  this.clientOptions = api._client.options;
17
16
  this.context = api._client.context;
18
17
  }
19
-
20
18
  async _run(apiName, payload) {
21
19
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
22
20
  this.helpers.assertReady();
@@ -27,14 +25,12 @@ class ApiBase extends _commons.Component {
27
25
  bulk: this.helpers.bulkInfo
28
26
  } : undefined;
29
27
  const apiGroup = this._apiPath;
30
-
31
28
  const url = this._url({
32
29
  apiGroup,
33
30
  apiName,
34
31
  payload,
35
32
  options
36
33
  });
37
-
38
34
  payload = this._preprocess({
39
35
  apiGroup,
40
36
  apiName,
@@ -48,19 +44,14 @@ class ApiBase extends _commons.Component {
48
44
  url,
49
45
  options
50
46
  };
51
-
52
47
  this._events.emit('request', Object.assign({}, requestData, bulkInfo));
53
-
54
48
  const response = await this._send(requestData);
55
49
  const responseData = Object.assign({}, requestData, {
56
50
  response
57
51
  });
58
-
59
52
  this._events.emit('response', Object.assign({}, responseData, bulkInfo));
60
-
61
53
  return this._postprocess(responseData);
62
54
  }
63
-
64
55
  _preprocess(_ref) {
65
56
  let {
66
57
  apiGroup,
@@ -73,7 +64,6 @@ class ApiBase extends _commons.Component {
73
64
  payload
74
65
  });
75
66
  }
76
-
77
67
  _url(_ref2) {
78
68
  let {
79
69
  apiGroup,
@@ -86,7 +76,6 @@ class ApiBase extends _commons.Component {
86
76
  url
87
77
  });
88
78
  }
89
-
90
79
  async _send(_ref3) {
91
80
  let {
92
81
  apiGroup,
@@ -102,7 +91,6 @@ class ApiBase extends _commons.Component {
102
91
  timeout
103
92
  });
104
93
  }
105
-
106
94
  _postprocess(_ref4) {
107
95
  let {
108
96
  response
@@ -110,7 +98,5 @@ class ApiBase extends _commons.Component {
110
98
  // TODO: we can introduce response passes
111
99
  return response.data;
112
100
  }
113
-
114
101
  }
115
-
116
102
  exports.default = ApiBase;
@@ -4,20 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  var _constants = require("../constants");
11
-
12
9
  class ApiHelpers {
13
10
  constructor(client, root) {
14
11
  this._client = client;
15
12
  this._root = root;
16
13
  this._bulk = new _commons.Bulk(this._runBulkFetch.bind(this), client._error.bind(client));
17
14
  }
18
-
19
15
  assertReady() {}
20
-
21
16
  async fetch(url, payload) {
22
17
  let {
23
18
  method = 'POST',
@@ -37,37 +32,30 @@ class ApiHelpers {
37
32
  });
38
33
  timeoutId && clearTimeout(timeoutId);
39
34
  const resBody = await res.json();
40
-
41
35
  if (res.status >= 400 || resBody.errors) {
42
36
  var err = new Error(resBody.message);
43
37
  err.data = resBody;
44
38
  err.status = res.status;
45
39
  throw err;
46
40
  }
47
-
48
41
  return resBody;
49
42
  }
50
-
51
43
  get bulkInfo() {
52
44
  return this._bulk.info;
53
45
  }
54
-
55
46
  async fetchForBulk(apiGroup, apiName, payload) {
56
47
  let {
57
48
  method
58
49
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
59
-
60
50
  if (method && method !== 'POST') {
61
51
  throw new Error(`Non-POST API is not supported in bulk mode: ${url}`);
62
52
  }
63
-
64
53
  return this._bulk.run({
65
54
  apiGroup,
66
55
  apiName,
67
56
  payload
68
57
  });
69
58
  }
70
-
71
59
  async _runBulkFetch(requests) {
72
60
  const url = this.url('bulk');
73
61
  const payload = {
@@ -88,7 +76,6 @@ class ApiHelpers {
88
76
  const {
89
77
  data: responses
90
78
  } = await this.fetch(url, payload);
91
-
92
79
  for (let i = 0, len = requests.length; i < len; i++) {
93
80
  const {
94
81
  resolution
@@ -98,7 +85,6 @@ class ApiHelpers {
98
85
  status_code,
99
86
  body
100
87
  } = responses[i];
101
-
102
88
  if (status_code >= 400 || error) {
103
89
  resolution.reject({
104
90
  status_code,
@@ -109,35 +95,28 @@ class ApiHelpers {
109
95
  }
110
96
  }
111
97
  }
112
-
113
98
  sendBeacon(url, payload) {
114
99
  let {
115
100
  method
116
101
  } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
117
-
118
102
  if (method && method !== 'POST') {
119
103
  throw new Error(`Non-POST API is not supported in useBeacon mode: ${url}`);
120
104
  }
121
-
122
105
  if (!window.navigator.sendBeacon(url, JSON.stringify(payload))) {
123
106
  throw new Error(`Send beacon unsuccessful: ${url}`);
124
107
  }
125
108
  }
126
-
127
109
  url() {
128
110
  const {
129
111
  apiKey
130
112
  } = this._client.options;
131
-
132
113
  for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
133
114
  paths[_key] = arguments[_key];
134
115
  }
135
-
136
- const apiName = paths.filter(s => s).join('/'); // TODO: neutralize use of DOM API
137
-
116
+ const apiName = paths.filter(s => s).join('/');
117
+ // TODO: neutralize use of DOM API
138
118
  return `${this.getApiEndpoint(apiName)}/${apiName}?api_key=${window.encodeURIComponent(apiKey)}`;
139
119
  }
140
-
141
120
  getApiEndpoint(apiName) {
142
121
  const {
143
122
  dataEndpoint = _constants.API.DATA_ENDPOINT,
@@ -145,7 +124,6 @@ class ApiHelpers {
145
124
  } = this._client.options;
146
125
  return apiName === 'interactions' ? eventEndpoint : dataEndpoint;
147
126
  }
148
-
149
127
  applyUrlPasses(component, _ref2) {
150
128
  let {
151
129
  apiGroup,
@@ -153,7 +131,6 @@ class ApiHelpers {
153
131
  url
154
132
  } = _ref2;
155
133
  const client = this._client;
156
-
157
134
  for (const pass of this._root._urlPasses) {
158
135
  try {
159
136
  url = pass({
@@ -166,10 +143,8 @@ class ApiHelpers {
166
143
  component.error(e);
167
144
  }
168
145
  }
169
-
170
146
  return url;
171
147
  }
172
-
173
148
  applyPayloadPasses(component, _ref3) {
174
149
  let {
175
150
  apiGroup,
@@ -177,7 +152,6 @@ class ApiHelpers {
177
152
  payload
178
153
  } = _ref3;
179
154
  const client = this._client;
180
-
181
155
  for (const pass of this._root._payloadPasses) {
182
156
  try {
183
157
  payload = pass({
@@ -190,10 +164,7 @@ class ApiHelpers {
190
164
  component.error(e);
191
165
  }
192
166
  }
193
-
194
167
  return payload;
195
168
  }
196
-
197
169
  }
198
-
199
170
  exports.default = ApiHelpers;
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  var _helpers = _interopRequireDefault(require("./helpers"));
11
-
12
9
  var _interactions = _interopRequireDefault(require("./interactions"));
13
-
14
10
  var _search = _interopRequireDefault(require("./search"));
15
-
16
11
  var _recommendation = _interopRequireDefault(require("./recommendation"));
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
13
  class Api extends _commons.Component {
21
14
  constructor(client, root) {
22
15
  super('api', client);
@@ -26,7 +19,5 @@ class Api extends _commons.Component {
26
19
  this.search = new _search.default(this);
27
20
  this.recommendation = new _recommendation.default(this);
28
21
  }
29
-
30
22
  }
31
-
32
23
  exports.default = Api;
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _base = _interopRequireDefault(require("./base"));
9
-
10
8
  const _excluded = ["useBeacon"],
11
- _excluded2 = ["options"];
12
-
9
+ _excluded2 = ["options"];
13
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
15
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
-
17
12
  class Interactions extends _base.default {
18
13
  constructor(api) {
19
14
  super(api, 'interactions');
20
15
  }
21
-
22
16
  async upload(payload, options) {
23
17
  try {
24
18
  return await this._run('upload', payload, options);
@@ -30,7 +24,6 @@ class Interactions extends _base.default {
30
24
  }
31
25
  }
32
26
  }
33
-
34
27
  _url(_ref) {
35
28
  let {
36
29
  apiGroup,
@@ -43,49 +36,41 @@ class Interactions extends _base.default {
43
36
  url
44
37
  });
45
38
  }
46
-
47
39
  _preprocess(_ref2) {
48
40
  let {
49
41
  apiGroup,
50
42
  apiName,
51
43
  payload
52
44
  } = _ref2;
53
-
54
45
  if (apiName === 'upload') {
55
46
  payload = this._normalizeUploadPayload(payload);
56
47
  }
57
-
58
48
  return super._preprocess({
59
49
  apiGroup,
60
50
  apiName,
61
51
  payload
62
52
  });
63
53
  }
64
-
65
54
  _normalizeUploadPayload(payload) {
66
55
  // TODO: accept string as a shortcut of { type: payload } as well
67
56
  if (typeof payload !== 'object') {
68
57
  throw new Error(`Interactions payload has to be either an object or an array of objects: ${payload}`);
69
58
  }
70
-
71
59
  if (!Array.isArray(payload)) {
72
60
  payload = [payload];
73
61
  }
74
-
75
62
  return {
76
63
  data: payload
77
64
  };
78
65
  }
79
-
80
66
  async _send(_ref3) {
81
67
  let {
82
- options: {
83
- useBeacon = true
84
- } = {}
85
- } = _ref3,
86
- options = _objectWithoutPropertiesLoose(_ref3.options, _excluded),
87
- args = _objectWithoutPropertiesLoose(_ref3, _excluded2);
88
-
68
+ options: {
69
+ useBeacon = true
70
+ } = {}
71
+ } = _ref3,
72
+ options = _objectWithoutPropertiesLoose(_ref3.options, _excluded),
73
+ args = _objectWithoutPropertiesLoose(_ref3, _excluded2);
89
74
  if (useBeacon) {
90
75
  const {
91
76
  url,
@@ -99,7 +84,5 @@ class Interactions extends _base.default {
99
84
  }));
100
85
  }
101
86
  }
102
-
103
87
  }
104
-
105
88
  exports.default = Interactions;
@@ -4,40 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _base = _interopRequireDefault(require("./base"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  class Recommendation extends _base.default {
13
10
  constructor(api) {
14
11
  super(api, 'recommendation');
15
12
  }
16
-
17
13
  async userToProducts(payload, options) {
18
14
  return this._run('user_to_products', payload, options);
19
15
  }
20
-
21
16
  async userToCategories(payload, options) {
22
17
  return this._run('user_to_categories', payload, options);
23
18
  }
24
-
25
19
  async userToAttributes(payload, options) {
26
20
  return this._run('user_to_attributes', payload, options);
27
21
  }
28
-
29
22
  async userToTrending(payload, options) {
30
23
  return this._run('user_to_trending', payload, options);
31
24
  }
32
-
33
25
  async userToHistory(payload, options) {
34
26
  return this._run('user_to_history', payload, options);
35
27
  }
36
-
37
28
  async productToProducts(payload, options) {
38
29
  return this._run('product_to_products', payload, options);
39
30
  }
40
-
41
31
  }
42
-
43
32
  exports.default = Recommendation;
@@ -4,28 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _base = _interopRequireDefault(require("./base"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  class Search extends _base.default {
13
10
  constructor(api) {
14
11
  super(api, 'search');
15
12
  }
16
-
17
13
  async search(payload, options) {
18
14
  return this._run('search', payload, options);
19
15
  }
20
-
21
16
  async autocomplete(payload, options) {
22
17
  return this._run('autocomplete', payload, options);
23
18
  }
24
-
25
19
  async multipleGet(payload, options) {
26
20
  return this._run('mget', payload, options);
27
21
  }
28
-
29
22
  }
30
-
31
23
  exports.default = Search;
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _api = _interopRequireDefault(require("./api"));
9
-
10
8
  var _base = _interopRequireDefault(require("./api/base"));
11
-
12
9
  var _helpers = _interopRequireDefault(require("./api/helpers"));
13
-
14
10
  var _interactions = _interopRequireDefault(require("./api/interactions"));
15
-
16
11
  var _recommendation = _interopRequireDefault(require("./api/recommendation"));
17
-
18
12
  var _search = _interopRequireDefault(require("./api/search"));
19
-
20
13
  var _context = _interopRequireDefault(require("./context"));
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
15
  var _default = {
25
16
  api: {
26
17
  Api: _api.default,
@@ -4,75 +4,54 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  var _root = require("./root");
11
-
12
9
  var _api = _interopRequireDefault(require("./api"));
13
-
14
10
  var _context = _interopRequireDefault(require("./context"));
15
-
16
11
  var helpers = _interopRequireWildcard(require("./utils"));
17
-
18
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
15
  class MisoClient extends _commons.Component {
25
16
  constructor(options) {
26
17
  super('client', _root.root);
27
-
28
18
  this._config(options);
29
-
30
19
  this.context = new _context.default(this);
31
20
  this.api = new _api.default(this, _root.root);
32
21
  (0, _root.register)(this);
33
22
  }
34
-
35
23
  get version() {
36
24
  return MisoClient.version;
37
25
  }
38
-
39
26
  _config(options) {
40
27
  this.options = Object.freeze(this._normalizeOptions(options));
41
28
  }
42
-
43
29
  _normalizeOptions(options) {
44
30
  if (typeof options === 'string') {
45
31
  options = {
46
32
  apiKey: options
47
33
  };
48
34
  }
49
-
50
35
  if (options.readConfigFromScriptUrl) {
51
36
  options = Object.assign({}, this._readConfigFromScriptUrl(), options);
52
37
  }
53
-
54
38
  if (!options.apiKey) {
55
39
  throw new Error('Require API key to initialize miso client.');
56
40
  }
57
-
58
41
  options.dataEndpoint = options.dataEndpoint || options.apiHost;
59
42
  options.eventEndpoint = options.eventEndpoint || options.apiHost;
60
43
  delete options.apiHost;
61
44
  return (0, _commons.trimObj)(options);
62
45
  }
63
-
64
46
  _readConfigFromScriptUrl() {
65
47
  const me = document.currentScript;
66
48
  const url = me.src || me.href; // might be <link> as well
67
-
68
49
  const params = new URL(new Request(url).url).searchParams;
69
50
  return (0, _commons.trimObj)({
70
51
  apiKey: params.get('api_key') || undefined
71
52
  });
72
53
  }
73
-
74
54
  }
75
-
76
55
  MisoClient.helpers = helpers;
77
56
  var _default = MisoClient;
78
57
  exports.default = _default;
package/dist/cjs/cmd.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = _default;
7
-
8
7
  function execute(onError, fn) {
9
8
  try {
10
9
  fn();
@@ -12,24 +11,21 @@ function execute(onError, fn) {
12
11
  onError(e);
13
12
  }
14
13
  }
15
-
16
14
  function _default(key) {
17
15
  let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : e => console.error(e);
18
16
  const cmds = window[key] || (window[key] = []);
19
-
20
17
  if (cmds._processed) {
21
18
  return;
22
19
  }
23
-
24
20
  cmds._processed = true;
21
+ const exec = fn => execute(onError, fn);
25
22
 
26
- const exec = fn => execute(onError, fn); // overrides push function so future commands are executed immediately
27
-
28
-
23
+ // overrides push function so future commands are executed immediately
29
24
  Object.defineProperty(cmds, 'push', {
30
25
  value: exec
31
- }); // process existing miso commands
26
+ });
32
27
 
28
+ // process existing miso commands
33
29
  for (const fn of cmds) {
34
30
  exec(fn);
35
31
  }
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  class Context extends _commons.Component {
11
9
  constructor(client) {
12
10
  super('context', client);
13
11
  this._client = client;
14
12
  }
15
-
16
13
  }
17
-
18
14
  exports.default = Context;
package/dist/cjs/index.js CHANGED
@@ -4,26 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _client = _interopRequireDefault(require("./client"));
9
-
10
8
  var _root = require("./root");
11
-
12
9
  var _cmd = _interopRequireDefault(require("./cmd"));
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  if (!window.MisoClient) {
17
12
  // gaurantee to execute init() only once globally (across different script sources)
18
- window.MisoClient = (0, _root.init)(_client.default); // kick off misodev execution
13
+ window.MisoClient = (0, _root.init)(_client.default);
19
14
 
20
- (0, _cmd.default)('misodev'); // do misocmd with setTimeout, so they will be executed after plugins are installed.
15
+ // kick off misodev execution
16
+ (0, _cmd.default)('misodev');
21
17
 
18
+ // do misocmd with setTimeout, so they will be executed after plugins are installed.
22
19
  setTimeout(() => (0, _cmd.default)('misocmd'));
23
20
  } else {
24
21
  // TODO: check version as well
25
22
  console.warn(`Use already defined window.MisoClient (${window.MisoClient.version}).`);
26
23
  }
27
-
28
24
  var _default = window.MisoClient;
29
25
  exports.default = _default;
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _commons = require("@miso.ai/commons");
9
-
10
8
  class AnonymousPlugin {
11
9
  constructor(install) {
12
10
  (0, _commons.defineValues)(this, {
13
11
  install
14
12
  });
15
13
  }
16
-
17
14
  }
18
-
19
15
  exports.default = AnonymousPlugin;