@miso.ai/client-sdk-ui 1.13.0-beta.6 → 1.13.0-beta.7

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.
@@ -166,7 +166,11 @@ class Ui {
166
166
  return this.recommendations.get(); // get default recommendation unit
167
167
  }
168
168
  get search() {
169
- return this._search || (this._search = new _index.Search(this._plugin, this._client));
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
- return this._hybridSearch || (this._hybridSearch = new _index.HybridSearch(this._plugin, this._client));
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));
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '1.13.0-beta.6';
7
+ var _default = exports.default = '1.13.0-beta.7';
@@ -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._create(unitId);
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._create(unitId);
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');
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@miso.ai/commons": "1.13.0-beta.6"
33
+ "@miso.ai/commons": "1.13.0-beta.7"
34
34
  },
35
- "version": "1.13.0-beta.6"
35
+ "version": "1.13.0-beta.7"
36
36
  }
package/src/plugin.js CHANGED
@@ -176,7 +176,11 @@ class Ui {
176
176
  }
177
177
 
178
178
  get search() {
179
- return this._search || (this._search = new Search(this._plugin, this._client));
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
- return this._hybridSearch || (this._hybridSearch = new HybridSearch(this._plugin, this._client));
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.6';
1
+ export default '1.13.0-beta.7';
@@ -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
  }
@@ -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._create(unitId);
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._create(unitId);
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) {