@miso.ai/client-sdk-core 1.8.0-beta.17 → 1.8.0-beta.19
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/cjs/api/api.js +25 -0
- package/dist/cjs/api/ask.js +1 -1
- package/dist/cjs/api/helpers.js +1 -1
- package/dist/cjs/api/index.js +49 -19
- package/dist/cjs/api/interactions.js +1 -1
- package/dist/cjs/api/recommendation.js +1 -1
- package/dist/cjs/api/search.js +1 -1
- package/dist/cjs/classes.js +5 -15
- package/dist/cjs/client.js +2 -2
- package/dist/cjs/index.js +31 -5
- package/dist/cjs/plugin/index.js +3 -3
- package/dist/cjs/plugin/plugin-root.js +3 -3
- package/dist/cjs/root.js +2 -2
- package/dist/cjs/version.js +1 -1
- package/package.json +9 -9
- package/{dist/es/api/index.js → src/api/api.js} +9 -6
- package/src/api/ask.js +75 -0
- package/src/api/base.js +47 -0
- package/{dist/es → src}/api/helpers.js +47 -91
- package/src/api/index.js +7 -0
- package/src/api/interactions.js +54 -0
- package/{dist/es → src}/api/recommendation.js +11 -2
- package/{dist/es → src}/api/search.js +8 -2
- package/src/classes.js +7 -0
- package/{dist/es → src}/client.js +25 -10
- package/{dist/es → src}/cmd.js +7 -8
- package/{dist/es → src}/constants.js +2 -2
- package/{dist/es → src}/context.js +4 -1
- package/src/index.js +3 -0
- package/{dist/es → src}/plugin/anonymous.js +5 -4
- package/{dist/es → src}/plugin/auto-events.js +24 -25
- package/src/plugin/index.js +3 -0
- package/{dist/es → src}/plugin/page-info.js +28 -24
- package/{dist/es → src}/plugin/plugin-root.js +37 -22
- package/{dist/es → src}/plugin/urls.js +2 -1
- package/{dist/es → src}/plugin/user.js +32 -37
- package/{dist/es → src}/root.js +10 -4
- package/src/utils.js +1 -0
- package/src/version.js +1 -0
- package/dist/es/api/ask.js +0 -85
- package/dist/es/api/base.js +0 -96
- package/dist/es/api/interactions.js +0 -82
- package/dist/es/classes.js +0 -20
- package/dist/es/index.js +0 -2
- package/dist/es/plugin/index.js +0 -3
- package/dist/es/utils.js +0 -1
- package/dist/es/version.js +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
const _excluded = ["useBeacon"],
|
|
2
|
-
_excluded2 = ["options"];
|
|
3
|
-
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; }
|
|
4
|
-
import ApiBase from './base';
|
|
5
|
-
export default class Interactions extends ApiBase {
|
|
6
|
-
constructor(api) {
|
|
7
|
-
super(api, 'interactions');
|
|
8
|
-
}
|
|
9
|
-
async upload(payload, options) {
|
|
10
|
-
try {
|
|
11
|
-
return await this._run('upload', payload, options);
|
|
12
|
-
} catch (e) {
|
|
13
|
-
if (e.status === 400 && e.message && e.message.toLowerCase().indexOf('playground') > -1) {
|
|
14
|
-
this._warn(`Ignore interactions uploaded to playground app.`);
|
|
15
|
-
} else {
|
|
16
|
-
throw e;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
_url(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
apiGroup,
|
|
23
|
-
apiName,
|
|
24
|
-
options
|
|
25
|
-
} = _ref;
|
|
26
|
-
const url = this.helpers.url([this._apiPath], options);
|
|
27
|
-
return this.helpers.applyUrlPasses(this, {
|
|
28
|
-
apiGroup,
|
|
29
|
-
apiName,
|
|
30
|
-
url,
|
|
31
|
-
options
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
_preprocess(_ref2) {
|
|
35
|
-
let {
|
|
36
|
-
apiGroup,
|
|
37
|
-
apiName,
|
|
38
|
-
payload
|
|
39
|
-
} = _ref2;
|
|
40
|
-
if (apiName === 'upload') {
|
|
41
|
-
payload = this._normalizeUploadPayload(payload);
|
|
42
|
-
}
|
|
43
|
-
return super._preprocess({
|
|
44
|
-
apiGroup,
|
|
45
|
-
apiName,
|
|
46
|
-
payload
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
_normalizeUploadPayload(payload) {
|
|
50
|
-
// TODO: accept string as a shortcut of { type: payload } as well
|
|
51
|
-
if (typeof payload !== 'object') {
|
|
52
|
-
throw new Error(`Interactions payload has to be either an object or an array of objects: ${payload}`);
|
|
53
|
-
}
|
|
54
|
-
if (!Array.isArray(payload)) {
|
|
55
|
-
payload = [payload];
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
data: payload
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async _send(_ref3) {
|
|
62
|
-
let {
|
|
63
|
-
options: {
|
|
64
|
-
useBeacon = true
|
|
65
|
-
} = {}
|
|
66
|
-
} = _ref3,
|
|
67
|
-
options = _objectWithoutPropertiesLoose(_ref3.options, _excluded),
|
|
68
|
-
args = _objectWithoutPropertiesLoose(_ref3, _excluded2);
|
|
69
|
-
if (useBeacon) {
|
|
70
|
-
const {
|
|
71
|
-
url,
|
|
72
|
-
payload
|
|
73
|
-
} = args;
|
|
74
|
-
this.helpers.sendBeacon(url, payload, options);
|
|
75
|
-
return {};
|
|
76
|
-
} else {
|
|
77
|
-
return super._send(Object.assign({}, args, {
|
|
78
|
-
options
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
package/dist/es/classes.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Api from './api';
|
|
2
|
-
import ApiBase from './api/base';
|
|
3
|
-
import ApiHelpers from './api/helpers';
|
|
4
|
-
import Interactions from './api/interactions';
|
|
5
|
-
import Recommendation from './api/recommendation';
|
|
6
|
-
import Search from './api/search';
|
|
7
|
-
import Context from './context';
|
|
8
|
-
export default {
|
|
9
|
-
api: {
|
|
10
|
-
Api,
|
|
11
|
-
ApiBase,
|
|
12
|
-
ApiHelpers,
|
|
13
|
-
Interactions,
|
|
14
|
-
Recommendation,
|
|
15
|
-
Search
|
|
16
|
-
},
|
|
17
|
-
context: {
|
|
18
|
-
Context
|
|
19
|
-
}
|
|
20
|
-
};
|
package/dist/es/index.js
DELETED
package/dist/es/plugin/index.js
DELETED
package/dist/es/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { viewable } from '@miso.ai/commons';
|
package/dist/es/version.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default '1.8.0-beta.17';
|