@miso.ai/client-sdk-ui 1.11.6 → 1.12.0-beta.0
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/defaults/hybrid-search/templates.js +2 -2
- package/dist/cjs/layout/index.js +7 -0
- package/dist/cjs/layout/list/collection.js +4 -0
- package/dist/cjs/layout/list/horizontal.js +33 -0
- package/dist/cjs/layout/templates.js +32 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/hybrid-search.js +25 -2
- package/package.json +2 -2
- package/src/defaults/hybrid-search/templates.js +2 -1
- package/src/layout/index.js +1 -0
- package/src/layout/list/collection.js +5 -1
- package/src/layout/list/horizontal.js +24 -0
- package/src/layout/templates.js +31 -0
- package/src/version.js +1 -1
- package/src/workflow/hybrid-search.js +25 -2
|
@@ -91,7 +91,7 @@ class Sections extends _templates.Sections {
|
|
|
91
91
|
} = options;
|
|
92
92
|
return element('div', {
|
|
93
93
|
classes: [`${classPrefix}__search-results-filters`]
|
|
94
|
-
}, ['<miso-facets></miso-facets>']);
|
|
94
|
+
}, ['<miso-facets></miso-facets>', '<miso-sort></miso-sort>']);
|
|
95
95
|
}
|
|
96
96
|
keywords(options) {
|
|
97
97
|
const {
|
|
@@ -147,7 +147,7 @@ function root(options = {}) {
|
|
|
147
147
|
searchResultsGroup
|
|
148
148
|
} = sections;
|
|
149
149
|
const {
|
|
150
|
-
answerBox: answerBoxOptions =
|
|
150
|
+
answerBox: answerBoxOptions = false
|
|
151
151
|
} = options;
|
|
152
152
|
return [section(options, {
|
|
153
153
|
name: 'question'
|
package/dist/cjs/layout/index.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "GalleryLayout", {
|
|
|
63
63
|
return _gallery.default;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "HorizontalLayout", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _horizontal.default;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
Object.defineProperty(exports, "ListLayout", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function () {
|
|
@@ -117,6 +123,7 @@ var _error = _interopRequireDefault(require("./error/error.js"));
|
|
|
117
123
|
var _banner = _interopRequireDefault(require("./banner/banner.js"));
|
|
118
124
|
var _collection = _interopRequireDefault(require("./list/collection.js"));
|
|
119
125
|
var _list = _interopRequireDefault(require("./list/list.js"));
|
|
126
|
+
var _horizontal = _interopRequireDefault(require("./list/horizontal.js"));
|
|
120
127
|
var _cards = _interopRequireDefault(require("./list/cards.js"));
|
|
121
128
|
var _carousel = _interopRequireDefault(require("./list/carousel.js"));
|
|
122
129
|
var _gallery = _interopRequireDefault(require("./list/gallery.js"));
|
|
@@ -92,6 +92,7 @@ function loading() {
|
|
|
92
92
|
const DEFAULT_TEMPLATES = Object.freeze({
|
|
93
93
|
product: _templates.product,
|
|
94
94
|
article: _templates.article,
|
|
95
|
+
compactArticle: _templates.compactArticle,
|
|
95
96
|
image: _templates.image,
|
|
96
97
|
question: _templates.question,
|
|
97
98
|
root,
|
|
@@ -104,11 +105,14 @@ const DEFAULT_TEMPLATES = Object.freeze({
|
|
|
104
105
|
item,
|
|
105
106
|
productInfoBlock: _templates.productInfoBlock,
|
|
106
107
|
articleInfoBlock: _templates.articleInfoBlock,
|
|
108
|
+
compactArticleInfoBlock: _templates.compactArticleInfoBlock,
|
|
107
109
|
imageInfoBlock: _templates.imageInfoBlock,
|
|
108
110
|
brandBlock: _templates.brandBlock,
|
|
109
111
|
titleBlock: _templates.titleBlock,
|
|
110
112
|
descriptionBlock: _templates.descriptionBlock,
|
|
111
113
|
dateBlock: _templates.dateBlock,
|
|
114
|
+
authorsBlock: _templates.authorsBlock,
|
|
115
|
+
authorsAndDateBlock: _templates.authorsAndDateBlock,
|
|
112
116
|
priceBlock: _templates.priceBlock,
|
|
113
117
|
discountRateText: _templates.discountRateText,
|
|
114
118
|
ctaBlock: _templates.ctaBlock,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _collection = _interopRequireDefault(require("./collection.js"));
|
|
8
|
+
const _excluded = ["className"];
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
|
+
const TYPE = 'horizontal';
|
|
12
|
+
const DEFAULT_CLASSNAME = 'miso-horizontal';
|
|
13
|
+
class HorizontalLayout extends _collection.default {
|
|
14
|
+
static get type() {
|
|
15
|
+
return TYPE;
|
|
16
|
+
}
|
|
17
|
+
static get defaultTemplates() {
|
|
18
|
+
return super.defaultTemplates;
|
|
19
|
+
}
|
|
20
|
+
static get defaultClassName() {
|
|
21
|
+
return DEFAULT_CLASSNAME;
|
|
22
|
+
}
|
|
23
|
+
constructor(_ref = {}) {
|
|
24
|
+
let {
|
|
25
|
+
className = DEFAULT_CLASSNAME
|
|
26
|
+
} = _ref,
|
|
27
|
+
options = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
|
+
super(Object.assign({
|
|
29
|
+
className
|
|
30
|
+
}, options));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = HorizontalLayout;
|
|
@@ -7,7 +7,11 @@ exports.affiliation = affiliation;
|
|
|
7
7
|
exports.affiliationInfoBlock = affiliationInfoBlock;
|
|
8
8
|
exports.article = article;
|
|
9
9
|
exports.articleInfoBlock = articleInfoBlock;
|
|
10
|
+
exports.authorsAndDateBlock = authorsAndDateBlock;
|
|
11
|
+
exports.authorsBlock = authorsBlock;
|
|
10
12
|
exports.brandBlock = brandBlock;
|
|
13
|
+
exports.compactArticle = compactArticle;
|
|
14
|
+
exports.compactArticleInfoBlock = compactArticleInfoBlock;
|
|
11
15
|
exports.cta = cta;
|
|
12
16
|
exports.ctaBlock = ctaBlock;
|
|
13
17
|
exports.dateBlock = dateBlock;
|
|
@@ -58,6 +62,13 @@ function article(layout, state, data, meta) {
|
|
|
58
62
|
const [openTag, closeTag] = tagPair(layout, data);
|
|
59
63
|
return [openTag, (templates.imageBlock || imageBlock)(layout, data, meta), (templates.infoBlock || templates.articleInfoBlock || articleInfoBlock)(layout, data, meta), (templates.indexBlock || indexBlock)(layout, data, meta), closeTag].join('');
|
|
60
64
|
}
|
|
65
|
+
function compactArticle(layout, state, data, meta) {
|
|
66
|
+
const {
|
|
67
|
+
templates
|
|
68
|
+
} = layout;
|
|
69
|
+
const [openTag, closeTag] = tagPair(layout, data);
|
|
70
|
+
return [openTag, (templates.indexBlock || indexBlock)(layout, data, meta), (templates.infoBlock || templates.articleInfoBlock || compactArticleInfoBlock)(layout, data, meta), closeTag].join('');
|
|
71
|
+
}
|
|
61
72
|
function image(layout, state, data, meta) {
|
|
62
73
|
const {
|
|
63
74
|
templates
|
|
@@ -97,6 +108,13 @@ function articleInfoBlock(layout, data, meta) {
|
|
|
97
108
|
} = layout;
|
|
98
109
|
return `<div class="${className}__item-info-container">${[(templates.titleBlock || titleBlock)(layout, data, meta), (templates.dateBlock || dateBlock)(layout, data, meta), (templates.descriptionBlock || descriptionBlock)(layout, data, meta), (templates.ctaBlock || ctaBlock)(layout, data, meta)].join('')}</div>`;
|
|
99
110
|
}
|
|
111
|
+
function compactArticleInfoBlock(layout, data, meta) {
|
|
112
|
+
const {
|
|
113
|
+
className,
|
|
114
|
+
templates
|
|
115
|
+
} = layout;
|
|
116
|
+
return `<div class="${className}__item-info-container">${[(templates.titleBlock || titleBlock)(layout, data, meta), (templates.authorsAndDateBlock || authorsAndDateBlock)(layout, data, meta)].join('')}</div>`;
|
|
117
|
+
}
|
|
100
118
|
function imageInfoBlock(layout, data, meta) {
|
|
101
119
|
const {
|
|
102
120
|
className,
|
|
@@ -144,6 +162,20 @@ function dateBlock({
|
|
|
144
162
|
const date = published_at || created_at || updated_at;
|
|
145
163
|
return date ? `<div class="${className}__item-date">${formatDate(date, templates.date)}</div>` : '';
|
|
146
164
|
}
|
|
165
|
+
function authorsBlock({
|
|
166
|
+
className
|
|
167
|
+
}, {
|
|
168
|
+
authors
|
|
169
|
+
}) {
|
|
170
|
+
return authors && Array.isArray(authors) && authors.length ? `<div class="${className}__item-authors">${authors.join(', ')}</div>` : '';
|
|
171
|
+
}
|
|
172
|
+
function authorsAndDateBlock(layout, data, meta) {
|
|
173
|
+
const {
|
|
174
|
+
className,
|
|
175
|
+
templates
|
|
176
|
+
} = layout;
|
|
177
|
+
return `<div class="${className}__item-authors-and-date-container">${[(templates.authorsBlock || authorsBlock)(layout, data, meta), (templates.dateBlock || dateBlock)(layout, data, meta)].join('')}</div>`;
|
|
178
|
+
}
|
|
147
179
|
function priceBlock(layout, data) {
|
|
148
180
|
const {
|
|
149
181
|
className,
|
package/dist/cjs/version.js
CHANGED
|
@@ -11,6 +11,7 @@ var _searchBased = _interopRequireDefault(require("./search-based.js"));
|
|
|
11
11
|
var _answerBased = _interopRequireDefault(require("./answer-based.js"));
|
|
12
12
|
var _constants = require("../constants.js");
|
|
13
13
|
var _index2 = require("../layout/index.js");
|
|
14
|
+
var _templates = require("../layout/templates.js");
|
|
14
15
|
var _hybridSearchAnswer = _interopRequireDefault(require("./hybrid-search-answer.js"));
|
|
15
16
|
var _hybridSearchResults = _interopRequireDefault(require("./hybrid-search-results.js"));
|
|
16
17
|
var _hybridSearchViews = _interopRequireDefault(require("./hybrid-search-views.js"));
|
|
@@ -20,7 +21,7 @@ const DEFAULT_API_OPTIONS = Object.freeze({
|
|
|
20
21
|
group: _commons.API.GROUP.ASK,
|
|
21
22
|
name: _commons.API.NAME.SEARCH,
|
|
22
23
|
payload: Object.assign({}, _answerBased.default.DEFAULT_API_OPTIONS.payload, _searchBased.default.DEFAULT_API_OPTIONS.payload, {
|
|
23
|
-
source_fl: ['cover_image', 'url', 'created_at', 'updated_at', 'published_at', 'title']
|
|
24
|
+
source_fl: ['cover_image', 'url', 'created_at', 'updated_at', 'published_at', 'title', 'authors']
|
|
24
25
|
})
|
|
25
26
|
});
|
|
26
27
|
const DEFAULT_LAYOUTS = Object.freeze(Object.assign({}, _answerBased.default.DEFAULT_LAYOUTS, _searchBased.default.DEFAULT_LAYOUTS, {
|
|
@@ -29,6 +30,15 @@ const DEFAULT_LAYOUTS = Object.freeze(Object.assign({}, _answerBased.default.DEF
|
|
|
29
30
|
}],
|
|
30
31
|
[_constants.ROLE.QUESTION]: [_index2.TextLayout.type, {
|
|
31
32
|
raw: true
|
|
33
|
+
}],
|
|
34
|
+
[_constants.ROLE.SOURCES]: [_index2.HorizontalLayout.type, {
|
|
35
|
+
incremental: true,
|
|
36
|
+
itemType: 'article',
|
|
37
|
+
templates: {
|
|
38
|
+
ordered: true,
|
|
39
|
+
article: _templates.compactArticle,
|
|
40
|
+
articleInfoBlock: _templates.compactArticleInfoBlock
|
|
41
|
+
}
|
|
32
42
|
}]
|
|
33
43
|
}));
|
|
34
44
|
const DEFAULT_TRACKERS = Object.freeze(Object.assign({}, _answerBased.default.DEFAULT_TRACKERS, _searchBased.default.DEFAULT_TRACKERS));
|
|
@@ -44,12 +54,25 @@ const DEFAULT_AUTOCOMPLETE_OPTIONS = Object.freeze({
|
|
|
44
54
|
}
|
|
45
55
|
}
|
|
46
56
|
});
|
|
57
|
+
const DEFAULT_FILTERS_OPTIONS = Object.freeze({
|
|
58
|
+
sort: {
|
|
59
|
+
options: [{
|
|
60
|
+
field: 'relevance',
|
|
61
|
+
text: 'Relevance',
|
|
62
|
+
default: true
|
|
63
|
+
}, {
|
|
64
|
+
field: 'published_at',
|
|
65
|
+
text: 'Date'
|
|
66
|
+
}]
|
|
67
|
+
}
|
|
68
|
+
});
|
|
47
69
|
const DEFAULT_OPTIONS = Object.freeze(Object.assign({}, _answerBased.default.DEFAULT_OPTIONS, _searchBased.default.DEFAULT_OPTIONS, {
|
|
48
70
|
api: DEFAULT_API_OPTIONS,
|
|
49
71
|
layouts: DEFAULT_LAYOUTS,
|
|
50
72
|
trackers: DEFAULT_TRACKERS,
|
|
51
73
|
autocomplete: DEFAULT_AUTOCOMPLETE_OPTIONS,
|
|
52
|
-
pagination: DEFAULT_PAGINATION
|
|
74
|
+
pagination: DEFAULT_PAGINATION,
|
|
75
|
+
filters: DEFAULT_FILTERS_OPTIONS
|
|
53
76
|
}));
|
|
54
77
|
const ROLES_OPTIONS = Object.freeze({
|
|
55
78
|
main: _constants.ROLE.PRODUCTS,
|
package/package.json
CHANGED
|
@@ -64,6 +64,7 @@ class Sections extends _Sections {
|
|
|
64
64
|
const { classPrefix } = options;
|
|
65
65
|
return element('div', { classes: [`${classPrefix}__search-results-filters`] }, [
|
|
66
66
|
'<miso-facets></miso-facets>',
|
|
67
|
+
'<miso-sort></miso-sort>',
|
|
67
68
|
]);
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -97,7 +98,7 @@ export function root(options = {}) {
|
|
|
97
98
|
const { normalizeOptions, section, container } = helpers;
|
|
98
99
|
options = normalizeOptions(options);
|
|
99
100
|
const { answerBox, answerGroup, searchResultsGroup } = sections;
|
|
100
|
-
const { answerBox: answerBoxOptions =
|
|
101
|
+
const { answerBox: answerBoxOptions = false } = options;
|
|
101
102
|
return [
|
|
102
103
|
section(options, { name: 'question' }, [
|
|
103
104
|
container(options, { name: 'query' }, '<miso-query></miso-query>'),
|
package/src/layout/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as ErrorLayout } from './error/error.js';
|
|
|
4
4
|
export { default as BannerLayout } from './banner/banner.js';
|
|
5
5
|
export { default as CollectionLayout } from './list/collection.js';
|
|
6
6
|
export { default as ListLayout } from './list/list.js';
|
|
7
|
+
export { default as HorizontalLayout } from './list/horizontal.js';
|
|
7
8
|
export { default as CardsLayout } from './list/cards.js';
|
|
8
9
|
export { default as CarouselLayout } from './list/carousel.js';
|
|
9
10
|
export { default as GalleryLayout } from './list/gallery.js';
|
|
@@ -2,7 +2,7 @@ import { STATUS } from '../../constants.js';
|
|
|
2
2
|
import TemplateBasedLayout from '../template.js';
|
|
3
3
|
import { makeTrackable } from '../mixin/trackable.js';
|
|
4
4
|
import { makeTriggerable } from '../mixin/triggerable.js';
|
|
5
|
-
import { product, article, image, question, productInfoBlock, articleInfoBlock, imageInfoBlock, titleBlock, brandBlock, descriptionBlock, dateBlock, priceBlock, discountRateText, ctaBlock, cta, imageBlock, indexBlock } from '../templates.js';
|
|
5
|
+
import { product, article, compactArticle, image, question, productInfoBlock, articleInfoBlock, compactArticleInfoBlock, imageInfoBlock, titleBlock, brandBlock, descriptionBlock, dateBlock, authorsBlock, authorsAndDateBlock, priceBlock, discountRateText, ctaBlock, cta, imageBlock, indexBlock } from '../templates.js';
|
|
6
6
|
|
|
7
7
|
function root(layout, state) {
|
|
8
8
|
const { className, role, templates, options } = layout;
|
|
@@ -63,6 +63,7 @@ function loading() {
|
|
|
63
63
|
const DEFAULT_TEMPLATES = Object.freeze({
|
|
64
64
|
product,
|
|
65
65
|
article,
|
|
66
|
+
compactArticle,
|
|
66
67
|
image,
|
|
67
68
|
question,
|
|
68
69
|
root,
|
|
@@ -75,11 +76,14 @@ const DEFAULT_TEMPLATES = Object.freeze({
|
|
|
75
76
|
item,
|
|
76
77
|
productInfoBlock,
|
|
77
78
|
articleInfoBlock,
|
|
79
|
+
compactArticleInfoBlock,
|
|
78
80
|
imageInfoBlock,
|
|
79
81
|
brandBlock,
|
|
80
82
|
titleBlock,
|
|
81
83
|
descriptionBlock,
|
|
82
84
|
dateBlock,
|
|
85
|
+
authorsBlock,
|
|
86
|
+
authorsAndDateBlock,
|
|
83
87
|
priceBlock,
|
|
84
88
|
discountRateText,
|
|
85
89
|
ctaBlock,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import CollectionLayout from './collection.js';
|
|
2
|
+
|
|
3
|
+
const TYPE = 'horizontal';
|
|
4
|
+
const DEFAULT_CLASSNAME = 'miso-horizontal';
|
|
5
|
+
|
|
6
|
+
export default class HorizontalLayout extends CollectionLayout {
|
|
7
|
+
|
|
8
|
+
static get type() {
|
|
9
|
+
return TYPE;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get defaultTemplates() {
|
|
13
|
+
return super.defaultTemplates;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get defaultClassName() {
|
|
17
|
+
return DEFAULT_CLASSNAME;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor({ className = DEFAULT_CLASSNAME, ...options } = {}) {
|
|
21
|
+
super({ className, ...options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
package/src/layout/templates.js
CHANGED
|
@@ -42,6 +42,17 @@ export function article(layout, state, data, meta) {
|
|
|
42
42
|
].join('');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export function compactArticle(layout, state, data, meta) {
|
|
46
|
+
const { templates } = layout;
|
|
47
|
+
const [openTag, closeTag] = tagPair(layout, data);
|
|
48
|
+
return [
|
|
49
|
+
openTag,
|
|
50
|
+
(templates.indexBlock || indexBlock)(layout, data, meta),
|
|
51
|
+
(templates.infoBlock || templates.articleInfoBlock || compactArticleInfoBlock)(layout, data, meta),
|
|
52
|
+
closeTag,
|
|
53
|
+
].join('');
|
|
54
|
+
}
|
|
55
|
+
|
|
45
56
|
export function image(layout, state, data, meta) {
|
|
46
57
|
const { templates } = layout;
|
|
47
58
|
const [openTag, closeTag] = tagPair(layout, data);
|
|
@@ -93,6 +104,14 @@ export function articleInfoBlock(layout, data, meta) {
|
|
|
93
104
|
].join('')}</div>`;
|
|
94
105
|
}
|
|
95
106
|
|
|
107
|
+
export function compactArticleInfoBlock(layout, data, meta) {
|
|
108
|
+
const { className, templates } = layout;
|
|
109
|
+
return `<div class="${className}__item-info-container">${[
|
|
110
|
+
(templates.titleBlock || titleBlock)(layout, data, meta),
|
|
111
|
+
(templates.authorsAndDateBlock || authorsAndDateBlock)(layout, data, meta),
|
|
112
|
+
].join('')}</div>`;
|
|
113
|
+
}
|
|
114
|
+
|
|
96
115
|
export function imageInfoBlock(layout, data, meta) {
|
|
97
116
|
const { className, templates } = layout;
|
|
98
117
|
return `<div class="${className}__item-info-container">${[
|
|
@@ -122,6 +141,18 @@ export function dateBlock({ className, templates }, { created_at, updated_at, pu
|
|
|
122
141
|
return date ? `<div class="${className}__item-date">${formatDate(date, templates.date)}</div>` : '';
|
|
123
142
|
}
|
|
124
143
|
|
|
144
|
+
export function authorsBlock({ className }, { authors }) {
|
|
145
|
+
return authors && Array.isArray(authors) && authors.length ? `<div class="${className}__item-authors">${authors.join(', ')}</div>` : '';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function authorsAndDateBlock(layout, data, meta) {
|
|
149
|
+
const { className, templates } = layout;
|
|
150
|
+
return `<div class="${className}__item-authors-and-date-container">${[
|
|
151
|
+
(templates.authorsBlock || authorsBlock)(layout, data, meta),
|
|
152
|
+
(templates.dateBlock || dateBlock)(layout, data, meta),
|
|
153
|
+
].join('')}</div>`;
|
|
154
|
+
}
|
|
155
|
+
|
|
125
156
|
export function priceBlock(layout, data) {
|
|
126
157
|
const { className, templates } = layout;
|
|
127
158
|
const { sale_price, original_price, currency = 'USD' } = data;
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.
|
|
1
|
+
export default '1.12.0-beta.0';
|
|
@@ -4,7 +4,8 @@ import Workflow from './base.js';
|
|
|
4
4
|
import SearchBasedWorkflow from './search-based.js';
|
|
5
5
|
import AnswerBasedWorkflow from './answer-based.js';
|
|
6
6
|
import { ROLE, WORKFLOW_CONFIGURABLE } from '../constants.js';
|
|
7
|
-
import { SearchBoxLayout, TextLayout } from '../layout/index.js';
|
|
7
|
+
import { SearchBoxLayout, TextLayout, HorizontalLayout } from '../layout/index.js';
|
|
8
|
+
import { compactArticle, compactArticleInfoBlock } from '../layout/templates.js';
|
|
8
9
|
import HybridSearchAnswer from './hybrid-search-answer.js';
|
|
9
10
|
import HybridSearchResults from './hybrid-search-results.js';
|
|
10
11
|
import HybridSearchViewsActor from './hybrid-search-views.js';
|
|
@@ -16,7 +17,7 @@ const DEFAULT_API_OPTIONS = Object.freeze({
|
|
|
16
17
|
payload: {
|
|
17
18
|
...AnswerBasedWorkflow.DEFAULT_API_OPTIONS.payload,
|
|
18
19
|
...SearchBasedWorkflow.DEFAULT_API_OPTIONS.payload,
|
|
19
|
-
source_fl: ['cover_image', 'url', 'created_at', 'updated_at', 'published_at', 'title'],
|
|
20
|
+
source_fl: ['cover_image', 'url', 'created_at', 'updated_at', 'published_at', 'title', 'authors'],
|
|
20
21
|
},
|
|
21
22
|
});
|
|
22
23
|
|
|
@@ -25,6 +26,18 @@ const DEFAULT_LAYOUTS = Object.freeze({
|
|
|
25
26
|
...SearchBasedWorkflow.DEFAULT_LAYOUTS,
|
|
26
27
|
[ROLE.QUERY]: [SearchBoxLayout.type, { placeholder: '' }],
|
|
27
28
|
[ROLE.QUESTION]: [TextLayout.type, { raw: true }],
|
|
29
|
+
[ROLE.SOURCES]: [
|
|
30
|
+
HorizontalLayout.type,
|
|
31
|
+
{
|
|
32
|
+
incremental: true,
|
|
33
|
+
itemType: 'article',
|
|
34
|
+
templates: {
|
|
35
|
+
ordered: true,
|
|
36
|
+
article: compactArticle,
|
|
37
|
+
articleInfoBlock: compactArticleInfoBlock
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
],
|
|
28
41
|
});
|
|
29
42
|
|
|
30
43
|
const DEFAULT_TRACKERS = Object.freeze({
|
|
@@ -47,6 +60,15 @@ const DEFAULT_AUTOCOMPLETE_OPTIONS = Object.freeze({
|
|
|
47
60
|
},
|
|
48
61
|
});
|
|
49
62
|
|
|
63
|
+
const DEFAULT_FILTERS_OPTIONS = Object.freeze({
|
|
64
|
+
sort: {
|
|
65
|
+
options: [
|
|
66
|
+
{ field: 'relevance', text: 'Relevance', default: true },
|
|
67
|
+
{ field: 'published_at', text: 'Date' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
50
72
|
const DEFAULT_OPTIONS = Object.freeze({
|
|
51
73
|
...AnswerBasedWorkflow.DEFAULT_OPTIONS,
|
|
52
74
|
...SearchBasedWorkflow.DEFAULT_OPTIONS,
|
|
@@ -55,6 +77,7 @@ const DEFAULT_OPTIONS = Object.freeze({
|
|
|
55
77
|
trackers: DEFAULT_TRACKERS,
|
|
56
78
|
autocomplete: DEFAULT_AUTOCOMPLETE_OPTIONS,
|
|
57
79
|
pagination: DEFAULT_PAGINATION,
|
|
80
|
+
filters: DEFAULT_FILTERS_OPTIONS,
|
|
58
81
|
});
|
|
59
82
|
|
|
60
83
|
const ROLES_OPTIONS = Object.freeze({
|