@miso.ai/client-sdk-ui 1.11.6-beta.0 → 1.11.6
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/actor/data.js +5 -7
- package/dist/cjs/actor/feedback.js +1 -2
- package/dist/cjs/actor/filters.js +20 -21
- package/dist/cjs/actor/hub.js +34 -8
- package/dist/cjs/actor/index.js +1 -2
- package/dist/cjs/actor/interactions.js +5 -7
- package/dist/cjs/actor/sessions.js +1 -2
- package/dist/cjs/actor/tracker.js +9 -12
- package/dist/cjs/actor/view.js +11 -20
- package/dist/cjs/actor/views.js +16 -21
- package/dist/cjs/affiliation/index.js +1 -2
- package/dist/cjs/combo/ask/elements.js +3 -4
- package/dist/cjs/combo/ask/index.js +1 -2
- package/dist/cjs/combo/ask/options.js +2 -6
- package/dist/cjs/defaults/ask/controls.js +1 -2
- package/dist/cjs/defaults/ask/index.js +1 -2
- package/dist/cjs/defaults/ask/templates.js +3 -6
- package/dist/cjs/defaults/common/templates.js +30 -41
- package/dist/cjs/defaults/hybrid-search/answer-box.js +9 -11
- package/dist/cjs/defaults/hybrid-search/controls.js +1 -2
- package/dist/cjs/defaults/hybrid-search/index.js +1 -2
- package/dist/cjs/defaults/hybrid-search/templates.js +2 -4
- package/dist/cjs/defaults/index.js +1 -2
- package/dist/cjs/element/container/miso-explore.js +7 -7
- package/dist/cjs/element/container/miso-hybrid-search.js +3 -3
- package/dist/cjs/element/container/miso-recommendation.js +3 -38
- package/dist/cjs/element/container/miso-search.js +3 -3
- package/dist/cjs/element/container/miso-unit.js +52 -0
- package/dist/cjs/element/index.js +1 -2
- package/dist/cjs/element/role/miso-component.js +3 -4
- package/dist/cjs/element/utils.js +6 -9
- package/dist/cjs/layout/affiliation/affiliation.js +4 -6
- package/dist/cjs/layout/banner/banner.js +1 -2
- package/dist/cjs/layout/button/more-button.js +1 -2
- package/dist/cjs/layout/container/container.js +7 -12
- package/dist/cjs/layout/error/error.js +1 -2
- package/dist/cjs/layout/input/facets.js +28 -41
- package/dist/cjs/layout/input/option-list.js +1 -2
- package/dist/cjs/layout/input/search-box.js +30 -39
- package/dist/cjs/layout/input/select.js +1 -2
- package/dist/cjs/layout/list/cards.js +1 -2
- package/dist/cjs/layout/list/carousel.js +1 -2
- package/dist/cjs/layout/list/collection.js +12 -16
- package/dist/cjs/layout/list/gallery.js +18 -26
- package/dist/cjs/layout/list/list.js +1 -2
- package/dist/cjs/layout/mixin/swipeable.js +3 -4
- package/dist/cjs/layout/mixin/trackable.js +3 -6
- package/dist/cjs/layout/progressive.js +1 -2
- package/dist/cjs/layout/radio/feedback.js +6 -8
- package/dist/cjs/layout/radio/radio.js +5 -6
- package/dist/cjs/layout/raf.js +6 -10
- package/dist/cjs/layout/template.js +7 -10
- package/dist/cjs/layout/templates.js +51 -71
- package/dist/cjs/layout/text/text.js +6 -8
- package/dist/cjs/layout/text/typewriter/index.js +14 -18
- package/dist/cjs/layout/text/typewriter/plaintext.js +8 -10
- package/dist/cjs/layout/text/typewriter/utils.js +12 -15
- package/dist/cjs/plugin.js +13 -3
- package/dist/cjs/source.js +6 -7
- package/dist/cjs/util/dom.js +1 -2
- package/dist/cjs/util/proxy.js +3 -4
- package/dist/cjs/util/trackers.js +1 -3
- package/dist/cjs/util/viewables.js +1 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/answer-based.js +17 -24
- package/dist/cjs/workflow/ask.js +1 -2
- package/dist/cjs/workflow/asks.js +4 -6
- package/dist/cjs/workflow/autocomplete.js +3 -4
- package/dist/cjs/workflow/base.js +56 -54
- package/dist/cjs/workflow/explore.js +18 -22
- package/dist/cjs/workflow/explores.js +18 -0
- package/dist/cjs/workflow/hybrid-search-answer.js +4 -3
- package/dist/cjs/workflow/index.js +3 -3
- package/dist/cjs/workflow/options/api.js +2 -6
- package/dist/cjs/workflow/options/auto-query.js +2 -4
- package/dist/cjs/workflow/options/configurable.js +2 -6
- package/dist/cjs/workflow/options/data-processor.js +1 -4
- package/dist/cjs/workflow/options/filters.js +1 -4
- package/dist/cjs/workflow/options/interactions.js +1 -4
- package/dist/cjs/workflow/options/layouts.js +2 -6
- package/dist/cjs/workflow/options/options.js +5 -8
- package/dist/cjs/workflow/options/pagination.js +1 -4
- package/dist/cjs/workflow/options/roles.js +1 -3
- package/dist/cjs/workflow/options/trackers.js +6 -16
- package/dist/cjs/workflow/processors.js +16 -22
- package/dist/cjs/workflow/recommendation.js +9 -52
- package/dist/cjs/workflow/recommendations.js +3 -23
- package/dist/cjs/workflow/search-based.js +12 -8
- package/dist/cjs/workflow/search.js +1 -5
- package/dist/cjs/workflow/unit.js +58 -0
- package/dist/cjs/workflow/units.js +37 -0
- package/dist/cjs/workflow/use-link.js +3 -6
- package/package.json +2 -2
- package/src/actor/filters.js +4 -2
- package/src/actor/hub.js +26 -5
- package/src/element/container/miso-explore.js +8 -8
- package/src/element/container/miso-hybrid-search.js +4 -4
- package/src/element/container/miso-recommendation.js +3 -45
- package/src/element/container/miso-search.js +4 -4
- package/src/element/container/miso-unit.js +55 -0
- package/src/layout/radio/radio.js +1 -0
- package/src/layout/templates.js +3 -2
- package/src/plugin.js +15 -2
- package/src/version.js +1 -1
- package/src/workflow/autocomplete.js +1 -0
- package/src/workflow/base.js +33 -23
- package/src/workflow/explore.js +13 -12
- package/src/workflow/explores.js +14 -0
- package/src/workflow/hybrid-search-answer.js +1 -1
- package/src/workflow/index.js +1 -1
- package/src/workflow/processors.js +2 -2
- package/src/workflow/recommendation.js +9 -47
- package/src/workflow/recommendations.js +3 -23
- package/src/workflow/search-based.js +4 -0
- package/src/workflow/unit.js +52 -0
- package/src/workflow/units.js +37 -0
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import WorkflowContext from './context.js';
|
|
1
|
+
import UnitWorkflowContext from './units.js';
|
|
3
2
|
import Recommendation from './recommendation.js';
|
|
4
3
|
|
|
5
|
-
export default class Recommendations extends
|
|
4
|
+
export default class Recommendations extends UnitWorkflowContext {
|
|
6
5
|
|
|
7
6
|
constructor(plugin, client) {
|
|
8
7
|
super('recommendations', plugin, client);
|
|
9
|
-
this._members = new Map();
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
return [...this._members.values()];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
create(unitId = DEFAULT_UNIT_ID) {
|
|
17
|
-
if (this._members.has(unitId)) {
|
|
18
|
-
throw new Error(`Unit already exists: ${unitId}`);
|
|
19
|
-
}
|
|
10
|
+
_create(unitId) {
|
|
20
11
|
return new Recommendation(this, unitId);
|
|
21
12
|
}
|
|
22
13
|
|
|
23
|
-
has(unitId = DEFAULT_UNIT_ID) {
|
|
24
|
-
return this._members.has(unitId);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get(unitId = DEFAULT_UNIT_ID) {
|
|
28
|
-
if (typeof unitId !== 'string') {
|
|
29
|
-
throw new Error(`Required unit ID to be a string: ${unitId}`);
|
|
30
|
-
}
|
|
31
|
-
return this._members.get(unitId) || new Recommendation(this, unitId);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
14
|
}
|
|
@@ -102,6 +102,9 @@ export default class SearchBasedWorkflow extends Workflow {
|
|
|
102
102
|
// keep track of the query args for refine and more calls
|
|
103
103
|
this._queryArgs = args;
|
|
104
104
|
|
|
105
|
+
// reset filters view
|
|
106
|
+
this._views.filters.reset({ silent: true });
|
|
107
|
+
|
|
105
108
|
// start a new session
|
|
106
109
|
this.restart();
|
|
107
110
|
|
|
@@ -126,6 +129,7 @@ export default class SearchBasedWorkflow extends Workflow {
|
|
|
126
129
|
this._request({ payload });
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
// TODO: expose API
|
|
129
133
|
_more() {
|
|
130
134
|
// if still loading, complain
|
|
131
135
|
if (this.status !== STATUS.READY) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineValues } from '@miso.ai/commons';
|
|
2
|
+
import Workflow from './base.js';
|
|
3
|
+
import { mergeInteraction } from './processors.js';
|
|
4
|
+
|
|
5
|
+
export default class UnitWorkflow extends Workflow {
|
|
6
|
+
|
|
7
|
+
_initProperties(args) {
|
|
8
|
+
super._initProperties(args);
|
|
9
|
+
const { id } = args;
|
|
10
|
+
defineValues(this, { id });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_initSession(args) {
|
|
14
|
+
this._context._members.set(args.id, this);
|
|
15
|
+
super._initSession(args);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// interactions //
|
|
19
|
+
_defaultProcessInteraction(payload, args) {
|
|
20
|
+
payload = super._defaultProcessInteraction(payload, args);
|
|
21
|
+
payload = this._writeUnitIdToInteraction(payload, args);
|
|
22
|
+
return payload;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_writeUnitIdToInteraction(payload) {
|
|
26
|
+
const unit_id = this.id;
|
|
27
|
+
const unit_instance_uuid = this.uuid;
|
|
28
|
+
return mergeInteraction(payload, {
|
|
29
|
+
context: {
|
|
30
|
+
custom_context: {
|
|
31
|
+
unit_id,
|
|
32
|
+
unit_instance_uuid,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// destroy //
|
|
39
|
+
_destroy(options) {
|
|
40
|
+
this._context._members.delete(this.id);
|
|
41
|
+
super._destroy(options);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Object.assign(UnitWorkflow, {
|
|
47
|
+
DEFAULT_API_OPTIONS: Workflow.DEFAULT_API_OPTIONS,
|
|
48
|
+
DEFAULT_LAYOUTS: Workflow.DEFAULT_LAYOUTS,
|
|
49
|
+
DEFAULT_TRACKERS: Workflow.DEFAULT_TRACKERS,
|
|
50
|
+
DEFAULT_OPTIONS: Workflow.DEFAULT_OPTIONS,
|
|
51
|
+
ROLES_OPTIONS: Workflow.ROLES_OPTIONS,
|
|
52
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DEFAULT_UNIT_ID } from '../constants.js';
|
|
2
|
+
import WorkflowContext from './context.js';
|
|
3
|
+
|
|
4
|
+
export default class UnitWorkflowContext extends WorkflowContext {
|
|
5
|
+
|
|
6
|
+
constructor(name, plugin, client) {
|
|
7
|
+
super(name, plugin, client);
|
|
8
|
+
this._members = new Map();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
workflows() {
|
|
12
|
+
return [...this._members.values()];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
create(unitId = DEFAULT_UNIT_ID) {
|
|
16
|
+
if (this._members.has(unitId)) {
|
|
17
|
+
throw new Error(`Unit already exists: ${unitId}`);
|
|
18
|
+
}
|
|
19
|
+
return this._create(unitId);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
has(unitId = DEFAULT_UNIT_ID) {
|
|
23
|
+
return this._members.has(unitId);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get(unitId = DEFAULT_UNIT_ID) {
|
|
27
|
+
if (typeof unitId !== 'string') {
|
|
28
|
+
throw new Error(`Required unit ID to be a string: ${unitId}`);
|
|
29
|
+
}
|
|
30
|
+
return this._members.get(unitId) || this._create(unitId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_create(unitId) {
|
|
34
|
+
throw new Error('Not implemented');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|