@ixo/editor 5.18.0 → 5.19.0

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/index.mjs CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  useCreateIxoEditor,
29
29
  useTrackBlockFocus,
30
30
  useTranslate
31
- } from "./chunk-7OOTFDLP.mjs";
31
+ } from "./chunk-TZBRXBBJ.mjs";
32
32
  import "./chunk-K4YAG7AQ.mjs";
33
33
  import {
34
34
  FlowAgentService,
@@ -3,6 +3,7 @@ import React__default, { PropsWithChildren } from 'react';
3
3
  import { ac as IxoBlockProps, W as IxoEditorType, w as BlocknoteHandlers, X as FlowNodeRuntimeState } from '../index-BoRWeiDg.mjs';
4
4
  export { H as Addr, A as AuthzExecActionTypes, y as BlockRequirements, x as BlocknoteContextValue, B as BlocknoteProvider, O as CosmosMsgForEmpty, ai as DomainCardData, ah as DomainCardRenderer, ae as DynamicListData, af as DynamicListDataProvider, ag as DynamicListPanelRenderer, K as Expiration, p as IxoCollaborativeEditorOptions, o as IxoCollaborativeUser, n as IxoEditorConfig, l as IxoEditorOptions, m as IxoEditorTheme, Q as ProposalAction, P as ProposalResponse, z as SingleChoiceProposal, v as StakeType, v as StakeTypeValue, L as Status, M as Threshold, T as Timestamp, J as Uint128, G as User, V as ValidatorActionType, ad as VisualizationRenderer, F as Vote, E as VoteInfo, C as VoteResponse, N as Votes, q as blockSpecs, r as getExtraSlashMenuItems, u as useBlocknoteContext, s as useBlocknoteHandlers } from '../index-BoRWeiDg.mjs';
5
5
  import * as zustand from 'zustand';
6
+ import { SurveyModel } from '@ixo/surveys';
6
7
  import * as _blocknote_core from '@blocknote/core';
7
8
  export { Block, BlockNoteEditor, BlockNoteSchema, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from '@blocknote/core';
8
9
  import { MatrixClient } from 'matrix-js-sdk';
@@ -202,6 +203,132 @@ declare const usePanel: (panelId: string, content: React.ReactNode) => {
202
203
  close: () => void;
203
204
  };
204
205
 
206
+ /**
207
+ * Registry for ephemeral SurveyJS forms — the right-side panels (claim
208
+ * submission, bid submission) whose schema and answers do NOT live in
209
+ * BlockNote state. The oracle reaches these via the `list_open_surveys` /
210
+ * `fill_open_survey` browser tools. Forms whose answers are persisted to
211
+ * `block.props.answers` are NOT registered here; the oracle updates those
212
+ * directly through the Matrix CRDT via the existing block tools.
213
+ */
214
+ interface OpenSurveyContext {
215
+ deedId?: string;
216
+ deedTitle?: string;
217
+ collectionId?: string;
218
+ blockId?: string;
219
+ blockTitle?: string;
220
+ blockType?: string;
221
+ pageRoomId?: string;
222
+ flowType?: string;
223
+ [key: string]: unknown;
224
+ }
225
+ interface OpenSurveyEntry {
226
+ /** Stable id the LLM uses to address this survey. */
227
+ id: string;
228
+ /** Human-readable label for disambiguation when multiple are open. */
229
+ title: string;
230
+ /** Where the survey lives in the UI. */
231
+ source: 'panel' | 'block-config';
232
+ /** Original survey schema (the JSON passed into `new SurveyModel(...)`). */
233
+ schema: unknown;
234
+ /** Context the LLM may need to fill correctly (deed/collection/page ids). */
235
+ context: OpenSurveyContext;
236
+ /** Read-only view (e.g. evaluator viewing a submitted claim). */
237
+ readonly: boolean;
238
+ /** Live SurveyJS model. Not serialized over the wire. */
239
+ model: SurveyModel;
240
+ }
241
+ interface OpenSurveyStore {
242
+ surveys: Map<string, OpenSurveyEntry>;
243
+ register: (entry: OpenSurveyEntry) => void;
244
+ unregister: (id: string) => void;
245
+ }
246
+ declare const useOpenSurveyStore: zustand.UseBoundStore<zustand.StoreApi<OpenSurveyStore>>;
247
+ /** Snapshot of a question's contract, sent to the oracle so it can fill correctly. */
248
+ interface OpenSurveyQuestionSummary {
249
+ name: string;
250
+ type: string;
251
+ title?: string;
252
+ description?: string;
253
+ isRequired: boolean;
254
+ visible: boolean;
255
+ readOnly: boolean;
256
+ inputType?: string;
257
+ /** Resolved choices the dropdown will accept. For `choicesByUrl`-driven
258
+ * questions this is `visibleChoices` from the live SurveyJS model — it
259
+ * reflects already-loaded async options. May be empty if those options
260
+ * haven't loaded yet. */
261
+ choices?: Array<{
262
+ value: unknown;
263
+ text: string;
264
+ }>;
265
+ /** Present when the question pulls choices from a URL. `loaded: true`
266
+ * means async choices have arrived; `false` means the consumer should
267
+ * expect choices to be populated shortly. */
268
+ choicesByUrl?: {
269
+ url: string;
270
+ valueName?: string;
271
+ titleName?: string;
272
+ loaded: boolean;
273
+ };
274
+ }
275
+ /** Wire-safe view of a registered survey returned by `list_open_surveys`. */
276
+ interface OpenSurveySnapshot {
277
+ id: string;
278
+ title: string;
279
+ source: 'panel' | 'block-config';
280
+ context: OpenSurveyContext;
281
+ readonly: boolean;
282
+ questions: OpenSurveyQuestionSummary[];
283
+ currentAnswers: Record<string, unknown>;
284
+ /** Full schema, only included when `includeSchema: true`. */
285
+ schema?: unknown;
286
+ }
287
+ interface FillOpenSurveyResult {
288
+ applied: Record<string, unknown>;
289
+ rejected: Array<{
290
+ field: string;
291
+ reason: string;
292
+ }>;
293
+ validation: Array<{
294
+ field: string;
295
+ message: string;
296
+ }>;
297
+ }
298
+ /**
299
+ * Build the wire-safe snapshot for a registered survey. Pulls the live
300
+ * answers from the SurveyJS model at call-time, so the oracle always sees
301
+ * what the user currently has typed.
302
+ */
303
+ declare function snapshotOpenSurvey(entry: OpenSurveyEntry, opts?: {
304
+ includeSchema?: boolean;
305
+ }): OpenSurveySnapshot;
306
+ /**
307
+ * Apply an answer patch to a registered survey. Per-field via `setValue` so
308
+ * SurveyJS's conditional visibility / dependent rules fire correctly. Does
309
+ * NOT submit — the user reviews and submits manually.
310
+ */
311
+ declare function fillOpenSurvey(entry: OpenSurveyEntry, patch: Record<string, unknown>, opts?: {
312
+ merge?: boolean;
313
+ }): FillOpenSurveyResult;
314
+ interface UseRegisterOpenSurveyParams {
315
+ id: string;
316
+ title: string;
317
+ source: 'panel' | 'block-config';
318
+ schema: unknown;
319
+ context: OpenSurveyContext;
320
+ model: SurveyModel | null | undefined;
321
+ readonly?: boolean;
322
+ /** Set to false to temporarily skip registration without unmounting. */
323
+ enabled?: boolean;
324
+ }
325
+ /**
326
+ * Registers a SurveyJS form with the open-survey registry while mounted.
327
+ * Re-registers if the model identity changes (e.g. schema reload).
328
+ * Auto-cleans on unmount.
329
+ */
330
+ declare function useRegisterOpenSurvey({ id, title, source, schema, context, model, readonly, enabled, }: UseRegisterOpenSurveyParams): void;
331
+
205
332
  /**
206
333
  * Reactive hook that subscribes to a single node's runtime state in yDoc.runtime.
207
334
  *
@@ -449,4 +576,4 @@ declare function setDMNotificationRecord(runtimeMap: Map$1<any>, blockId: string
449
576
  */
450
577
  declare function shouldNotify(state: DMNotificationState, blockId: string, currentAssignedDid: string): boolean;
451
578
 
452
- export { BaseIconPicker, type BlockActionDefinition, BlocknoteHandlers, type CollapseEvent, type ColumnPosition, type DMNotificationRecord, type DMNotificationState, type DataSource, DebugButton, type DynamicListAction, type DynamicListBlockProps, DynamicListBlockSpec, type DynamicListColumn, type DynamicListPanelConfig, type HookedActionInstanceConfig, type HookedActionType, type HookedActionsConfig, HookedActionsTab, IxoEditorType, type ListBlocksUIContextValue, type Listener, PageHeader, type PageHeaderMenuItem, type PageHeaderProps, PageTitle, type PageTitleProps, type PayloadField, didToMatrixUserId, findOrCreateDMRoom, getAllHookedActionTypes, getBlockActions, getDMNotificationState, getHomeserver, getHookedActionType, initializeHookedActions, registerBlockActions, registerBuiltInActionTypes, registerHookedActionType, sendDirectMessage, setDMNotificationRecord, shouldNotify, useHookedActions, useListBlocksUI, useListBlocksUIStore, useNodeRuntime, usePanel, usePanelStore };
579
+ export { BaseIconPicker, type BlockActionDefinition, BlocknoteHandlers, type CollapseEvent, type ColumnPosition, type DMNotificationRecord, type DMNotificationState, type DataSource, DebugButton, type DynamicListAction, type DynamicListBlockProps, DynamicListBlockSpec, type DynamicListColumn, type DynamicListPanelConfig, type FillOpenSurveyResult, type HookedActionInstanceConfig, type HookedActionType, type HookedActionsConfig, HookedActionsTab, IxoEditorType, type ListBlocksUIContextValue, type Listener, type OpenSurveyContext, type OpenSurveyEntry, type OpenSurveyQuestionSummary, type OpenSurveySnapshot, PageHeader, type PageHeaderMenuItem, type PageHeaderProps, PageTitle, type PageTitleProps, type PayloadField, didToMatrixUserId, fillOpenSurvey, findOrCreateDMRoom, getAllHookedActionTypes, getBlockActions, getDMNotificationState, getHomeserver, getHookedActionType, initializeHookedActions, registerBlockActions, registerBuiltInActionTypes, registerHookedActionType, sendDirectMessage, setDMNotificationRecord, shouldNotify, snapshotOpenSurvey, useHookedActions, useListBlocksUI, useListBlocksUIStore, useNodeRuntime, useOpenSurveyStore, usePanel, usePanelStore, useRegisterOpenSurvey };
@@ -25,6 +25,7 @@ import {
25
25
  StakeType,
26
26
  ValidatorActionType,
27
27
  blockSpecs,
28
+ fillOpenSurvey,
28
29
  getAllHookedActionTypes,
29
30
  getBlockActions,
30
31
  getDMNotificationState,
@@ -38,6 +39,7 @@ import {
38
39
  registerHookedActionType,
39
40
  setDMNotificationRecord,
40
41
  shouldNotify,
42
+ snapshotOpenSurvey,
41
43
  useBlockPresence,
42
44
  useBlocknoteContext,
43
45
  useBlocknoteHandlers,
@@ -47,10 +49,12 @@ import {
47
49
  useListBlocksUI,
48
50
  useListBlocksUIStore,
49
51
  useNodeRuntime,
52
+ useOpenSurveyStore,
50
53
  usePanel,
51
54
  usePanelStore,
55
+ useRegisterOpenSurvey,
52
56
  useTrackBlockFocus
53
- } from "../chunk-7OOTFDLP.mjs";
57
+ } from "../chunk-TZBRXBBJ.mjs";
54
58
  import {
55
59
  didToMatrixUserId,
56
60
  findOrCreateDMRoom,
@@ -85,6 +89,7 @@ export {
85
89
  ValidatorActionType,
86
90
  blockSpecs,
87
91
  didToMatrixUserId,
92
+ fillOpenSurvey,
88
93
  findOrCreateDMRoom,
89
94
  getAllHookedActionTypes,
90
95
  getBlockActions,
@@ -101,6 +106,7 @@ export {
101
106
  sendDirectMessage,
102
107
  setDMNotificationRecord,
103
108
  shouldNotify,
109
+ snapshotOpenSurvey,
104
110
  useBlockPresence,
105
111
  useBlocknoteContext,
106
112
  useBlocknoteHandlers,
@@ -110,8 +116,10 @@ export {
110
116
  useListBlocksUI,
111
117
  useListBlocksUIStore,
112
118
  useNodeRuntime,
119
+ useOpenSurveyStore,
113
120
  usePanel,
114
121
  usePanelStore,
122
+ useRegisterOpenSurvey,
115
123
  useTrackBlockFocus
116
124
  };
117
125
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixo/editor",
3
- "version": "5.18.0",
3
+ "version": "5.19.0",
4
4
  "description": "A custom BlockNote editor wrapper for IXO team",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",