@miso.ai/client-sdk-core 1.9.3-beta.0 → 1.9.3-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.
package/dist/cjs/plugin/index.js
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "AutoEventsPlugin", {
|
|
|
9
9
|
return _autoEvents.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "InteractionsPlugin", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _interactions.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "PageInfoPlugin", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function () {
|
|
@@ -24,4 +30,5 @@ Object.defineProperty(exports, "UserPlugin", {
|
|
|
24
30
|
var _user = _interopRequireDefault(require("./user.js"));
|
|
25
31
|
var _pageInfo = _interopRequireDefault(require("./page-info.js"));
|
|
26
32
|
var _autoEvents = _interopRequireDefault(require("./auto-events.js"));
|
|
33
|
+
var _interactions = _interopRequireDefault(require("./interactions.js"));
|
|
27
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _commons = require("@miso.ai/commons");
|
|
8
|
+
const ID = 'std:interactions';
|
|
9
|
+
class InteractionsPlugin {
|
|
10
|
+
static get id() {
|
|
11
|
+
return ID;
|
|
12
|
+
}
|
|
13
|
+
constructor() {}
|
|
14
|
+
install(_, _ref) {
|
|
15
|
+
let {
|
|
16
|
+
addPayloadPass
|
|
17
|
+
} = _ref;
|
|
18
|
+
addPayloadPass(this._modifyPayload.bind(this));
|
|
19
|
+
}
|
|
20
|
+
_modifyPayload(_ref2) {
|
|
21
|
+
let {
|
|
22
|
+
apiGroup,
|
|
23
|
+
apiName,
|
|
24
|
+
payload
|
|
25
|
+
} = _ref2;
|
|
26
|
+
return apiGroup === 'interactions' && apiName === 'upload' ? this._modifyPayloadForInteractions(payload) : payload;
|
|
27
|
+
}
|
|
28
|
+
_modifyPayloadForInteractions(_ref3) {
|
|
29
|
+
let {
|
|
30
|
+
data
|
|
31
|
+
} = _ref3;
|
|
32
|
+
return {
|
|
33
|
+
data: data.map(modifyInteractionRecord)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = InteractionsPlugin;
|
|
38
|
+
function modifyInteractionRecord(record) {
|
|
39
|
+
const {
|
|
40
|
+
context = {}
|
|
41
|
+
} = record;
|
|
42
|
+
const custom_context = Object.assign({}, context.custom_context);
|
|
43
|
+
if (!custom_context.uuid) {
|
|
44
|
+
custom_context.uuid = (0, _commons.uuidv4)();
|
|
45
|
+
}
|
|
46
|
+
return Object.assign({}, record, {
|
|
47
|
+
context: Object.assign({}, context, {
|
|
48
|
+
custom_context
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
package/dist/cjs/version.js
CHANGED
package/package.json
CHANGED
package/src/plugin/index.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { uuidv4 } from '@miso.ai/commons';
|
|
2
|
+
|
|
3
|
+
const ID = 'std:interactions';
|
|
4
|
+
|
|
5
|
+
export default class InteractionsPlugin {
|
|
6
|
+
|
|
7
|
+
static get id() {
|
|
8
|
+
return ID;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
install(_, { addPayloadPass }) {
|
|
15
|
+
addPayloadPass(this._modifyPayload.bind(this));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
_modifyPayload({ apiGroup, apiName, payload }) {
|
|
19
|
+
return apiGroup === 'interactions' && apiName === 'upload' ?
|
|
20
|
+
this._modifyPayloadForInteractions(payload) : payload;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_modifyPayloadForInteractions({ data }) {
|
|
24
|
+
return { data: data.map(modifyInteractionRecord) };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function modifyInteractionRecord(record) {
|
|
30
|
+
const { context = {} } = record;
|
|
31
|
+
const custom_context = { ...context.custom_context };
|
|
32
|
+
if (!custom_context.uuid) {
|
|
33
|
+
custom_context.uuid = uuidv4();
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
...record,
|
|
37
|
+
context: {
|
|
38
|
+
...context,
|
|
39
|
+
custom_context,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.9.3-beta.
|
|
1
|
+
export default '1.9.3-beta.1';
|