@miso.ai/client-sdk-ui 1.9.5-beta.0 → 1.9.5-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/version.js
CHANGED
package/dist/cjs/workflow/ask.js
CHANGED
|
@@ -10,7 +10,7 @@ var _options = require("./options.js");
|
|
|
10
10
|
var _index = require("../actor/index.js");
|
|
11
11
|
var _constants = require("../constants.js");
|
|
12
12
|
var _index2 = require("../layout/index.js");
|
|
13
|
-
const _excluded = ["q", "
|
|
13
|
+
const _excluded = ["q", "qs"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
16
|
const DEFAULT_API_OPTIONS = Object.freeze({
|
|
@@ -118,7 +118,7 @@ class Ask extends _base.default {
|
|
|
118
118
|
} = this._autoQuery = options;
|
|
119
119
|
const searchParams = new URLSearchParams(window.location.search);
|
|
120
120
|
const q = searchParams.get('q');
|
|
121
|
-
const
|
|
121
|
+
const qs = searchParams.get('qs');
|
|
122
122
|
const {
|
|
123
123
|
layout
|
|
124
124
|
} = this._views.get(_constants.ROLE.QUERY);
|
|
@@ -133,7 +133,7 @@ class Ask extends _base.default {
|
|
|
133
133
|
if (q) {
|
|
134
134
|
this.query({
|
|
135
135
|
q,
|
|
136
|
-
|
|
136
|
+
qs
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -141,7 +141,7 @@ class Ask extends _base.default {
|
|
|
141
141
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
142
142
|
let {
|
|
143
143
|
q: question,
|
|
144
|
-
|
|
144
|
+
qs: questionSource
|
|
145
145
|
} = _ref,
|
|
146
146
|
payload = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
147
147
|
payload = Object.assign({}, payload, {
|
|
@@ -150,8 +150,8 @@ class Ask extends _base.default {
|
|
|
150
150
|
if (this.parentQuestionId) {
|
|
151
151
|
payload.parent_question_id = this.parentQuestionId;
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
154
|
-
(payload._meta || (payload._meta = {})).question_source =
|
|
153
|
+
if (questionSource) {
|
|
154
|
+
(payload._meta || (payload._meta = {})).question_source = questionSource;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// clear question id from previous session
|
|
@@ -163,8 +163,8 @@ class Ask extends _base.default {
|
|
|
163
163
|
const {
|
|
164
164
|
session
|
|
165
165
|
} = this;
|
|
166
|
-
if (
|
|
167
|
-
session.meta.question_source =
|
|
166
|
+
if (questionSource) {
|
|
167
|
+
session.meta.question_source = questionSource;
|
|
168
168
|
}
|
|
169
169
|
this._hub.update(_index.fields.request(), (0, _options.mergeApiOptions)(this._options.resolved.api, {
|
|
170
170
|
payload,
|
package/package.json
CHANGED
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.9.5-beta.
|
|
1
|
+
export default '1.9.5-beta.1';
|
package/src/workflow/ask.js
CHANGED
|
@@ -101,7 +101,7 @@ export default class Ask extends Workflow {
|
|
|
101
101
|
const { setValue = true, focus = true } = this._autoQuery = options;
|
|
102
102
|
const searchParams = new URLSearchParams(window.location.search);
|
|
103
103
|
const q = searchParams.get('q');
|
|
104
|
-
const
|
|
104
|
+
const qs = searchParams.get('qs');
|
|
105
105
|
const { layout } = this._views.get(ROLE.QUERY);
|
|
106
106
|
if (layout) {
|
|
107
107
|
if (q && setValue) {
|
|
@@ -112,18 +112,18 @@ export default class Ask extends Workflow {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
if (q) {
|
|
115
|
-
this.query({ q,
|
|
115
|
+
this.query({ q, qs });
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
query({ q: question,
|
|
119
|
+
query({ q: question, qs: questionSource, ...payload } = {}) {
|
|
120
120
|
payload = { ...payload, question };
|
|
121
121
|
|
|
122
122
|
if (this.parentQuestionId) {
|
|
123
123
|
payload.parent_question_id = this.parentQuestionId;
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
(payload._meta || (payload._meta = {})).question_source =
|
|
125
|
+
if (questionSource) {
|
|
126
|
+
(payload._meta || (payload._meta = {})).question_source = questionSource;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// clear question id from previous session
|
|
@@ -135,8 +135,8 @@ export default class Ask extends Workflow {
|
|
|
135
135
|
this.restart();
|
|
136
136
|
|
|
137
137
|
const { session } = this;
|
|
138
|
-
if (
|
|
139
|
-
session.meta.question_source =
|
|
138
|
+
if (questionSource) {
|
|
139
|
+
session.meta.question_source = questionSource;
|
|
140
140
|
}
|
|
141
141
|
this._hub.update(fields.request(), mergeApiOptions(this._options.resolved.api, { payload, session }));
|
|
142
142
|
|
package/src/workflow/explore.js
CHANGED
|
@@ -121,7 +121,7 @@ export default class Explore extends Workflow {
|
|
|
121
121
|
}
|
|
122
122
|
const url = this._linkFn(text);
|
|
123
123
|
if (this._productId) {
|
|
124
|
-
return `${url}&
|
|
124
|
+
return `${url}&qs=${encodeURIComponent(this._productId)}`;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|