@miso.ai/client-sdk-ui 1.13.2-beta.1 → 1.14.0-beta.2

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 (214) hide show
  1. package/dist/cjs/asset/svgs.js +15 -4
  2. package/dist/cjs/combo/ask/index.js +2 -2
  3. package/dist/cjs/constants.js +118 -98
  4. package/dist/cjs/defaults/ask/controls.js +1 -1
  5. package/dist/cjs/defaults/hybrid-search/answer-box.js +4 -4
  6. package/dist/cjs/defaults.js +169 -0
  7. package/dist/cjs/element/container/index.js +14 -0
  8. package/dist/cjs/element/container/miso-ask.js +3 -3
  9. package/dist/cjs/element/container/miso-conversation.js +21 -0
  10. package/dist/cjs/element/container/miso-explore.js +1 -1
  11. package/dist/cjs/element/container/miso-history.js +21 -0
  12. package/dist/cjs/element/container/miso-hybrid-search.js +1 -1
  13. package/dist/cjs/element/container/miso-recommendation.js +1 -1
  14. package/dist/cjs/element/container/miso-search.js +1 -1
  15. package/dist/cjs/element/context/miso-follow-ups.js +1 -1
  16. package/dist/cjs/element/role/index.js +42 -0
  17. package/dist/cjs/element/role/miso-messages.js +20 -0
  18. package/dist/cjs/element/role/miso-new-thread.js +20 -0
  19. package/dist/cjs/element/role/miso-rename.js +20 -0
  20. package/dist/cjs/element/role/miso-subscription.js +20 -0
  21. package/dist/cjs/element/role/miso-threads.js +20 -0
  22. package/dist/cjs/element/role/miso-title.js +20 -0
  23. package/dist/cjs/layout/affiliation/affiliation.js +1 -1
  24. package/dist/cjs/layout/banner/banner.js +2 -1
  25. package/dist/cjs/layout/button/button.js +130 -0
  26. package/dist/cjs/layout/button/checkbox.js +115 -0
  27. package/dist/cjs/layout/button/more-button.js +3 -3
  28. package/dist/cjs/layout/container/container.js +1 -1
  29. package/dist/cjs/layout/error/error.js +2 -1
  30. package/dist/cjs/layout/index.js +28 -0
  31. package/dist/cjs/layout/input/facets.js +4 -3
  32. package/dist/cjs/layout/input/option-list.js +3 -2
  33. package/dist/cjs/layout/input/search-box.js +42 -9
  34. package/dist/cjs/layout/input/select.js +2 -1
  35. package/dist/cjs/layout/list/cards.js +2 -1
  36. package/dist/cjs/layout/list/carousel.js +2 -1
  37. package/dist/cjs/layout/list/collection.js +5 -0
  38. package/dist/cjs/layout/list/gallery.js +2 -1
  39. package/dist/cjs/layout/list/horizontal.js +2 -1
  40. package/dist/cjs/layout/list/list.js +2 -1
  41. package/dist/cjs/layout/list/messages.js +346 -0
  42. package/dist/cjs/layout/list/threads.js +257 -0
  43. package/dist/cjs/layout/mixin/trackable.js +4 -5
  44. package/dist/cjs/layout/mixin/triggerable.js +2 -2
  45. package/dist/cjs/layout/radio/feedback.js +4 -3
  46. package/dist/cjs/layout/templates.js +70 -0
  47. package/dist/cjs/layout/text/text.js +2 -1
  48. package/dist/cjs/layout/text/typewriter/index.js +4 -2
  49. package/dist/cjs/plugin.js +43 -104
  50. package/dist/cjs/util/confirm.js +33 -0
  51. package/dist/cjs/util/modal.js +48 -0
  52. package/dist/cjs/util/prompt.js +47 -0
  53. package/dist/cjs/version.js +1 -1
  54. package/package.json +5 -4
  55. package/src/CLAUDE.md +48 -105
  56. package/src/asset/svgs.js +14 -3
  57. package/src/combo/ask/index.js +2 -2
  58. package/src/constants.js +37 -147
  59. package/src/defaults/ask/controls.js +1 -1
  60. package/src/defaults/hybrid-search/answer-box.js +2 -2
  61. package/src/defaults.js +107 -0
  62. package/src/element/container/index.js +2 -0
  63. package/src/element/container/miso-ask.js +3 -3
  64. package/src/element/container/miso-conversation.js +19 -0
  65. package/src/element/container/miso-explore.js +1 -1
  66. package/src/element/container/miso-history.js +19 -0
  67. package/src/element/container/miso-hybrid-search.js +1 -1
  68. package/src/element/container/miso-recommendation.js +1 -1
  69. package/src/element/container/miso-search.js +1 -1
  70. package/src/element/context/miso-follow-ups.js +1 -1
  71. package/src/element/role/index.js +6 -0
  72. package/src/element/role/miso-messages.js +16 -0
  73. package/src/element/role/miso-new-thread.js +16 -0
  74. package/src/element/role/miso-rename.js +16 -0
  75. package/src/element/role/miso-subscription.js +16 -0
  76. package/src/element/role/miso-threads.js +16 -0
  77. package/src/element/role/miso-title.js +16 -0
  78. package/src/layout/affiliation/affiliation.js +2 -2
  79. package/src/layout/banner/banner.js +2 -1
  80. package/src/layout/button/button.js +116 -0
  81. package/src/layout/button/checkbox.js +91 -0
  82. package/src/layout/button/more-button.js +3 -3
  83. package/src/layout/container/container.js +2 -2
  84. package/src/layout/error/error.js +2 -1
  85. package/src/layout/index.js +4 -0
  86. package/src/layout/input/facets.js +3 -2
  87. package/src/layout/input/option-list.js +3 -2
  88. package/src/layout/input/search-box.js +41 -6
  89. package/src/layout/input/select.js +2 -1
  90. package/src/layout/list/cards.js +2 -1
  91. package/src/layout/list/carousel.js +2 -1
  92. package/src/layout/list/collection.js +6 -1
  93. package/src/layout/list/gallery.js +2 -1
  94. package/src/layout/list/horizontal.js +2 -1
  95. package/src/layout/list/list.js +2 -1
  96. package/src/layout/list/messages.js +318 -0
  97. package/src/layout/list/threads.js +206 -0
  98. package/src/layout/mixin/trackable.js +2 -3
  99. package/src/layout/mixin/triggerable.js +1 -1
  100. package/src/layout/radio/feedback.js +3 -2
  101. package/src/layout/templates.js +62 -0
  102. package/src/layout/text/text.js +2 -1
  103. package/src/layout/text/typewriter/index.js +5 -3
  104. package/src/plugin.js +31 -117
  105. package/src/util/confirm.js +28 -0
  106. package/src/util/modal.js +49 -0
  107. package/src/util/prompt.js +42 -0
  108. package/src/version.js +1 -1
  109. package/dist/cjs/actor/data.js +0 -132
  110. package/dist/cjs/actor/feedback.js +0 -29
  111. package/dist/cjs/actor/fields.js +0 -57
  112. package/dist/cjs/actor/filters.js +0 -161
  113. package/dist/cjs/actor/hub.js +0 -57
  114. package/dist/cjs/actor/index.js +0 -73
  115. package/dist/cjs/actor/interactions.js +0 -36
  116. package/dist/cjs/actor/sessions.js +0 -25
  117. package/dist/cjs/actor/tracker-states.js +0 -61
  118. package/dist/cjs/actor/tracker.js +0 -109
  119. package/dist/cjs/actor/trackers.js +0 -52
  120. package/dist/cjs/actor/utils.js +0 -15
  121. package/dist/cjs/actor/view.js +0 -294
  122. package/dist/cjs/actor/views.js +0 -209
  123. package/dist/cjs/source.js +0 -27
  124. package/dist/cjs/util/proxy.js +0 -88
  125. package/dist/cjs/util/trackers.js +0 -88
  126. package/dist/cjs/workflow/affiliations.js +0 -140
  127. package/dist/cjs/workflow/answer-based.js +0 -337
  128. package/dist/cjs/workflow/ask.js +0 -319
  129. package/dist/cjs/workflow/asks.js +0 -150
  130. package/dist/cjs/workflow/autocompletable.js +0 -63
  131. package/dist/cjs/workflow/autocomplete.js +0 -120
  132. package/dist/cjs/workflow/base.js +0 -418
  133. package/dist/cjs/workflow/context.js +0 -19
  134. package/dist/cjs/workflow/explore.js +0 -210
  135. package/dist/cjs/workflow/explores.js +0 -21
  136. package/dist/cjs/workflow/hybrid-search-answer.js +0 -88
  137. package/dist/cjs/workflow/hybrid-search-views.js +0 -109
  138. package/dist/cjs/workflow/hybrid-search.js +0 -213
  139. package/dist/cjs/workflow/index.js +0 -41
  140. package/dist/cjs/workflow/options/api.js +0 -41
  141. package/dist/cjs/workflow/options/auto-query.js +0 -97
  142. package/dist/cjs/workflow/options/configurable.js +0 -45
  143. package/dist/cjs/workflow/options/data-processor.js +0 -20
  144. package/dist/cjs/workflow/options/filters.js +0 -15
  145. package/dist/cjs/workflow/options/index.js +0 -126
  146. package/dist/cjs/workflow/options/interactions.js +0 -41
  147. package/dist/cjs/workflow/options/layouts.js +0 -79
  148. package/dist/cjs/workflow/options/options.js +0 -156
  149. package/dist/cjs/workflow/options/pagination.js +0 -25
  150. package/dist/cjs/workflow/options/roles.js +0 -15
  151. package/dist/cjs/workflow/options/templates.js +0 -30
  152. package/dist/cjs/workflow/options/trackers.js +0 -83
  153. package/dist/cjs/workflow/options/utils.js +0 -33
  154. package/dist/cjs/workflow/processors.js +0 -607
  155. package/dist/cjs/workflow/recommendation.js +0 -57
  156. package/dist/cjs/workflow/recommendations.js +0 -18
  157. package/dist/cjs/workflow/search-based.js +0 -337
  158. package/dist/cjs/workflow/search.js +0 -64
  159. package/dist/cjs/workflow/unit.js +0 -57
  160. package/dist/cjs/workflow/units.js +0 -42
  161. package/dist/cjs/workflow/use-link.js +0 -49
  162. package/src/actor/data.js +0 -106
  163. package/src/actor/feedback.js +0 -28
  164. package/src/actor/fields.js +0 -51
  165. package/src/actor/filters.js +0 -149
  166. package/src/actor/hub.js +0 -47
  167. package/src/actor/index.js +0 -10
  168. package/src/actor/interactions.js +0 -32
  169. package/src/actor/sessions.js +0 -21
  170. package/src/actor/tracker-states.js +0 -57
  171. package/src/actor/tracker.js +0 -104
  172. package/src/actor/trackers.js +0 -45
  173. package/src/actor/utils.js +0 -7
  174. package/src/actor/view.js +0 -272
  175. package/src/actor/views.js +0 -224
  176. package/src/source.js +0 -17
  177. package/src/util/proxy.js +0 -81
  178. package/src/util/trackers.js +0 -84
  179. package/src/workflow/affiliations.js +0 -121
  180. package/src/workflow/answer-based.js +0 -312
  181. package/src/workflow/ask.js +0 -284
  182. package/src/workflow/asks.js +0 -143
  183. package/src/workflow/autocompletable.js +0 -67
  184. package/src/workflow/autocomplete.js +0 -114
  185. package/src/workflow/base.js +0 -396
  186. package/src/workflow/context.js +0 -16
  187. package/src/workflow/explore.js +0 -194
  188. package/src/workflow/explores.js +0 -18
  189. package/src/workflow/hybrid-search-answer.js +0 -73
  190. package/src/workflow/hybrid-search-views.js +0 -116
  191. package/src/workflow/hybrid-search.js +0 -230
  192. package/src/workflow/index.js +0 -5
  193. package/src/workflow/options/api.js +0 -31
  194. package/src/workflow/options/auto-query.js +0 -70
  195. package/src/workflow/options/configurable.js +0 -48
  196. package/src/workflow/options/data-processor.js +0 -15
  197. package/src/workflow/options/filters.js +0 -10
  198. package/src/workflow/options/index.js +0 -11
  199. package/src/workflow/options/interactions.js +0 -36
  200. package/src/workflow/options/layouts.js +0 -73
  201. package/src/workflow/options/options.js +0 -175
  202. package/src/workflow/options/pagination.js +0 -18
  203. package/src/workflow/options/roles.js +0 -12
  204. package/src/workflow/options/templates.js +0 -27
  205. package/src/workflow/options/trackers.js +0 -80
  206. package/src/workflow/options/utils.js +0 -26
  207. package/src/workflow/processors.js +0 -490
  208. package/src/workflow/recommendation.js +0 -63
  209. package/src/workflow/recommendations.js +0 -14
  210. package/src/workflow/search-based.js +0 -329
  211. package/src/workflow/search.js +0 -73
  212. package/src/workflow/unit.js +0 -51
  213. package/src/workflow/units.js +0 -43
  214. package/src/workflow/use-link.js +0 -41
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = confirm;
7
+ var _modal = require("./modal.js");
8
+ const DEFAULT_CLASSNAME = 'miso-confirm';
9
+
10
+ /**
11
+ * Show a modal confirmation dialog (a native <dialog>), resolving to whether
12
+ * the user confirmed. Cancel button, backdrop click, and the Escape key all
13
+ * resolve to false. Exposed as `MisoClient.ui.confirm()`.
14
+ */
15
+ function confirm({
16
+ title,
17
+ message,
18
+ confirmText = 'Confirm',
19
+ cancelText = 'Cancel',
20
+ danger = false,
21
+ className = DEFAULT_CLASSNAME
22
+ } = {}) {
23
+ return (0, _modal.openModal)({
24
+ className,
25
+ title,
26
+ message,
27
+ confirmText,
28
+ cancelText,
29
+ danger,
30
+ result: () => true,
31
+ cancelValue: false
32
+ });
33
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.openModal = openModal;
7
+ var _commons = require("@miso.ai/commons");
8
+ /**
9
+ * The shared modal dialog core of confirm() and prompt(): a native <dialog>
10
+ * with title, message, an optional body, and cancel/confirm actions. Resolves
11
+ * with `result(dialog)` when confirmed; the cancel button, a backdrop click,
12
+ * and the Escape key all resolve with `cancelValue`.
13
+ */
14
+ function openModal({
15
+ className,
16
+ title,
17
+ message,
18
+ body = '',
19
+ confirmText = 'Confirm',
20
+ cancelText = 'Cancel',
21
+ danger = false,
22
+ onOpen,
23
+ result = () => true,
24
+ cancelValue
25
+ } = {}) {
26
+ return new Promise(resolve => {
27
+ const dialog = document.createElement('dialog');
28
+ dialog.className = className;
29
+ dialog.innerHTML = [title ? `<div class="${className}__title">${(0, _commons.escapeHtml)(title)}</div>` : '', message ? `<div class="${className}__message">${(0, _commons.escapeHtml)(message)}</div>` : '', body, `<div class="${className}__actions">`, `<button type="button" class="${className}__button ${className}__cancel-button" data-role="cancel">${(0, _commons.escapeHtml)(cancelText)}</button>`, `<button type="button" class="${className}__button ${className}__confirm-button${danger ? ` ${className}__confirm-button--danger` : ''}" data-role="confirm">${(0, _commons.escapeHtml)(confirmText)}</button>`, `</div>`].join('');
30
+ dialog.addEventListener('click', event => {
31
+ if (event.target.closest('[data-role="confirm"]')) {
32
+ dialog.close('confirm');
33
+ } else if (event.target.closest('[data-role="cancel"]') || event.target === dialog) {
34
+ dialog.close(); // cancel button or backdrop click
35
+ }
36
+ });
37
+ dialog.addEventListener('close', () => {
38
+ const value = dialog.returnValue === 'confirm' ? result(dialog) : cancelValue;
39
+ dialog.remove();
40
+ resolve(value);
41
+ }, {
42
+ once: true
43
+ });
44
+ document.body.appendChild(dialog);
45
+ dialog.showModal();
46
+ onOpen && onOpen(dialog);
47
+ });
48
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = prompt;
7
+ var _commons = require("@miso.ai/commons");
8
+ var _modal = require("./modal.js");
9
+ const DEFAULT_CLASSNAME = 'miso-prompt';
10
+
11
+ /**
12
+ * Show a modal input dialog (a native <dialog>), resolving to the entered
13
+ * (trimmed) text when confirmed. Cancel button, backdrop click, and the
14
+ * Escape key all resolve to undefined. The Enter key confirms. Exposed as
15
+ * `MisoClient.ui.prompt()`.
16
+ */
17
+ function prompt({
18
+ title,
19
+ message,
20
+ value = '',
21
+ placeholder,
22
+ confirmText = 'Confirm',
23
+ cancelText = 'Cancel',
24
+ className = DEFAULT_CLASSNAME
25
+ } = {}) {
26
+ return (0, _modal.openModal)({
27
+ className,
28
+ title,
29
+ message,
30
+ body: `<input class="${className}__input" type="text" data-role="input" value="${(0, _commons.escapeHtml)(value)}"${placeholder ? ` placeholder="${(0, _commons.escapeHtml)(placeholder)}"` : ''}>`,
31
+ confirmText,
32
+ cancelText,
33
+ onOpen: dialog => {
34
+ const input = dialog.querySelector('[data-role="input"]');
35
+ input.addEventListener('keydown', event => {
36
+ if (event.key === 'Enter') {
37
+ event.preventDefault();
38
+ dialog.close('confirm');
39
+ }
40
+ });
41
+ input.focus();
42
+ input.select();
43
+ },
44
+ result: dialog => dialog.querySelector('[data-role="input"]').value.trim(),
45
+ cancelValue: undefined
46
+ });
47
+ }
@@ -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.2-beta.1';
7
+ var _default = exports.default = '1.14.0-beta.2';
package/package.json CHANGED
@@ -12,8 +12,8 @@
12
12
  "access": "public"
13
13
  },
14
14
  "scripts": {
15
- "build:clean": "npx rimraf dist",
16
- "build:cjs": "BABEL_ENV=cjs npx babel src --root-mode upward --out-dir dist/cjs",
15
+ "build:clean": "rimraf dist",
16
+ "build:cjs": "BABEL_ENV=cjs babel src --root-mode upward --out-dir dist/cjs",
17
17
  "build": "npm run build:clean && npm run build:cjs"
18
18
  },
19
19
  "repository": {
@@ -30,7 +30,8 @@
30
30
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@miso.ai/commons": "1.13.2-beta.1"
33
+ "@miso.ai/commons": "1.14.0-beta.2",
34
+ "@miso.ai/client-sdk-workflow": "1.14.0-beta.2"
34
35
  },
35
- "version": "1.13.2-beta.1"
36
+ "version": "1.14.0-beta.2"
36
37
  }
package/src/CLAUDE.md CHANGED
@@ -1,112 +1,60 @@
1
1
  # Client SDK UI
2
2
 
3
- The UI package (`std:ui` plugin) provides the presentation layer for Miso SDK, including custom elements, workflows, and rendering infrastructure.
3
+ The UI package (`std:ui` plugin) provides the presentation layer for Miso SDK: custom elements, layouts, and rendering infrastructure.
4
4
 
5
- ## Architecture Overview
5
+ The workflow layer (workflow classes, actors, hub, default-options store) lives in `@miso.ai/client-sdk-workflow` — see `packages/client-sdk-workflow/CLAUDE.md` for the hub-and-spoke architecture, workflow class hierarchy, roles/status model, and the end-to-end data flow. This package plugs elements and layouts into those workflows.
6
6
 
7
- // TODO: wrong concept
7
+ ## Architecture Overview
8
8
 
9
9
  ```
10
- ┌─────────────────────────────────────────────────────────────────┐
11
- │ UiPlugin │
12
- │ - Registered as 'std:ui' │
13
- │ - Injects client.ui on each MisoClient instance │
14
- │ - Manages layouts, combo, and extensions │
15
- └─────────────────────────────────────────────────────────────────┘
16
- │
17
- ┌─────────────────────┼─────────────────────┐
18
- ▼ ▼ ▼
19
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
20
- │ Workflows │ │ Elements │ │ Layouts │
21
- │ │◄────►│ │◄────►│ │
22
- │ (Logic) │ │ (Custom El) │ │ (Rendering) │
23
- └─────────────┘ └─────────────┘ └─────────────┘
24
- │
25
- ▼
26
- ┌─────────────┐
27
- │ Actors │
28
- │ (Hub I/O) │
29
- └─────────────┘
10
+ UiPlugin ('std:ui', singleton)
11
+ ├─ ensures WorkflowPlugin ('std:workflow') is installed
12
+ ├─ provides its Layouts registry to the workflow plugin (setLayouts)
13
+ ├─ seeds default layout options (defaults.js) + ask followUp template
14
+ │ into the workflow plugin's defaults store
15
+ ├─ Layouts registry (layout classes, keyed by type)
16
+ ├─ defines <miso-*> custom elements
17
+ └─ injects client.ui on each MisoClient instance; its workflow accessors
18
+ (search, asks, ...) delegate to client.workflows for backward compatibility
30
19
  ```
31
20
 
32
- ## Core Directories
21
+ Key points that are easy to get wrong:
33
22
 
34
- // TODO: wrong concept
23
+ - **Elements render nothing.** A container element (e.g. `<miso-ask>`) locates its workflow on `connectedCallback()` and registers itself; child role elements register through their container. The workflow's `ViewsActor` then creates one `ViewActor` per element, pairing it with a **layout instance** for that role. The layout writes DOM into the element.
24
+ - Layouts are **instances created per view** from classes registered in the plugin's `Layouts` registry (`layout.type` → class), chosen by the workflow's `layouts` options. They are not templates.
25
+ - Default layout options per workflow live in `src/defaults.js`, keyed by workflow name, and are seeded into the workflow plugin's defaults store at install — they are not baked into the workflow classes.
26
+
27
+ ## Core Directories
35
28
 
36
29
  | Directory | Purpose |
37
30
  |-----------|---------|
38
- | `workflow/` | Orchestration logic for features (Ask, Search, Explore, etc.) |
39
- | `element/` | Custom HTML elements (`<miso-*>` tags) |
40
- | `actor/` | Hub-connected actors for data, views, tracking, interactions |
41
- | `layout/` | Rendering templates for different UI roles |
42
- | `combo/` | Pre-built composite UI configurations (deprecated) |
43
- | `trait/` | Reusable behavior mixins |
44
- | `defaults/` | Default configurations |
45
-
46
- ## Key Concepts
47
-
48
- ### Workflows (`workflow/`)
49
-
50
- // TODO: wrong concept
51
-
52
- State machines that orchestrate API calls and UI updates. Each workflow manages:
53
- - Session lifecycle (restart, query, response)
54
- - Data flow via Hub
55
- - View state synchronization
56
- - Interaction tracking
57
-
58
- **Available workflows**: `Ask`, `Search`, `HybridSearch`, `Explore`, `Recommendation`
31
+ | `element/` | Custom HTML elements (`<miso-*>`): thin, render-free DOM anchors that bind themselves to workflows |
32
+ | `layout/` | Layout classes (rendering logic), registered by `type` in the plugin's registry, instantiated per view |
33
+ | `combo/` | `AskCombo`: programmatic pre-built ask UI (deprecated) |
34
+ | `trait/` | Reusable behaviors exposed as `MisoClient.ui.traits` (e.g. `CollapsibleTrait`) |
35
+ | `defaults/` | Default templates/phrases/controls for ask and hybrid-search UIs, exposed as `MisoClient.ui.defaults` |
36
+ | `defaults.js` | Default layout options of each workflow, seeded into the workflow plugin's store |
37
+ | `constants.js` | UI-only constants (`LAYOUT_TYPE`, data attributes); re-exports workflow constants (`ROLE`, `STATUS`, ...) for convenience |
59
38
 
60
- ### Elements (`element/`)
39
+ ## Elements (`element/`)
61
40
 
62
- Web Components following the `<miso-*>` naming convention:
41
+ Web Components (`<miso-*>`). They contain **no rendering or data logic** — they only establish the DOM binding:
63
42
 
64
- - **Containers**: Top-level elements that own a workflow
65
- - `<miso-ask>`, `<miso-search>`, `<miso-explore>`, `<miso-recommendation>`, `<miso-hybrid-search>`
43
+ - **Containers** (`element/container/`): own the workflow binding for their subtree.
44
+ - `<miso-ask>` — binds by `parent-question-id` attribute (absent = root ask), or `workflow="active"` to follow `asks.active`
45
+ - `<miso-search>`, `<miso-hybrid-search>` — bind to `client.ui.search` / `.hybridSearch`
46
+ - `<miso-explore>`, `<miso-recommendation>` — bind by `unit-id` attribute
47
+ - `<miso-history>`, `<miso-conversation>` — bind to `client.workflows.history` / `.conversation`, forming the chat history interface (thread list + conversation panel); their role elements are `<miso-threads>`, `<miso-new-thread>`, `<miso-messages>`, `<miso-title>`, `<miso-rename>` and `<miso-subscription>`. The new-thread button is its own component (`<miso-new-thread>`, role `new_thread`), *not* part of the thread list, so it renders regardless of the list state (loading, empty, erroneous); it uses the generic `button` layout — an icon and a label, both configurable (`icon`, `text`), emitting a `submit` view event when clicked — which History answers by clearing the selection and resetting the conversation panel to new-thread mode. The thread list uses the `threads` layout (a list of `thread` items — the `<li>` itself is the item, carrying `data-role="item"`, the thread id and the state attributes; the thread template renders it directly, skipping the stock li-wrapper + role-body split that exists for anchor-bodied product items; selection is part of the data — `selectedThreadId` lives in the workflow's committed value and each record carries its `selected` flag right in the data layer (stamped by the workflow's default data pass; the role mapping is a plain slice) — and the list renders incrementally: appends render new items, while in-place state changes on existing items (selected/unread) are applied by an attribute-sync pass after each render, reading fresh values off the item bindings); the conversation uses the `messages` layout with `message` items (question bubble + answer body, with a per-message loading placeholder while answer contents are fetched), rendered incrementally; each question bubble carries its authorship — `data-author` ('Written by Miso' for questions whose `metadata.miso_generated_by` is `answer_update_monitor`, read via `getGeneratedBy`; the user's own questions carry no label; the label renders as a CSS `attr()` badge overlapping the bubble's top-left border, and monitor-generated bubbles take a distinct background) — stamped by the item template and re-applied by the sync pass, since the metadata arrives with the answers response after the stub render; the item template leaves question/answer contents blank, and a post-render pass (`_syncMessages`) fills them in place — finished answers via the `std:ui-markdown` plugin's pure `transform()`, and `live`/streaming answers (posted follow-ups) via a per-message typewriter (progressive markdown renderer + paced cursor). The conversation's header roles come from the open thread's record: `<miso-title>` (role `title`) renders its title with the generic `text` layout, `<miso-rename>` (role `rename`) renders a pencil button with the generic `button` layout whose **`prompt` option** turns the click into ask-then-submit: the shared prompt dialog opens pre-filled with the control's current value — the role's mapped data value, read off the latest rendered state (`_currentValue()`; `RafLayout` retains it per element) — and the `submit` view event carries the confirmed text as `value`, which Conversation answers with `rename(value)` — and `<miso-subscription>` (role `subscription`) renders the answer-updates toggle with the **`checkbox` layout** — a button-layout subclass; a checkbox that looks like a button (`<button role="switch" aria-checked>` with `data-checked`, an icon and label per state via `icon`/`text` and `checkedIcon`/`checkedText`). Its checked state comes from the data, so a click emits a `change` view event carrying only the requested state (`{ checked }`), read off the rendered element; the Conversation workflow answers it with `subscribe()`/`unsubscribe()` and the new state arrives back down the data path. Note the `visible-when` mechanism forces `display: block !important` on the element it toggles, so a page that lays such an element out as a flex row needs an inner wrapper (as the history demo pages do for the header). A `<miso-query>` (search-box layout) inside `<miso-conversation>` sends questions through the hub `query` field — follow-ups, or the first question of a new thread (the conversation starts in new-thread mode). With `messages`/`threads` registered as data roles, `<miso-conversation>` carries the `empty`/`nonempty` content status, which pages use to center the composer in the empty (new-thread) state. The `threads` layout's post-render sync also applies in-place record changes (title, `data-thread-id`) so renames and placeholder→real-thread resolutions reflect without item re-renders. A click on a thread item is a navigation action, not a content-engagement click: the layout overrides `_onClick` to emit a `select` view event (no click tracking), which the History workflow handles with `select()`. Each item also carries a context menu (vertical dots, revealed on hover) with thread actions, each going through a shared modal dialog util (promise-returning native `<dialog>`s on a common core, `util/modal.js`): rename asks via `prompt()` (`util/prompt.js`, a modal text input pre-filled with the current title — Enter confirms, resolving to the trimmed text, or undefined on cancel; exposed as `MisoClient.ui.prompt`) and emits a `rename` view event, handled by the History workflow with `rename()`; delete asks via `confirm()` (`util/confirm.js`, exposed as `MisoClient.ui.confirm`) and emits a `delete` view event, handled with `delete()`.
48
+ - **Role components** (`element/role/`): register with their ancestor container; the role determines which slice of data they display. Either dedicated tags (`<miso-answer>`, `<miso-sources>`, `<miso-products>`, `<miso-query>`, ...) or generic `<miso-component role="...">`. `<miso-results>` is deprecated in favor of `<miso-products>`.
49
+ - **Combos** (`element/combo/`): pre-configured composite `<miso-ask-combo>` (deprecated).
66
50
 
67
- - **Roles**: Child elements bound to specific data roles
68
- - Query: `<miso-query>`
69
- - Results: `<miso-answer>`, `<miso-sources>`, `<miso-products>`, `<miso-results>`
70
- - Navigation: `<miso-follow-up-questions>`, `<miso-related-questions>`
71
- - Utility: `<miso-feedback>`, `<miso-error>`, `<miso-facets>`, `<miso-total>`
51
+ Connecting an element to the DOM is what triggers view creation: container `connectedCallback` → `workflow._views.addContainer/addComponent` → `ViewActor` created with a layout instance → rendered as soon as data exists.
72
52
 
73
- - **Combos**: Pre-configured composite elements (deprecated)
74
- - `<miso-ask-combo>`
53
+ ## Layouts (`layout/`)
75
54
 
76
- ### Actors (`actor/`)
55
+ Rendering strategies. A layout class has a static `type` (e.g. `'list'`, `'typewriter'`, `'search-box'`) and is registered in the plugin registry; workflows pick layouts per role via options (`useLayouts({ answer: ['typewriter', {...}] })`). `ViewsActor` instantiates one layout object per view.
77
56
 
78
- Components that subscribe to and publish on the Hub:
79
- - `DataActor` - Fetches data from API based on requests
80
- - `ViewsActor` - Manages view state for each role
81
- - `TrackersActor` - Handles impression/click/viewable tracking
82
- - `InteractionsActor` - Sends interaction events to API
83
- - `SessionMaker` - Manages session lifecycle
84
-
85
- ### Hub
86
-
87
- Central pub/sub state manager connecting workflows and actors. Fields include:
88
- - `session` - Current session object
89
- - `request` - API request parameters
90
- - `data` - Response data
91
- - `view(role)` - View state per role
92
- - `tracker(role, event)` - Tracking state
93
-
94
- ### Layouts (`layout/`)
95
-
96
- Rendering strategies for each role. Registered via `plugin.layouts.register()`.
97
-
98
- Types: `input`, `list`, `text`, `container`, `error`, `button`, etc.
99
-
100
- ### Roles & Status
101
-
102
- **Roles** (from `constants.js`): Define what data a view displays
103
- - Content: `answer`, `question`, `sources`, `products`, `results`
104
- - Navigation: `follow_up_questions`, `related_questions`, `query_suggestions`
105
- - Meta: `feedback`, `error`, `total`, `facets`
106
-
107
- **Status**: Workflow/view lifecycle states
108
- - `initial` → `loading` → `ready` / `erroneous`
109
- - `ongoing` (streaming) → `done`
57
+ Contract: `render(element, data, { notifyUpdate })` is mandatory; `initialize(view)`, `unrender(element)`, `syncSize(element)`, `destroy()` are optional. `notifyUpdate(state)` is how a layout reports its view state back (published to `view:<role>` on the hub) — this drives workflow lifecycle events. A layout can also write to the hub (e.g. `SearchBoxLayout` submits `fields.query()`).
110
58
 
111
59
  ## Entry Point
112
60
 
@@ -115,20 +63,15 @@ Types: `input`, `list`, `text`, `container`, `error`, `button`, etc.
115
63
  // Installed automatically with full SDK, or manually:
116
64
  MisoClient.plugins.use('std:ui');
117
65
 
118
- // Access via client instance:
66
+ // Access via client instance (canonical, injected by std:workflow):
119
67
  const client = new MisoClient({ apiKey });
120
- client.ui.ask; // Ask workflow
121
- client.ui.search; // Search workflow
122
- client.ui.recommendations; // Recommendations
68
+ client.workflows.ask; // root Ask workflow (=== client.workflows.asks.root)
69
+ client.workflows.asks; // Asks context (follow-up chain, .active, .root)
70
+ client.workflows.search; // Search workflow
71
+ client.workflows.hybridSearch; // HybridSearch workflow
72
+ client.workflows.recommendations.get(unitId); // Recommendation workflow per unit
73
+ client.workflows.explores.get(unitId); // Explore workflow per unit
74
+
75
+ // client.ui.search, client.ui.asks, client.ui.sources, ... delegate to
76
+ // client.workflows for backward compatibility; client.ui's own surface is only `ready`.
123
77
  ```
124
-
125
- ## Event Flow
126
-
127
- 1. User interacts with `<miso-query>` element (ask, hybrid-search, search, etc.), or start by calling `start()` on the workflow instance (explore, recommendations).
128
- 2. Container element triggers workflow request
129
- 3. Workflow publishes request to Hub
130
- 4. `DataActor` fetches from API, publishes response
131
- 5. `ViewsActor` updates view states per role
132
- 6. Layout renders updated content in elements
133
- 7. `TrackersActor` observes visibility, triggers interactions
134
- 8. `InteractionsActor` sends tracking data to API
package/src/asset/svgs.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isInBrowser } from '@miso.ai/commons';
1
2
  import version from '../version.js';
2
3
 
3
4
  function trianglePath(r) {
@@ -18,6 +19,11 @@ const ICON_NAME = {
18
19
  CHEVRON: 'chevron',
19
20
  CHEVRON_NEGATIVE: 'chevron-negative',
20
21
  BULB: 'bulb',
22
+ DOTS_VERTICAL: 'dots-vertical',
23
+ PLUS: 'plus',
24
+ PENCIL: 'pencil',
25
+ BELL: 'bell',
26
+ BELL_FILL: 'bell-fill',
21
27
  };
22
28
 
23
29
  // CC0 SVGs
@@ -31,9 +37,14 @@ const ICON_CHEVRON = `<symbol id="${PREFIX}-${ICON_NAME.CHEVRON}" viewBox="-100
31
37
  const ICON_CHEVRON_NEGATIVE = `<symbol id="${PREFIX}-${ICON_NAME.CHEVRON_NEGATIVE}" viewBox="-100 -100 200 200"><path d="M100 100V-200H-200V200H200ZM-10.61 -43.94A15 15,0,0,1,10.61 -43.94L60.61 6.06A15 15,0,0,1,39.39 27.27L0 -12.12L-39.39 27.27A15 15,0,0,1,-60.61 6.06L-10.61 -43.94Z"/></symbol>`;
32
38
 
33
39
  // from Bootstrap Icons (MIT)
34
- const ICON_BULB = `<symbol id="${PREFIX}-${ICON_NAME.BULB}" viewBox="0 0 16 16"><path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a2 2 0 0 0-.453-.618A5.98 5.98 0 0 1 2 6m6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1"/></symbol>`;
40
+ const ICON_BULB = `<symbol id="${PREFIX}-${ICON_NAME.BULB}" viewBox="0 0 16 16"><path fill="currentColor" d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a2 2 0 0 0-.453-.618A5.98 5.98 0 0 1 2 6m6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1"/></symbol>`;
41
+ const ICON_DOTS_VERTICAL = `<symbol id="${PREFIX}-${ICON_NAME.DOTS_VERTICAL}" viewBox="0 0 16 16"><path fill="currentColor" d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/></symbol>`;
42
+ const ICON_PLUS = `<symbol id="${PREFIX}-${ICON_NAME.PLUS}" viewBox="0 0 16 16"><path fill="currentColor" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/></symbol>`;
43
+ const ICON_PENCIL = `<symbol id="${PREFIX}-${ICON_NAME.PENCIL}" viewBox="0 0 16 16"><path fill="currentColor" d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.325-.175"/></symbol>`;
44
+ const ICON_BELL = `<symbol id="${PREFIX}-${ICON_NAME.BELL}" viewBox="0 0 16 16"><path fill="currentColor" d="M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2M8 1.918l-.797.161A4 4 0 0 0 4 6c0 .628-.134 2.197-.459 3.742-.16.767-.376 1.566-.663 2.258h10.244c-.287-.692-.502-1.49-.663-2.258C12.134 8.197 12 6.628 12 6a4 4 0 0 0-3.203-3.92zM14.22 12c.223.447.481.801.78 1H1c.299-.199.557-.553.78-1C2.68 10.2 3 6.88 3 6c0-2.42 1.72-4.44 4.005-4.901a1 1 0 1 1 1.99 0A5 5 0 0 1 13 6c0 .88.32 4.2 1.22 6"/></symbol>`;
45
+ const ICON_BELL_FILL = `<symbol id="${PREFIX}-${ICON_NAME.BELL_FILL}" viewBox="0 0 16 16"><path fill="currentColor" d="M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2m.995-14.901a1 1 0 1 0-1.99 0A5 5 0 0 0 3 6c0 1.098-.5 6-2 7h14c-1.5-1-2-5.902-2-7 0-2.42-1.72-4.44-4.005-4.901"/></symbol>`;
35
46
 
36
- const ICONS = [ICON_SEND, ICON_SEARCH, ICON_TRIANGLE, ICON_TRIANGLE_EQ, ICON_CHEVRON, ICON_CHEVRON_NEGATIVE, ICON_BULB];
47
+ const ICONS = [ICON_SEND, ICON_SEARCH, ICON_TRIANGLE, ICON_TRIANGLE_EQ, ICON_CHEVRON, ICON_CHEVRON_NEGATIVE, ICON_BULB, ICON_DOTS_VERTICAL, ICON_PLUS, ICON_PENCIL, ICON_BELL, ICON_BELL_FILL];
37
48
 
38
49
  const SPRITES_SVG = `<svg id="${ID}" style="display:none;">${ICONS.join('')}</svg>`;
39
50
 
@@ -47,7 +58,7 @@ function loadSvgSprites() {
47
58
  document.head.insertAdjacentHTML('beforeend', SPRITES_SVG);
48
59
  }
49
60
 
50
- loadSvgSprites();
61
+ isInBrowser && loadSvgSprites();
51
62
 
52
63
  function _icon(name) {
53
64
  return `<svg class="miso-ui-icon miso-ui-icon-${name}"><use href="#${PREFIX}-${name}"></use></svg>`;
@@ -102,8 +102,8 @@ export default class AskCombo extends Combo {
102
102
  const { wireFollowUps, wireRelatedResources } = MisoClient.ui.defaults.ask;
103
103
  const { templates = {}, features = {}, api } = options;
104
104
 
105
- const context = client.ui.asks;
106
- const rootWorkflow = client.ui.ask;
105
+ const context = client.workflows.asks;
106
+ const rootWorkflow = client.workflows.ask;
107
107
 
108
108
  if (api) {
109
109
  context.useApi(api);
package/src/constants.js CHANGED
@@ -1,156 +1,46 @@
1
+ // workflow-level constants live in the workflow package; re-exported here for convenience
2
+ export {
3
+ DEFAULT_UNIT_ID,
4
+ ROLE,
5
+ isDataRole,
6
+ isProductRole,
7
+ EVENT_TYPE,
8
+ TRACKING_EVENT_TYPES,
9
+ PERFORMANCE_EVENT_TYPES,
10
+ DIRECT_TRACKING_EVENT_TYPES,
11
+ isPerformanceEventType,
12
+ TRACKING_STATUS,
13
+ STATUS,
14
+ QUESTION_SOURCE,
15
+ validateEventType,
16
+ validateTrackingStatus,
17
+ WORKFLOW_CONFIGURABLE,
18
+ REQUEST_TYPE,
19
+ } from '@miso.ai/client-sdk-workflow';
20
+
1
21
  export const ATTR_DATA_MISO_UNIT_ID = `data-miso-unit-id`;
2
22
  export const ATTR_DATA_MISO_PRODUCT_ID = `data-miso-product-id`;
3
- export const DEFAULT_UNIT_ID = 'default';
4
23
 
5
- export const ROLE = Object.freeze({
24
+ export const LAYOUT_TYPE = Object.freeze({
6
25
  CONTAINER: 'container',
26
+ ERROR: 'error',
7
27
  BANNER: 'banner',
8
- QUERY: 'query',
9
- FEEDBACK: 'feedback',
10
- PRODUCTS: 'products',
11
- CATEGORIES: 'categories',
12
- ATTRIBUTES: 'attributes',
13
- RESULTS: 'results',
14
- ITEMS: 'items',
15
- QUESTION: 'question',
16
- ANSWER: 'answer',
17
- REASONING: 'reasoning',
18
- IMAGES: 'images',
19
- SOURCES: 'sources',
20
- RELATED_RESOURCES: 'related_resources',
21
- FOLLOW_UP_QUESTIONS: 'follow_up_questions',
22
- QUERY_SUGGESTIONS: 'query_suggestions',
23
- RELATED_QUESTIONS: 'related_questions',
24
28
  AFFILIATION: 'affiliation',
25
- KEYWORDS: 'keywords',
29
+ LIST: 'list',
30
+ THREADS: 'threads',
31
+ MESSAGES: 'messages',
32
+ HORIZONTAL: 'horizontal',
33
+ CARDS: 'cards',
34
+ CAROUSEL: 'carousel',
35
+ GALLERY: 'gallery',
36
+ SEARCH_BOX: 'search-box',
37
+ OPTION_LIST: 'option-list',
26
38
  FACETS: 'facets',
27
- TOTAL: 'total',
28
- MORE: 'more',
29
- SORT: 'sort',
30
- ERROR: 'error',
31
- });
32
-
33
- const DATA_ROLE_SET = new Set([
34
- ROLE.PRODUCTS,
35
- ROLE.CATEGORIES,
36
- ROLE.ATTRIBUTES,
37
- ROLE.RESULTS,
38
- ROLE.ITEMS,
39
- ROLE.QUESTION,
40
- ROLE.ANSWER,
41
- ROLE.REASONING,
42
- ROLE.IMAGES,
43
- ROLE.SOURCES,
44
- ROLE.RELATED_RESOURCES,
45
- ROLE.FOLLOW_UP_QUESTIONS,
46
- ROLE.QUERY_SUGGESTIONS,
47
- ROLE.RELATED_QUESTIONS,
48
- ROLE.AFFILIATION,
49
- ROLE.FACETS,
50
- ROLE.TOTAL,
51
- ]);
52
-
53
- export function isDataRole(role) {
54
- return DATA_ROLE_SET.has(role);
55
- }
56
-
57
- const PRODUCT_ROLE_SET = new Set([
58
- ROLE.PRODUCTS,
59
- ROLE.IMAGES,
60
- ROLE.SOURCES,
61
- ROLE.RELATED_RESOURCES,
62
- ]);
63
-
64
- export function isProductRole(role) {
65
- return PRODUCT_ROLE_SET.has(role);
66
- }
67
-
68
- export const EVENT_TYPE = Object.freeze({
69
- IMPRESSION: 'impression',
70
- VIEWABLE: 'viewable',
71
- CLICK: 'click',
72
- SUBMIT: 'submit',
39
+ SELECT: 'select',
40
+ MORE_BUTTON: 'more-button',
41
+ BUTTON: 'button',
42
+ CHECKBOX: 'checkbox',
73
43
  FEEDBACK: 'feedback',
74
- HEARTBEAT: 'heartbeat',
75
- GENERIC_CLICK: 'generic_click',
76
- });
77
-
78
- export const TRACKING_EVENT_TYPES = [
79
- EVENT_TYPE.IMPRESSION,
80
- EVENT_TYPE.VIEWABLE,
81
- EVENT_TYPE.CLICK,
82
- EVENT_TYPE.SUBMIT,
83
- EVENT_TYPE.FEEDBACK,
84
- EVENT_TYPE.HEARTBEAT,
85
- ];
86
-
87
- export const PERFORMANCE_EVENT_TYPES = [
88
- EVENT_TYPE.IMPRESSION,
89
- EVENT_TYPE.VIEWABLE,
90
- EVENT_TYPE.CLICK,
91
- ];
92
-
93
- export const DIRECT_TRACKING_EVENT_TYPES = [
94
- EVENT_TYPE.SUBMIT,
95
- EVENT_TYPE.HEARTBEAT,
96
- EVENT_TYPE.GENERIC_CLICK,
97
- ];
98
-
99
- const PERFORMANCE_EVENT_TYPE_SET = new Set(PERFORMANCE_EVENT_TYPES);
100
-
101
- export function isPerformanceEventType(type) {
102
- return PERFORMANCE_EVENT_TYPE_SET.has(type);
103
- }
104
-
105
- export const TRACKING_STATUS = Object.freeze({
106
- UNTRACKED: 'untracked',
107
- TRACKING: 'tracking',
108
- TRIGGERED: 'triggered',
109
- });
110
-
111
- export const STATUS = Object.freeze({
112
- INITIAL: 'initial',
113
- LOADING: 'loading',
114
- ERRONEOUS: 'erroneous',
115
- READY: 'ready',
116
- ONGOING: 'ongoing',
117
- DONE: 'done',
118
- EMPTY: 'empty',
119
- NONEMPTY: 'nonempty',
120
- UNANSWERABLE: 'unanswerable',
121
- });
122
-
123
- export const QUESTION_SOURCE = Object.freeze({
124
- ORGANIC: '_organic',
125
- SUGGESTED_QUESTIONS: '_suggested_questions',
126
- INLINE_QUESTION_LINK: '_inline_question_link',
127
- });
128
-
129
- export function validateEventType(value) {
130
- if (TRACKING_EVENT_TYPES.indexOf(value) < 0) {
131
- throw new Error(`Unrecognized event type: ${value}`);
132
- }
133
- }
134
-
135
- export function validateTrackingStatus(value) {
136
- if (value !== TRACKING_STATUS.UNTRACKED && value !== TRACKING_STATUS.TRACKING && value !== TRACKING_STATUS.TRIGGERED) {
137
- throw new Error(`Unrecognized tracking status: ${value}`);
138
- }
139
- }
140
-
141
- export const WORKFLOW_CONFIGURABLE = Object.freeze({
142
- API: 'api',
143
- LAYOUTS: 'layouts',
144
- DATA_PROCESSOR: 'dataProcessor',
145
- TRACKERS: 'trackers',
146
- INTERACTIONS: 'interactions',
147
- FILTERS: 'filters',
148
- PAGINATION: 'pagination',
149
- TEMPLATES: 'templates',
150
- });
151
-
152
- export const REQUEST_TYPE = Object.freeze({
153
- QUERY: 'query',
154
- REFINE: 'refine',
155
- MORE: 'more',
44
+ TEXT: 'text',
45
+ TYPEWRITER: 'typewriter',
156
46
  });
@@ -17,7 +17,7 @@ function setFollowUpTemplate(client, { template = followUpTemplate, ...options }
17
17
  if (template === followUpTemplate && !hasExtraOptions) {
18
18
  return; // same as default
19
19
  }
20
- client.ui.asks.useTemplates({
20
+ client.workflows.asks.useTemplates({
21
21
  followUp: hasExtraOptions ? (args) => template({ ...options, ...args }) : template,
22
22
  });
23
23
  }
@@ -1,6 +1,6 @@
1
1
  import { CLASS_PREFIX } from './constants.js';
2
2
  import { STATUS } from '../../constants.js';
3
- import { fields } from '../../actor/index.js';
3
+ import { fields } from '@miso.ai/client-sdk-workflow';
4
4
  import { showMore as DEFAULT_PHRASE_SHOW_MORE, showLess as DEFAULT_PHRASE_SHOW_LESS } from './phrases.js';
5
5
 
6
6
  const CLASS_OPEN = 'answer-box-open';
@@ -11,7 +11,7 @@ export default class AnswerBox {
11
11
 
12
12
  constructor(client, element, { classPrefix = CLASS_PREFIX, phrases = {}, hideWhenUnanswerable = true } = {}) {
13
13
  this._client = client;
14
- this._workflow = client.ui.hybridSearch;
14
+ this._workflow = client.workflows.hybridSearch;
15
15
  this._element = element;
16
16
  this._classPrefix = classPrefix;
17
17
  this._phrases = phrases;