@miso.ai/client-sdk-ui 1.9.0-beta.7 → 1.9.0-beta.9
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/combo/ask/index.js +4 -0
- package/dist/cjs/combo/ask/options.js +7 -3
- package/dist/cjs/combo/ask/templates.js +2 -3
- package/dist/cjs/combo/base.js +4 -1
- package/dist/cjs/element/combo/miso-combo.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/package.json +2 -2
- package/src/combo/ask/index.js +5 -0
- package/src/combo/ask/options.js +7 -2
- package/src/combo/ask/templates.js +2 -3
- package/src/combo/base.js +4 -1
- package/src/element/combo/miso-combo.js +1 -1
- package/src/version.js +1 -1
|
@@ -18,6 +18,7 @@ class AskCombo extends _base.default {
|
|
|
18
18
|
plugin,
|
|
19
19
|
MisoClient
|
|
20
20
|
});
|
|
21
|
+
// TODO: extract options to super class
|
|
21
22
|
this._options = new _options.default();
|
|
22
23
|
this._localOptions = {};
|
|
23
24
|
}
|
|
@@ -41,6 +42,9 @@ class AskCombo extends _base.default {
|
|
|
41
42
|
get elements() {
|
|
42
43
|
return this._elements;
|
|
43
44
|
}
|
|
45
|
+
autoStart() {
|
|
46
|
+
this.resolvedOptions.autostart && this.start();
|
|
47
|
+
}
|
|
44
48
|
async _start() {
|
|
45
49
|
await (0, _commons.waitForDomContentLoaded)();
|
|
46
50
|
await this.MisoClient.cmdDone;
|
|
@@ -16,7 +16,8 @@ const {
|
|
|
16
16
|
currentScript
|
|
17
17
|
} = document;
|
|
18
18
|
const DEFAULT_OPTIONS = Object.freeze({
|
|
19
|
-
templates
|
|
19
|
+
templates,
|
|
20
|
+
autostart: true
|
|
20
21
|
});
|
|
21
22
|
class AskComboOptions {
|
|
22
23
|
constructor() {
|
|
@@ -74,7 +75,7 @@ function readFromScriptSrc() {
|
|
|
74
75
|
if (key === 'q') {
|
|
75
76
|
continue;
|
|
76
77
|
}
|
|
77
|
-
params[key] = value
|
|
78
|
+
params[key] = coerceValue(value);
|
|
78
79
|
}
|
|
79
80
|
return params;
|
|
80
81
|
}
|
|
@@ -88,10 +89,13 @@ function readFromPageUrl() {
|
|
|
88
89
|
const params = {};
|
|
89
90
|
for (const [key, value] of new URLSearchParams(window.location.search)) {
|
|
90
91
|
if (key.startsWith('miso_') && key.length > 5 && key !== 'miso_api_key') {
|
|
91
|
-
params[key.substring(5)] = value
|
|
92
|
+
params[key.substring(5)] = coerceValue(value);
|
|
92
93
|
} else if (key === 'q') {
|
|
93
94
|
params.q = value;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
return params;
|
|
98
|
+
}
|
|
99
|
+
function coerceValue(value) {
|
|
100
|
+
return value === '' ? true : value === 'false' ? false : value;
|
|
97
101
|
}
|
|
@@ -18,8 +18,7 @@ const root = options => `
|
|
|
18
18
|
${options.templates.answer(options)}
|
|
19
19
|
${options.templates.sources(options)}
|
|
20
20
|
</section>
|
|
21
|
-
<div id="${_constants.PREFIX}__follow-ups" class="${_constants.PREFIX}__follow-ups">
|
|
22
|
-
</div>
|
|
21
|
+
<div id="${_constants.PREFIX}__follow-ups" class="${_constants.PREFIX}__follow-ups"></div>
|
|
23
22
|
<section id="${_constants.PREFIX}__related-resources" class="${_constants.PREFIX}__section ${_constants.PREFIX}__related-resources">
|
|
24
23
|
<miso-ask visible-when="nonempty" logo="true">
|
|
25
24
|
<h2 class="${_constants.PREFIX}__phrase ${_constants.PREFIX}__related-resources-phrase"></h2>
|
|
@@ -34,7 +33,7 @@ const followUp = (options, _ref) => {
|
|
|
34
33
|
} = _ref;
|
|
35
34
|
return `
|
|
36
35
|
<section class="${_constants.PREFIX}__section ${_constants.PREFIX}__follow-up">
|
|
37
|
-
<miso-ask class="${_constants.PREFIX}__query-suggestions-container" visible-when="initial" parent-question-id="${parentQuestionId}">
|
|
36
|
+
<miso-ask class="${_constants.PREFIX}__query-suggestions-container" visible-when="initial+nonempty" parent-question-id="${parentQuestionId}">
|
|
38
37
|
<h3 class="${_constants.PREFIX}__phrase ${_constants.PREFIX}__related-questions-phrase"></h3>
|
|
39
38
|
<miso-query-suggestions></miso-query-suggestions>
|
|
40
39
|
</miso-ask>
|
package/dist/cjs/combo/base.js
CHANGED
|
@@ -30,11 +30,14 @@ class Combo extends _commons.Component {
|
|
|
30
30
|
set element(element) {
|
|
31
31
|
this._element = element;
|
|
32
32
|
}
|
|
33
|
-
start() {
|
|
33
|
+
start(options) {
|
|
34
34
|
if (this._started) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
this._started = true;
|
|
38
|
+
if (options) {
|
|
39
|
+
this.config(options);
|
|
40
|
+
}
|
|
38
41
|
this._start();
|
|
39
42
|
}
|
|
40
43
|
_start() {
|
package/dist/cjs/version.js
CHANGED
package/package.json
CHANGED
package/src/combo/ask/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export default class AskCombo extends Combo {
|
|
|
13
13
|
plugin,
|
|
14
14
|
MisoClient,
|
|
15
15
|
});
|
|
16
|
+
// TODO: extract options to super class
|
|
16
17
|
this._options = new AskComboOptions();
|
|
17
18
|
this._localOptions = {};
|
|
18
19
|
}
|
|
@@ -40,6 +41,10 @@ export default class AskCombo extends Combo {
|
|
|
40
41
|
return this._elements;
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
autoStart() {
|
|
45
|
+
this.resolvedOptions.autostart && this.start();
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
async _start() {
|
|
44
49
|
await waitForDomContentLoaded();
|
|
45
50
|
await this.MisoClient.cmdDone;
|
package/src/combo/ask/options.js
CHANGED
|
@@ -7,6 +7,7 @@ const { currentScript } = document;
|
|
|
7
7
|
|
|
8
8
|
const DEFAULT_OPTIONS = Object.freeze({
|
|
9
9
|
templates,
|
|
10
|
+
autostart: true,
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
export default class AskComboOptions {
|
|
@@ -64,7 +65,7 @@ function readFromScriptSrc() {
|
|
|
64
65
|
if (key === 'q') {
|
|
65
66
|
continue;
|
|
66
67
|
}
|
|
67
|
-
params[key] = value
|
|
68
|
+
params[key] = coerceValue(value);
|
|
68
69
|
}
|
|
69
70
|
return params;
|
|
70
71
|
}
|
|
@@ -78,10 +79,14 @@ function readFromPageUrl() {
|
|
|
78
79
|
const params = {};
|
|
79
80
|
for (const [key, value] of new URLSearchParams(window.location.search)) {
|
|
80
81
|
if (key.startsWith('miso_') && key.length > 5 && key !== 'miso_api_key') {
|
|
81
|
-
params[key.substring(5)] = value
|
|
82
|
+
params[key.substring(5)] = coerceValue(value);
|
|
82
83
|
} else if (key === 'q') {
|
|
83
84
|
params.q = value;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
return params;
|
|
87
88
|
}
|
|
89
|
+
|
|
90
|
+
function coerceValue(value) {
|
|
91
|
+
return value === '' ? true : value === 'false' ? false : value;
|
|
92
|
+
}
|
|
@@ -13,8 +13,7 @@ export const root = (options) => `
|
|
|
13
13
|
${options.templates.answer(options)}
|
|
14
14
|
${options.templates.sources(options)}
|
|
15
15
|
</section>
|
|
16
|
-
<div id="${PREFIX}__follow-ups" class="${PREFIX}__follow-ups">
|
|
17
|
-
</div>
|
|
16
|
+
<div id="${PREFIX}__follow-ups" class="${PREFIX}__follow-ups"></div>
|
|
18
17
|
<section id="${PREFIX}__related-resources" class="${PREFIX}__section ${PREFIX}__related-resources">
|
|
19
18
|
<miso-ask visible-when="nonempty" logo="true">
|
|
20
19
|
<h2 class="${PREFIX}__phrase ${PREFIX}__related-resources-phrase"></h2>
|
|
@@ -25,7 +24,7 @@ export const root = (options) => `
|
|
|
25
24
|
|
|
26
25
|
export const followUp = (options, { parentQuestionId }) => `
|
|
27
26
|
<section class="${PREFIX}__section ${PREFIX}__follow-up">
|
|
28
|
-
<miso-ask class="${PREFIX}__query-suggestions-container" visible-when="initial" parent-question-id="${parentQuestionId}">
|
|
27
|
+
<miso-ask class="${PREFIX}__query-suggestions-container" visible-when="initial+nonempty" parent-question-id="${parentQuestionId}">
|
|
29
28
|
<h3 class="${PREFIX}__phrase ${PREFIX}__related-questions-phrase"></h3>
|
|
30
29
|
<miso-query-suggestions></miso-query-suggestions>
|
|
31
30
|
</miso-ask>
|
package/src/combo/base.js
CHANGED
|
@@ -27,11 +27,14 @@ export default class Combo extends Component {
|
|
|
27
27
|
this._element = element;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
start() {
|
|
30
|
+
start(options) {
|
|
31
31
|
if (this._started) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
this._started = true;
|
|
35
|
+
if (options) {
|
|
36
|
+
this.config(options);
|
|
37
|
+
}
|
|
35
38
|
this._start();
|
|
36
39
|
}
|
|
37
40
|
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.9.0-beta.
|
|
1
|
+
export default '1.9.0-beta.9';
|