@ixo/editor 3.0.0-beta.3 → 3.0.0-beta.5
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.
|
@@ -25972,28 +25972,6 @@ var EmailSendConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
25972
25972
|
currentBlockId: blockId,
|
|
25973
25973
|
description: "Carbon copy recipients (optional)"
|
|
25974
25974
|
}
|
|
25975
|
-
), /* @__PURE__ */ React241.createElement(
|
|
25976
|
-
DataInput,
|
|
25977
|
-
{
|
|
25978
|
-
label: "BCC",
|
|
25979
|
-
placeholder: "bcc@example.com",
|
|
25980
|
-
value: local.bcc,
|
|
25981
|
-
onChange: (value) => update({ bcc: value }),
|
|
25982
|
-
editorDocument: editor?.document || [],
|
|
25983
|
-
currentBlockId: blockId,
|
|
25984
|
-
description: "Blind carbon copy recipients (optional)"
|
|
25985
|
-
}
|
|
25986
|
-
), /* @__PURE__ */ React241.createElement(
|
|
25987
|
-
DataInput,
|
|
25988
|
-
{
|
|
25989
|
-
label: "Reply-To",
|
|
25990
|
-
placeholder: "reply@example.com",
|
|
25991
|
-
value: local.replyTo,
|
|
25992
|
-
onChange: (value) => update({ replyTo: value }),
|
|
25993
|
-
editorDocument: editor?.document || [],
|
|
25994
|
-
currentBlockId: blockId,
|
|
25995
|
-
description: "Reply-to address (optional)"
|
|
25996
|
-
}
|
|
25997
25975
|
)), /* @__PURE__ */ React241.createElement(Divider24, { variant: "dashed" }), /* @__PURE__ */ React241.createElement(
|
|
25998
25976
|
BaseTextInput,
|
|
25999
25977
|
{
|
|
@@ -28225,6 +28203,49 @@ var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
|
28225
28203
|
import React251, { useCallback as useCallback83, useEffect as useEffect83, useMemo as useMemo97, useState as useState101 } from "react";
|
|
28226
28204
|
import { Alert as Alert46, Loader as Loader45, Stack as Stack169, Text as Text143 } from "@mantine/core";
|
|
28227
28205
|
import { Survey as Survey12, SurveyModel as SurveyModel12 } from "@ixo/surveys";
|
|
28206
|
+
function parsePrimarySkill(rawSkill) {
|
|
28207
|
+
const coerce = (candidate) => {
|
|
28208
|
+
if (!candidate || typeof candidate !== "object") return null;
|
|
28209
|
+
const cid = String(candidate.cid || "").trim();
|
|
28210
|
+
const name = String(candidate.name || "").trim();
|
|
28211
|
+
if (!cid) return null;
|
|
28212
|
+
return name ? { cid, name } : { cid };
|
|
28213
|
+
};
|
|
28214
|
+
if (!rawSkill) return null;
|
|
28215
|
+
if (typeof rawSkill === "object") {
|
|
28216
|
+
if (Array.isArray(rawSkill)) {
|
|
28217
|
+
for (const entry of rawSkill) {
|
|
28218
|
+
const skill = coerce(entry);
|
|
28219
|
+
if (skill) return skill;
|
|
28220
|
+
}
|
|
28221
|
+
return null;
|
|
28222
|
+
}
|
|
28223
|
+
return coerce(rawSkill);
|
|
28224
|
+
}
|
|
28225
|
+
if (typeof rawSkill === "string") {
|
|
28226
|
+
const trimmed = rawSkill.trim();
|
|
28227
|
+
if (!trimmed) return null;
|
|
28228
|
+
try {
|
|
28229
|
+
const parsed = JSON.parse(trimmed);
|
|
28230
|
+
return parsePrimarySkill(parsed);
|
|
28231
|
+
} catch {
|
|
28232
|
+
return null;
|
|
28233
|
+
}
|
|
28234
|
+
}
|
|
28235
|
+
return null;
|
|
28236
|
+
}
|
|
28237
|
+
function buildCompanionPrompt(params) {
|
|
28238
|
+
const answersJson = JSON.stringify(params.answers || {}, null, 2);
|
|
28239
|
+
return [
|
|
28240
|
+
"Use the skill with this form context.",
|
|
28241
|
+
`Skill name: ${params.skill.name || "(not provided)"}`,
|
|
28242
|
+
`Skill CID: ${params.skill.cid}`,
|
|
28243
|
+
`Action block title: ${params.blockTitle || "Form Submit Action"}`,
|
|
28244
|
+
`Action block description: ${params.blockDescription || "Complete the form to execute this action."}`,
|
|
28245
|
+
`Form answers JSON:
|
|
28246
|
+
${answersJson}`
|
|
28247
|
+
].join("\n");
|
|
28248
|
+
}
|
|
28228
28249
|
var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28229
28250
|
const handlers = useBlocknoteHandlers();
|
|
28230
28251
|
const services = useMemo97(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
@@ -28293,6 +28314,18 @@ var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isD
|
|
|
28293
28314
|
setError(null);
|
|
28294
28315
|
updateRuntime({ state: "running", error: void 0 });
|
|
28295
28316
|
try {
|
|
28317
|
+
const skill = parsePrimarySkill(block?.props?.skill);
|
|
28318
|
+
if (skill && typeof handlers?.askCompanion === "function") {
|
|
28319
|
+
const prompt = buildCompanionPrompt({
|
|
28320
|
+
skill,
|
|
28321
|
+
blockTitle: String(block?.props?.title || ""),
|
|
28322
|
+
blockDescription: String(block?.props?.description || ""),
|
|
28323
|
+
answers: sender.data || {}
|
|
28324
|
+
});
|
|
28325
|
+
handlers.askCompanion(prompt).catch((askError) => {
|
|
28326
|
+
console.error("askCompanion failed during form submit execution", askError);
|
|
28327
|
+
});
|
|
28328
|
+
}
|
|
28296
28329
|
const outcome = await executeNode({
|
|
28297
28330
|
node: flowNode,
|
|
28298
28331
|
actorDid,
|
|
@@ -29226,125 +29259,6 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
29226
29259
|
group: "DAO",
|
|
29227
29260
|
subtext: "Create a new DAO proposal"
|
|
29228
29261
|
},
|
|
29229
|
-
{
|
|
29230
|
-
title: "API Request",
|
|
29231
|
-
onItemClick: () => {
|
|
29232
|
-
editor.insertBlocks(
|
|
29233
|
-
[
|
|
29234
|
-
{
|
|
29235
|
-
type: "apiRequest",
|
|
29236
|
-
props: {
|
|
29237
|
-
title: "",
|
|
29238
|
-
description: "",
|
|
29239
|
-
icon: "square-check",
|
|
29240
|
-
endpoint: "",
|
|
29241
|
-
method: "GET",
|
|
29242
|
-
headers: "[]",
|
|
29243
|
-
body: "[]",
|
|
29244
|
-
response: "",
|
|
29245
|
-
status: "idle",
|
|
29246
|
-
conditions: "",
|
|
29247
|
-
assignment: JSON.stringify({
|
|
29248
|
-
assignedActor: { did: "", avatar: "", displayName: "" },
|
|
29249
|
-
assignedBy: { did: "", avatar: "", displayName: "" },
|
|
29250
|
-
assignedTimestamp: ""
|
|
29251
|
-
})
|
|
29252
|
-
}
|
|
29253
|
-
}
|
|
29254
|
-
],
|
|
29255
|
-
editor.getTextCursorPosition().block,
|
|
29256
|
-
"after"
|
|
29257
|
-
);
|
|
29258
|
-
},
|
|
29259
|
-
aliases: ["api", "api-request", "request", "http", "fetch"],
|
|
29260
|
-
group: "Basics",
|
|
29261
|
-
subtext: "Make HTTP requests and handle responses"
|
|
29262
|
-
},
|
|
29263
|
-
{
|
|
29264
|
-
title: "Email",
|
|
29265
|
-
onItemClick: () => {
|
|
29266
|
-
editor.insertBlocks(
|
|
29267
|
-
[
|
|
29268
|
-
{
|
|
29269
|
-
type: "email",
|
|
29270
|
-
props: {
|
|
29271
|
-
title: "",
|
|
29272
|
-
description: "",
|
|
29273
|
-
icon: "mail",
|
|
29274
|
-
templateName: "",
|
|
29275
|
-
templateVersion: "",
|
|
29276
|
-
from: "",
|
|
29277
|
-
to: "",
|
|
29278
|
-
subject: "",
|
|
29279
|
-
variables: "{}",
|
|
29280
|
-
extractedVariables: "[]",
|
|
29281
|
-
status: "idle",
|
|
29282
|
-
conditions: ""
|
|
29283
|
-
}
|
|
29284
|
-
}
|
|
29285
|
-
],
|
|
29286
|
-
editor.getTextCursorPosition().block,
|
|
29287
|
-
"after"
|
|
29288
|
-
);
|
|
29289
|
-
},
|
|
29290
|
-
aliases: ["email", "mail", "send", "mailgun", "message"],
|
|
29291
|
-
group: "Basics",
|
|
29292
|
-
subtext: "Send emails using Mailgun templates"
|
|
29293
|
-
},
|
|
29294
|
-
{
|
|
29295
|
-
title: "Claim",
|
|
29296
|
-
onItemClick: () => {
|
|
29297
|
-
editor.insertBlocks(
|
|
29298
|
-
[
|
|
29299
|
-
{
|
|
29300
|
-
type: "claim",
|
|
29301
|
-
props: {}
|
|
29302
|
-
}
|
|
29303
|
-
],
|
|
29304
|
-
editor.getTextCursorPosition().block,
|
|
29305
|
-
"after"
|
|
29306
|
-
);
|
|
29307
|
-
},
|
|
29308
|
-
aliases: ["claim", "submission", "form", "attestation"],
|
|
29309
|
-
group: "DAO",
|
|
29310
|
-
subtext: "Create and manage claims with submission tracking"
|
|
29311
|
-
},
|
|
29312
|
-
{
|
|
29313
|
-
title: "Bid",
|
|
29314
|
-
onItemClick: () => {
|
|
29315
|
-
editor.insertBlocks(
|
|
29316
|
-
[
|
|
29317
|
-
{
|
|
29318
|
-
type: "bid",
|
|
29319
|
-
props: {}
|
|
29320
|
-
}
|
|
29321
|
-
],
|
|
29322
|
-
editor.getTextCursorPosition().block,
|
|
29323
|
-
"after"
|
|
29324
|
-
);
|
|
29325
|
-
},
|
|
29326
|
-
aliases: ["bid", "offer", "tender"],
|
|
29327
|
-
group: "DAO",
|
|
29328
|
-
subtext: "Create and submit bids"
|
|
29329
|
-
},
|
|
29330
|
-
{
|
|
29331
|
-
title: "Evaluator",
|
|
29332
|
-
onItemClick: () => {
|
|
29333
|
-
editor.insertBlocks(
|
|
29334
|
-
[
|
|
29335
|
-
{
|
|
29336
|
-
type: "evaluator",
|
|
29337
|
-
props: {}
|
|
29338
|
-
}
|
|
29339
|
-
],
|
|
29340
|
-
editor.getTextCursorPosition().block,
|
|
29341
|
-
"after"
|
|
29342
|
-
);
|
|
29343
|
-
},
|
|
29344
|
-
aliases: ["evaluator", "evaluate", "review", "assessment"],
|
|
29345
|
-
group: "DAO",
|
|
29346
|
-
subtext: "Evaluate and review submitted claims"
|
|
29347
|
-
},
|
|
29348
29262
|
{
|
|
29349
29263
|
title: "Visualization",
|
|
29350
29264
|
onItemClick: () => {
|
|
@@ -29419,32 +29333,6 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
29419
29333
|
group: "Domains",
|
|
29420
29334
|
subtext: "Select a protocol from a predefined list"
|
|
29421
29335
|
},
|
|
29422
|
-
{
|
|
29423
|
-
title: "Form",
|
|
29424
|
-
onItemClick: () => {
|
|
29425
|
-
editor.insertBlocks(
|
|
29426
|
-
[
|
|
29427
|
-
{
|
|
29428
|
-
type: "form",
|
|
29429
|
-
props: {
|
|
29430
|
-
title: "",
|
|
29431
|
-
description: "",
|
|
29432
|
-
icon: "checklist",
|
|
29433
|
-
surveySchema: "",
|
|
29434
|
-
answers: "",
|
|
29435
|
-
status: "pending",
|
|
29436
|
-
completedAt: ""
|
|
29437
|
-
}
|
|
29438
|
-
}
|
|
29439
|
-
],
|
|
29440
|
-
editor.getTextCursorPosition().block,
|
|
29441
|
-
"after"
|
|
29442
|
-
);
|
|
29443
|
-
},
|
|
29444
|
-
aliases: ["form", "survey", "questionnaire", "input"],
|
|
29445
|
-
group: "Basics",
|
|
29446
|
-
subtext: "Add a configurable form with SurveyJS"
|
|
29447
|
-
},
|
|
29448
29336
|
{
|
|
29449
29337
|
title: "Sign to Create",
|
|
29450
29338
|
onItemClick: () => {
|
|
@@ -30278,7 +30166,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
30278
30166
|
|
|
30279
30167
|
// src/mantine/IxoEditor.tsx
|
|
30280
30168
|
import React269, { useState as useState112, useEffect as useEffect94, useCallback as useCallback88 } from "react";
|
|
30281
|
-
import {
|
|
30169
|
+
import { SuggestionMenuController } from "@blocknote/react";
|
|
30282
30170
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
30283
30171
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
30284
30172
|
import { MantineProvider } from "@mantine/core";
|
|
@@ -31602,9 +31490,8 @@ function IxoEditorContent({
|
|
|
31602
31490
|
{
|
|
31603
31491
|
triggerCharacter: "/",
|
|
31604
31492
|
getItems: async (query) => {
|
|
31605
|
-
const defaultItems = getDefaultReactSlashMenuItems(editor);
|
|
31606
31493
|
const customItems = getExtraSlashMenuItems(editor);
|
|
31607
|
-
const allItems = [...
|
|
31494
|
+
const allItems = [...customItems];
|
|
31608
31495
|
allItems.sort((a, b) => {
|
|
31609
31496
|
const groupA = a.group || "";
|
|
31610
31497
|
const groupB = b.group || "";
|
|
@@ -32263,4 +32150,4 @@ export {
|
|
|
32263
32150
|
getExtraSlashMenuItems,
|
|
32264
32151
|
useCreateIxoEditor
|
|
32265
32152
|
};
|
|
32266
|
-
//# sourceMappingURL=chunk-
|
|
32153
|
+
//# sourceMappingURL=chunk-VYBAY32D.mjs.map
|