@miso.ai/client-sdk-ui 1.13.0-beta.6 → 1.13.0-beta.8
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/plugin.js +10 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/asks.js +2 -0
- package/dist/cjs/workflow/explore.js +1 -0
- package/dist/cjs/workflow/units.js +7 -2
- package/dist/cjs/workflow/use-link.js +1 -1
- package/package.json +2 -2
- package/src/plugin.js +10 -2
- package/src/version.js +1 -1
- package/src/workflow/asks.js +3 -0
- package/src/workflow/explore.js +1 -1
- package/src/workflow/units.js +8 -2
- package/src/workflow/use-link.js +1 -1
package/dist/cjs/plugin.js
CHANGED
|
@@ -166,7 +166,11 @@ class Ui {
|
|
|
166
166
|
return this.recommendations.get(); // get default recommendation unit
|
|
167
167
|
}
|
|
168
168
|
get search() {
|
|
169
|
-
|
|
169
|
+
if (!this._search) {
|
|
170
|
+
this._search = new _index.Search(this._plugin, this._client);
|
|
171
|
+
this._client._events.emit('postworkflow', this._search);
|
|
172
|
+
}
|
|
173
|
+
return this._search;
|
|
170
174
|
}
|
|
171
175
|
get asks() {
|
|
172
176
|
return this._asks || (this._asks = this._plugin._getAsks(this._client));
|
|
@@ -175,7 +179,11 @@ class Ui {
|
|
|
175
179
|
return this.asks.root;
|
|
176
180
|
}
|
|
177
181
|
get hybridSearch() {
|
|
178
|
-
|
|
182
|
+
if (!this._hybridSearch) {
|
|
183
|
+
this._hybridSearch = new _index.HybridSearch(this._plugin, this._client);
|
|
184
|
+
this._client._events.emit('postworkflow', this._hybridSearch);
|
|
185
|
+
}
|
|
186
|
+
return this._hybridSearch;
|
|
179
187
|
}
|
|
180
188
|
get explores() {
|
|
181
189
|
return this._explores || (this._explores = this._plugin._getExplores(this._client));
|
package/dist/cjs/version.js
CHANGED
|
@@ -39,6 +39,7 @@ class Asks extends _context.default {
|
|
|
39
39
|
this._byQid = new Map();
|
|
40
40
|
this._byPqid = new Map();
|
|
41
41
|
this._root = new _ask.default(this); // initialize with default workflow
|
|
42
|
+
client._events.emit('postworkflow', this._root);
|
|
42
43
|
this._events.on('*', event => this._createNextIfNecessary(event));
|
|
43
44
|
this._events.on('loading', event => this._setActive(event.workflow));
|
|
44
45
|
this._events.on('destroy', () => this._requestEmitAfterDestroy());
|
|
@@ -73,6 +74,7 @@ class Asks extends _context.default {
|
|
|
73
74
|
let workflow = this._byPqid.get(parentQuestionId);
|
|
74
75
|
if (!workflow && autoCreate) {
|
|
75
76
|
workflow = new _ask.default(this, parentQuestionId);
|
|
77
|
+
this._client._events.emit('postworkflow', workflow);
|
|
76
78
|
}
|
|
77
79
|
return workflow;
|
|
78
80
|
}
|
|
@@ -19,7 +19,7 @@ class UnitWorkflowContext extends _context.default {
|
|
|
19
19
|
if (this._members.has(unitId)) {
|
|
20
20
|
throw new Error(`Unit already exists: ${unitId}`);
|
|
21
21
|
}
|
|
22
|
-
return this.
|
|
22
|
+
return this._createAndEmit(unitId);
|
|
23
23
|
}
|
|
24
24
|
has(unitId = _constants.DEFAULT_UNIT_ID) {
|
|
25
25
|
return this._members.has(unitId);
|
|
@@ -28,7 +28,12 @@ class UnitWorkflowContext extends _context.default {
|
|
|
28
28
|
if (typeof unitId !== 'string') {
|
|
29
29
|
throw new Error(`Required unit ID to be a string: ${unitId}`);
|
|
30
30
|
}
|
|
31
|
-
return this._members.get(unitId) || this.
|
|
31
|
+
return this._members.get(unitId) || this._createAndEmit(unitId);
|
|
32
|
+
}
|
|
33
|
+
_createAndEmit(unitId) {
|
|
34
|
+
const workflow = this._create(unitId);
|
|
35
|
+
this._client._events.emit('postworkflow', workflow);
|
|
36
|
+
return workflow;
|
|
32
37
|
}
|
|
33
38
|
_create(unitId) {
|
|
34
39
|
throw new Error('Not implemented');
|
|
@@ -29,7 +29,7 @@ class UseLinkMixin {
|
|
|
29
29
|
window.location.href = url;
|
|
30
30
|
} else {
|
|
31
31
|
const target = options.target || '_blank';
|
|
32
|
-
const windowFeatures = options.windowFeatures || '';
|
|
32
|
+
const windowFeatures = options.windowFeatures || 'noopener';
|
|
33
33
|
window.open(url, target, windowFeatures);
|
|
34
34
|
}
|
|
35
35
|
}
|
package/package.json
CHANGED
package/src/plugin.js
CHANGED
|
@@ -176,7 +176,11 @@ class Ui {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
get search() {
|
|
179
|
-
|
|
179
|
+
if (!this._search) {
|
|
180
|
+
this._search = new Search(this._plugin, this._client);
|
|
181
|
+
this._client._events.emit('postworkflow', this._search);
|
|
182
|
+
}
|
|
183
|
+
return this._search;
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
get asks() {
|
|
@@ -188,7 +192,11 @@ class Ui {
|
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
get hybridSearch() {
|
|
191
|
-
|
|
195
|
+
if (!this._hybridSearch) {
|
|
196
|
+
this._hybridSearch = new HybridSearch(this._plugin, this._client);
|
|
197
|
+
this._client._events.emit('postworkflow', this._hybridSearch);
|
|
198
|
+
}
|
|
199
|
+
return this._hybridSearch;
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
get explores() {
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.13.0-beta.
|
|
1
|
+
export default '1.13.0-beta.8';
|
package/src/workflow/asks.js
CHANGED
|
@@ -30,6 +30,8 @@ export default class Asks extends WorkflowContext {
|
|
|
30
30
|
this._byQid = new Map();
|
|
31
31
|
this._byPqid = new Map();
|
|
32
32
|
this._root = new Ask(this); // initialize with default workflow
|
|
33
|
+
client._events.emit('postworkflow', this._root);
|
|
34
|
+
|
|
33
35
|
this._events.on('*', event => this._createNextIfNecessary(event));
|
|
34
36
|
this._events.on('loading', event => this._setActive(event.workflow));
|
|
35
37
|
this._events.on('destroy', () => this._requestEmitAfterDestroy());
|
|
@@ -67,6 +69,7 @@ export default class Asks extends WorkflowContext {
|
|
|
67
69
|
let workflow = this._byPqid.get(parentQuestionId);
|
|
68
70
|
if (!workflow && autoCreate) {
|
|
69
71
|
workflow = new Ask(this, parentQuestionId);
|
|
72
|
+
this._client._events.emit('postworkflow', workflow);
|
|
70
73
|
}
|
|
71
74
|
return workflow;
|
|
72
75
|
}
|
package/src/workflow/explore.js
CHANGED
|
@@ -14,7 +14,7 @@ const DEFAULT_API_OPTIONS = Object.freeze({
|
|
|
14
14
|
|
|
15
15
|
const DEFAULT_LAYOUTS = Object.freeze({
|
|
16
16
|
...UnitWorkflow.DEFAULT_LAYOUTS,
|
|
17
|
-
[ROLE.RELATED_QUESTIONS]: [ListLayout.type, { itemType: 'question', link: { rel: 'noopener nofollow' } }],
|
|
17
|
+
[ROLE.RELATED_QUESTIONS]: [ListLayout.type, { itemType: 'question', link: { rel: 'noopener nofollow' } }], // TODO: should define by useLink()
|
|
18
18
|
[ROLE.QUERY]: [SearchBoxLayout.type, { placeholder: 'Ask a question' }],
|
|
19
19
|
});
|
|
20
20
|
|
package/src/workflow/units.js
CHANGED
|
@@ -16,7 +16,7 @@ export default class UnitWorkflowContext extends WorkflowContext {
|
|
|
16
16
|
if (this._members.has(unitId)) {
|
|
17
17
|
throw new Error(`Unit already exists: ${unitId}`);
|
|
18
18
|
}
|
|
19
|
-
return this.
|
|
19
|
+
return this._createAndEmit(unitId);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
has(unitId = DEFAULT_UNIT_ID) {
|
|
@@ -27,7 +27,13 @@ export default class UnitWorkflowContext extends WorkflowContext {
|
|
|
27
27
|
if (typeof unitId !== 'string') {
|
|
28
28
|
throw new Error(`Required unit ID to be a string: ${unitId}`);
|
|
29
29
|
}
|
|
30
|
-
return this._members.get(unitId) || this.
|
|
30
|
+
return this._members.get(unitId) || this._createAndEmit(unitId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_createAndEmit(unitId) {
|
|
34
|
+
const workflow = this._create(unitId);
|
|
35
|
+
this._client._events.emit('postworkflow', workflow);
|
|
36
|
+
return workflow;
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
_create(unitId) {
|
package/src/workflow/use-link.js
CHANGED
|
@@ -24,7 +24,7 @@ export class UseLinkMixin {
|
|
|
24
24
|
window.location.href = url;
|
|
25
25
|
} else {
|
|
26
26
|
const target = options.target || '_blank';
|
|
27
|
-
const windowFeatures = options.windowFeatures || '';
|
|
27
|
+
const windowFeatures = options.windowFeatures || 'noopener';
|
|
28
28
|
window.open(url, target, windowFeatures);
|
|
29
29
|
}
|
|
30
30
|
}
|