@miso.ai/client-sdk-core 1.8.2-beta.2 → 1.8.2-beta.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.
@@ -5,14 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _commons = require("@miso.ai/commons");
8
- var _constants = require("./constants.js");
9
8
  var _base = _interopRequireDefault(require("./base.js"));
10
9
  const _excluded = ["pollingInterval", "signal", "stallTimeout"];
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
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; }
12
+ const {
13
+ GROUP,
14
+ NAME
15
+ } = _commons.API;
13
16
  class Ask extends _base.default {
14
17
  constructor(api) {
15
- super(api, _constants.GROUP.ASK);
18
+ super(api, GROUP.ASK);
16
19
  }
17
20
  async questions(payload) {
18
21
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -21,20 +24,20 @@ class Ask extends _base.default {
21
24
  question_id: payload
22
25
  }, options);
23
26
  }
24
- const response = await this._run(_constants.NAME.QUESTIONS, payload, options);
27
+ const response = await this._run(NAME.QUESTIONS, payload, options);
25
28
  return new Answer(this, response, options);
26
29
  }
27
30
  async _questions(payload, options) {
28
- return this._run(_constants.NAME.QUESTIONS, payload, options);
31
+ return this._run(NAME.QUESTIONS, payload, options);
29
32
  }
30
33
  async _get(questionId, options) {
31
- return this._run(`${_constants.NAME.QUESTIONS}/${questionId}/answer`, undefined, Object.assign({}, options, {
34
+ return this._run(`${NAME.QUESTIONS}/${questionId}/answer`, undefined, Object.assign({}, options, {
32
35
  method: 'GET'
33
36
  }));
34
37
  }
35
38
  async relatedQuestions(payload) {
36
39
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
- return this._run(_constants.NAME.RELATED_QUESTIONS, payload, options);
40
+ return this._run(NAME.RELATED_QUESTIONS, payload, options);
38
41
  }
39
42
  }
40
43
  exports.default = Ask;
@@ -45,7 +45,6 @@ Object.defineProperty(exports, "Search", {
45
45
  return _search.default;
46
46
  }
47
47
  });
48
- exports.constants = void 0;
49
48
  var _api = _interopRequireDefault(require("./api.js"));
50
49
  var _base = _interopRequireDefault(require("./base.js"));
51
50
  var _helpers = _interopRequireDefault(require("./helpers.js"));
@@ -53,8 +52,4 @@ var _interactions = _interopRequireDefault(require("./interactions.js"));
53
52
  var _ask = _interopRequireDefault(require("./ask.js"));
54
53
  var _search = _interopRequireDefault(require("./search.js"));
55
54
  var _recommendation = _interopRequireDefault(require("./recommendation.js"));
56
- var _constants = _interopRequireWildcard(require("./constants.js"));
57
- exports.constants = _constants;
58
- 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); }
59
- 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; }
60
55
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,19 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _constants = require("./constants.js");
7
+ var _commons = require("@miso.ai/commons");
8
8
  var _base = _interopRequireDefault(require("./base.js"));
9
9
  const _excluded = ["useBeacon"],
10
10
  _excluded2 = ["options"];
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  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; }
13
+ const {
14
+ GROUP,
15
+ NAME
16
+ } = _commons.API;
13
17
  class Interactions extends _base.default {
14
18
  constructor(api) {
15
- super(api, _constants.GROUP.INTERACTIONS);
19
+ super(api, GROUP.INTERACTIONS);
16
20
  }
17
21
  async upload(payload, options) {
18
22
  try {
19
- return await this._run(_constants.NAME.UPLOAD, payload, options);
23
+ return await this._run(NAME.UPLOAD, payload, options);
20
24
  } catch (e) {
21
25
  if (e.status === 400 && e.message && e.message.toLowerCase().indexOf('playground') > -1) {
22
26
  this._warn(`Ignore interactions uploaded to playground app.`);
@@ -45,7 +49,7 @@ class Interactions extends _base.default {
45
49
  apiName,
46
50
  payload
47
51
  } = _ref2;
48
- if (apiName === _constants.NAME.UPLOAD) {
52
+ if (apiName === NAME.UPLOAD) {
49
53
  payload = this._normalizeUploadPayload(payload);
50
54
  }
51
55
  return super._preprocess({
@@ -4,30 +4,34 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _constants = require("./constants.js");
7
+ var _commons = require("@miso.ai/commons");
8
8
  var _base = _interopRequireDefault(require("./base.js"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const {
11
+ GROUP,
12
+ NAME
13
+ } = _commons.API;
10
14
  class Recommendation extends _base.default {
11
15
  constructor(api) {
12
- super(api, _constants.GROUP.RECOMMENDATION);
16
+ super(api, GROUP.RECOMMENDATION);
13
17
  }
14
18
  async userToProducts(payload, options) {
15
- return this._run(_constants.NAME.USER_TO_PRODUCTS, payload, options);
19
+ return this._run(NAME.USER_TO_PRODUCTS, payload, options);
16
20
  }
17
21
  async userToCategories(payload, options) {
18
- return this._run(_constants.NAME.USER_TO_CATEGORIES, payload, options);
22
+ return this._run(NAME.USER_TO_CATEGORIES, payload, options);
19
23
  }
20
24
  async userToAttributes(payload, options) {
21
- return this._run(_constants.NAME.USER_TO_ATTRIBUTES, payload, options);
25
+ return this._run(NAME.USER_TO_ATTRIBUTES, payload, options);
22
26
  }
23
27
  async userToTrending(payload, options) {
24
- return this._run(_constants.NAME.USER_TO_TRENDING, payload, options);
28
+ return this._run(NAME.USER_TO_TRENDING, payload, options);
25
29
  }
26
30
  async userToHistory(payload, options) {
27
- return this._run(_constants.NAME.USER_TO_HISTORY, payload, options);
31
+ return this._run(NAME.USER_TO_HISTORY, payload, options);
28
32
  }
29
33
  async productToProducts(payload, options) {
30
- return this._run(_constants.NAME.PRODUCT_TO_PRODUCTS, payload, options);
34
+ return this._run(NAME.PRODUCT_TO_PRODUCTS, payload, options);
31
35
  }
32
36
  }
33
37
  exports.default = Recommendation;
@@ -4,21 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _constants = require("./constants.js");
7
+ var _commons = require("@miso.ai/commons");
8
8
  var _base = _interopRequireDefault(require("./base.js"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const {
11
+ GROUP,
12
+ NAME
13
+ } = _commons.API;
10
14
  class Search extends _base.default {
11
15
  constructor(api) {
12
- super(api, _constants.GROUP.SEARCH);
16
+ super(api, GROUP.SEARCH);
13
17
  }
14
18
  async search(payload, options) {
15
- return this._run(_constants.NAME.SEARCH, payload, options);
19
+ return this._run(NAME.SEARCH, payload, options);
16
20
  }
17
21
  async autocomplete(payload, options) {
18
- return this._run(_constants.NAME.AUTOCOMPLETE, payload, options);
22
+ return this._run(NAME.AUTOCOMPLETE, payload, options);
19
23
  }
20
24
  async multipleGet(payload, options) {
21
- return this._run(_constants.NAME.MGET, payload, options);
25
+ return this._run(NAME.MGET, payload, options);
22
26
  }
23
27
  }
24
28
  exports.default = Search;
package/dist/cjs/index.js CHANGED
@@ -5,15 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  version: true,
8
- MisoClient: true,
9
- API: true
8
+ MisoClient: true
10
9
  };
11
- Object.defineProperty(exports, "API", {
12
- enumerable: true,
13
- get: function () {
14
- return _index.constants;
15
- }
16
- });
17
10
  Object.defineProperty(exports, "MisoClient", {
18
11
  enumerable: true,
19
12
  get: function () {
@@ -28,16 +21,15 @@ Object.defineProperty(exports, "version", {
28
21
  });
29
22
  var _version = _interopRequireDefault(require("./version.js"));
30
23
  var _client = _interopRequireDefault(require("./client.js"));
31
- var _index = require("./api/index.js");
32
- var _index2 = require("./plugin/index.js");
33
- Object.keys(_index2).forEach(function (key) {
24
+ var _index = require("./plugin/index.js");
25
+ Object.keys(_index).forEach(function (key) {
34
26
  if (key === "default" || key === "__esModule") return;
35
27
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
36
- if (key in exports && exports[key] === _index2[key]) return;
28
+ if (key in exports && exports[key] === _index[key]) return;
37
29
  Object.defineProperty(exports, key, {
38
30
  enumerable: true,
39
31
  get: function () {
40
- return _index2[key];
32
+ return _index[key];
41
33
  }
42
34
  });
43
35
  });
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _commons = require("@miso.ai/commons");
8
- var _index = require("../api/index.js");
9
8
  const PLUGIN_ID = 'std:auto-events';
10
9
  class AutoEventsPlugin extends _commons.Component {
11
10
  static get id() {
@@ -33,9 +32,9 @@ class AutoEventsPlugin extends _commons.Component {
33
32
  payload
34
33
  } = _ref;
35
34
  switch (apiGroup) {
36
- case _index.constants.GROUP.SEARCH:
35
+ case _commons.API.GROUP.SEARCH:
37
36
  switch (apiName) {
38
- case _index.constants.NAME.SEARCH:
37
+ case _commons.API.NAME.SEARCH:
39
38
  this._captureSearchApiRequest(client, payload);
40
39
  break;
41
40
  }
@@ -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.8.2-beta.2';
7
+ var _default = exports.default = '1.8.2-beta.3';
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.8.2-beta.2"
32
+ "@miso.ai/commons": "1.8.2-beta.3"
33
33
  },
34
- "version": "1.8.2-beta.2"
34
+ "version": "1.8.2-beta.3"
35
35
  }
package/src/api/ask.js CHANGED
@@ -1,7 +1,8 @@
1
- import { polling, signals, StallTimeoutAbortController } from '@miso.ai/commons';
2
- import { GROUP, NAME } from './constants.js';
1
+ import { polling, signals, StallTimeoutAbortController, API } from '@miso.ai/commons';
3
2
  import ApiBase from './base.js';
4
3
 
4
+ const { GROUP, NAME } = API;
5
+
5
6
  export default class Ask extends ApiBase {
6
7
 
7
8
  constructor(api) {
package/src/api/index.js CHANGED
@@ -5,4 +5,3 @@ export { default as Interactions } from './interactions.js';
5
5
  export { default as Ask } from './ask.js';
6
6
  export { default as Search } from './search.js';
7
7
  export { default as Recommendation } from './recommendation.js';
8
- export * as constants from './constants.js';
@@ -1,6 +1,8 @@
1
- import { GROUP, NAME } from './constants.js';
1
+ import { API } from '@miso.ai/commons';
2
2
  import ApiBase from './base.js';
3
3
 
4
+ const { GROUP, NAME } = API;
5
+
4
6
  export default class Interactions extends ApiBase {
5
7
 
6
8
  constructor(api) {
@@ -1,6 +1,8 @@
1
- import { GROUP, NAME } from './constants.js';
1
+ import { API } from '@miso.ai/commons';
2
2
  import ApiBase from './base.js';
3
3
 
4
+ const { GROUP, NAME } = API;
5
+
4
6
  export default class Recommendation extends ApiBase {
5
7
 
6
8
  constructor(api) {
package/src/api/search.js CHANGED
@@ -1,6 +1,8 @@
1
- import { GROUP, NAME } from './constants.js';
1
+ import { API } from '@miso.ai/commons';
2
2
  import ApiBase from './base.js';
3
3
 
4
+ const { GROUP, NAME } = API;
5
+
4
6
  export default class Search extends ApiBase {
5
7
 
6
8
  constructor(api) {
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  export { default as version } from './version.js';
2
2
  export { default as MisoClient } from './client.js';
3
- export { constants as API } from './api/index.js';
4
3
  export * from './plugin/index.js';
@@ -1,5 +1,4 @@
1
- import { Component } from '@miso.ai/commons';
2
- import { constants as API } from '../api/index.js';
1
+ import { Component, API } from '@miso.ai/commons';
3
2
 
4
3
  const PLUGIN_ID = 'std:auto-events';
5
4
 
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.8.2-beta.2';
1
+ export default '1.8.2-beta.3';
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NAME = exports.GROUP = void 0;
7
- const GROUP = exports.GROUP = Object.freeze({
8
- ASK: 'ask',
9
- SEARCH: 'search',
10
- RECOMMENDATION: 'recommendation',
11
- INTERACTIONS: 'interactions'
12
- });
13
- const NAME = exports.NAME = Object.freeze({
14
- QUESTIONS: 'questions',
15
- RELATED_QUESTIONS: 'related_questions',
16
- SEARCH: 'search',
17
- AUTOCOMPLETE: 'autocomplete',
18
- MGET: 'mget',
19
- USER_TO_PRODUCTS: 'user_to_products',
20
- USER_TO_CATEGORIES: 'user_to_categories',
21
- USER_TO_ATTRIBUTES: 'user_to_attributes',
22
- USER_TO_TRENDING: 'user_to_trending',
23
- USER_TO_HISTORY: 'user_to_history',
24
- PRODUCT_TO_PRODUCTS: 'product_to_products',
25
- UPLOAD: 'upload'
26
- });
@@ -1,21 +0,0 @@
1
- export const GROUP = Object.freeze({
2
- ASK: 'ask',
3
- SEARCH: 'search',
4
- RECOMMENDATION: 'recommendation',
5
- INTERACTIONS: 'interactions',
6
- });
7
-
8
- export const NAME = Object.freeze({
9
- QUESTIONS: 'questions',
10
- RELATED_QUESTIONS: 'related_questions',
11
- SEARCH: 'search',
12
- AUTOCOMPLETE: 'autocomplete',
13
- MGET: 'mget',
14
- USER_TO_PRODUCTS: 'user_to_products',
15
- USER_TO_CATEGORIES: 'user_to_categories',
16
- USER_TO_ATTRIBUTES: 'user_to_attributes',
17
- USER_TO_TRENDING: 'user_to_trending',
18
- USER_TO_HISTORY: 'user_to_history',
19
- PRODUCT_TO_PRODUCTS: 'product_to_products',
20
- UPLOAD: 'upload',
21
- });