@miso.ai/client-sdk-ui 1.12.1-beta.1 → 1.12.1-beta.3

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.
Files changed (53) hide show
  1. package/dist/cjs/actor/fields.js +0 -4
  2. package/dist/cjs/actor/view.js +28 -29
  3. package/dist/cjs/actor/views.js +2 -14
  4. package/dist/cjs/affiliation/index.js +17 -2
  5. package/dist/cjs/defaults/ask/templates.js +30 -12
  6. package/dist/cjs/defaults/common/templates.js +2 -0
  7. package/dist/cjs/element/container/miso-container.js +8 -2
  8. package/dist/cjs/element/role/index.js +6 -6
  9. package/dist/cjs/element/util/index.js +3 -3
  10. package/dist/cjs/element/util/miso-stub.js +81 -0
  11. package/dist/cjs/element/utils.js +0 -10
  12. package/dist/cjs/layout/input/option-list.js +2 -9
  13. package/dist/cjs/layout/templates.js +7 -2
  14. package/dist/cjs/layout/text/typewriter/index.js +1 -1
  15. package/dist/cjs/plugin.js +5 -4
  16. package/dist/cjs/trait/collapsible.js +57 -0
  17. package/dist/cjs/trait/helpers.js +65 -0
  18. package/dist/cjs/trait/index.js +13 -0
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/cjs/workflow/ask.js +28 -32
  21. package/dist/cjs/workflow/base.js +1 -2
  22. package/dist/cjs/workflow/hybrid-search-views.js +0 -1
  23. package/dist/cjs/workflow/processors.js +20 -9
  24. package/package.json +2 -2
  25. package/src/actor/fields.js +0 -4
  26. package/src/actor/view.js +28 -25
  27. package/src/actor/views.js +2 -12
  28. package/src/affiliation/index.js +18 -2
  29. package/src/defaults/ask/templates.js +36 -23
  30. package/src/defaults/common/templates.js +2 -2
  31. package/src/element/container/miso-container.js +10 -2
  32. package/src/element/role/index.js +1 -1
  33. package/src/element/util/index.js +1 -1
  34. package/src/element/util/miso-stub.js +85 -0
  35. package/src/element/utils.js +0 -10
  36. package/src/layout/input/option-list.js +1 -8
  37. package/src/layout/templates.js +8 -2
  38. package/src/layout/text/typewriter/index.js +1 -1
  39. package/src/plugin.js +4 -4
  40. package/src/trait/collapsible.js +51 -0
  41. package/src/trait/helpers.js +48 -0
  42. package/src/trait/index.js +1 -0
  43. package/src/version.js +1 -1
  44. package/src/workflow/ask.js +28 -21
  45. package/src/workflow/base.js +2 -2
  46. package/src/workflow/hybrid-search-views.js +0 -1
  47. package/src/workflow/processors.js +16 -9
  48. package/dist/cjs/element/util/miso-collapsible.js +0 -52
  49. package/dist/cjs/element/util/miso-utility.js +0 -83
  50. package/dist/cjs/element/util/utils.js +0 -12
  51. package/src/element/util/miso-collapsible.js +0 -49
  52. package/src/element/util/miso-utility.js +0 -69
  53. package/src/element/util/utils.js +0 -3
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineActions = defineActions;
7
+ exports.defineClickables = defineClickables;
8
+ exports.defineStatusGetters = defineStatusGetters;
9
+ exports.listenToClickables = listenToClickables;
10
+ function defineStatusGetters(prototype, statuses) {
11
+ for (const status of statuses) {
12
+ Object.defineProperty(prototype, status, {
13
+ get() {
14
+ return this._element && this._element.classList.contains(status);
15
+ }
16
+ });
17
+ }
18
+ }
19
+ function defineActions(prototype, actions) {
20
+ for (const {
21
+ action,
22
+ classAction,
23
+ className
24
+ } of actions) {
25
+ prototype[action] = function () {
26
+ this._element && this._element.classList[classAction](className);
27
+ this[`_${action}`] && this[`_${action}`]();
28
+ };
29
+ }
30
+ }
31
+ function defineClickables(prototype, clickables) {
32
+ prototype._handleClick = function (event) {
33
+ const {
34
+ target,
35
+ button
36
+ } = event;
37
+ if (button !== 0) {
38
+ return; // only left click
39
+ }
40
+ for (let {
41
+ role,
42
+ selector,
43
+ action
44
+ } of clickables) {
45
+ selector = selector || `[data-role="${role}"]`;
46
+ if (!selector) {
47
+ continue;
48
+ }
49
+ if (target.closest(selector)) {
50
+ this[action]();
51
+ event.stopPropagation();
52
+ return;
53
+ }
54
+ }
55
+ };
56
+ }
57
+ function listenToClickables(addon) {
58
+ const element = addon._element;
59
+ if (!element) {
60
+ return () => {};
61
+ }
62
+ const handleClick = event => addon._handleClick(event);
63
+ element.addEventListener('click', handleClick);
64
+ return () => element.removeEventListener('click', handleClick);
65
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CollapsibleTrait", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _collapsible.default;
10
+ }
11
+ });
12
+ var _collapsible = _interopRequireDefault(require("./collapsible.js"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -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.12.1-beta.1';
7
+ var _default = exports.default = '1.12.1-beta.3';
@@ -47,7 +47,10 @@ const DEFAULT_OPTIONS = Object.freeze(Object.assign({}, _answerBased.default.DEF
47
47
  trackers: DEFAULT_TRACKERS
48
48
  }));
49
49
  const ROLES_OPTIONS = (0, _index3.mergeRolesOptions)(_answerBased.default.ROLES_OPTIONS, {
50
- members: Object.keys(DEFAULT_LAYOUTS)
50
+ members: Object.keys(DEFAULT_LAYOUTS),
51
+ mappings: {
52
+ [_constants.ROLE.QUERY_SUGGESTIONS]: _processors.mappingSuggestionsData
53
+ }
51
54
  });
52
55
  class Ask extends _answerBased.default {
53
56
  constructor(context, parentQuestionId) {
@@ -69,24 +72,8 @@ class Ask extends _answerBased.default {
69
72
  });
70
73
  }
71
74
  _initSubscriptions(args) {
72
- this._setSuggestedQuestions();
73
75
  super._initSubscriptions(args);
74
- }
75
- _setSuggestedQuestions() {
76
- const {
77
- previous
78
- } = this;
79
- if (!previous) {
80
- return;
81
- }
82
- // TODO: write question_source from payload._meta, so we don't need to write it to session.meta
83
- const values = previous.states[_index.fields.data()].value;
84
- const value = values.suggested_followup_questions || values.followup_questions || [];
85
- this._hub.update(_index.fields.suggestions(), {
86
- value: value.map(text => ({
87
- text
88
- }))
89
- });
76
+ this._unsubscribes = [...this._unsubscribes, this._hub.on(_index.fields.view(_constants.ROLE.REASONING), state => this._onReasoningViewUpdate(state))];
90
77
  }
91
78
  _initSession(args) {
92
79
  // register at context
@@ -153,25 +140,29 @@ class Ask extends _answerBased.default {
153
140
  // data //
154
141
  _updateData(data) {
155
142
  super._updateData(data);
156
- this._triggerReasoningShowIfNecessary(data);
143
+ this._triggerSuggestionsRefreshIfNecessary();
157
144
  }
158
- _triggerReasoningShowIfNecessary({
159
- session,
160
- value
161
- } = {}) {
162
- if (!value || !value.reasoning) {
145
+ _triggerSuggestionsRefreshIfNecessary() {
146
+ const {
147
+ next
148
+ } = this;
149
+ if (!next) {
163
150
  return;
164
151
  }
165
- const context = this._getSessionContext(session);
166
- if (context.reasoningShown) {
152
+ const view = next._views.get(_constants.ROLE.QUERY_SUGGESTIONS);
153
+ view && view.refresh();
154
+ }
155
+
156
+ // view //
157
+ _onReasoningViewUpdate({
158
+ status,
159
+ ongoing
160
+ }) {
161
+ if (status !== _constants.STATUS.READY || ongoing) {
167
162
  return;
168
163
  }
169
- context.reasoningShown = true;
170
- const view = this._views.get(_constants.ROLE.REASONING);
171
- view && view.triggerAction({
172
- name: 'show',
173
- target: '[data-role="reasoning-container"]'
174
- });
164
+ const element = this._getReasoningBoxElement();
165
+ element && element.classList.add('done');
175
166
  }
176
167
 
177
168
  // interactions //
@@ -219,6 +210,11 @@ class Ask extends _answerBased.default {
219
210
  this._questionId = undefined;
220
211
  }
221
212
  }
213
+ _getReasoningBoxElement() {
214
+ const view = this._views.get(_constants.ROLE.REASONING);
215
+ const element = view && view.element;
216
+ return element && element.closest('[data-role="reasoning-box"]');
217
+ }
222
218
 
223
219
  // destroy //
224
220
  _destroy(options) {
@@ -63,7 +63,6 @@ class Workflow extends _commons.Component {
63
63
  }
64
64
  _initProperties() {}
65
65
  _initActors({
66
- name,
67
66
  roles
68
67
  }) {
69
68
  const hub = this._hub;
@@ -81,7 +80,7 @@ class Workflow extends _commons.Component {
81
80
  layouts,
82
81
  roles,
83
82
  options,
84
- workflow: name
83
+ workflow: this
85
84
  });
86
85
  this._interactions = new _index.InteractionsActor(hub, {
87
86
  client,
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _constants = require("../constants.js");
8
7
  var _hybridSearchResults = _interopRequireDefault(require("./hybrid-search-results.js"));
9
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
9
  function getSubworkflowByRole(role) {
@@ -9,6 +9,7 @@ exports.getRevision = getRevision;
9
9
  exports.mappingAnswerData = mappingAnswerData;
10
10
  exports.mappingReasoningData = mappingReasoningData;
11
11
  exports.mappingSortData = mappingSortData;
12
+ exports.mappingSuggestionsData = mappingSuggestionsData;
12
13
  exports.mergeInteraction = mergeInteraction;
13
14
  exports.retainFacetCountsInData = retainFacetCountsInData;
14
15
  exports.writeAffiliationInfoToInteraction = writeAffiliationInfoToInteraction;
@@ -51,9 +52,17 @@ function mappingSortData(_, {
51
52
  });
52
53
  });
53
54
  }
55
+ function findDefaultSortOption(options) {
56
+ for (const option of options) {
57
+ if (option.default) {
58
+ return option;
59
+ }
60
+ }
61
+ return options[0];
62
+ }
54
63
  function mappingAnswerData(data) {
55
64
  if (!data || !data.value) {
56
- return data;
65
+ return undefined;
57
66
  }
58
67
  const {
59
68
  answer = '',
@@ -68,7 +77,7 @@ function mappingAnswerData(data) {
68
77
  }
69
78
  function mappingReasoningData(data) {
70
79
  if (!data || !data.value) {
71
- return data;
80
+ return undefined;
72
81
  }
73
82
  const {
74
83
  reasoning = '',
@@ -80,13 +89,15 @@ function mappingReasoningData(data) {
80
89
  finished: !!reasoning_finished
81
90
  });
82
91
  }
83
- function findDefaultSortOption(options) {
84
- for (const option of options) {
85
- if (option.default) {
86
- return option;
87
- }
88
- }
89
- return options[0];
92
+ function mappingSuggestionsData(_, {
93
+ workflow
94
+ } = {}) {
95
+ const previous = workflow.previous;
96
+ const values = previous && previous.states[_index.fields.data()].value;
97
+ const value = values && (values.suggested_followup_questions || values.followup_questions || []);
98
+ return value && value.map(text => ({
99
+ text
100
+ }));
90
101
  }
91
102
 
92
103
  // data //
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@miso.ai/commons": "1.12.1-beta.1"
29
+ "@miso.ai/commons": "1.12.1-beta.3"
30
30
  },
31
- "version": "1.12.1-beta.1"
31
+ "version": "1.12.1-beta.3"
32
32
  }
@@ -2,10 +2,6 @@ export function session() {
2
2
  return 'session';
3
3
  }
4
4
 
5
- export function suggestions() {
6
- return 'suggestions';
7
- }
8
-
9
5
  export function completions() {
10
6
  return 'completions';
11
7
  }
package/src/actor/view.js CHANGED
@@ -3,7 +3,6 @@ import { STATUS, ROLE, isDataRole } from '../constants.js';
3
3
  import * as fields from './fields.js';
4
4
  import ProxyElement from '../util/proxy.js';
5
5
  import Tracker from './tracker.js';
6
- import { triggerMisoAction } from '../element/util/utils.js';
7
6
 
8
7
  function statesEqual(a, b) {
9
8
  return a === b || (a && b &&
@@ -11,6 +10,7 @@ function statesEqual(a, b) {
11
10
  a.error === b.error &&
12
11
  a.value === b.value && // skip deep equals
13
12
  a.ongoing === b.ongoing &&
13
+ stateEmptyness(a) === stateEmptyness(b) && // TODO: ad-hoc
14
14
  sessionEquals(a.session, b.session));
15
15
  }
16
16
 
@@ -18,11 +18,16 @@ function sessionEquals(a, b) {
18
18
  return a === b || (a && b && a.uuid === b.uuid);
19
19
  }
20
20
 
21
+ function stateEmptyness(data) {
22
+ return data && data.meta && data.meta.empty;
23
+ }
24
+
21
25
  export default class ViewActor {
22
26
 
23
27
  constructor(views, role) {
24
28
  this._events = new EventEmitter({ target: this });
25
29
  this._views = views;
30
+ // TODO: we should pull this up to views, for the results are also used in judging container emptyness
26
31
  this._mapping = asMappingFunction((views._roles.mappings || {})[role] || role);
27
32
 
28
33
  defineValues(this, {
@@ -103,6 +108,10 @@ export default class ViewActor {
103
108
  }
104
109
  return this._tracker;
105
110
  }
111
+
112
+ get workflow() {
113
+ return this._views._workflow;
114
+ }
106
115
 
107
116
  get workflowOptions() {
108
117
  return this._views._options.resolved;
@@ -138,7 +147,7 @@ export default class ViewActor {
138
147
  }
139
148
 
140
149
  const { session, status, ongoing, request, meta, value } = data;
141
- const baseState = { session, status, ongoing, request, meta, data: value, ...getDataEmptyness(data) };
150
+ const baseState = { session, status, ongoing, request, meta, data: value, ...getDataEmptyness(this.role, data) };
142
151
 
143
152
  // render
144
153
  const notifyUpdate = (state = {}, options) => {
@@ -160,14 +169,6 @@ export default class ViewActor {
160
169
  this.hub.update(fields.view(role), state, { silent });
161
170
  }
162
171
 
163
- triggerAction(data) {
164
- const { element } = this;
165
- if (!element) {
166
- return;
167
- }
168
- triggerMisoAction(element, data);
169
- }
170
-
171
172
  _sliceData(data) {
172
173
  const { value, error, status, meta, ...rest } = data;
173
174
  const sliced = {
@@ -181,13 +182,13 @@ export default class ViewActor {
181
182
  // pass empty/nonempty information
182
183
  sliced.meta = {
183
184
  ...meta,
184
- empty: this._isContainerEmpty(value),
185
+ empty: this._isContainerEmpty(data),
185
186
  };
186
187
  }
187
188
  return trimObj(sliced);
188
189
  }
189
190
 
190
- _isContainerEmpty(value) {
191
+ _isContainerEmpty(data) {
191
192
  const { element } = this;
192
193
  if (!element) {
193
194
  return false;
@@ -198,14 +199,10 @@ export default class ViewActor {
198
199
  if (!isDataRole(role)) {
199
200
  continue;
200
201
  }
201
- let sliced = value && value[role];
202
- if (role === ROLE.QUERY_SUGGESTIONS) {
203
- // special case: query suggestions -> look up value from hub
204
- // TODO: adhoc
205
- const data = this.hub.states[fields.suggestions()];
206
- sliced = data && data.value;
207
- }
208
- if (sliced && sliced.length !== 0) {
202
+ // respect data mapping
203
+ const mapping = asMappingFunction((this._views._roles.mappings || {})[role] || role);
204
+ const sliced = mapping(data, this); // TODO: the view passed in should be the view of the role, not container role
205
+ if (!isDateValueEmpty(role, sliced)) {
209
206
  return false;
210
207
  }
211
208
  }
@@ -257,15 +254,21 @@ function asMappingFunction(fn) {
257
254
  }
258
255
  }
259
256
 
260
- function getDataEmptyness(data) {
261
- return isDataStatusRelevantToEmptyness(data) ? { empty: !!isDateValueEmpty(data) } : {};
257
+ function getDataEmptyness(role, data) {
258
+ return isDataStatusRelevantToEmptyness(data) ? { empty: !!isDateValueEmpty(role, data && data.value) } : {};
262
259
  }
263
260
 
264
261
  function isDataStatusRelevantToEmptyness(data) {
265
262
  return data.status === STATUS.READY && !data.ongoing;
266
263
  }
267
264
 
268
- function isDateValueEmpty(data) {
269
- const { value } = data;
270
- return value === undefined || ((Array.isArray(value) || typeof value === 'string') && !value.length);
265
+ function isDateValueEmpty(role, value) {
266
+ // TODO: ad-hoc
267
+ switch (role) {
268
+ case ROLE.ANSWER:
269
+ case ROLE.REASONING:
270
+ return !value || !value.value;
271
+ default:
272
+ return value === undefined || ((Array.isArray(value) || typeof value === 'string') && !value.length);
273
+ }
271
274
  }
@@ -16,7 +16,8 @@ export default class ViewsActor {
16
16
  options,
17
17
  }) {
18
18
  this._hub = hub;
19
- this._workflowName = workflow;
19
+ this._workflow = workflow;
20
+ this._workflowName = workflow._name;
20
21
  this._extensions = extensions;
21
22
  this._layoutFactory = layouts;
22
23
  this._options = options;
@@ -193,17 +194,6 @@ export default class ViewsActor {
193
194
  // container first
194
195
  let views = this._getViews(true);
195
196
 
196
- if (!force && data._inst) {
197
- const { includes, excludes } = data._inst;
198
- if (includes) {
199
- // always include containers
200
- views = views.filter(view => view.role === ROLE.CONTAINER || includes.includes(view.role));
201
- }
202
- if (excludes) {
203
- views = views.filter(view => !excludes.includes(view.role));
204
- }
205
- }
206
-
207
197
  await Promise.all(views.map(view => view.refresh({ force, data })));
208
198
  }
209
199
 
@@ -12,6 +12,15 @@ export function processData(data) {
12
12
  }
13
13
 
14
14
  function processValue(value) {
15
+ /*
16
+ if (value.affiliation_products) {
17
+ const { affiliation_products, ...rest } = value;
18
+ value = {
19
+ ...rest,
20
+ affiliation: processMisoData(affiliation_products),
21
+ };
22
+ } else
23
+ */
15
24
  if (value.sovrn_aff) {
16
25
  const { sovrn_aff, ...rest } = value;
17
26
  value = {
@@ -48,10 +57,17 @@ function postProcessValue(value) {
48
57
  };
49
58
  }
50
59
 
51
- function processSovrnData({ products, ...sovrn_aff }) {
60
+ function processMisoData(products) {
61
+ return {
62
+ channel: 'miso',
63
+ products,
64
+ };
65
+ }
66
+
67
+ function processSovrnData({ products, ...data }) {
52
68
  return {
53
69
  channel: 'sovrn',
54
- ...sovrn_aff,
70
+ ...data,
55
71
  products: products.map(processSovrnProduct),
56
72
  };
57
73
  }
@@ -13,43 +13,56 @@ class Sections extends _Sections {
13
13
  answerGroup(options) {
14
14
  const { container } = this._helpers;
15
15
  return [
16
- ...super.answerGroup(options),
16
+ this.question(options),
17
+ this.reasoning(options),
18
+ this.answer(options),
19
+ this.affiliation(options),
20
+ this.sources(options),
17
21
  container(options, { name: 'bottom-spacing', visibleWhen: 'ongoing' }),
18
22
  ];
19
23
  }
20
24
 
25
+ question(options) {
26
+ const { container, phrase } = this._helpers;
27
+ return container(options, { name: 'question', visibleWhen: 'ready' }, [
28
+ options.parentQuestionId ? '<hr>' : '',
29
+ phrase(options, { name: 'question', tag: 'div' }),
30
+ '<miso-question></miso-question>',
31
+ ]);
32
+ }
33
+
21
34
  answer(options) {
22
35
  const { container } = this._helpers;
23
36
  return container(options, { name: 'answer', visibleWhen: 'ready' }, [
24
- options.parentQuestionId ? '<hr>' : '',
25
- ...this.question(options),
26
- this.reasoning(options),
27
37
  '<miso-answer></miso-answer>',
28
38
  '<miso-feedback></miso-feedback>',
29
39
  ]);
30
40
  }
31
41
 
32
- reasoning({ phrases, reasoning: options = {} } = {}) {
33
- const { element, phraseText } = this._helpers;
42
+ reasoning(options = {}) {
43
+ const { phrases, reasoning: reasoningOptions = {} } = options;
44
+ const { container, element, phraseText } = this._helpers;
34
45
  const classes = [];
35
- options.hide !== false && classes.push('hidden');
36
- options.expand && classes.push('expanded');
37
- return element('miso-collapsible', {
38
- classes,
39
- 'data-role': 'reasoning-container',
40
- }, [
41
- element('div', {
42
- classes: ['miso-collapsible__header'],
43
- 'data-role': 'toggle-expand',
44
- }, [
45
- `<div class="miso-collapsible__icon">${options.icon || BULB}</div>`,
46
- `<div class="miso-collapsible__title" data-role="title">${phraseText(phrases, 'thoughts')}</div>`,
47
- `<div class="miso-collapsible__toggle">${CHEVRON}</div>`,
48
- ]),
49
- element('div', {
50
- classes: ['miso-collapsible__body'],
46
+ reasoningOptions.expand && classes.push('expanded');
47
+ return container(options, { name: 'reasoning', visibleWhen: 'nonempty' }, [
48
+ element('miso-stub', {
49
+ classes,
50
+ trait: 'collapsible',
51
+ 'data-role': 'reasoning-box',
51
52
  }, [
52
- '<miso-reasoning></miso-reasoning>',
53
+ element('div', {
54
+ classes: ['miso-collapsible__header'],
55
+ 'data-role': 'toggle-expand',
56
+ }, [
57
+ `<div class="miso-collapsible__icon">${reasoningOptions.icon || BULB}</div>`,
58
+ `<div class="miso-collapsible__title" data-role="title">${phraseText(phrases, 'thoughts')}</div>`,
59
+ `<div class="miso-collapsible__toggle">${CHEVRON}</div>`,
60
+ ]),
61
+ element('div', {
62
+ classes: ['miso-collapsible__body'],
63
+ }, [
64
+ '<miso-reasoning></miso-reasoning>',
65
+ ]),
53
66
  ]),
54
67
  ]);
55
68
  }
@@ -126,10 +126,10 @@ export class Helpers {
126
126
  }, body);
127
127
  }
128
128
 
129
- container({ classPrefix, circledCitationIndex, parentQuestionId }, { name, visibleWhen, logo = false }, body) {
129
+ container({ classPrefix, circledCitationIndex, parentQuestionId }, { name, visibleWhen, trait, logo = false }, body) {
130
130
  const classes = [`${classPrefix}__${name}-container`];
131
131
  circledCitationIndex && classes.push('miso-circled-citation-index');
132
- return this.element(this._context.CONAINER_TAG, { classes, visibleWhen, logo, parentQuestionId }, body);
132
+ return this.element(this._context.CONAINER_TAG, { classes, visibleWhen, trait, logo, parentQuestionId }, body);
133
133
  }
134
134
 
135
135
  element(tag, attributes = {}, body = '') {
@@ -1,8 +1,12 @@
1
+ import MisoStubElement from '../util/miso-stub.js';
1
2
  import { getClient } from '../utils.js';
2
3
 
3
4
  const ATTR_LOGO = 'logo';
4
5
  const DEFAULT_LOGO_VALUE = 'auto';
5
- const OBSERVED_ATTRIBUTES = Object.freeze([ATTR_LOGO]);
6
+ const OBSERVED_ATTRIBUTES = Object.freeze([
7
+ ...MisoStubElement.observedAttributes,
8
+ ATTR_LOGO,
9
+ ]);
6
10
 
7
11
  function logoAttrToProp(value) {
8
12
  if (!value) {
@@ -31,7 +35,7 @@ function logoPropToAttr(value) {
31
35
  }
32
36
  }
33
37
 
34
- export default class MisoContainerElement extends HTMLElement {
38
+ export default class MisoContainerElement extends MisoStubElement {
35
39
 
36
40
  static get observedAttributes() {
37
41
  return OBSERVED_ATTRIBUTES;
@@ -74,6 +78,7 @@ export default class MisoContainerElement extends HTMLElement {
74
78
 
75
79
  // lifecycle //
76
80
  async connectedCallback() {
81
+ super.connectedCallback();
77
82
  const client = this._client = await getClient(MisoContainerElement);
78
83
  if (document.body.contains(this)) { // in case already disconnected
79
84
  this._setWorkflow(this._getWorkflow(client));
@@ -82,6 +87,7 @@ export default class MisoContainerElement extends HTMLElement {
82
87
 
83
88
  disconnectedCallback() {
84
89
  this._setWorkflow(undefined);
90
+ super.disconnectedCallback();
85
91
  }
86
92
 
87
93
  _getWorkflow(client) {
@@ -106,6 +112,8 @@ export default class MisoContainerElement extends HTMLElement {
106
112
  case ATTR_LOGO:
107
113
  this._handleLogoUpdate(oldValue, newValue);
108
114
  break;
115
+ default:
116
+ super.attributeChangedCallback(attr, oldValue, newValue);
109
117
  }
110
118
  }
111
119
 
@@ -11,7 +11,7 @@ export { default as MisoSourcesElement } from './miso-sources.js';
11
11
  export { default as MisoImagesElement } from './miso-images.js';
12
12
  export { default as MisoRelatedResourcesElement } from './miso-related-resources.js';
13
13
  export { default as MisoRelatedQuestionsElement } from './miso-related-questions.js';
14
- export { default as MisoSovrnAffiliationElement } from './miso-affiliation.js';
14
+ export { default as MisoAffiliationElement } from './miso-affiliation.js';
15
15
  export { default as MisoKeywordsElement } from './miso-keywords.js';
16
16
  export { default as MisoTotalElement } from './miso-total.js';
17
17
  export { default as MisoFacetsElement } from './miso-facets.js';
@@ -1,2 +1,2 @@
1
1
  export { default as MisoBannerElement } from './miso-banner.js';
2
- export { default as MisoCollapsibleElement } from './miso-collapsible.js';
2
+ export { default as MisoStubElement } from './miso-stub.js';