@miso.ai/client-sdk-ui 1.9.1-beta.1 → 1.9.1-beta.2
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/version.js
CHANGED
|
@@ -20,7 +20,8 @@ const DEFAULT_API_OPTIONS = Object.freeze({
|
|
|
20
20
|
const DEFAULT_LAYOUTS = Object.freeze({
|
|
21
21
|
[_constants.ROLE.RELATED_QUESTIONS]: [_index2.ListLayout.type, {
|
|
22
22
|
itemType: 'question'
|
|
23
|
-
}]
|
|
23
|
+
}],
|
|
24
|
+
[_constants.ROLE.QUERY]: [_index2.SearchBoxLayout.type]
|
|
24
25
|
});
|
|
25
26
|
const DEFAULT_TRACKERS = Object.freeze({
|
|
26
27
|
[_constants.ROLE.RELATED_QUESTIONS]: {}
|
|
@@ -41,7 +42,7 @@ class Explore extends _base.default {
|
|
|
41
42
|
});
|
|
42
43
|
this._productId = undefined;
|
|
43
44
|
this._linkFn = undefined;
|
|
44
|
-
this._unsubscribes.
|
|
45
|
+
this._unsubscribes = [...this._unsubscribes, this._views.get(_constants.ROLE.RELATED_QUESTIONS).on('click', event => this._handleRelatedQuestionClick(event)), this._hub.on(_index.fields.query(), payload => this.query(payload))];
|
|
45
46
|
}
|
|
46
47
|
set productId(value) {
|
|
47
48
|
console.warning('DEPRECATED: use useApi() instead');
|
|
@@ -102,7 +103,7 @@ class Explore extends _base.default {
|
|
|
102
103
|
})
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
+
_handleRelatedQuestionClick(_ref) {
|
|
106
107
|
let {
|
|
107
108
|
value: question
|
|
108
109
|
} = _ref,
|
|
@@ -111,5 +112,15 @@ class Explore extends _base.default {
|
|
|
111
112
|
question
|
|
112
113
|
})));
|
|
113
114
|
}
|
|
115
|
+
query() {
|
|
116
|
+
let {
|
|
117
|
+
q
|
|
118
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
119
|
+
if (!this._linkFn) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const url = this._linkFn(q);
|
|
123
|
+
window.open(url, '_blank');
|
|
124
|
+
}
|
|
114
125
|
}
|
|
115
126
|
exports.default = Explore;
|
package/package.json
CHANGED
|
@@ -176,7 +176,7 @@ export default class CollectionLayout extends TemplateBasedLayout {
|
|
|
176
176
|
}
|
|
177
177
|
const value = element[VALUE];
|
|
178
178
|
const { session } = this._view._state;
|
|
179
|
-
this._view._events.emit('click', { session, value, element });
|
|
179
|
+
this._view._events.emit('click', { session, value, element, domEvent: event });
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
destroy() {
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.9.1-beta.
|
|
1
|
+
export default '1.9.1-beta.2';
|
package/src/workflow/explore.js
CHANGED
|
@@ -3,7 +3,7 @@ import Workflow from './base.js';
|
|
|
3
3
|
import { mergeApiOptions } from './options.js';
|
|
4
4
|
import { fields } from '../actor/index.js';
|
|
5
5
|
import { ROLE } from '../constants.js';
|
|
6
|
-
import { ListLayout } from '../layout/index.js';
|
|
6
|
+
import { ListLayout, SearchBoxLayout } from '../layout/index.js';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_API_OPTIONS = Object.freeze({
|
|
9
9
|
group: API.GROUP.ASK,
|
|
@@ -12,6 +12,7 @@ const DEFAULT_API_OPTIONS = Object.freeze({
|
|
|
12
12
|
|
|
13
13
|
const DEFAULT_LAYOUTS = Object.freeze({
|
|
14
14
|
[ROLE.RELATED_QUESTIONS]: [ListLayout.type, { itemType: 'question' }],
|
|
15
|
+
[ROLE.QUERY]: [SearchBoxLayout.type],
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
const DEFAULT_TRACKERS = Object.freeze({
|
|
@@ -36,7 +37,12 @@ export default class Explore extends Workflow {
|
|
|
36
37
|
});
|
|
37
38
|
this._productId = undefined;
|
|
38
39
|
this._linkFn = undefined;
|
|
39
|
-
|
|
40
|
+
|
|
41
|
+
this._unsubscribes = [
|
|
42
|
+
...this._unsubscribes,
|
|
43
|
+
this._views.get(ROLE.RELATED_QUESTIONS).on('click', event => this._handleRelatedQuestionClick(event)),
|
|
44
|
+
this._hub.on(fields.query(), payload => this.query(payload)),
|
|
45
|
+
];
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
set productId(value) {
|
|
@@ -89,8 +95,16 @@ export default class Explore extends Workflow {
|
|
|
89
95
|
};
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
_handleRelatedQuestionClick({ value: question, ...event }) {
|
|
93
99
|
this._events.emit('select', Object.freeze({ ...event, question }));
|
|
94
100
|
}
|
|
95
101
|
|
|
102
|
+
query({ q } = {}) {
|
|
103
|
+
if (!this._linkFn) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const url = this._linkFn(q);
|
|
107
|
+
window.open(url, '_blank');
|
|
108
|
+
}
|
|
109
|
+
|
|
96
110
|
}
|