@ixo/editor 3.7.0 → 3.8.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.
|
@@ -5701,7 +5701,8 @@ import { Stack as Stack36, Flex as Flex19, Text as Text35 } from "@mantine/core"
|
|
|
5701
5701
|
// src/mantine/components/Base/BaseAvatar.tsx
|
|
5702
5702
|
import React57 from "react";
|
|
5703
5703
|
import { Avatar as Avatar2, Box as Box17, Center as Center2 } from "@mantine/core";
|
|
5704
|
-
import
|
|
5704
|
+
import JazziconImport from "react-jazzicon";
|
|
5705
|
+
var Jazzicon2 = JazziconImport?.default ?? JazziconImport;
|
|
5705
5706
|
var getSeedFromDid = (did) => {
|
|
5706
5707
|
return Array.from(did ?? "").reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
5707
5708
|
};
|
|
@@ -22821,11 +22822,11 @@ var FlowLinkBlockSpec = createReactBlockSpec19(
|
|
|
22821
22822
|
);
|
|
22822
22823
|
|
|
22823
22824
|
// src/mantine/blocks/action/ActionBlockSpec.tsx
|
|
22824
|
-
import
|
|
22825
|
+
import React277 from "react";
|
|
22825
22826
|
import { createReactBlockSpec as createReactBlockSpec20 } from "@blocknote/react";
|
|
22826
22827
|
|
|
22827
22828
|
// src/mantine/blocks/action/ActionBlock.tsx
|
|
22828
|
-
import
|
|
22829
|
+
import React276 from "react";
|
|
22829
22830
|
|
|
22830
22831
|
// src/mantine/blocks/action/template/TemplateView.tsx
|
|
22831
22832
|
import React235, { useMemo as useMemo86 } from "react";
|
|
@@ -26198,10 +26199,257 @@ var EvaluateClaimConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26198
26199
|
};
|
|
26199
26200
|
|
|
26200
26201
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/EvaluateClaimFlowDetail.tsx
|
|
26201
|
-
import
|
|
26202
|
-
import { ActionIcon as ActionIcon36, Alert as Alert44, Box as
|
|
26202
|
+
import React254, { useCallback as useCallback81, useEffect as useEffect85, useMemo as useMemo100, useState as useState105 } from "react";
|
|
26203
|
+
import { ActionIcon as ActionIcon36, Alert as Alert44, Box as Box54, Button as Button48, Checkbox as Checkbox12, Divider as Divider22, Group as Group96, Loader as Loader42, ScrollArea as ScrollArea8, Stack as Stack171, Text as Text147, UnstyledButton as UnstyledButton6 } from "@mantine/core";
|
|
26203
26204
|
import { IconArrowLeft as IconArrowLeft7, IconCheck as IconCheck19, IconFilter as IconFilter2 } from "@tabler/icons-react";
|
|
26204
26205
|
import { SurveyModel as SurveyModel11 } from "@ixo/surveys";
|
|
26206
|
+
|
|
26207
|
+
// src/mantine/blocks/action/actionTypes/evaluateClaim/ClaimAttachments.tsx
|
|
26208
|
+
import React253, { useMemo as useMemo99, useState as useState104 } from "react";
|
|
26209
|
+
import { Box as Box53, Group as Group95, SimpleGrid as SimpleGrid4, Stack as Stack170, Text as Text146, Tooltip as Tooltip22, UnstyledButton as UnstyledButton5 } from "@mantine/core";
|
|
26210
|
+
import { IconFile as IconFile5, IconFileText as IconFileText6, IconMusic, IconPhoto as IconPhoto4, IconVideo } from "@tabler/icons-react";
|
|
26211
|
+
|
|
26212
|
+
// src/mantine/components/MediaPreviewModal.tsx
|
|
26213
|
+
import React252 from "react";
|
|
26214
|
+
import { Anchor, Box as Box52, Center as Center13, Modal as Modal3, Stack as Stack169, Text as Text145 } from "@mantine/core";
|
|
26215
|
+
import { IconDownload as IconDownload4 } from "@tabler/icons-react";
|
|
26216
|
+
function detectKind(type, name) {
|
|
26217
|
+
const t = (type || "").toLowerCase();
|
|
26218
|
+
const ext = (name || "").toLowerCase().split(".").pop() || "";
|
|
26219
|
+
if (t.startsWith("image/") || ["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"].includes(ext)) return "image";
|
|
26220
|
+
if (t.startsWith("video/") || ["mp4", "webm", "mov", "mkv"].includes(ext)) return "video";
|
|
26221
|
+
if (t.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(ext)) return "audio";
|
|
26222
|
+
if (t === "application/pdf" || ext === "pdf") return "pdf";
|
|
26223
|
+
return "other";
|
|
26224
|
+
}
|
|
26225
|
+
var MediaPreviewModal = ({ file, onClose }) => {
|
|
26226
|
+
const opened = !!file;
|
|
26227
|
+
const kind = file ? detectKind(file.type, file.name) : "other";
|
|
26228
|
+
return /* @__PURE__ */ React252.createElement(
|
|
26229
|
+
Modal3,
|
|
26230
|
+
{
|
|
26231
|
+
opened,
|
|
26232
|
+
onClose,
|
|
26233
|
+
title: /* @__PURE__ */ React252.createElement(Text145, { fw: 500, size: "sm", truncate: true }, file?.name || "Preview"),
|
|
26234
|
+
size: "xl",
|
|
26235
|
+
centered: true
|
|
26236
|
+
},
|
|
26237
|
+
file && /* @__PURE__ */ React252.createElement(Stack169, { gap: "sm" }, kind === "image" && /* @__PURE__ */ React252.createElement(Center13, null, /* @__PURE__ */ React252.createElement("img", { src: file.content, alt: file.name, style: { maxWidth: "100%", maxHeight: "70vh", objectFit: "contain", borderRadius: 8 } })), kind === "video" && // eslint-disable-next-line jsx-a11y/media-has-caption
|
|
26238
|
+
/* @__PURE__ */ React252.createElement("video", { src: file.content, controls: true, style: { width: "100%", maxHeight: "70vh", borderRadius: 8, background: "var(--mantine-color-neutralColor-3)" } }), kind === "audio" && /* @__PURE__ */ React252.createElement("audio", { src: file.content, controls: true, style: { width: "100%" } }), kind === "pdf" && /* @__PURE__ */ React252.createElement(Box52, { style: { height: "70vh", borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React252.createElement("iframe", { src: file.content, title: file.name, style: { width: "100%", height: "100%", border: "none" } })), kind === "other" && /* @__PURE__ */ React252.createElement(Center13, { p: "xl" }, /* @__PURE__ */ React252.createElement(Stack169, { gap: "xs", align: "center" }, /* @__PURE__ */ React252.createElement(Text145, { size: "sm", c: "dimmed" }, "This file type can't be previewed inline."), /* @__PURE__ */ React252.createElement(Anchor, { href: file.content, target: "_blank", rel: "noopener noreferrer", download: file.name }, /* @__PURE__ */ React252.createElement(Box52, { style: { display: "inline-flex", alignItems: "center", gap: 6 } }, icon(IconDownload4, 16), "Download ", file.name)))), /* @__PURE__ */ React252.createElement(Anchor, { href: file.content, target: "_blank", rel: "noopener noreferrer", download: file.name, size: "xs", c: "dimmed" }, /* @__PURE__ */ React252.createElement(Box52, { style: { display: "inline-flex", alignItems: "center", gap: 4 } }, icon(IconDownload4, 12), "Download original")))
|
|
26239
|
+
);
|
|
26240
|
+
};
|
|
26241
|
+
|
|
26242
|
+
// src/mantine/blocks/action/actionTypes/evaluateClaim/resolveClaimFileRef.ts
|
|
26243
|
+
var IPFS_GATEWAY = "https://ipfs.gateway.ixo.world/ipfs/";
|
|
26244
|
+
var CID_REGEX = /(baf[a-z0-9]{20,})/i;
|
|
26245
|
+
function extractCid(source) {
|
|
26246
|
+
const m = source.match(CID_REGEX);
|
|
26247
|
+
return m ? m[1] : null;
|
|
26248
|
+
}
|
|
26249
|
+
function resolveClaimFileRef(raw) {
|
|
26250
|
+
if (raw == null) return null;
|
|
26251
|
+
if (typeof raw === "string") {
|
|
26252
|
+
const trimmed = raw.trim();
|
|
26253
|
+
if (!trimmed) return null;
|
|
26254
|
+
if (/^https?:/i.test(trimmed)) return trimmed;
|
|
26255
|
+
if (trimmed.startsWith("data:")) return trimmed;
|
|
26256
|
+
if (/^ipfs:/i.test(trimmed)) {
|
|
26257
|
+
const cid = extractCid(trimmed.replace(/^ipfs:\/*/i, ""));
|
|
26258
|
+
return cid ? `${IPFS_GATEWAY}${cid}` : null;
|
|
26259
|
+
}
|
|
26260
|
+
if (trimmed.startsWith("{")) {
|
|
26261
|
+
try {
|
|
26262
|
+
return resolveClaimFileRef(JSON.parse(trimmed));
|
|
26263
|
+
} catch {
|
|
26264
|
+
return null;
|
|
26265
|
+
}
|
|
26266
|
+
}
|
|
26267
|
+
if (/^did:/i.test(trimmed)) {
|
|
26268
|
+
const cid = extractCid(trimmed);
|
|
26269
|
+
return cid ? `${IPFS_GATEWAY}${cid}` : null;
|
|
26270
|
+
}
|
|
26271
|
+
if (/^baf[a-z0-9]/i.test(trimmed) && trimmed.length < 200 && !trimmed.includes(" ")) {
|
|
26272
|
+
const cid = extractCid(trimmed);
|
|
26273
|
+
return cid ? `${IPFS_GATEWAY}${cid}` : null;
|
|
26274
|
+
}
|
|
26275
|
+
return null;
|
|
26276
|
+
}
|
|
26277
|
+
if (typeof raw === "object") {
|
|
26278
|
+
const obj = raw;
|
|
26279
|
+
if (typeof obj.serviceEndpoint === "string" && /^https?:/i.test(obj.serviceEndpoint)) {
|
|
26280
|
+
return obj.serviceEndpoint;
|
|
26281
|
+
}
|
|
26282
|
+
if (typeof obj.proof === "string") {
|
|
26283
|
+
const cid = extractCid(obj.proof);
|
|
26284
|
+
if (cid) return `${IPFS_GATEWAY}${cid}`;
|
|
26285
|
+
}
|
|
26286
|
+
if (typeof obj.id === "string") {
|
|
26287
|
+
const hashIdx = obj.id.indexOf("#");
|
|
26288
|
+
const tail = hashIdx >= 0 ? obj.id.slice(hashIdx + 1) : obj.id;
|
|
26289
|
+
const cid = extractCid(tail);
|
|
26290
|
+
if (cid) return `${IPFS_GATEWAY}${cid}`;
|
|
26291
|
+
}
|
|
26292
|
+
if (typeof obj.content === "string") {
|
|
26293
|
+
return resolveClaimFileRef(obj.content);
|
|
26294
|
+
}
|
|
26295
|
+
if (typeof obj.url === "string" && /^https?:/i.test(obj.url)) {
|
|
26296
|
+
return obj.url;
|
|
26297
|
+
}
|
|
26298
|
+
}
|
|
26299
|
+
return null;
|
|
26300
|
+
}
|
|
26301
|
+
function isFileLike(value) {
|
|
26302
|
+
if (Array.isArray(value)) {
|
|
26303
|
+
return value.length > 0 && value.every((v) => v && typeof v === "object" && typeof v.content === "string");
|
|
26304
|
+
}
|
|
26305
|
+
return !!value && typeof value === "object" && typeof value.content === "string";
|
|
26306
|
+
}
|
|
26307
|
+
function resolveOneFileEntry(entry) {
|
|
26308
|
+
const resolved = resolveClaimFileRef(entry.content);
|
|
26309
|
+
if (resolved && resolved !== entry.content) {
|
|
26310
|
+
return { ...entry, content: resolved };
|
|
26311
|
+
}
|
|
26312
|
+
return entry;
|
|
26313
|
+
}
|
|
26314
|
+
function resolveFilesInCredentialSubject(subject) {
|
|
26315
|
+
if (!subject || typeof subject !== "object") return subject;
|
|
26316
|
+
const out = Array.isArray(subject) ? [...subject] : { ...subject };
|
|
26317
|
+
for (const [key, value] of Object.entries(subject)) {
|
|
26318
|
+
if (!isFileLike(value)) continue;
|
|
26319
|
+
if (Array.isArray(value)) {
|
|
26320
|
+
out[key] = value.map((v) => resolveOneFileEntry(v));
|
|
26321
|
+
} else {
|
|
26322
|
+
out[key] = resolveOneFileEntry(value);
|
|
26323
|
+
}
|
|
26324
|
+
}
|
|
26325
|
+
return out;
|
|
26326
|
+
}
|
|
26327
|
+
|
|
26328
|
+
// src/mantine/blocks/action/actionTypes/evaluateClaim/ClaimAttachments.tsx
|
|
26329
|
+
function toMediaFile(raw) {
|
|
26330
|
+
if (!raw) return null;
|
|
26331
|
+
if (typeof raw === "object" && typeof raw.content === "string") {
|
|
26332
|
+
const obj = raw;
|
|
26333
|
+
const resolved = resolveClaimFileRef(obj.content);
|
|
26334
|
+
if (!resolved) return null;
|
|
26335
|
+
return {
|
|
26336
|
+
name: typeof obj.name === "string" ? obj.name : "file",
|
|
26337
|
+
type: typeof obj.type === "string" ? obj.type : "",
|
|
26338
|
+
content: resolved
|
|
26339
|
+
};
|
|
26340
|
+
}
|
|
26341
|
+
if (typeof raw === "string") {
|
|
26342
|
+
const resolved = resolveClaimFileRef(raw);
|
|
26343
|
+
if (!resolved) return null;
|
|
26344
|
+
const name = resolved.split("/").pop()?.split("?")[0] || "file";
|
|
26345
|
+
return { name, type: "", content: resolved };
|
|
26346
|
+
}
|
|
26347
|
+
return null;
|
|
26348
|
+
}
|
|
26349
|
+
function extractFiles(value) {
|
|
26350
|
+
if (!value) return [];
|
|
26351
|
+
if (Array.isArray(value)) {
|
|
26352
|
+
return value.map((v) => toMediaFile(v)).filter((f) => !!f);
|
|
26353
|
+
}
|
|
26354
|
+
const single = toMediaFile(value);
|
|
26355
|
+
return single ? [single] : [];
|
|
26356
|
+
}
|
|
26357
|
+
function kindIcon(file) {
|
|
26358
|
+
const t = (file.type || "").toLowerCase();
|
|
26359
|
+
const ext = (file.name || "").toLowerCase().split(".").pop() || "";
|
|
26360
|
+
if (t.startsWith("image/") || ["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"].includes(ext)) return IconPhoto4;
|
|
26361
|
+
if (t.startsWith("video/") || ["mp4", "webm", "mov", "mkv"].includes(ext)) return IconVideo;
|
|
26362
|
+
if (t.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(ext)) return IconMusic;
|
|
26363
|
+
if (t === "application/pdf" || ext === "pdf") return IconFileText6;
|
|
26364
|
+
return IconFile5;
|
|
26365
|
+
}
|
|
26366
|
+
function isImage(file) {
|
|
26367
|
+
const t = (file.type || "").toLowerCase();
|
|
26368
|
+
const ext = (file.name || "").toLowerCase().split(".").pop() || "";
|
|
26369
|
+
return t.startsWith("image/") || ["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"].includes(ext);
|
|
26370
|
+
}
|
|
26371
|
+
var ClaimAttachments = ({ surveyModel, credentialSubject }) => {
|
|
26372
|
+
const [active, setActive] = useState104(null);
|
|
26373
|
+
const items = useMemo99(() => {
|
|
26374
|
+
if (!credentialSubject || typeof credentialSubject !== "object") return [];
|
|
26375
|
+
const questionTitles = /* @__PURE__ */ new Map();
|
|
26376
|
+
const fileQuestionNames = /* @__PURE__ */ new Set();
|
|
26377
|
+
if (surveyModel) {
|
|
26378
|
+
for (const q of surveyModel.getAllQuestions()) {
|
|
26379
|
+
const qType = (q.getType?.() || "").toLowerCase();
|
|
26380
|
+
const name = q.name;
|
|
26381
|
+
if (name) questionTitles.set(name, q.title || name);
|
|
26382
|
+
if (qType === "file" || qType === "signaturepad" || qType === "image") {
|
|
26383
|
+
fileQuestionNames.add(name);
|
|
26384
|
+
}
|
|
26385
|
+
}
|
|
26386
|
+
}
|
|
26387
|
+
const result = [];
|
|
26388
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26389
|
+
const pushFrom = (key, value) => {
|
|
26390
|
+
const files = extractFiles(value);
|
|
26391
|
+
if (!files.length) return;
|
|
26392
|
+
const label = questionTitles.get(key) || key;
|
|
26393
|
+
for (const f of files) result.push({ ...f, label });
|
|
26394
|
+
};
|
|
26395
|
+
for (const name of fileQuestionNames) {
|
|
26396
|
+
if (credentialSubject[name] !== void 0) {
|
|
26397
|
+
pushFrom(name, credentialSubject[name]);
|
|
26398
|
+
seen.add(name);
|
|
26399
|
+
}
|
|
26400
|
+
}
|
|
26401
|
+
for (const [key, value] of Object.entries(credentialSubject)) {
|
|
26402
|
+
if (seen.has(key)) continue;
|
|
26403
|
+
pushFrom(key, value);
|
|
26404
|
+
}
|
|
26405
|
+
return result;
|
|
26406
|
+
}, [surveyModel, credentialSubject]);
|
|
26407
|
+
if (items.length === 0) {
|
|
26408
|
+
return /* @__PURE__ */ React253.createElement(Text146, { size: "xs", c: "dimmed" }, "No attachments in this submission.");
|
|
26409
|
+
}
|
|
26410
|
+
return /* @__PURE__ */ React253.createElement(React253.Fragment, null, /* @__PURE__ */ React253.createElement(SimpleGrid4, { cols: { base: 2, sm: 3, md: 4 }, spacing: "xs" }, items.map((item, index) => {
|
|
26411
|
+
const IconCmp = kindIcon(item);
|
|
26412
|
+
const showImage = isImage(item);
|
|
26413
|
+
return /* @__PURE__ */ React253.createElement(Tooltip22, { key: `${item.content}-${index}`, label: item.label, openDelay: 400, disabled: !item.label || item.label === item.name }, /* @__PURE__ */ React253.createElement(
|
|
26414
|
+
UnstyledButton5,
|
|
26415
|
+
{
|
|
26416
|
+
onClick: () => setActive(item),
|
|
26417
|
+
style: {
|
|
26418
|
+
borderRadius: 12,
|
|
26419
|
+
overflow: "hidden",
|
|
26420
|
+
background: "var(--mantine-color-neutralColor-5)",
|
|
26421
|
+
border: "1px solid var(--mantine-color-neutralColor-4)"
|
|
26422
|
+
}
|
|
26423
|
+
},
|
|
26424
|
+
/* @__PURE__ */ React253.createElement(Stack170, { gap: 0 }, /* @__PURE__ */ React253.createElement(
|
|
26425
|
+
Box53,
|
|
26426
|
+
{
|
|
26427
|
+
style: {
|
|
26428
|
+
aspectRatio: "1 / 1",
|
|
26429
|
+
display: "flex",
|
|
26430
|
+
alignItems: "center",
|
|
26431
|
+
justifyContent: "center",
|
|
26432
|
+
background: "var(--mantine-color-neutralColor-3)",
|
|
26433
|
+
overflow: "hidden"
|
|
26434
|
+
}
|
|
26435
|
+
},
|
|
26436
|
+
showImage ? /* @__PURE__ */ React253.createElement(
|
|
26437
|
+
"img",
|
|
26438
|
+
{
|
|
26439
|
+
src: item.content,
|
|
26440
|
+
alt: item.name,
|
|
26441
|
+
style: { width: "100%", height: "100%", objectFit: "cover" },
|
|
26442
|
+
onError: (e) => {
|
|
26443
|
+
e.currentTarget.style.display = "none";
|
|
26444
|
+
}
|
|
26445
|
+
}
|
|
26446
|
+
) : icon(IconCmp, 28)
|
|
26447
|
+
), /* @__PURE__ */ React253.createElement(Group95, { gap: 6, p: 8, wrap: "nowrap" }, icon(IconCmp, 14), /* @__PURE__ */ React253.createElement(Text146, { size: "xs", truncate: true, style: { flex: 1 } }, item.name)))
|
|
26448
|
+
));
|
|
26449
|
+
})), /* @__PURE__ */ React253.createElement(MediaPreviewModal, { file: active, onClose: () => setActive(null) }));
|
|
26450
|
+
};
|
|
26451
|
+
|
|
26452
|
+
// src/mantine/blocks/action/actionTypes/evaluateClaim/EvaluateClaimFlowDetail.tsx
|
|
26205
26453
|
var USDC_DENOM5 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
|
|
26206
26454
|
var IXO_DENOM5 = "uixo";
|
|
26207
26455
|
var CUSTOM_DENOM2 = "__custom__";
|
|
@@ -26252,71 +26500,76 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26252
26500
|
registerRuntimeInputs
|
|
26253
26501
|
}) => {
|
|
26254
26502
|
const handlers = useBlocknoteHandlers();
|
|
26255
|
-
const services =
|
|
26256
|
-
const flowNode =
|
|
26257
|
-
const runtimeManager =
|
|
26258
|
-
const ucanService =
|
|
26259
|
-
const invocationStore =
|
|
26260
|
-
const flowId =
|
|
26261
|
-
const flowOwnerDid =
|
|
26262
|
-
const schemaVersion =
|
|
26263
|
-
const flowUri =
|
|
26503
|
+
const services = useMemo100(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
26504
|
+
const flowNode = useMemo100(() => buildFlowNodeFromBlock(block), [block]);
|
|
26505
|
+
const runtimeManager = useMemo100(() => createRuntimeStateManager(editor), [editor]);
|
|
26506
|
+
const ucanService = useMemo100(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
26507
|
+
const invocationStore = useMemo100(() => editor?._invocationStore || void 0, [editor]);
|
|
26508
|
+
const flowId = useMemo100(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
26509
|
+
const flowOwnerDid = useMemo100(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
26510
|
+
const schemaVersion = useMemo100(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
26511
|
+
const flowUri = useMemo100(() => {
|
|
26264
26512
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
26265
26513
|
return `ixo:flow:${docId}`;
|
|
26266
26514
|
}, [editor, block.id]);
|
|
26267
|
-
const actorDid =
|
|
26515
|
+
const actorDid = useMemo100(() => {
|
|
26268
26516
|
try {
|
|
26269
26517
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
26270
26518
|
} catch {
|
|
26271
26519
|
return "";
|
|
26272
26520
|
}
|
|
26273
26521
|
}, [handlers]);
|
|
26274
|
-
const parsed =
|
|
26522
|
+
const parsed = useMemo100(() => parseEvaluateClaimActionInputs(inputs), [inputs]);
|
|
26275
26523
|
const editorDocument = editor?.document || [];
|
|
26276
|
-
const resolveOpts =
|
|
26524
|
+
const resolveOpts = useMemo100(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
26277
26525
|
const deedDid = resolveReferences(parsed.deedDid, editorDocument, resolveOpts).trim();
|
|
26278
26526
|
const collectionId = resolveReferences(parsed.collectionId, editorDocument, resolveOpts).trim();
|
|
26279
|
-
const [claims, setClaims] =
|
|
26280
|
-
const [selectedClaimId, setSelectedClaimId] =
|
|
26281
|
-
const [decision, setDecision] =
|
|
26282
|
-
const [loadingClaims, setLoadingClaims] =
|
|
26283
|
-
const [submitting, setSubmitting] =
|
|
26284
|
-
const [error, setError] =
|
|
26285
|
-
const [adminAddress, setAdminAddress] =
|
|
26286
|
-
const [paymentRows, setPaymentRows] =
|
|
26287
|
-
const [createUdid, setCreateUdid] =
|
|
26288
|
-
const [claimData, setClaimData] =
|
|
26289
|
-
const [surveyJson, setSurveyJson] =
|
|
26290
|
-
const [surveyLoading, setSurveyLoading] =
|
|
26291
|
-
const [evaluationLoading, setEvaluationLoading] =
|
|
26292
|
-
const [evaluationResult, setEvaluationResult] =
|
|
26293
|
-
const [activeFilter, setActiveFilter] =
|
|
26294
|
-
const [outcomeTemplateJson, setOutcomeTemplateJson] =
|
|
26295
|
-
const [outcomeTemplateLoading, setOutcomeTemplateLoading] =
|
|
26296
|
-
const [outcomeResponses, setOutcomeResponses] =
|
|
26297
|
-
const [outcomeComplete, setOutcomeComplete] =
|
|
26298
|
-
const [isEvaluatorAuthorized, setIsEvaluatorAuthorized] =
|
|
26299
|
-
const [authChecking, setAuthChecking] =
|
|
26300
|
-
const [profilesByDid, setProfilesByDid] =
|
|
26301
|
-
const selectedClaim =
|
|
26302
|
-
const filteredClaims =
|
|
26527
|
+
const [claims, setClaims] = useState105([]);
|
|
26528
|
+
const [selectedClaimId, setSelectedClaimId] = useState105("");
|
|
26529
|
+
const [decision, setDecision] = useState105("");
|
|
26530
|
+
const [loadingClaims, setLoadingClaims] = useState105(false);
|
|
26531
|
+
const [submitting, setSubmitting] = useState105(false);
|
|
26532
|
+
const [error, setError] = useState105(null);
|
|
26533
|
+
const [adminAddress, setAdminAddress] = useState105("");
|
|
26534
|
+
const [paymentRows, setPaymentRows] = useState105([createPaymentRow2()]);
|
|
26535
|
+
const [createUdid, setCreateUdid] = useState105(true);
|
|
26536
|
+
const [claimData, setClaimData] = useState105(null);
|
|
26537
|
+
const [surveyJson, setSurveyJson] = useState105(null);
|
|
26538
|
+
const [surveyLoading, setSurveyLoading] = useState105(false);
|
|
26539
|
+
const [evaluationLoading, setEvaluationLoading] = useState105(false);
|
|
26540
|
+
const [evaluationResult, setEvaluationResult] = useState105(null);
|
|
26541
|
+
const [activeFilter, setActiveFilter] = useState105("all");
|
|
26542
|
+
const [outcomeTemplateJson, setOutcomeTemplateJson] = useState105(null);
|
|
26543
|
+
const [outcomeTemplateLoading, setOutcomeTemplateLoading] = useState105(false);
|
|
26544
|
+
const [outcomeResponses, setOutcomeResponses] = useState105({});
|
|
26545
|
+
const [outcomeComplete, setOutcomeComplete] = useState105(false);
|
|
26546
|
+
const [isEvaluatorAuthorized, setIsEvaluatorAuthorized] = useState105(false);
|
|
26547
|
+
const [authChecking, setAuthChecking] = useState105(true);
|
|
26548
|
+
const [profilesByDid, setProfilesByDid] = useState105({});
|
|
26549
|
+
const selectedClaim = useMemo100(() => claims.find((claim) => claim.claimId === selectedClaimId) || null, [claims, selectedClaimId]);
|
|
26550
|
+
const filteredClaims = useMemo100(() => {
|
|
26303
26551
|
if (activeFilter === "all") return claims;
|
|
26304
26552
|
return claims.filter((claim) => {
|
|
26305
26553
|
const status = getClaimStatusInfo(claim).key;
|
|
26306
26554
|
return status === activeFilter;
|
|
26307
26555
|
});
|
|
26308
26556
|
}, [claims, activeFilter]);
|
|
26309
|
-
const
|
|
26557
|
+
const resolvedCredentialSubject = useMemo100(() => {
|
|
26558
|
+
const cs = claimData?.credentialSubject ?? claimData;
|
|
26559
|
+
if (!cs || typeof cs !== "object") return cs;
|
|
26560
|
+
return resolveFilesInCredentialSubject(cs);
|
|
26561
|
+
}, [claimData]);
|
|
26562
|
+
const surveyModel = useMemo100(() => {
|
|
26310
26563
|
if (!surveyJson || !claimData) return null;
|
|
26311
26564
|
const model = new SurveyModel11(surveyJson);
|
|
26312
26565
|
model.applyTheme(surveyTheme);
|
|
26313
26566
|
model.showQuestionNumbers = "off";
|
|
26314
26567
|
model.questionsOnPageMode = "singlePage";
|
|
26315
26568
|
model.mode = "display";
|
|
26316
|
-
model.data =
|
|
26569
|
+
model.data = resolvedCredentialSubject;
|
|
26317
26570
|
return model;
|
|
26318
|
-
}, [surveyJson, claimData]);
|
|
26319
|
-
const outcomeSurveyModel =
|
|
26571
|
+
}, [surveyJson, claimData, resolvedCredentialSubject]);
|
|
26572
|
+
const outcomeSurveyModel = useMemo100(() => {
|
|
26320
26573
|
if (!outcomeTemplateJson) return null;
|
|
26321
26574
|
const model = new SurveyModel11(outcomeTemplateJson);
|
|
26322
26575
|
model.applyTheme(surveyTheme2);
|
|
@@ -26514,7 +26767,7 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26514
26767
|
setOutcomeComplete(false);
|
|
26515
26768
|
loadClaimDetail(selectedClaim);
|
|
26516
26769
|
}, [selectedClaim, loadClaimDetail]);
|
|
26517
|
-
const isClaimAlreadyEvaluated =
|
|
26770
|
+
const isClaimAlreadyEvaluated = useMemo100(() => {
|
|
26518
26771
|
if (!selectedClaim) return false;
|
|
26519
26772
|
return isClaimEvaluated(selectedClaim);
|
|
26520
26773
|
}, [selectedClaim]);
|
|
@@ -26674,8 +26927,8 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26674
26927
|
const selectedClaimProfile = profilesByDid[selectedClaim.agentDid];
|
|
26675
26928
|
const selectedDisplayName = selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress;
|
|
26676
26929
|
const selectedAvatarLabel = (selectedClaimProfile?.displayname || selectedClaim.agentDid || selectedClaim.agentAddress || "?")[0]?.toUpperCase();
|
|
26677
|
-
return /* @__PURE__ */
|
|
26678
|
-
|
|
26930
|
+
return /* @__PURE__ */ React254.createElement(Stack171, { gap: "md" }, /* @__PURE__ */ React254.createElement(Group96, { gap: "xs", align: "center" }, /* @__PURE__ */ React254.createElement(ActionIcon36, { variant: "subtle", color: "gray", size: "sm", onClick: () => setSelectedClaimId("") }, /* @__PURE__ */ React254.createElement(IconArrowLeft7, { size: 16 })), /* @__PURE__ */ React254.createElement(Text147, { fw: 500, size: "sm", title: selectedClaim.claimId }, "Claim #", truncateId(selectedClaim.claimId))), /* @__PURE__ */ React254.createElement(Group96, { gap: 16, align: "center", style: { width: "100%" } }, /* @__PURE__ */ React254.createElement(
|
|
26931
|
+
Box54,
|
|
26679
26932
|
{
|
|
26680
26933
|
style: {
|
|
26681
26934
|
width: 40,
|
|
@@ -26695,15 +26948,15 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26695
26948
|
}
|
|
26696
26949
|
},
|
|
26697
26950
|
selectedClaimProfile?.avatarUrl ? null : selectedAvatarLabel
|
|
26698
|
-
), /* @__PURE__ */
|
|
26951
|
+
), /* @__PURE__ */ React254.createElement(Stack171, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React254.createElement(Text147, { fw: 500, size: "md", truncate: true }, selectedDisplayName), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed", truncate: true }, truncateAddress4(selectedClaim.agentAddress))), /* @__PURE__ */ React254.createElement(Stack171, { gap: 0, align: "flex-end", style: { flexShrink: 0 } }, /* @__PURE__ */ React254.createElement(Text147, { fw: 500, size: "md", c: claimStatus.color }, claimStatus.key === "approved" && /* @__PURE__ */ React254.createElement(IconCheck19, { size: 14, style: { verticalAlign: "middle", marginRight: 4 } }), claimStatus.label), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, getTimeAgo3(selectedClaim.submissionDate || "")))), /* @__PURE__ */ React254.createElement(CollapsibleSection, { title: "Submission" }, surveyLoading ? /* @__PURE__ */ React254.createElement(Group96, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Loader42, { size: "xs" }), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "Loading submission details...")) : surveyModel ? /* @__PURE__ */ React254.createElement(ScrollArea8, { h: 280 }, /* @__PURE__ */ React254.createElement(StableSurvey, { model: surveyModel })) : /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "No submission template/data available.")), /* @__PURE__ */ React254.createElement(CollapsibleSection, { title: "Attachments" }, /* @__PURE__ */ React254.createElement(ClaimAttachments, { surveyModel, credentialSubject: resolvedCredentialSubject })), /* @__PURE__ */ React254.createElement(CollapsibleSection, { title: "AI Evaluation" }, evaluationLoading ? /* @__PURE__ */ React254.createElement(Group96, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Loader42, { size: "xs" }), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "Running rubric evaluation...")) : evaluationResult ? /* @__PURE__ */ React254.createElement(ScrollArea8, { h: 280 }, /* @__PURE__ */ React254.createElement(RubricEvaluationResults, { evaluation: evaluationResult })) : /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "No rubric evaluation available for this claim.")), (outcomeTemplateLoading || outcomeTemplateJson) && /* @__PURE__ */ React254.createElement(
|
|
26699
26952
|
CollapsibleSection,
|
|
26700
26953
|
{
|
|
26701
26954
|
title: "Outcome",
|
|
26702
26955
|
defaultOpen: true,
|
|
26703
|
-
badge: /* @__PURE__ */
|
|
26956
|
+
badge: /* @__PURE__ */ React254.createElement(React254.Fragment, null, outcomeTemplateJson && !outcomeComplete && /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "yellow" }, "(required)"), outcomeComplete && /* @__PURE__ */ React254.createElement(IconCheck19, { size: 14, color: "var(--mantine-color-green-6)" }))
|
|
26704
26957
|
},
|
|
26705
|
-
outcomeTemplateLoading ? /* @__PURE__ */
|
|
26706
|
-
), /* @__PURE__ */
|
|
26958
|
+
outcomeTemplateLoading ? /* @__PURE__ */ React254.createElement(Group96, { gap: "xs" }, /* @__PURE__ */ React254.createElement(Loader42, { size: "xs" }), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "Loading evaluation template...")) : outcomeSurveyModel ? /* @__PURE__ */ React254.createElement(ScrollArea8, { h: 320 }, /* @__PURE__ */ React254.createElement(StableSurvey, { model: outcomeSurveyModel })) : /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "No evaluation template available.")
|
|
26959
|
+
), /* @__PURE__ */ React254.createElement(CollapsibleSection, { title: "Evaluation", defaultOpen: true }, /* @__PURE__ */ React254.createElement(Stack171, { gap: "md" }, /* @__PURE__ */ React254.createElement(Divider22, { color: "rgba(255,255,255,0.06)" }), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "Payment (optional custom payouts)"), paymentRows.map((row, index) => /* @__PURE__ */ React254.createElement(Stack171, { key: row.id, gap: 8 }, /* @__PURE__ */ React254.createElement(Group96, { justify: "space-between", align: "center" }, /* @__PURE__ */ React254.createElement(Text147, { size: "sm" }, "Token ", index + 1), paymentRows.length > 1 && /* @__PURE__ */ React254.createElement(Button48, { variant: "subtle", size: "compact-xs", color: "red", onClick: () => removePaymentRow(row.id), disabled: isDisabled || submitting }, "Remove")), /* @__PURE__ */ React254.createElement(
|
|
26707
26960
|
BaseSelect,
|
|
26708
26961
|
{
|
|
26709
26962
|
value: row.denom,
|
|
@@ -26716,7 +26969,7 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26716
26969
|
clearable: false,
|
|
26717
26970
|
disabled: isDisabled || submitting
|
|
26718
26971
|
}
|
|
26719
|
-
), row.denom === CUSTOM_DENOM2 && /* @__PURE__ */
|
|
26972
|
+
), row.denom === CUSTOM_DENOM2 && /* @__PURE__ */ React254.createElement(
|
|
26720
26973
|
BaseTextInput,
|
|
26721
26974
|
{
|
|
26722
26975
|
placeholder: "Custom denom (e.g. ibc/... or uixo)",
|
|
@@ -26724,7 +26977,7 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26724
26977
|
onChange: (event) => updatePaymentRow(row.id, { customDenom: event.currentTarget.value }),
|
|
26725
26978
|
disabled: isDisabled || submitting
|
|
26726
26979
|
}
|
|
26727
|
-
), /* @__PURE__ */
|
|
26980
|
+
), /* @__PURE__ */ React254.createElement(
|
|
26728
26981
|
BaseNumberInput,
|
|
26729
26982
|
{
|
|
26730
26983
|
min: 0,
|
|
@@ -26733,7 +26986,7 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26733
26986
|
placeholder: "Amount",
|
|
26734
26987
|
disabled: isDisabled || submitting
|
|
26735
26988
|
}
|
|
26736
|
-
))), /* @__PURE__ */
|
|
26989
|
+
))), /* @__PURE__ */ React254.createElement(Button48, { variant: "light", size: "xs", onClick: addPaymentRow, disabled: isDisabled || submitting }, "Add Payment"), /* @__PURE__ */ React254.createElement(Checkbox12, { label: "Generate UDID proof before evaluation", checked: createUdid, onChange: (event) => setCreateUdid(event.currentTarget.checked) }))), outcomeNotReady && /* @__PURE__ */ React254.createElement(Alert44, { color: "yellow", styles: actionAlertStyles }, "Complete the Outcome evaluation template before approving or rejecting."), isClaimAlreadyEvaluated && /* @__PURE__ */ React254.createElement(Alert44, { color: "yellow", styles: actionAlertStyles }, "This claim is already evaluated. Re-evaluation is disabled."), !authChecking && !isEvaluatorAuthorized && /* @__PURE__ */ React254.createElement(Alert44, { color: "yellow", styles: actionAlertStyles }, "You need evaluator authorization for this collection to approve or reject claims."), /* @__PURE__ */ React254.createElement(
|
|
26737
26990
|
BaseSelect,
|
|
26738
26991
|
{
|
|
26739
26992
|
label: "Decision",
|
|
@@ -26746,7 +26999,7 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26746
26999
|
],
|
|
26747
27000
|
disabled: isDisabled || submitting || isClaimAlreadyEvaluated
|
|
26748
27001
|
}
|
|
26749
|
-
), error && /* @__PURE__ */
|
|
27002
|
+
), error && /* @__PURE__ */ React254.createElement(Alert44, { color: "red", styles: actionAlertStyles }, error));
|
|
26750
27003
|
}
|
|
26751
27004
|
const filterTabs = [
|
|
26752
27005
|
{ value: "all", label: "All" },
|
|
@@ -26754,8 +27007,8 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26754
27007
|
{ value: "approved", label: "Approved" },
|
|
26755
27008
|
{ value: "rejected", label: "Rejected" }
|
|
26756
27009
|
];
|
|
26757
|
-
return /* @__PURE__ */
|
|
26758
|
-
|
|
27010
|
+
return /* @__PURE__ */ React254.createElement(Stack171, { gap: "md" }, !deedDid || !collectionId ? /* @__PURE__ */ React254.createElement(Alert44, { color: "yellow", styles: actionAlertStyles }, "Configure DID and claim collection in template mode before running this action.") : /* @__PURE__ */ React254.createElement(React254.Fragment, null, /* @__PURE__ */ React254.createElement(Group96, { justify: "space-between", align: "center" }, /* @__PURE__ */ React254.createElement(Group96, { gap: 0 }, filterTabs.map((tab) => /* @__PURE__ */ React254.createElement(
|
|
27011
|
+
UnstyledButton6,
|
|
26759
27012
|
{
|
|
26760
27013
|
key: tab.value,
|
|
26761
27014
|
onClick: () => setActiveFilter(tab.value),
|
|
@@ -26767,14 +27020,14 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26767
27020
|
transition: "background 150ms ease"
|
|
26768
27021
|
}
|
|
26769
27022
|
},
|
|
26770
|
-
/* @__PURE__ */
|
|
26771
|
-
))), /* @__PURE__ */
|
|
27023
|
+
/* @__PURE__ */ React254.createElement(Text147, { size: "sm", fw: 500, c: activeFilter === tab.value ? "white" : "dimmed" }, tab.label)
|
|
27024
|
+
))), /* @__PURE__ */ React254.createElement(ActionIcon36, { variant: "subtle", color: "gray", size: "sm" }, /* @__PURE__ */ React254.createElement(IconFilter2, { size: 16 }))), loadingClaims && /* @__PURE__ */ React254.createElement(Group96, { gap: "xs", justify: "center", py: "md" }, /* @__PURE__ */ React254.createElement(Loader42, { size: "xs" }), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, "Loading claims...")), !loadingClaims && filteredClaims.length === 0 && /* @__PURE__ */ React254.createElement(Text147, { size: "sm", c: "dimmed", ta: "center", py: "md" }, claims.length === 0 ? "No claims available for this collection." : `No ${activeFilter} claims found.`), filteredClaims.length > 0 && /* @__PURE__ */ React254.createElement(Stack171, { gap: 12 }, filteredClaims.map((claim) => {
|
|
26772
27025
|
const status = getClaimStatusInfo(claim);
|
|
26773
27026
|
const profile = profilesByDid[claim.agentDid];
|
|
26774
27027
|
const displayName = profile?.displayname || claim.agentDid || claim.agentAddress;
|
|
26775
27028
|
const avatarLabel = (profile?.displayname || claim.agentDid || claim.agentAddress || "?")[0]?.toUpperCase();
|
|
26776
|
-
return /* @__PURE__ */
|
|
26777
|
-
|
|
27029
|
+
return /* @__PURE__ */ React254.createElement(ListItemContainer, { key: claim.claimId, isChecked: false, onClick: () => setSelectedClaimId(claim.claimId) }, /* @__PURE__ */ React254.createElement(Group96, { gap: 16, align: "center", style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React254.createElement(
|
|
27030
|
+
Box54,
|
|
26778
27031
|
{
|
|
26779
27032
|
style: {
|
|
26780
27033
|
width: 32,
|
|
@@ -26794,8 +27047,8 @@ var EvaluateClaimFlowDetail = ({
|
|
|
26794
27047
|
}
|
|
26795
27048
|
},
|
|
26796
27049
|
profile?.avatarUrl ? null : avatarLabel
|
|
26797
|
-
), /* @__PURE__ */
|
|
26798
|
-
}))), error && /* @__PURE__ */
|
|
27050
|
+
), /* @__PURE__ */ React254.createElement(Stack171, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React254.createElement(Text147, { fw: 500, size: "md", truncate: true, style: { lineHeight: 1.5 } }, displayName), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed", truncate: true }, truncateAddress4(claim.agentAddress)))), /* @__PURE__ */ React254.createElement(Stack171, { gap: 0, align: "flex-end", style: { flexShrink: 0, minWidth: 80 } }, /* @__PURE__ */ React254.createElement(Text147, { fw: 500, size: "md", c: status.color, style: { lineHeight: 1.5 } }, status.key === "approved" && /* @__PURE__ */ React254.createElement(IconCheck19, { size: 14, style: { verticalAlign: "middle", marginRight: 2 } }), status.label), /* @__PURE__ */ React254.createElement(Text147, { size: "xs", c: "dimmed" }, getTimeAgo3(claim.submissionDate || ""))));
|
|
27051
|
+
}))), error && /* @__PURE__ */ React254.createElement(Alert44, { color: "red", styles: actionAlertStyles }, error));
|
|
26799
27052
|
};
|
|
26800
27053
|
|
|
26801
27054
|
// src/mantine/blocks/action/actionTypes/evaluateClaim/index.ts
|
|
@@ -26806,8 +27059,8 @@ registerActionTypeUI("qi/claim.evaluate", {
|
|
|
26806
27059
|
});
|
|
26807
27060
|
|
|
26808
27061
|
// src/mantine/blocks/action/actionTypes/proposalCreate/ProposalCreateConfig.tsx
|
|
26809
|
-
import
|
|
26810
|
-
import { Divider as Divider23, Loader as Loader43, SegmentedControl as SegmentedControl6, Stack as
|
|
27062
|
+
import React255, { useCallback as useCallback82, useEffect as useEffect86, useState as useState106 } from "react";
|
|
27063
|
+
import { Divider as Divider23, Loader as Loader43, SegmentedControl as SegmentedControl6, Stack as Stack172, Text as Text148 } from "@mantine/core";
|
|
26811
27064
|
|
|
26812
27065
|
// src/mantine/blocks/action/actionTypes/proposalCreate/types.ts
|
|
26813
27066
|
function parseProposalCreateInputs(json) {
|
|
@@ -26835,11 +27088,11 @@ function serializeProposalCreateInputs(inputs) {
|
|
|
26835
27088
|
// src/mantine/blocks/action/actionTypes/proposalCreate/ProposalCreateConfig.tsx
|
|
26836
27089
|
var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
26837
27090
|
const handlers = useBlocknoteHandlers();
|
|
26838
|
-
const [local, setLocal] =
|
|
26839
|
-
const [groups, setGroups] =
|
|
26840
|
-
const [loadingGroups, setLoadingGroups] =
|
|
26841
|
-
const [inputMode, setInputMode] =
|
|
26842
|
-
const [manualAddress, setManualAddress] =
|
|
27091
|
+
const [local, setLocal] = useState106(() => parseProposalCreateInputs(inputs));
|
|
27092
|
+
const [groups, setGroups] = useState106([]);
|
|
27093
|
+
const [loadingGroups, setLoadingGroups] = useState106(false);
|
|
27094
|
+
const [inputMode, setInputMode] = useState106("select");
|
|
27095
|
+
const [manualAddress, setManualAddress] = useState106("");
|
|
26843
27096
|
useEffect86(() => {
|
|
26844
27097
|
setLocal(parseProposalCreateInputs(inputs));
|
|
26845
27098
|
}, [inputs]);
|
|
@@ -26882,7 +27135,7 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26882
27135
|
},
|
|
26883
27136
|
[update]
|
|
26884
27137
|
);
|
|
26885
|
-
return /* @__PURE__ */
|
|
27138
|
+
return /* @__PURE__ */ React255.createElement(Stack172, { gap: "lg" }, /* @__PURE__ */ React255.createElement(Stack172, { gap: "xs" }, /* @__PURE__ */ React255.createElement(Text148, { size: "sm", fw: 600 }, "DAO Group"), /* @__PURE__ */ React255.createElement(
|
|
26886
27139
|
SegmentedControl6,
|
|
26887
27140
|
{
|
|
26888
27141
|
value: inputMode,
|
|
@@ -26893,7 +27146,7 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26893
27146
|
],
|
|
26894
27147
|
fullWidth: true
|
|
26895
27148
|
}
|
|
26896
|
-
), inputMode === "select" ? /* @__PURE__ */
|
|
27149
|
+
), inputMode === "select" ? /* @__PURE__ */ React255.createElement(
|
|
26897
27150
|
BaseSelect,
|
|
26898
27151
|
{
|
|
26899
27152
|
placeholder: loadingGroups ? "Loading groups..." : "Select a DAO group",
|
|
@@ -26911,10 +27164,10 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26911
27164
|
label: group.name
|
|
26912
27165
|
})),
|
|
26913
27166
|
disabled: loadingGroups,
|
|
26914
|
-
rightSection: loadingGroups ? /* @__PURE__ */
|
|
27167
|
+
rightSection: loadingGroups ? /* @__PURE__ */ React255.createElement(Loader43, { size: "xs" }) : void 0,
|
|
26915
27168
|
searchable: true
|
|
26916
27169
|
}
|
|
26917
|
-
) : /* @__PURE__ */
|
|
27170
|
+
) : /* @__PURE__ */ React255.createElement(
|
|
26918
27171
|
BaseTextInput,
|
|
26919
27172
|
{
|
|
26920
27173
|
placeholder: "Enter DAO core address",
|
|
@@ -26925,7 +27178,7 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26925
27178
|
update({ coreAddress: newAddress });
|
|
26926
27179
|
}
|
|
26927
27180
|
}
|
|
26928
|
-
)), /* @__PURE__ */
|
|
27181
|
+
)), /* @__PURE__ */ React255.createElement(Divider23, { variant: "dashed" }), /* @__PURE__ */ React255.createElement(
|
|
26929
27182
|
DataInput,
|
|
26930
27183
|
{
|
|
26931
27184
|
label: "Proposal Title",
|
|
@@ -26936,7 +27189,7 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26936
27189
|
currentBlockId: blockId,
|
|
26937
27190
|
required: true
|
|
26938
27191
|
}
|
|
26939
|
-
), /* @__PURE__ */
|
|
27192
|
+
), /* @__PURE__ */ React255.createElement(
|
|
26940
27193
|
DataInput,
|
|
26941
27194
|
{
|
|
26942
27195
|
label: "Proposal Description",
|
|
@@ -26947,12 +27200,12 @@ var ProposalCreateConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
26947
27200
|
currentBlockId: blockId,
|
|
26948
27201
|
required: true
|
|
26949
27202
|
}
|
|
26950
|
-
), /* @__PURE__ */
|
|
27203
|
+
), /* @__PURE__ */ React255.createElement(Divider23, { variant: "dashed" }), /* @__PURE__ */ React255.createElement(Text148, { size: "sm", fw: 600 }, "Governance Actions"), /* @__PURE__ */ React255.createElement(Text148, { size: "xs", c: "dimmed" }, "Actions to execute on-chain if the proposal passes."), /* @__PURE__ */ React255.createElement(ActionsTab2, { actions: local.governanceActions, onActionsChange: handleActionsChange, isProposalCreated: false }));
|
|
26951
27204
|
};
|
|
26952
27205
|
|
|
26953
27206
|
// src/mantine/blocks/action/actionTypes/proposalCreate/ProposalCreateFlowDetail.tsx
|
|
26954
|
-
import
|
|
26955
|
-
import { Alert as Alert45, Badge as Badge45, Button as Button49, Card as Card23, Group as
|
|
27207
|
+
import React256, { useCallback as useCallback83, useEffect as useEffect87, useMemo as useMemo101, useState as useState107 } from "react";
|
|
27208
|
+
import { Alert as Alert45, Badge as Badge45, Button as Button49, Card as Card23, Group as Group97, Loader as Loader44, Stack as Stack173, Text as Text149 } from "@mantine/core";
|
|
26956
27209
|
import { IconPlus as IconPlus9, IconPlayerPlay as IconPlayerPlay5 } from "@tabler/icons-react";
|
|
26957
27210
|
var CHAIN_STATUSES2 = ["open", "passed", "rejected", "executed", "closed", "execution_failed", "veto_timelock"];
|
|
26958
27211
|
var isChainStatus2 = (value) => CHAIN_STATUSES2.includes(value);
|
|
@@ -26971,35 +27224,35 @@ var statusColor2 = {
|
|
|
26971
27224
|
};
|
|
26972
27225
|
var ProposalCreateFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
26973
27226
|
const handlers = useBlocknoteHandlers();
|
|
26974
|
-
const services =
|
|
26975
|
-
const flowNode =
|
|
26976
|
-
const runtimeManager =
|
|
26977
|
-
const ucanService =
|
|
26978
|
-
const invocationStore =
|
|
26979
|
-
const flowId =
|
|
26980
|
-
const flowOwnerDid =
|
|
26981
|
-
const schemaVersion =
|
|
26982
|
-
const flowUri =
|
|
27227
|
+
const services = useMemo101(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
27228
|
+
const flowNode = useMemo101(() => buildFlowNodeFromBlock(block), [block]);
|
|
27229
|
+
const runtimeManager = useMemo101(() => createRuntimeStateManager(editor), [editor]);
|
|
27230
|
+
const ucanService = useMemo101(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
27231
|
+
const invocationStore = useMemo101(() => editor?._invocationStore || void 0, [editor]);
|
|
27232
|
+
const flowId = useMemo101(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
27233
|
+
const flowOwnerDid = useMemo101(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
27234
|
+
const schemaVersion = useMemo101(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
27235
|
+
const flowUri = useMemo101(() => {
|
|
26983
27236
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
26984
27237
|
return `ixo:flow:${docId}`;
|
|
26985
27238
|
}, [editor, block.id]);
|
|
26986
|
-
const actorDid =
|
|
27239
|
+
const actorDid = useMemo101(() => {
|
|
26987
27240
|
try {
|
|
26988
27241
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
26989
27242
|
} catch {
|
|
26990
27243
|
return "";
|
|
26991
27244
|
}
|
|
26992
27245
|
}, [handlers]);
|
|
26993
|
-
const parsed =
|
|
27246
|
+
const parsed = useMemo101(() => parseProposalCreateInputs(inputs), [inputs]);
|
|
26994
27247
|
const editorDocument = editor?.document || [];
|
|
26995
|
-
const resolveOpts =
|
|
27248
|
+
const resolveOpts = useMemo101(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
26996
27249
|
const coreAddress = resolveReferences(parsed.coreAddress, editorDocument, resolveOpts).trim();
|
|
26997
27250
|
const proposalTitle = resolveReferences(parsed.proposalTitle, editorDocument, resolveOpts).trim();
|
|
26998
27251
|
const proposalDescription = resolveReferences(parsed.proposalDescription, editorDocument, resolveOpts).trim();
|
|
26999
|
-
const [isCreating, setIsCreating] =
|
|
27000
|
-
const [isExecuting, setIsExecuting] =
|
|
27001
|
-
const [error, setError] =
|
|
27002
|
-
const [proposalContractAddress, setProposalContractAddress] =
|
|
27252
|
+
const [isCreating, setIsCreating] = useState107(false);
|
|
27253
|
+
const [isExecuting, setIsExecuting] = useState107(false);
|
|
27254
|
+
const [error, setError] = useState107(null);
|
|
27255
|
+
const [proposalContractAddress, setProposalContractAddress] = useState107(null);
|
|
27003
27256
|
const proposalId = runtime.output?.proposalId || "";
|
|
27004
27257
|
const currentStatus = parseStatus2(runtime.output?.status);
|
|
27005
27258
|
const isProposalCreated = !!proposalId;
|
|
@@ -27180,7 +27433,7 @@ var ProposalCreateFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27180
27433
|
updateRuntime({ state: "completed" });
|
|
27181
27434
|
}
|
|
27182
27435
|
}, [currentStatus, runtime.state, updateRuntime]);
|
|
27183
|
-
return /* @__PURE__ */
|
|
27436
|
+
return /* @__PURE__ */ React256.createElement(Stack173, { gap: "md" }, /* @__PURE__ */ React256.createElement(Stack173, { gap: 2 }, /* @__PURE__ */ React256.createElement(Text149, { fw: 600 }, block?.props?.title || "Create Proposal"), /* @__PURE__ */ React256.createElement(Text149, { size: "sm", c: "dimmed" }, block?.props?.description || "Create and manage an on-chain governance proposal.")), !coreAddress ? /* @__PURE__ */ React256.createElement(Alert45, { color: "yellow", styles: actionAlertStyles }, "Configure DAO core address in template mode before running this action.") : /* @__PURE__ */ React256.createElement(React256.Fragment, null, isProposalCreated && currentStatus && /* @__PURE__ */ React256.createElement(
|
|
27184
27437
|
Card23,
|
|
27185
27438
|
{
|
|
27186
27439
|
padding: "md",
|
|
@@ -27190,30 +27443,30 @@ var ProposalCreateFlowDetail = ({ inputs, editor, block, runtime, updateRuntime,
|
|
|
27190
27443
|
border: `1px solid ${statusColor2[currentStatus] || "#333"}`
|
|
27191
27444
|
}
|
|
27192
27445
|
},
|
|
27193
|
-
/* @__PURE__ */
|
|
27194
|
-
), isProposalCreated && /* @__PURE__ */
|
|
27446
|
+
/* @__PURE__ */ React256.createElement(Stack173, { gap: "xs" }, /* @__PURE__ */ React256.createElement(Group97, { justify: "space-between" }, /* @__PURE__ */ React256.createElement(Text149, { size: "sm", fw: 500, style: { color: "#f1f3f5" } }, "Proposal #", proposalId), /* @__PURE__ */ React256.createElement(Badge45, { color: statusColor2[currentStatus], variant: "filled", size: "sm", radius: "sm" }, currentStatus.replace(/_/g, " ").toUpperCase())), proposalTitle && /* @__PURE__ */ React256.createElement(Text149, { size: "sm", style: { color: "#adb5bd" } }, proposalTitle))
|
|
27447
|
+
), isProposalCreated && /* @__PURE__ */ React256.createElement(Card23, { padding: "md", radius: "md", withBorder: true, style: { borderColor: "var(--mantine-color-green-6)" } }, /* @__PURE__ */ React256.createElement(Text149, { fw: 500, size: "sm", c: "green" }, "Proposal Created Successfully"), /* @__PURE__ */ React256.createElement(Text149, { size: "sm", c: "dimmed" }, "Your proposal has been created and is now open for voting.")), currentStatus === "passed" && /* @__PURE__ */ React256.createElement(
|
|
27195
27448
|
Button49,
|
|
27196
27449
|
{
|
|
27197
27450
|
fullWidth: true,
|
|
27198
27451
|
color: "green",
|
|
27199
|
-
leftSection: isExecuting ? /* @__PURE__ */
|
|
27452
|
+
leftSection: isExecuting ? /* @__PURE__ */ React256.createElement(Loader44, { size: 14 }) : /* @__PURE__ */ React256.createElement(IconPlayerPlay5, { size: 14 }),
|
|
27200
27453
|
onClick: handleExecuteProposal,
|
|
27201
27454
|
disabled: isExecuting,
|
|
27202
27455
|
loading: isExecuting
|
|
27203
27456
|
},
|
|
27204
27457
|
"Execute Proposal"
|
|
27205
|
-
), /* @__PURE__ */
|
|
27206
|
-
}, isProposalCreated }), !isProposalCreated && /* @__PURE__ */
|
|
27458
|
+
), /* @__PURE__ */ React256.createElement(ActionsTab2, { actions: parsed.governanceActions, onActionsChange: () => {
|
|
27459
|
+
}, isProposalCreated }), !isProposalCreated && /* @__PURE__ */ React256.createElement(
|
|
27207
27460
|
Button49,
|
|
27208
27461
|
{
|
|
27209
27462
|
fullWidth: true,
|
|
27210
|
-
leftSection: isCreating ? /* @__PURE__ */
|
|
27463
|
+
leftSection: isCreating ? /* @__PURE__ */ React256.createElement(Loader44, { size: 14 }) : /* @__PURE__ */ React256.createElement(IconPlus9, { size: 14 }),
|
|
27211
27464
|
onClick: handleCreateProposal,
|
|
27212
27465
|
disabled: isDisabled || isCreating || !proposalTitle || !proposalDescription,
|
|
27213
27466
|
loading: isCreating
|
|
27214
27467
|
},
|
|
27215
27468
|
"Create Proposal"
|
|
27216
|
-
)), isFetching && /* @__PURE__ */
|
|
27469
|
+
)), isFetching && /* @__PURE__ */ React256.createElement(Group97, { gap: "xs" }, /* @__PURE__ */ React256.createElement(Loader44, { size: "xs" }), /* @__PURE__ */ React256.createElement(Text149, { size: "xs", c: "dimmed" }, "Fetching proposal status...")), error && /* @__PURE__ */ React256.createElement(Alert45, { color: "red", styles: actionAlertStyles }, error), fetchError && /* @__PURE__ */ React256.createElement(Alert45, { color: "red", styles: actionAlertStyles }, typeof fetchError === "string" ? fetchError : "Failed to fetch proposal data"), runtime.error?.message && /* @__PURE__ */ React256.createElement(Alert45, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
27217
27470
|
};
|
|
27218
27471
|
|
|
27219
27472
|
// src/mantine/blocks/action/actionTypes/proposalCreate/index.ts
|
|
@@ -27223,8 +27476,8 @@ registerActionTypeUI("qi/proposal.create", {
|
|
|
27223
27476
|
});
|
|
27224
27477
|
|
|
27225
27478
|
// src/mantine/blocks/action/actionTypes/proposalVote/ProposalVoteConfig.tsx
|
|
27226
|
-
import
|
|
27227
|
-
import { Divider as Divider24, Loader as Loader45, SegmentedControl as SegmentedControl7, Stack as
|
|
27479
|
+
import React257, { useCallback as useCallback84, useEffect as useEffect88, useState as useState108 } from "react";
|
|
27480
|
+
import { Divider as Divider24, Loader as Loader45, SegmentedControl as SegmentedControl7, Stack as Stack174, Text as Text150 } from "@mantine/core";
|
|
27228
27481
|
|
|
27229
27482
|
// src/mantine/blocks/action/actionTypes/proposalVote/types.ts
|
|
27230
27483
|
function parseProposalVoteInputs(json) {
|
|
@@ -27250,11 +27503,11 @@ function serializeProposalVoteInputs(inputs) {
|
|
|
27250
27503
|
// src/mantine/blocks/action/actionTypes/proposalVote/ProposalVoteConfig.tsx
|
|
27251
27504
|
var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
27252
27505
|
const handlers = useBlocknoteHandlers();
|
|
27253
|
-
const [local, setLocal] =
|
|
27254
|
-
const [groups, setGroups] =
|
|
27255
|
-
const [loadingGroups, setLoadingGroups] =
|
|
27256
|
-
const [inputMode, setInputMode] =
|
|
27257
|
-
const [manualAddress, setManualAddress] =
|
|
27506
|
+
const [local, setLocal] = useState108(() => parseProposalVoteInputs(inputs));
|
|
27507
|
+
const [groups, setGroups] = useState108([]);
|
|
27508
|
+
const [loadingGroups, setLoadingGroups] = useState108(false);
|
|
27509
|
+
const [inputMode, setInputMode] = useState108("select");
|
|
27510
|
+
const [manualAddress, setManualAddress] = useState108("");
|
|
27258
27511
|
useEffect88(() => {
|
|
27259
27512
|
setLocal(parseProposalVoteInputs(inputs));
|
|
27260
27513
|
}, [inputs]);
|
|
@@ -27291,7 +27544,7 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27291
27544
|
};
|
|
27292
27545
|
fetchGroups();
|
|
27293
27546
|
}, [handlers]);
|
|
27294
|
-
return /* @__PURE__ */
|
|
27547
|
+
return /* @__PURE__ */ React257.createElement(Stack174, { gap: "lg" }, /* @__PURE__ */ React257.createElement(Stack174, { gap: "xs" }, /* @__PURE__ */ React257.createElement(Text150, { size: "sm", fw: 600 }, "DAO Group"), /* @__PURE__ */ React257.createElement(Text150, { size: "xs", c: "dimmed" }, "The DAO group whose proposal to vote on. Used to resolve the proposal contract address."), /* @__PURE__ */ React257.createElement(
|
|
27295
27548
|
SegmentedControl7,
|
|
27296
27549
|
{
|
|
27297
27550
|
value: inputMode,
|
|
@@ -27302,7 +27555,7 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27302
27555
|
],
|
|
27303
27556
|
fullWidth: true
|
|
27304
27557
|
}
|
|
27305
|
-
), inputMode === "select" ? /* @__PURE__ */
|
|
27558
|
+
), inputMode === "select" ? /* @__PURE__ */ React257.createElement(
|
|
27306
27559
|
BaseSelect,
|
|
27307
27560
|
{
|
|
27308
27561
|
placeholder: loadingGroups ? "Loading groups..." : "Select a DAO group",
|
|
@@ -27320,10 +27573,10 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27320
27573
|
label: group.name
|
|
27321
27574
|
})),
|
|
27322
27575
|
disabled: loadingGroups,
|
|
27323
|
-
rightSection: loadingGroups ? /* @__PURE__ */
|
|
27576
|
+
rightSection: loadingGroups ? /* @__PURE__ */ React257.createElement(Loader45, { size: "xs" }) : void 0,
|
|
27324
27577
|
searchable: true
|
|
27325
27578
|
}
|
|
27326
|
-
) : /* @__PURE__ */
|
|
27579
|
+
) : /* @__PURE__ */ React257.createElement(
|
|
27327
27580
|
BaseTextInput,
|
|
27328
27581
|
{
|
|
27329
27582
|
placeholder: "Enter DAO core address",
|
|
@@ -27334,7 +27587,7 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27334
27587
|
update({ coreAddress: newAddress });
|
|
27335
27588
|
}
|
|
27336
27589
|
}
|
|
27337
|
-
)), /* @__PURE__ */
|
|
27590
|
+
)), /* @__PURE__ */ React257.createElement(Divider24, { variant: "dashed" }), /* @__PURE__ */ React257.createElement(
|
|
27338
27591
|
DataInput,
|
|
27339
27592
|
{
|
|
27340
27593
|
label: "Proposal ID",
|
|
@@ -27346,7 +27599,7 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27346
27599
|
currentBlockId: blockId,
|
|
27347
27600
|
required: true
|
|
27348
27601
|
}
|
|
27349
|
-
), /* @__PURE__ */
|
|
27602
|
+
), /* @__PURE__ */ React257.createElement(
|
|
27350
27603
|
DataInput,
|
|
27351
27604
|
{
|
|
27352
27605
|
label: "Proposal Contract Address",
|
|
@@ -27361,8 +27614,8 @@ var ProposalVoteConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
27361
27614
|
};
|
|
27362
27615
|
|
|
27363
27616
|
// src/mantine/blocks/action/actionTypes/proposalVote/ProposalVoteFlowDetail.tsx
|
|
27364
|
-
import
|
|
27365
|
-
import { Alert as Alert46, Box as
|
|
27617
|
+
import React258, { useCallback as useCallback85, useEffect as useEffect89, useMemo as useMemo102, useState as useState109 } from "react";
|
|
27618
|
+
import { Alert as Alert46, Box as Box55, Button as Button50, Card as Card24, Group as Group98, Progress as Progress4, Stack as Stack175, Text as Text151, Tooltip as Tooltip23 } from "@mantine/core";
|
|
27366
27619
|
var getVoteIcon2 = (voteType) => {
|
|
27367
27620
|
switch (voteType) {
|
|
27368
27621
|
case "yes":
|
|
@@ -27378,37 +27631,37 @@ var getVoteIcon2 = (voteType) => {
|
|
|
27378
27631
|
};
|
|
27379
27632
|
var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
27380
27633
|
const handlers = useBlocknoteHandlers();
|
|
27381
|
-
const services =
|
|
27382
|
-
const flowNode =
|
|
27383
|
-
const runtimeManager =
|
|
27384
|
-
const ucanService =
|
|
27385
|
-
const invocationStore =
|
|
27386
|
-
const flowId =
|
|
27387
|
-
const flowOwnerDid =
|
|
27388
|
-
const schemaVersion =
|
|
27389
|
-
const flowUri =
|
|
27634
|
+
const services = useMemo102(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
27635
|
+
const flowNode = useMemo102(() => buildFlowNodeFromBlock(block), [block]);
|
|
27636
|
+
const runtimeManager = useMemo102(() => createRuntimeStateManager(editor), [editor]);
|
|
27637
|
+
const ucanService = useMemo102(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
27638
|
+
const invocationStore = useMemo102(() => editor?._invocationStore || void 0, [editor]);
|
|
27639
|
+
const flowId = useMemo102(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
27640
|
+
const flowOwnerDid = useMemo102(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
27641
|
+
const schemaVersion = useMemo102(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
27642
|
+
const flowUri = useMemo102(() => {
|
|
27390
27643
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
27391
27644
|
return `ixo:flow:${docId}`;
|
|
27392
27645
|
}, [editor, block.id]);
|
|
27393
|
-
const actorDid =
|
|
27646
|
+
const actorDid = useMemo102(() => {
|
|
27394
27647
|
try {
|
|
27395
27648
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
27396
27649
|
} catch {
|
|
27397
27650
|
return "";
|
|
27398
27651
|
}
|
|
27399
27652
|
}, [handlers]);
|
|
27400
|
-
const parsed =
|
|
27653
|
+
const parsed = useMemo102(() => parseProposalVoteInputs(inputs), [inputs]);
|
|
27401
27654
|
const editorDocument = editor?.document || [];
|
|
27402
|
-
const resolveOpts =
|
|
27655
|
+
const resolveOpts = useMemo102(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
27403
27656
|
const proposalId = resolveReferences(parsed.proposalId, editorDocument, resolveOpts).trim();
|
|
27404
27657
|
const coreAddress = resolveReferences(parsed.coreAddress, editorDocument, resolveOpts).trim();
|
|
27405
27658
|
const inputContractAddress = resolveReferences(parsed.proposalContractAddress, editorDocument, resolveOpts).trim();
|
|
27406
|
-
const [selectedVote, setSelectedVote] =
|
|
27407
|
-
const [rationale, setRationale] =
|
|
27408
|
-
const [submitting, setSubmitting] =
|
|
27409
|
-
const [error, setError] =
|
|
27410
|
-
const [userVote, setUserVote] =
|
|
27411
|
-
const [proposalContractAddress, setProposalContractAddress] =
|
|
27659
|
+
const [selectedVote, setSelectedVote] = useState109("");
|
|
27660
|
+
const [rationale, setRationale] = useState109("");
|
|
27661
|
+
const [submitting, setSubmitting] = useState109(false);
|
|
27662
|
+
const [error, setError] = useState109(null);
|
|
27663
|
+
const [userVote, setUserVote] = useState109(null);
|
|
27664
|
+
const [proposalContractAddress, setProposalContractAddress] = useState109(inputContractAddress || null);
|
|
27412
27665
|
const hasSubmittedProposal = Boolean(proposalId);
|
|
27413
27666
|
const hasVoted = Boolean(userVote?.vote);
|
|
27414
27667
|
useEffect89(() => {
|
|
@@ -27552,7 +27805,7 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27552
27805
|
ucanService,
|
|
27553
27806
|
updateRuntime
|
|
27554
27807
|
]);
|
|
27555
|
-
return /* @__PURE__ */
|
|
27808
|
+
return /* @__PURE__ */ React258.createElement(Stack175, { gap: "md" }, /* @__PURE__ */ React258.createElement(Stack175, { gap: 2 }, /* @__PURE__ */ React258.createElement(Text151, { fw: 600 }, block?.props?.title || "Vote on Proposal"), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", c: "dimmed" }, block?.props?.description || "Cast your vote on a governance proposal.")), !hasSubmittedProposal && /* @__PURE__ */ React258.createElement(
|
|
27556
27809
|
Card24,
|
|
27557
27810
|
{
|
|
27558
27811
|
padding: "md",
|
|
@@ -27563,8 +27816,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27563
27816
|
color: "#f1f3f5"
|
|
27564
27817
|
}
|
|
27565
27818
|
},
|
|
27566
|
-
/* @__PURE__ */
|
|
27567
|
-
|
|
27819
|
+
/* @__PURE__ */ React258.createElement(Group98, { gap: "xs", align: "center" }, /* @__PURE__ */ React258.createElement(
|
|
27820
|
+
Box55,
|
|
27568
27821
|
{
|
|
27569
27822
|
style: {
|
|
27570
27823
|
width: 8,
|
|
@@ -27573,9 +27826,9 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27573
27826
|
borderRadius: "50%"
|
|
27574
27827
|
}
|
|
27575
27828
|
}
|
|
27576
|
-
), /* @__PURE__ */
|
|
27577
|
-
/* @__PURE__ */
|
|
27578
|
-
), /* @__PURE__ */
|
|
27829
|
+
), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", fw: 500, style: { color: "#ffd43b" } }, "Waiting for Proposal Submission")),
|
|
27830
|
+
/* @__PURE__ */ React258.createElement(Text151, { size: "xs", style: { color: "#adb5bd", marginTop: 4 } }, "The connected proposal needs to be submitted before voting can begin.")
|
|
27831
|
+
), /* @__PURE__ */ React258.createElement(
|
|
27579
27832
|
Card24,
|
|
27580
27833
|
{
|
|
27581
27834
|
padding: "lg",
|
|
@@ -27587,8 +27840,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27587
27840
|
opacity: !hasSubmittedProposal ? 0.6 : 1
|
|
27588
27841
|
}
|
|
27589
27842
|
},
|
|
27590
|
-
/* @__PURE__ */
|
|
27591
|
-
|
|
27843
|
+
/* @__PURE__ */ React258.createElement(Stack175, { gap: "xs" }, /* @__PURE__ */ React258.createElement(Group98, { justify: "space-between" }, /* @__PURE__ */ React258.createElement(Group98, { gap: "xs" }, /* @__PURE__ */ React258.createElement(
|
|
27844
|
+
Box55,
|
|
27592
27845
|
{
|
|
27593
27846
|
w: 8,
|
|
27594
27847
|
h: 8,
|
|
@@ -27597,9 +27850,9 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27597
27850
|
borderRadius: "50%"
|
|
27598
27851
|
}
|
|
27599
27852
|
}
|
|
27600
|
-
), /* @__PURE__ */
|
|
27601
|
-
/* @__PURE__ */
|
|
27602
|
-
), hasSubmittedProposal && !hasVoted && /* @__PURE__ */
|
|
27853
|
+
), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", style: { color: "#adb5bd" } }, "Proposal ID")), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", fw: 500, style: { color: "#f1f3f5" } }, hasSubmittedProposal ? `#${proposalId}` : "TBD")), /* @__PURE__ */ React258.createElement(Group98, { justify: "space-between" }, /* @__PURE__ */ React258.createElement(Group98, { gap: "xs" }, /* @__PURE__ */ React258.createElement(Box55, { w: 8, h: 8, style: { backgroundColor: "#adb5bd", borderRadius: "50%" } }), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", style: { color: "#adb5bd" } }, "My Vote")), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", fw: 500, style: { color: "#f1f3f5" } }, hasSubmittedProposal ? userVote?.vote ? userVote.vote.vote : "Pending" : "N/A"))),
|
|
27854
|
+
/* @__PURE__ */ React258.createElement(Stack175, { gap: "xs", mt: "md" }, /* @__PURE__ */ React258.createElement(Text151, { size: "sm", style: { color: "#adb5bd" } }, hasSubmittedProposal ? "Voting is open" : "Voting pending"), /* @__PURE__ */ React258.createElement(Progress4, { value: hasSubmittedProposal ? 75 : 0, size: "md" }))
|
|
27855
|
+
), hasSubmittedProposal && !hasVoted && /* @__PURE__ */ React258.createElement(Stack175, { gap: "lg" }, /* @__PURE__ */ React258.createElement(Stack175, { gap: "md" }, ["yes", "no", "no_with_veto", "abstain"].map((voteType) => /* @__PURE__ */ React258.createElement(Tooltip23, { key: voteType, label: isDisabled ? "Action is disabled" : void 0, disabled: !isDisabled, position: "top" }, /* @__PURE__ */ React258.createElement(
|
|
27603
27856
|
Button50,
|
|
27604
27857
|
{
|
|
27605
27858
|
variant: "outline",
|
|
@@ -27618,8 +27871,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27618
27871
|
opacity: isDisabled ? 0.5 : 1
|
|
27619
27872
|
}
|
|
27620
27873
|
},
|
|
27621
|
-
/* @__PURE__ */
|
|
27622
|
-
)))), /* @__PURE__ */
|
|
27874
|
+
/* @__PURE__ */ React258.createElement(Text151, { fw: 500, tt: "capitalize", style: { textAlign: "left" } }, voteType === "no_with_veto" ? "No with Veto" : voteType)
|
|
27875
|
+
)))), /* @__PURE__ */ React258.createElement(
|
|
27623
27876
|
BaseTextArea,
|
|
27624
27877
|
{
|
|
27625
27878
|
label: "Rationale (optional)",
|
|
@@ -27629,7 +27882,7 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27629
27882
|
disabled: isDisabled,
|
|
27630
27883
|
rows: 3
|
|
27631
27884
|
}
|
|
27632
|
-
)), !hasSubmittedProposal && /* @__PURE__ */
|
|
27885
|
+
)), !hasSubmittedProposal && /* @__PURE__ */ React258.createElement(Stack175, { gap: "md" }, ["yes", "no", "no_with_veto", "abstain"].map((voteType) => /* @__PURE__ */ React258.createElement(Tooltip23, { key: voteType, label: "Proposal must be submitted before voting", position: "top" }, /* @__PURE__ */ React258.createElement(
|
|
27633
27886
|
Button50,
|
|
27634
27887
|
{
|
|
27635
27888
|
variant: "outline",
|
|
@@ -27646,8 +27899,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27646
27899
|
opacity: 0.5
|
|
27647
27900
|
}
|
|
27648
27901
|
},
|
|
27649
|
-
/* @__PURE__ */
|
|
27650
|
-
)))), hasSubmittedProposal && !hasVoted && selectedVote && /* @__PURE__ */
|
|
27902
|
+
/* @__PURE__ */ React258.createElement(Text151, { fw: 500, tt: "capitalize", style: { textAlign: "left" } }, voteType === "no_with_veto" ? "No with Veto" : voteType)
|
|
27903
|
+
)))), hasSubmittedProposal && !hasVoted && selectedVote && /* @__PURE__ */ React258.createElement(
|
|
27651
27904
|
Button50,
|
|
27652
27905
|
{
|
|
27653
27906
|
size: "sm",
|
|
@@ -27664,7 +27917,7 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27664
27917
|
}
|
|
27665
27918
|
},
|
|
27666
27919
|
"Sign"
|
|
27667
|
-
), hasVoted && hasSubmittedProposal && /* @__PURE__ */
|
|
27920
|
+
), hasVoted && hasSubmittedProposal && /* @__PURE__ */ React258.createElement(
|
|
27668
27921
|
Card24,
|
|
27669
27922
|
{
|
|
27670
27923
|
padding: "md",
|
|
@@ -27675,8 +27928,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27675
27928
|
color: "#f1f3f5"
|
|
27676
27929
|
}
|
|
27677
27930
|
},
|
|
27678
|
-
/* @__PURE__ */
|
|
27679
|
-
|
|
27931
|
+
/* @__PURE__ */ React258.createElement(Stack175, { gap: "xs" }, /* @__PURE__ */ React258.createElement(Group98, { gap: "xs", align: "center" }, /* @__PURE__ */ React258.createElement(
|
|
27932
|
+
Box55,
|
|
27680
27933
|
{
|
|
27681
27934
|
style: {
|
|
27682
27935
|
width: 8,
|
|
@@ -27685,8 +27938,8 @@ var ProposalVoteFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
27685
27938
|
borderRadius: "50%"
|
|
27686
27939
|
}
|
|
27687
27940
|
}
|
|
27688
|
-
), /* @__PURE__ */
|
|
27689
|
-
), error && /* @__PURE__ */
|
|
27941
|
+
), /* @__PURE__ */ React258.createElement(Text151, { size: "sm", fw: 500, style: { color: "#51cf66" } }, "Vote Submitted")), /* @__PURE__ */ React258.createElement(Text151, { size: "xs", style: { color: "#adb5bd" } }, "You have already voted on this proposal. Your vote:", " ", /* @__PURE__ */ React258.createElement(Text151, { span: true, fw: 500, tt: "capitalize" }, userVote?.vote?.vote)))
|
|
27942
|
+
), error && /* @__PURE__ */ React258.createElement(Alert46, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React258.createElement(Alert46, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
27690
27943
|
};
|
|
27691
27944
|
|
|
27692
27945
|
// src/mantine/blocks/action/actionTypes/proposalVote/index.ts
|
|
@@ -27696,8 +27949,8 @@ registerActionTypeUI("qi/proposal.vote", {
|
|
|
27696
27949
|
});
|
|
27697
27950
|
|
|
27698
27951
|
// src/mantine/blocks/action/actionTypes/protocolSelect/ProtocolSelectConfig.tsx
|
|
27699
|
-
import
|
|
27700
|
-
import { Box as
|
|
27952
|
+
import React259, { useMemo as useMemo103, useState as useState110 } from "react";
|
|
27953
|
+
import { Box as Box56, Pill as Pill3, PillsInput as PillsInput3, Stack as Stack176, Text as Text152 } from "@mantine/core";
|
|
27701
27954
|
function parseInputs(json) {
|
|
27702
27955
|
try {
|
|
27703
27956
|
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
@@ -27709,8 +27962,8 @@ function parseInputs(json) {
|
|
|
27709
27962
|
}
|
|
27710
27963
|
}
|
|
27711
27964
|
var ProtocolSelectConfig = ({ inputs, onInputsChange }) => {
|
|
27712
|
-
const local =
|
|
27713
|
-
const [inputValue, setInputValue] =
|
|
27965
|
+
const local = useMemo103(() => parseInputs(inputs), [inputs]);
|
|
27966
|
+
const [inputValue, setInputValue] = useState110("");
|
|
27714
27967
|
const update = (dids) => {
|
|
27715
27968
|
onInputsChange(JSON.stringify({ ...local, protocolDids: dids }));
|
|
27716
27969
|
};
|
|
@@ -27724,7 +27977,7 @@ var ProtocolSelectConfig = ({ inputs, onInputsChange }) => {
|
|
|
27724
27977
|
const handleRemove = (did) => {
|
|
27725
27978
|
update(local.protocolDids.filter((d) => d !== did));
|
|
27726
27979
|
};
|
|
27727
|
-
return /* @__PURE__ */
|
|
27980
|
+
return /* @__PURE__ */ React259.createElement(Stack176, { gap: "xs" }, /* @__PURE__ */ React259.createElement(Text152, { size: "sm", fw: 600 }, "Protocol DIDs"), /* @__PURE__ */ React259.createElement(Text152, { size: "xs", c: "dimmed" }, "Add the protocol DIDs that users can select from. Enter a DID and press Enter to add it."), /* @__PURE__ */ React259.createElement(PillsInput3, null, /* @__PURE__ */ React259.createElement(Pill3.Group, null, local.protocolDids.map((did) => /* @__PURE__ */ React259.createElement(Pill3, { key: did, withRemoveButton: true, onRemove: () => handleRemove(did) }, did.length > 30 ? `${did.slice(0, 15)}...${did.slice(-12)}` : did)), /* @__PURE__ */ React259.createElement(
|
|
27728
27981
|
PillsInput3.Field,
|
|
27729
27982
|
{
|
|
27730
27983
|
placeholder: local.protocolDids.length === 0 ? "Enter protocol DID and press Enter" : "",
|
|
@@ -27737,12 +27990,12 @@ var ProtocolSelectConfig = ({ inputs, onInputsChange }) => {
|
|
|
27737
27990
|
}
|
|
27738
27991
|
}
|
|
27739
27992
|
}
|
|
27740
|
-
))), local.protocolDids.length > 0 && /* @__PURE__ */
|
|
27993
|
+
))), local.protocolDids.length > 0 && /* @__PURE__ */ React259.createElement(Box56, null, /* @__PURE__ */ React259.createElement(Text152, { size: "xs", c: "dimmed" }, local.protocolDids.length, " protocol", local.protocolDids.length !== 1 ? "s" : "", " configured")));
|
|
27741
27994
|
};
|
|
27742
27995
|
|
|
27743
27996
|
// src/mantine/blocks/action/actionTypes/protocolSelect/ProtocolSelectFlowDetail.tsx
|
|
27744
|
-
import
|
|
27745
|
-
import { Box as
|
|
27997
|
+
import React260, { useCallback as useCallback86, useEffect as useEffect90, useMemo as useMemo104, useState as useState111 } from "react";
|
|
27998
|
+
import { Box as Box57, Group as Group99, Loader as Loader46, Stack as Stack177, Text as Text153 } from "@mantine/core";
|
|
27746
27999
|
function parseInputs2(json) {
|
|
27747
28000
|
try {
|
|
27748
28001
|
const parsed = typeof json === "string" ? JSON.parse(json) : json;
|
|
@@ -27755,8 +28008,8 @@ function parseInputs2(json) {
|
|
|
27755
28008
|
}
|
|
27756
28009
|
var ProtocolSelectFlowDetail = ({ inputs, block, runtime, updateRuntime, isDisabled }) => {
|
|
27757
28010
|
const handlers = useBlocknoteHandlers();
|
|
27758
|
-
const { protocolDids } =
|
|
27759
|
-
const [protocols, setProtocols] =
|
|
28011
|
+
const { protocolDids } = useMemo104(() => parseInputs2(inputs), [inputs]);
|
|
28012
|
+
const [protocols, setProtocols] = useState111([]);
|
|
27760
28013
|
const selectedDid = runtime.output?.selectedProtocolDid;
|
|
27761
28014
|
useEffect90(() => {
|
|
27762
28015
|
if (protocolDids.length === 0) {
|
|
@@ -27823,12 +28076,12 @@ var ProtocolSelectFlowDetail = ({ inputs, block, runtime, updateRuntime, isDisab
|
|
|
27823
28076
|
[isDisabled, updateRuntime]
|
|
27824
28077
|
);
|
|
27825
28078
|
if (protocolDids.length === 0) {
|
|
27826
|
-
return /* @__PURE__ */
|
|
28079
|
+
return /* @__PURE__ */ React260.createElement(Box57, { py: "md" }, /* @__PURE__ */ React260.createElement(Text153, { c: "dimmed", ta: "center" }, "No protocols configured.", /* @__PURE__ */ React260.createElement("br", null), "Add protocol DIDs in template mode."));
|
|
27827
28080
|
}
|
|
27828
|
-
return /* @__PURE__ */
|
|
28081
|
+
return /* @__PURE__ */ React260.createElement(Stack177, { gap: "sm" }, /* @__PURE__ */ React260.createElement(Text153, { fw: 600 }, block?.props?.title || "Select Protocol"), protocols.map((protocol) => {
|
|
27829
28082
|
const isSelected = protocol.did === selectedDid;
|
|
27830
|
-
return /* @__PURE__ */
|
|
27831
|
-
|
|
28083
|
+
return /* @__PURE__ */ React260.createElement(
|
|
28084
|
+
Box57,
|
|
27832
28085
|
{
|
|
27833
28086
|
key: protocol.did,
|
|
27834
28087
|
onClick: () => handleSelect(protocol),
|
|
@@ -27841,7 +28094,7 @@ var ProtocolSelectFlowDetail = ({ inputs, block, runtime, updateRuntime, isDisab
|
|
|
27841
28094
|
transition: "all 0.15s ease"
|
|
27842
28095
|
}
|
|
27843
28096
|
},
|
|
27844
|
-
/* @__PURE__ */
|
|
28097
|
+
/* @__PURE__ */ React260.createElement(Group99, { wrap: "nowrap", gap: "md", align: "center" }, protocol.loading ? /* @__PURE__ */ React260.createElement(Loader46, { size: "xs", color: "white" }) : /* @__PURE__ */ React260.createElement(EntityAvatar_default, { size: 24 }), /* @__PURE__ */ React260.createElement(Stack177, { gap: 2, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React260.createElement(Text153, { fw: 500, size: "sm", lineClamp: 1 }, protocol.loading ? "Loading..." : protocol.type), /* @__PURE__ */ React260.createElement(Text153, { size: "xs", c: "dimmed", lineClamp: 2 }, protocol.loading ? "Fetching protocol info..." : protocol.description || protocol.did)))
|
|
27845
28098
|
);
|
|
27846
28099
|
}));
|
|
27847
28100
|
};
|
|
@@ -27853,8 +28106,8 @@ registerActionTypeUI("qi/protocol.select", {
|
|
|
27853
28106
|
});
|
|
27854
28107
|
|
|
27855
28108
|
// src/mantine/blocks/action/actionTypes/domainSign/DomainSignConfig.tsx
|
|
27856
|
-
import
|
|
27857
|
-
import { Divider as Divider25, Stack as
|
|
28109
|
+
import React261, { useCallback as useCallback87, useEffect as useEffect91, useState as useState112 } from "react";
|
|
28110
|
+
import { Divider as Divider25, Stack as Stack178, Text as Text154, Textarea as Textarea2 } from "@mantine/core";
|
|
27858
28111
|
|
|
27859
28112
|
// src/mantine/blocks/action/actionTypes/domainSign/types.ts
|
|
27860
28113
|
function parseDomainSignInputs(json) {
|
|
@@ -27885,7 +28138,7 @@ var ENTITY_TYPE_OPTIONS = [
|
|
|
27885
28138
|
{ value: "asset", label: "Asset" }
|
|
27886
28139
|
];
|
|
27887
28140
|
var DomainSignConfig = ({ inputs, onInputsChange }) => {
|
|
27888
|
-
const [local, setLocal] =
|
|
28141
|
+
const [local, setLocal] = useState112(() => parseDomainSignInputs(inputs));
|
|
27889
28142
|
useEffect91(() => {
|
|
27890
28143
|
setLocal(parseDomainSignInputs(inputs));
|
|
27891
28144
|
}, [inputs]);
|
|
@@ -27897,7 +28150,7 @@ var DomainSignConfig = ({ inputs, onInputsChange }) => {
|
|
|
27897
28150
|
},
|
|
27898
28151
|
[local, onInputsChange]
|
|
27899
28152
|
);
|
|
27900
|
-
return /* @__PURE__ */
|
|
28153
|
+
return /* @__PURE__ */ React261.createElement(Stack178, { gap: "lg" }, /* @__PURE__ */ React261.createElement(Stack178, { gap: "xs" }, /* @__PURE__ */ React261.createElement(Text154, { size: "sm", fw: 600 }, "Domain Type"), /* @__PURE__ */ React261.createElement(Text154, { size: "xs", c: "dimmed" }, "The entity type to create on-chain. If left blank, the type is inferred from the domain card credential."), /* @__PURE__ */ React261.createElement(
|
|
27901
28154
|
BaseSelect,
|
|
27902
28155
|
{
|
|
27903
28156
|
placeholder: "Select domain type (optional)",
|
|
@@ -27906,7 +28159,7 @@ var DomainSignConfig = ({ inputs, onInputsChange }) => {
|
|
|
27906
28159
|
data: ENTITY_TYPE_OPTIONS,
|
|
27907
28160
|
clearable: true
|
|
27908
28161
|
}
|
|
27909
|
-
)), /* @__PURE__ */
|
|
28162
|
+
)), /* @__PURE__ */ React261.createElement(Divider25, { variant: "dashed" }), /* @__PURE__ */ React261.createElement(Stack178, { gap: "xs" }, /* @__PURE__ */ React261.createElement(Text154, { size: "sm", fw: 600 }, "Governance Groups"), /* @__PURE__ */ React261.createElement(Text154, { size: "xs", c: "dimmed" }, "Optional JSON array of linked entity data for governance groups. Passed from upstream via flow inputs."), /* @__PURE__ */ React261.createElement(
|
|
27910
28163
|
Textarea2,
|
|
27911
28164
|
{
|
|
27912
28165
|
placeholder: '[{"type":"governanceGroup","coreAddress":"cosmos1..."}]',
|
|
@@ -27925,8 +28178,8 @@ var DomainSignConfig = ({ inputs, onInputsChange }) => {
|
|
|
27925
28178
|
};
|
|
27926
28179
|
|
|
27927
28180
|
// src/mantine/blocks/action/actionTypes/domainSign/DomainSignFlowDetail.tsx
|
|
27928
|
-
import
|
|
27929
|
-
import { Alert as Alert47, Button as Button51, Group as
|
|
28181
|
+
import React262, { useCallback as useCallback88, useMemo as useMemo105, useState as useState113 } from "react";
|
|
28182
|
+
import { Alert as Alert47, Button as Button51, Group as Group100, Loader as Loader47, Stack as Stack179, Text as Text155 } from "@mantine/core";
|
|
27930
28183
|
import { IconCheck as IconCheck20, IconAlertCircle as IconAlertCircle17, IconExternalLink as IconExternalLink2 } from "@tabler/icons-react";
|
|
27931
28184
|
var STEP_LABELS = {
|
|
27932
28185
|
signing: "Signing credential...",
|
|
@@ -27935,30 +28188,30 @@ var STEP_LABELS = {
|
|
|
27935
28188
|
};
|
|
27936
28189
|
var DomainSignFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
27937
28190
|
const handlers = useBlocknoteHandlers();
|
|
27938
|
-
const services =
|
|
27939
|
-
const flowNode =
|
|
27940
|
-
const runtimeManager =
|
|
27941
|
-
const ucanService =
|
|
27942
|
-
const invocationStore =
|
|
27943
|
-
const flowId =
|
|
27944
|
-
const flowOwnerDid =
|
|
27945
|
-
const schemaVersion =
|
|
27946
|
-
const flowUri =
|
|
28191
|
+
const services = useMemo105(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28192
|
+
const flowNode = useMemo105(() => buildFlowNodeFromBlock(block), [block]);
|
|
28193
|
+
const runtimeManager = useMemo105(() => createRuntimeStateManager(editor), [editor]);
|
|
28194
|
+
const ucanService = useMemo105(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
28195
|
+
const invocationStore = useMemo105(() => editor?._invocationStore || void 0, [editor]);
|
|
28196
|
+
const flowId = useMemo105(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
28197
|
+
const flowOwnerDid = useMemo105(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28198
|
+
const schemaVersion = useMemo105(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
28199
|
+
const flowUri = useMemo105(() => {
|
|
27947
28200
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
27948
28201
|
return `ixo:flow:${docId}`;
|
|
27949
28202
|
}, [editor, block.id]);
|
|
27950
|
-
const actorDid =
|
|
28203
|
+
const actorDid = useMemo105(() => {
|
|
27951
28204
|
try {
|
|
27952
28205
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
27953
28206
|
} catch {
|
|
27954
28207
|
return "";
|
|
27955
28208
|
}
|
|
27956
28209
|
}, [handlers]);
|
|
27957
|
-
const parsed =
|
|
28210
|
+
const parsed = useMemo105(() => parseDomainSignInputs(inputs), [inputs]);
|
|
27958
28211
|
const editorDocument = editor?.document || [];
|
|
27959
|
-
const resolveOpts =
|
|
28212
|
+
const resolveOpts = useMemo105(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
27960
28213
|
const entityType = resolveReferences(parsed.entityType, editorDocument, resolveOpts).trim();
|
|
27961
|
-
const domainCardData =
|
|
28214
|
+
const domainCardData = useMemo105(() => {
|
|
27962
28215
|
try {
|
|
27963
28216
|
const raw = runtime.output?.domainCardData || block.props?.domainCardData;
|
|
27964
28217
|
if (!raw) return null;
|
|
@@ -27970,13 +28223,13 @@ var DomainSignFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isD
|
|
|
27970
28223
|
const domainName = domainCardData?.credentialSubject?.name || null;
|
|
27971
28224
|
const domainDescription = domainCardData?.credentialSubject?.description || null;
|
|
27972
28225
|
const resolvedEntityType = entityType || (domainCardData?.credentialSubject?.type?.[0]?.replace(/^schema:/i, "").toLowerCase() ?? "dao");
|
|
27973
|
-
const [flowStep, setFlowStep] =
|
|
28226
|
+
const [flowStep, setFlowStep] = useState113(() => {
|
|
27974
28227
|
if (runtime.state === "completed") return "success";
|
|
27975
28228
|
if (runtime.state === "failed") return "error";
|
|
27976
28229
|
return "idle";
|
|
27977
28230
|
});
|
|
27978
|
-
const [activeStep, setActiveStep] =
|
|
27979
|
-
const [error, setError] =
|
|
28231
|
+
const [activeStep, setActiveStep] = useState113("");
|
|
28232
|
+
const [error, setError] = useState113(runtime.error?.message || null);
|
|
27980
28233
|
const entityDid = runtime.output?.entityDid || "";
|
|
27981
28234
|
const isCompleted = flowStep === "success" || runtime.state === "completed";
|
|
27982
28235
|
const handleSign = useCallback88(async () => {
|
|
@@ -28101,11 +28354,11 @@ var DomainSignFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isD
|
|
|
28101
28354
|
handlers.redirectToEntityOverview(entityDid, resolvedEntityType);
|
|
28102
28355
|
}
|
|
28103
28356
|
}, [entityDid, resolvedEntityType, handlers]);
|
|
28104
|
-
return /* @__PURE__ */
|
|
28357
|
+
return /* @__PURE__ */ React262.createElement(Stack179, { gap: "md" }, /* @__PURE__ */ React262.createElement(Stack179, { gap: 2 }, /* @__PURE__ */ React262.createElement(Text155, { fw: 600 }, block?.props?.title || "Sign Domain Card"), /* @__PURE__ */ React262.createElement(Text155, { size: "sm", c: "dimmed" }, block?.props?.description || "Sign the domain card credential and create a domain entity on-chain.")), !domainCardData ? /* @__PURE__ */ React262.createElement(Alert47, { color: "yellow", styles: actionAlertStyles }, "No domain card data available. The domain card viewer block must push data to this action before it can run.") : /* @__PURE__ */ React262.createElement(React262.Fragment, null, /* @__PURE__ */ React262.createElement(Stack179, { gap: "xs", p: "md", style: { backgroundColor: "var(--mantine-color-dark-6)", borderRadius: 8 } }, /* @__PURE__ */ React262.createElement(Text155, { fw: 600, size: "sm" }, "Domain Card Summary"), /* @__PURE__ */ React262.createElement(Group100, { gap: "xs" }, /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: "dimmed", style: { width: 80 } }, "Name:"), /* @__PURE__ */ React262.createElement(Text155, { size: "xs" }, domainName || "Not set")), /* @__PURE__ */ React262.createElement(Group100, { gap: "xs" }, /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: "dimmed", style: { width: 80 } }, "Type:"), /* @__PURE__ */ React262.createElement(Text155, { size: "xs" }, resolvedEntityType)), domainDescription && /* @__PURE__ */ React262.createElement(Group100, { gap: "xs", align: "flex-start" }, /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: "dimmed", style: { width: 80 } }, "Description:"), /* @__PURE__ */ React262.createElement(Text155, { size: "xs", lineClamp: 2, style: { flex: 1 } }, domainDescription))), flowStep === "running" && /* @__PURE__ */ React262.createElement(Stack179, { gap: "xs" }, ["signing", "uploading", "creating"].map((step) => {
|
|
28105
28358
|
const isActive = activeStep === step;
|
|
28106
28359
|
const isDone = ["signing", "uploading", "creating"].indexOf(step) < ["signing", "uploading", "creating"].indexOf(activeStep);
|
|
28107
|
-
return /* @__PURE__ */
|
|
28108
|
-
})), isCompleted && /* @__PURE__ */
|
|
28360
|
+
return /* @__PURE__ */ React262.createElement(Group100, { key: step, gap: "xs" }, isDone ? /* @__PURE__ */ React262.createElement(IconCheck20, { size: 14, color: "var(--mantine-color-green-5)" }) : isActive ? /* @__PURE__ */ React262.createElement(Loader47, { size: 14 }) : /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: "dimmed", style: { width: 14 } }, "\u2013"), /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: isActive ? void 0 : "dimmed" }, STEP_LABELS[step]));
|
|
28361
|
+
})), isCompleted && /* @__PURE__ */ React262.createElement(Alert47, { icon: /* @__PURE__ */ React262.createElement(IconCheck20, { size: 16 }), title: "Domain Created Successfully", color: "green" }, /* @__PURE__ */ React262.createElement(Stack179, { gap: "xs" }, /* @__PURE__ */ React262.createElement(Text155, { size: "sm" }, "The domain card has been signed and the entity has been created on-chain."), entityDid && /* @__PURE__ */ React262.createElement(Text155, { size: "xs", c: "dimmed", style: { wordBreak: "break-all" } }, "Entity DID: ", entityDid))), isCompleted && entityDid && handlers?.redirectToEntityOverview && /* @__PURE__ */ React262.createElement(Button51, { variant: "outline", leftSection: /* @__PURE__ */ React262.createElement(IconExternalLink2, { size: 14 }), onClick: handleVisitEntity }, "Visit Entity"), !isCompleted && /* @__PURE__ */ React262.createElement(Button51, { fullWidth: true, onClick: handleSign, disabled: isDisabled || flowStep === "running", loading: flowStep === "running" }, flowStep === "running" ? "Processing..." : "Sign & Create Domain"), flowStep === "error" && /* @__PURE__ */ React262.createElement(Group100, null, /* @__PURE__ */ React262.createElement(Button51, { variant: "outline", onClick: handleRetry }, "Try Again"))), error && /* @__PURE__ */ React262.createElement(Alert47, { icon: /* @__PURE__ */ React262.createElement(IconAlertCircle17, { size: 16 }), color: "red", styles: actionAlertStyles }, error), runtime.error?.message && flowStep !== "error" && /* @__PURE__ */ React262.createElement(Alert47, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28109
28362
|
};
|
|
28110
28363
|
|
|
28111
28364
|
// src/mantine/blocks/action/actionTypes/domainSign/index.ts
|
|
@@ -28115,8 +28368,8 @@ registerActionTypeUI("qi/domain.sign", {
|
|
|
28115
28368
|
});
|
|
28116
28369
|
|
|
28117
28370
|
// src/mantine/blocks/action/actionTypes/domainCreate/DomainCreateConfig.tsx
|
|
28118
|
-
import
|
|
28119
|
-
import { Stack as
|
|
28371
|
+
import React263, { useCallback as useCallback89, useEffect as useEffect92, useState as useState114 } from "react";
|
|
28372
|
+
import { Stack as Stack180, Text as Text156 } from "@mantine/core";
|
|
28120
28373
|
|
|
28121
28374
|
// src/mantine/blocks/action/actionTypes/domainCreate/types.ts
|
|
28122
28375
|
function parseDomainCreateInputs(json) {
|
|
@@ -28146,7 +28399,7 @@ var ENTITY_TYPE_OPTIONS2 = [
|
|
|
28146
28399
|
{ value: "deed", label: "Deed" }
|
|
28147
28400
|
];
|
|
28148
28401
|
var DomainCreateConfig = ({ inputs, onInputsChange }) => {
|
|
28149
|
-
const [local, setLocal] =
|
|
28402
|
+
const [local, setLocal] = useState114(() => parseDomainCreateInputs(inputs));
|
|
28150
28403
|
useEffect92(() => {
|
|
28151
28404
|
setLocal(parseDomainCreateInputs(inputs));
|
|
28152
28405
|
}, [inputs]);
|
|
@@ -28163,7 +28416,7 @@ var DomainCreateConfig = ({ inputs, onInputsChange }) => {
|
|
|
28163
28416
|
update({ surveySchema: tempDomainCreatorSurvey });
|
|
28164
28417
|
}
|
|
28165
28418
|
}, []);
|
|
28166
|
-
return /* @__PURE__ */
|
|
28419
|
+
return /* @__PURE__ */ React263.createElement(Stack180, { gap: "lg" }, /* @__PURE__ */ React263.createElement(Stack180, { gap: "xs" }, /* @__PURE__ */ React263.createElement(Text156, { size: "sm", fw: 600 }, "Default Entity Type"), /* @__PURE__ */ React263.createElement(Text156, { size: "xs", c: "dimmed" }, "The domain type used if not specified in the survey. The survey itself can also set the entity type."), /* @__PURE__ */ React263.createElement(
|
|
28167
28420
|
BaseSelect,
|
|
28168
28421
|
{
|
|
28169
28422
|
placeholder: "Select entity type",
|
|
@@ -28173,44 +28426,44 @@ var DomainCreateConfig = ({ inputs, onInputsChange }) => {
|
|
|
28173
28426
|
},
|
|
28174
28427
|
data: ENTITY_TYPE_OPTIONS2
|
|
28175
28428
|
}
|
|
28176
|
-
)), /* @__PURE__ */
|
|
28429
|
+
)), /* @__PURE__ */ React263.createElement(Stack180, { gap: "xs" }, /* @__PURE__ */ React263.createElement(Text156, { size: "sm", fw: 600 }, "Survey"), /* @__PURE__ */ React263.createElement(Text156, { size: "xs", c: "dimmed" }, "Uses the default Domain Card survey with fields for name, type, description, contact, composition, relationships, and more.")));
|
|
28177
28430
|
};
|
|
28178
28431
|
|
|
28179
28432
|
// src/mantine/blocks/action/actionTypes/domainCreate/DomainCreateFlowDetail.tsx
|
|
28180
|
-
import
|
|
28181
|
-
import { Alert as Alert48, Button as Button52, Group as
|
|
28433
|
+
import React264, { useCallback as useCallback90, useEffect as useEffect93, useMemo as useMemo106, useState as useState115 } from "react";
|
|
28434
|
+
import { Alert as Alert48, Button as Button52, Group as Group101, Loader as Loader48, Stack as Stack181, Text as Text157 } from "@mantine/core";
|
|
28182
28435
|
import { IconCheck as IconCheck21, IconAlertCircle as IconAlertCircle18, IconPlayerPlay as IconPlayerPlay6 } from "@tabler/icons-react";
|
|
28183
28436
|
import { SurveyModel as SurveyModel12 } from "@ixo/surveys";
|
|
28184
28437
|
var DomainCreateFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28185
28438
|
const handlers = useBlocknoteHandlers();
|
|
28186
|
-
const services =
|
|
28187
|
-
const flowNode =
|
|
28188
|
-
const runtimeManager =
|
|
28189
|
-
const ucanService =
|
|
28190
|
-
const invocationStore =
|
|
28191
|
-
const flowId =
|
|
28192
|
-
const flowOwnerDid =
|
|
28193
|
-
const schemaVersion =
|
|
28194
|
-
const flowUri =
|
|
28439
|
+
const services = useMemo106(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28440
|
+
const flowNode = useMemo106(() => buildFlowNodeFromBlock(block), [block]);
|
|
28441
|
+
const runtimeManager = useMemo106(() => createRuntimeStateManager(editor), [editor]);
|
|
28442
|
+
const ucanService = useMemo106(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
28443
|
+
const invocationStore = useMemo106(() => editor?._invocationStore || void 0, [editor]);
|
|
28444
|
+
const flowId = useMemo106(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
28445
|
+
const flowOwnerDid = useMemo106(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28446
|
+
const schemaVersion = useMemo106(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
28447
|
+
const flowUri = useMemo106(() => {
|
|
28195
28448
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28196
28449
|
return `ixo:flow:${docId}`;
|
|
28197
28450
|
}, [editor, block.id]);
|
|
28198
|
-
const actorDid =
|
|
28451
|
+
const actorDid = useMemo106(() => {
|
|
28199
28452
|
try {
|
|
28200
28453
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
28201
28454
|
} catch {
|
|
28202
28455
|
return "";
|
|
28203
28456
|
}
|
|
28204
28457
|
}, [handlers]);
|
|
28205
|
-
const parsed =
|
|
28458
|
+
const parsed = useMemo106(() => parseDomainCreateInputs(inputs), [inputs]);
|
|
28206
28459
|
const editorDocument = editor?.document || [];
|
|
28207
|
-
const resolveOpts =
|
|
28460
|
+
const resolveOpts = useMemo106(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28208
28461
|
const entityType = resolveReferences(parsed.entityType, editorDocument, resolveOpts).trim() || "dao";
|
|
28209
28462
|
const initialStep = runtime.output?.entityDid ? "success" : "idle";
|
|
28210
|
-
const [flowStep, setFlowStep] =
|
|
28211
|
-
const [error, setError] =
|
|
28463
|
+
const [flowStep, setFlowStep] = useState115(initialStep);
|
|
28464
|
+
const [error, setError] = useState115(null);
|
|
28212
28465
|
const surveySchema = parsed.surveySchema || tempDomainCreatorSurvey;
|
|
28213
|
-
const surveyModel =
|
|
28466
|
+
const surveyModel = useMemo106(() => {
|
|
28214
28467
|
const model = new SurveyModel12(surveySchema);
|
|
28215
28468
|
model.applyTheme(surveyTheme);
|
|
28216
28469
|
model.showQuestionNumbers = "off";
|
|
@@ -28312,7 +28565,7 @@ var DomainCreateFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
28312
28565
|
}
|
|
28313
28566
|
}, [runtime.output, entityType, handlers]);
|
|
28314
28567
|
const entityDid = runtime.output?.entityDid || "";
|
|
28315
|
-
return /* @__PURE__ */
|
|
28568
|
+
return /* @__PURE__ */ React264.createElement(Stack181, { gap: "md" }, /* @__PURE__ */ React264.createElement(Stack181, { gap: 2 }, /* @__PURE__ */ React264.createElement(Text157, { fw: 600 }, block?.props?.title || "Create Domain"), /* @__PURE__ */ React264.createElement(Text157, { size: "sm", c: "dimmed" }, block?.props?.description || "Complete the survey to create a new domain with a signed Domain Card credential.")), flowStep === "success" && /* @__PURE__ */ React264.createElement(Stack181, { gap: "md" }, /* @__PURE__ */ React264.createElement(Alert48, { icon: /* @__PURE__ */ React264.createElement(IconCheck21, { size: 16 }), title: "Domain Created", color: "green", styles: actionAlertStyles }, /* @__PURE__ */ React264.createElement(Stack181, { gap: "xs" }, /* @__PURE__ */ React264.createElement(Text157, { size: "sm" }, "Your domain has been created and the Domain Card has been signed and stored."), entityDid && /* @__PURE__ */ React264.createElement(Text157, { size: "xs", c: "dimmed" }, "DID: ", entityDid))), entityDid && /* @__PURE__ */ React264.createElement(Button52, { variant: "outline", onClick: handleVisitEntity }, "Visit Entity")), flowStep === "error" && /* @__PURE__ */ React264.createElement(Stack181, { gap: "md" }, /* @__PURE__ */ React264.createElement(Alert48, { icon: /* @__PURE__ */ React264.createElement(IconAlertCircle18, { size: 16 }), title: "Domain Creation Failed", color: "red", styles: actionAlertStyles }, /* @__PURE__ */ React264.createElement(Text157, { size: "sm" }, error || "An unexpected error occurred")), /* @__PURE__ */ React264.createElement(Group101, null, /* @__PURE__ */ React264.createElement(Button52, { variant: "outline", onClick: handleRetry, disabled: isDisabled }, "Try Again"))), flowStep === "submitting" && /* @__PURE__ */ React264.createElement(Stack181, { gap: "sm", align: "center", py: "md" }, /* @__PURE__ */ React264.createElement(Loader48, { size: "md" }), /* @__PURE__ */ React264.createElement(Text157, { size: "sm", c: "dimmed" }, "Creating domain \u2014 signing, uploading, and registering on chain...")), flowStep === "idle" && /* @__PURE__ */ React264.createElement(Button52, { leftSection: /* @__PURE__ */ React264.createElement(IconPlayerPlay6, { size: 14 }), onClick: handleStartSurvey, disabled: isDisabled }, "Start Domain Creator"), flowStep === "survey" && !error && /* @__PURE__ */ React264.createElement(StableSurvey, { model: surveyModel }), runtime.error?.message && flowStep !== "error" && /* @__PURE__ */ React264.createElement(Alert48, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28316
28569
|
};
|
|
28317
28570
|
|
|
28318
28571
|
// src/mantine/blocks/action/actionTypes/domainCreate/index.ts
|
|
@@ -28322,8 +28575,8 @@ registerActionTypeUI("qi/domain.create", {
|
|
|
28322
28575
|
});
|
|
28323
28576
|
|
|
28324
28577
|
// src/mantine/blocks/action/actionTypes/oracle/OracleConfig.tsx
|
|
28325
|
-
import
|
|
28326
|
-
import { Stack as
|
|
28578
|
+
import React265, { useCallback as useCallback91, useEffect as useEffect94, useState as useState116 } from "react";
|
|
28579
|
+
import { Stack as Stack182 } from "@mantine/core";
|
|
28327
28580
|
|
|
28328
28581
|
// src/mantine/blocks/action/actionTypes/oracle/types.ts
|
|
28329
28582
|
function parseOracleInputs(json) {
|
|
@@ -28344,7 +28597,7 @@ function serializeOracleInputs(inputs) {
|
|
|
28344
28597
|
|
|
28345
28598
|
// src/mantine/blocks/action/actionTypes/oracle/OracleConfig.tsx
|
|
28346
28599
|
var OracleConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
28347
|
-
const [local, setLocal] =
|
|
28600
|
+
const [local, setLocal] = useState116(() => parseOracleInputs(inputs));
|
|
28348
28601
|
useEffect94(() => {
|
|
28349
28602
|
setLocal(parseOracleInputs(inputs));
|
|
28350
28603
|
}, [inputs]);
|
|
@@ -28356,7 +28609,7 @@ var OracleConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28356
28609
|
},
|
|
28357
28610
|
[local, onInputsChange]
|
|
28358
28611
|
);
|
|
28359
|
-
return /* @__PURE__ */
|
|
28612
|
+
return /* @__PURE__ */ React265.createElement(Stack182, { gap: "lg" }, /* @__PURE__ */ React265.createElement(
|
|
28360
28613
|
DataInput,
|
|
28361
28614
|
{
|
|
28362
28615
|
label: "Prompt",
|
|
@@ -28372,17 +28625,17 @@ var OracleConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28372
28625
|
};
|
|
28373
28626
|
|
|
28374
28627
|
// src/mantine/blocks/action/actionTypes/oracle/OracleFlowDetail.tsx
|
|
28375
|
-
import
|
|
28376
|
-
import { Alert as Alert49, Button as Button53, Stack as
|
|
28628
|
+
import React266, { useCallback as useCallback92, useMemo as useMemo107, useState as useState117 } from "react";
|
|
28629
|
+
import { Alert as Alert49, Button as Button53, Stack as Stack183 } from "@mantine/core";
|
|
28377
28630
|
import { IconCheck as IconCheck22, IconAlertCircle as IconAlertCircle19, IconSparkles as IconSparkles6 } from "@tabler/icons-react";
|
|
28378
28631
|
var OracleFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisabled }) => {
|
|
28379
28632
|
const handlers = useBlocknoteHandlers();
|
|
28380
|
-
const parsed =
|
|
28633
|
+
const parsed = useMemo107(() => parseOracleInputs(inputs), [inputs]);
|
|
28381
28634
|
const editorDocument = editor?.document || [];
|
|
28382
|
-
const resolveOpts =
|
|
28635
|
+
const resolveOpts = useMemo107(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28383
28636
|
const resolvedPrompt = resolveReferences(parsed.prompt, editorDocument, resolveOpts).trim();
|
|
28384
|
-
const [isLoading, setIsLoading] =
|
|
28385
|
-
const [error, setError] =
|
|
28637
|
+
const [isLoading, setIsLoading] = useState117(false);
|
|
28638
|
+
const [error, setError] = useState117(null);
|
|
28386
28639
|
const isCompleted = runtime.state === "completed";
|
|
28387
28640
|
const handleExecute = useCallback92(async () => {
|
|
28388
28641
|
if (isDisabled || isLoading || isCompleted) return;
|
|
@@ -28415,7 +28668,7 @@ var OracleFlowDetail = ({ inputs, editor, runtime, updateRuntime, isDisabled })
|
|
|
28415
28668
|
setIsLoading(false);
|
|
28416
28669
|
}
|
|
28417
28670
|
}, [handlers, isCompleted, isDisabled, isLoading, resolvedPrompt, updateRuntime]);
|
|
28418
|
-
return /* @__PURE__ */
|
|
28671
|
+
return /* @__PURE__ */ React266.createElement(Stack183, { gap: "md" }, !resolvedPrompt && /* @__PURE__ */ React266.createElement(Alert49, { color: "yellow", styles: actionAlertStyles }, "Configure a prompt in template mode before running this action."), resolvedPrompt && !isCompleted && /* @__PURE__ */ React266.createElement(Button53, { fullWidth: true, onClick: handleExecute, disabled: isDisabled || isLoading, loading: isLoading, leftSection: !isLoading ? /* @__PURE__ */ React266.createElement(IconSparkles6, { size: 14 }) : void 0 }, isLoading ? "Sending..." : "Ask Companion"), isCompleted && /* @__PURE__ */ React266.createElement(Alert49, { icon: /* @__PURE__ */ React266.createElement(IconCheck22, { size: 16 }), color: "green", styles: actionAlertStyles }, "Prompt sent to companion."), error && /* @__PURE__ */ React266.createElement(Alert49, { icon: /* @__PURE__ */ React266.createElement(IconAlertCircle19, { size: 16 }), color: "red", styles: actionAlertStyles }, error), runtime.error?.message && !error && /* @__PURE__ */ React266.createElement(Alert49, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28419
28672
|
};
|
|
28420
28673
|
|
|
28421
28674
|
// src/mantine/blocks/action/actionTypes/oracle/index.ts
|
|
@@ -28425,8 +28678,8 @@ registerActionTypeUI("oracle", {
|
|
|
28425
28678
|
});
|
|
28426
28679
|
|
|
28427
28680
|
// src/mantine/blocks/action/actionTypes/oraclePrompt/OraclePromptConfig.tsx
|
|
28428
|
-
import
|
|
28429
|
-
import { Stack as
|
|
28681
|
+
import React267, { useCallback as useCallback93, useEffect as useEffect95, useState as useState118 } from "react";
|
|
28682
|
+
import { Stack as Stack184 } from "@mantine/core";
|
|
28430
28683
|
|
|
28431
28684
|
// src/mantine/blocks/action/actionTypes/oraclePrompt/types.ts
|
|
28432
28685
|
function parseOraclePromptInputs(json) {
|
|
@@ -28445,7 +28698,7 @@ function serializeOraclePromptInputs(inputs) {
|
|
|
28445
28698
|
|
|
28446
28699
|
// src/mantine/blocks/action/actionTypes/oraclePrompt/OraclePromptConfig.tsx
|
|
28447
28700
|
var OraclePromptConfig = ({ inputs, onInputsChange }) => {
|
|
28448
|
-
const [localPrompt, setLocalPrompt] =
|
|
28701
|
+
const [localPrompt, setLocalPrompt] = useState118(() => parseOraclePromptInputs(inputs).prompt);
|
|
28449
28702
|
useEffect95(() => {
|
|
28450
28703
|
setLocalPrompt(parseOraclePromptInputs(inputs).prompt);
|
|
28451
28704
|
}, [inputs]);
|
|
@@ -28456,7 +28709,7 @@ var OraclePromptConfig = ({ inputs, onInputsChange }) => {
|
|
|
28456
28709
|
},
|
|
28457
28710
|
[onInputsChange]
|
|
28458
28711
|
);
|
|
28459
|
-
return /* @__PURE__ */
|
|
28712
|
+
return /* @__PURE__ */ React267.createElement(Stack184, { gap: "xs" }, /* @__PURE__ */ React267.createElement(
|
|
28460
28713
|
BaseTextArea,
|
|
28461
28714
|
{
|
|
28462
28715
|
label: "Prompt",
|
|
@@ -28470,8 +28723,8 @@ var OraclePromptConfig = ({ inputs, onInputsChange }) => {
|
|
|
28470
28723
|
};
|
|
28471
28724
|
|
|
28472
28725
|
// src/mantine/blocks/action/actionTypes/oraclePrompt/OraclePromptFlowDetail.tsx
|
|
28473
|
-
import
|
|
28474
|
-
import { Alert as Alert50, Loader as Loader49, Stack as
|
|
28726
|
+
import React268, { useCallback as useCallback94, useMemo as useMemo108, useState as useState119 } from "react";
|
|
28727
|
+
import { Alert as Alert50, Loader as Loader49, Stack as Stack185, Text as Text158 } from "@mantine/core";
|
|
28475
28728
|
import { IconSend as IconSend6 } from "@tabler/icons-react";
|
|
28476
28729
|
function parsePrimarySkill(rawSkill) {
|
|
28477
28730
|
const coerce = (candidate) => {
|
|
@@ -28510,12 +28763,12 @@ function buildFinalPrompt(prompt, skill) {
|
|
|
28510
28763
|
}
|
|
28511
28764
|
var OraclePromptFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28512
28765
|
const handlers = useBlocknoteHandlers();
|
|
28513
|
-
const parsed =
|
|
28766
|
+
const parsed = useMemo108(() => parseOraclePromptInputs(inputs), [inputs]);
|
|
28514
28767
|
const editorDocument = editor?.document || [];
|
|
28515
|
-
const resolveOpts =
|
|
28516
|
-
const resolvedPrompt =
|
|
28517
|
-
const [submitting, setSubmitting] =
|
|
28518
|
-
const [error, setError] =
|
|
28768
|
+
const resolveOpts = useMemo108(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28769
|
+
const resolvedPrompt = useMemo108(() => resolveReferences(parsed.prompt || "", editorDocument, resolveOpts).trim(), [parsed.prompt, editorDocument, resolveOpts]);
|
|
28770
|
+
const [submitting, setSubmitting] = useState119(false);
|
|
28771
|
+
const [error, setError] = useState119(null);
|
|
28519
28772
|
const handleExecute = useCallback94(async () => {
|
|
28520
28773
|
if (isDisabled || submitting || !resolvedPrompt) return;
|
|
28521
28774
|
if (typeof handlers?.askCompanion !== "function") {
|
|
@@ -28546,7 +28799,7 @@ var OraclePromptFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, i
|
|
|
28546
28799
|
}
|
|
28547
28800
|
}, [block?.props?.skill, handlers, isDisabled, resolvedPrompt, submitting, updateRuntime]);
|
|
28548
28801
|
const isCompleted = runtime.state === "completed";
|
|
28549
|
-
return /* @__PURE__ */
|
|
28802
|
+
return /* @__PURE__ */ React268.createElement(Stack185, { gap: "md" }, !resolvedPrompt ? /* @__PURE__ */ React268.createElement(Alert50, { color: "yellow", styles: actionAlertStyles }, "Configure a prompt in template mode before running this action.") : /* @__PURE__ */ React268.createElement(React268.Fragment, null, /* @__PURE__ */ React268.createElement(Text158, { size: "sm", c: "dimmed", style: { whiteSpace: "pre-wrap" } }, resolvedPrompt), /* @__PURE__ */ React268.createElement(BasePrimaryButton, { leftSection: submitting ? /* @__PURE__ */ React268.createElement(Loader49, { size: 14 }) : /* @__PURE__ */ React268.createElement(IconSend6, { size: 14 }), onClick: handleExecute, disabled: isDisabled || submitting }, submitting ? "Sending..." : isCompleted ? "Send Again" : "Send Prompt")), isCompleted && /* @__PURE__ */ React268.createElement(Text158, { size: "xs", c: "dimmed" }, "Prompt sent successfully."), error && /* @__PURE__ */ React268.createElement(Alert50, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React268.createElement(Alert50, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28550
28803
|
};
|
|
28551
28804
|
|
|
28552
28805
|
// src/mantine/blocks/action/actionTypes/oraclePrompt/index.ts
|
|
@@ -28556,8 +28809,8 @@ registerActionTypeUI("oracle.prompt", {
|
|
|
28556
28809
|
});
|
|
28557
28810
|
|
|
28558
28811
|
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitConfig.tsx
|
|
28559
|
-
import
|
|
28560
|
-
import { Stack as
|
|
28812
|
+
import React269, { useCallback as useCallback95, useEffect as useEffect96, useState as useState120 } from "react";
|
|
28813
|
+
import { Stack as Stack186, Text as Text159 } from "@mantine/core";
|
|
28561
28814
|
|
|
28562
28815
|
// src/mantine/blocks/action/actionTypes/formSubmit/types.ts
|
|
28563
28816
|
function parseFormSubmitActionInputs(json) {
|
|
@@ -28591,8 +28844,8 @@ function isValidSchemaJson(value) {
|
|
|
28591
28844
|
}
|
|
28592
28845
|
}
|
|
28593
28846
|
var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
28594
|
-
const [localSchema, setLocalSchema] =
|
|
28595
|
-
const [error, setError] =
|
|
28847
|
+
const [localSchema, setLocalSchema] = useState120(() => parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28848
|
+
const [error, setError] = useState120(null);
|
|
28596
28849
|
useEffect96(() => {
|
|
28597
28850
|
setLocalSchema(parseFormSubmitActionInputs(inputs).surveySchema);
|
|
28598
28851
|
setError(null);
|
|
@@ -28613,7 +28866,7 @@ var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
|
28613
28866
|
},
|
|
28614
28867
|
[onInputsChange]
|
|
28615
28868
|
);
|
|
28616
|
-
return /* @__PURE__ */
|
|
28869
|
+
return /* @__PURE__ */ React269.createElement(Stack186, { gap: "xs" }, /* @__PURE__ */ React269.createElement(
|
|
28617
28870
|
BaseTextArea,
|
|
28618
28871
|
{
|
|
28619
28872
|
label: "Survey Schema (JSON)",
|
|
@@ -28624,12 +28877,12 @@ var FormSubmitConfig = ({ inputs, onInputsChange }) => {
|
|
|
28624
28877
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
28625
28878
|
error
|
|
28626
28879
|
}
|
|
28627
|
-
), localSchema && !error && /* @__PURE__ */
|
|
28880
|
+
), localSchema && !error && /* @__PURE__ */ React269.createElement(Text159, { size: "xs", c: "green" }, "\u2713 Valid JSON object"));
|
|
28628
28881
|
};
|
|
28629
28882
|
|
|
28630
28883
|
// src/mantine/blocks/action/actionTypes/formSubmit/FormSubmitFlowDetail.tsx
|
|
28631
|
-
import
|
|
28632
|
-
import { Alert as Alert51, Loader as Loader50, Stack as
|
|
28884
|
+
import React270, { useCallback as useCallback96, useEffect as useEffect97, useMemo as useMemo109, useState as useState121 } from "react";
|
|
28885
|
+
import { Alert as Alert51, Loader as Loader50, Stack as Stack187, Text as Text160 } from "@mantine/core";
|
|
28633
28886
|
import { SurveyModel as SurveyModel13 } from "@ixo/surveys";
|
|
28634
28887
|
function parsePrimarySkill2(rawSkill) {
|
|
28635
28888
|
const coerce = (candidate) => {
|
|
@@ -28677,32 +28930,32 @@ ${answersJson}`
|
|
|
28677
28930
|
}
|
|
28678
28931
|
var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28679
28932
|
const handlers = useBlocknoteHandlers();
|
|
28680
|
-
const services =
|
|
28681
|
-
const flowNode =
|
|
28682
|
-
const runtimeManager =
|
|
28683
|
-
const ucanService =
|
|
28684
|
-
const invocationStore =
|
|
28685
|
-
const flowId =
|
|
28686
|
-
const flowOwnerDid =
|
|
28687
|
-
const schemaVersion =
|
|
28688
|
-
const flowUri =
|
|
28933
|
+
const services = useMemo109(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
28934
|
+
const flowNode = useMemo109(() => buildFlowNodeFromBlock(block), [block]);
|
|
28935
|
+
const runtimeManager = useMemo109(() => createRuntimeStateManager(editor), [editor]);
|
|
28936
|
+
const ucanService = useMemo109(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
28937
|
+
const invocationStore = useMemo109(() => editor?._invocationStore || void 0, [editor]);
|
|
28938
|
+
const flowId = useMemo109(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
28939
|
+
const flowOwnerDid = useMemo109(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
28940
|
+
const schemaVersion = useMemo109(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
28941
|
+
const flowUri = useMemo109(() => {
|
|
28689
28942
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28690
28943
|
return `ixo:flow:${docId}`;
|
|
28691
28944
|
}, [editor, block.id]);
|
|
28692
|
-
const actorDid =
|
|
28945
|
+
const actorDid = useMemo109(() => {
|
|
28693
28946
|
try {
|
|
28694
28947
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
28695
28948
|
} catch {
|
|
28696
28949
|
return "";
|
|
28697
28950
|
}
|
|
28698
28951
|
}, [handlers]);
|
|
28699
|
-
const parsed =
|
|
28952
|
+
const parsed = useMemo109(() => parseFormSubmitActionInputs(inputs), [inputs]);
|
|
28700
28953
|
const editorDocument = editor?.document || [];
|
|
28701
|
-
const resolveOpts =
|
|
28702
|
-
const resolvedSchemaString =
|
|
28703
|
-
const [submitting, setSubmitting] =
|
|
28704
|
-
const [error, setError] =
|
|
28705
|
-
const parsedSchema =
|
|
28954
|
+
const resolveOpts = useMemo109(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
28955
|
+
const resolvedSchemaString = useMemo109(() => resolveReferences(parsed.surveySchema || "", editorDocument, resolveOpts).trim(), [parsed.surveySchema, editorDocument, resolveOpts]);
|
|
28956
|
+
const [submitting, setSubmitting] = useState121(false);
|
|
28957
|
+
const [error, setError] = useState121(null);
|
|
28958
|
+
const parsedSchema = useMemo109(() => {
|
|
28706
28959
|
if (!resolvedSchemaString) return null;
|
|
28707
28960
|
try {
|
|
28708
28961
|
const schema = JSON.parse(resolvedSchemaString);
|
|
@@ -28714,7 +28967,7 @@ var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isD
|
|
|
28714
28967
|
}, [resolvedSchemaString]);
|
|
28715
28968
|
const isCompleted = runtime.state === "completed";
|
|
28716
28969
|
const savedAnswers = isCompleted && runtime.output?.answers && typeof runtime.output.answers === "object" ? runtime.output.answers : null;
|
|
28717
|
-
const surveyModel =
|
|
28970
|
+
const surveyModel = useMemo109(() => {
|
|
28718
28971
|
if (!parsedSchema) return null;
|
|
28719
28972
|
const model = new SurveyModel13(parsedSchema);
|
|
28720
28973
|
model.applyTheme(surveyTheme);
|
|
@@ -28823,7 +29076,7 @@ var FormSubmitFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isD
|
|
|
28823
29076
|
};
|
|
28824
29077
|
}, [surveyModel, handleSurveyComplete]);
|
|
28825
29078
|
const statusMessage = runtime.state === "completed" ? "Last execution completed." : submitting ? "Executing..." : null;
|
|
28826
|
-
return /* @__PURE__ */
|
|
29079
|
+
return /* @__PURE__ */ React270.createElement(Stack187, { gap: "md" }, !resolvedSchemaString ? /* @__PURE__ */ React270.createElement(Alert51, { color: "yellow", styles: actionAlertStyles }, "Configure Survey Schema JSON in template mode before running this action.") : !parsedSchema ? /* @__PURE__ */ React270.createElement(Alert51, { color: "red", styles: actionAlertStyles }, "Survey schema is invalid JSON. Fix it in template mode.") : /* @__PURE__ */ React270.createElement(StableSurvey, { model: surveyModel }), statusMessage && /* @__PURE__ */ React270.createElement(Stack187, { gap: 4 }, submitting && /* @__PURE__ */ React270.createElement(Loader50, { size: "xs" }), /* @__PURE__ */ React270.createElement(Text160, { size: "xs", c: "dimmed" }, statusMessage)), error && /* @__PURE__ */ React270.createElement(Alert51, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && /* @__PURE__ */ React270.createElement(Alert51, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
28827
29080
|
};
|
|
28828
29081
|
|
|
28829
29082
|
// src/mantine/blocks/action/actionTypes/formSubmit/index.ts
|
|
@@ -28837,8 +29090,8 @@ registerActionTypeUI("qi/human.form.submit", {
|
|
|
28837
29090
|
});
|
|
28838
29091
|
|
|
28839
29092
|
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreConfig.tsx
|
|
28840
|
-
import
|
|
28841
|
-
import { Stack as
|
|
29093
|
+
import React271, { useCallback as useCallback97, useEffect as useEffect98, useState as useState122 } from "react";
|
|
29094
|
+
import { Stack as Stack188, Text as Text161 } from "@mantine/core";
|
|
28842
29095
|
|
|
28843
29096
|
// src/mantine/blocks/action/actionTypes/credentialStore/types.ts
|
|
28844
29097
|
function parseCredentialStoreInputs(json) {
|
|
@@ -28869,7 +29122,7 @@ function serializeCredentialStoreInputs(inputs) {
|
|
|
28869
29122
|
|
|
28870
29123
|
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreConfig.tsx
|
|
28871
29124
|
var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
28872
|
-
const [local, setLocal] =
|
|
29125
|
+
const [local, setLocal] = useState122(() => parseCredentialStoreInputs(inputs));
|
|
28873
29126
|
useEffect98(() => {
|
|
28874
29127
|
setLocal(parseCredentialStoreInputs(inputs));
|
|
28875
29128
|
}, [inputs]);
|
|
@@ -28881,7 +29134,7 @@ var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28881
29134
|
},
|
|
28882
29135
|
[local, onInputsChange]
|
|
28883
29136
|
);
|
|
28884
|
-
return /* @__PURE__ */
|
|
29137
|
+
return /* @__PURE__ */ React271.createElement(Stack188, { gap: "lg" }, /* @__PURE__ */ React271.createElement(Stack188, { gap: "xs" }, /* @__PURE__ */ React271.createElement(Text161, { size: "sm", c: "neutralColor.7" }, "Credential Key"), /* @__PURE__ */ React271.createElement(
|
|
28885
29138
|
BaseTextInput,
|
|
28886
29139
|
{
|
|
28887
29140
|
placeholder: "e.g. kycamllevel1",
|
|
@@ -28889,7 +29142,7 @@ var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28889
29142
|
value: local.credentialKey,
|
|
28890
29143
|
onChange: (e) => update({ credentialKey: e.currentTarget.value })
|
|
28891
29144
|
}
|
|
28892
|
-
)), /* @__PURE__ */
|
|
29145
|
+
)), /* @__PURE__ */ React271.createElement(Stack188, { gap: "xs" }, /* @__PURE__ */ React271.createElement(Text161, { size: "sm", c: "neutralColor.7" }, "Credential"), /* @__PURE__ */ React271.createElement(
|
|
28893
29146
|
DataInput,
|
|
28894
29147
|
{
|
|
28895
29148
|
placeholder: "Credential JSON or {{blockId.output.credential}}",
|
|
@@ -28899,7 +29152,7 @@ var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28899
29152
|
editorDocument: editor?.document || [],
|
|
28900
29153
|
currentBlockId: blockId
|
|
28901
29154
|
}
|
|
28902
|
-
)), /* @__PURE__ */
|
|
29155
|
+
)), /* @__PURE__ */ React271.createElement(Stack188, { gap: "xs" }, /* @__PURE__ */ React271.createElement(Text161, { size: "sm", c: "neutralColor.7" }, "Room ID (optional)"), /* @__PURE__ */ React271.createElement(
|
|
28903
29156
|
DataInput,
|
|
28904
29157
|
{
|
|
28905
29158
|
placeholder: "Defaults to the actor's room",
|
|
@@ -28913,8 +29166,8 @@ var CredentialStoreConfig = ({ inputs, onInputsChange, editor, blockId }) => {
|
|
|
28913
29166
|
};
|
|
28914
29167
|
|
|
28915
29168
|
// src/mantine/blocks/action/actionTypes/credentialStore/CredentialStoreFlowDetail.tsx
|
|
28916
|
-
import
|
|
28917
|
-
import { Alert as Alert52, Button as Button54, Code as Code10, Loader as Loader51, Stack as
|
|
29169
|
+
import React272, { useCallback as useCallback98, useMemo as useMemo110, useState as useState123 } from "react";
|
|
29170
|
+
import { Alert as Alert52, Button as Button54, Code as Code10, Loader as Loader51, Stack as Stack189, Text as Text162 } from "@mantine/core";
|
|
28918
29171
|
import { IconShieldCheck as IconShieldCheck15 } from "@tabler/icons-react";
|
|
28919
29172
|
function safeParse(value) {
|
|
28920
29173
|
let result = value;
|
|
@@ -28929,7 +29182,7 @@ function safeParse(value) {
|
|
|
28929
29182
|
return result;
|
|
28930
29183
|
}
|
|
28931
29184
|
function CredentialPreview({ value }) {
|
|
28932
|
-
const display =
|
|
29185
|
+
const display = useMemo110(() => {
|
|
28933
29186
|
if (!value) return null;
|
|
28934
29187
|
const parsed = safeParse(value);
|
|
28935
29188
|
if (parsed && typeof parsed === "object") {
|
|
@@ -28938,40 +29191,40 @@ function CredentialPreview({ value }) {
|
|
|
28938
29191
|
return value;
|
|
28939
29192
|
}, [value]);
|
|
28940
29193
|
if (!display) return null;
|
|
28941
|
-
return /* @__PURE__ */
|
|
29194
|
+
return /* @__PURE__ */ React272.createElement(React272.Fragment, null, /* @__PURE__ */ React272.createElement(Text162, { size: "xs", fw: 600, c: "dimmed" }, "Credential"), /* @__PURE__ */ React272.createElement(Code10, { block: true, style: { fontSize: "11px", maxHeight: "200px", overflow: "auto" } }, display));
|
|
28942
29195
|
}
|
|
28943
29196
|
var CredentialStoreFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
28944
29197
|
const handlers = useBlocknoteHandlers();
|
|
28945
|
-
const services =
|
|
28946
|
-
const flowNode =
|
|
28947
|
-
const runtimeManager =
|
|
28948
|
-
const ucanService =
|
|
28949
|
-
const invocationStore =
|
|
28950
|
-
const flowId =
|
|
28951
|
-
const flowOwnerDid =
|
|
28952
|
-
const schemaVersion =
|
|
28953
|
-
const flowUri =
|
|
29198
|
+
const services = useMemo110(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
29199
|
+
const flowNode = useMemo110(() => buildFlowNodeFromBlock(block), [block]);
|
|
29200
|
+
const runtimeManager = useMemo110(() => createRuntimeStateManager(editor), [editor]);
|
|
29201
|
+
const ucanService = useMemo110(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
29202
|
+
const invocationStore = useMemo110(() => editor?._invocationStore || void 0, [editor]);
|
|
29203
|
+
const flowId = useMemo110(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
29204
|
+
const flowOwnerDid = useMemo110(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
29205
|
+
const schemaVersion = useMemo110(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
29206
|
+
const flowUri = useMemo110(() => {
|
|
28954
29207
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
28955
29208
|
return `ixo:flow:${docId}`;
|
|
28956
29209
|
}, [editor, block.id]);
|
|
28957
|
-
const actorDid =
|
|
29210
|
+
const actorDid = useMemo110(() => {
|
|
28958
29211
|
try {
|
|
28959
29212
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
28960
29213
|
} catch {
|
|
28961
29214
|
return "";
|
|
28962
29215
|
}
|
|
28963
29216
|
}, [handlers]);
|
|
28964
|
-
const parsed =
|
|
29217
|
+
const parsed = useMemo110(() => parseCredentialStoreInputs(inputs), [inputs]);
|
|
28965
29218
|
const editorDocument = editor?.document || [];
|
|
28966
|
-
const resolveOpts =
|
|
28967
|
-
const resolvedCredentialKey =
|
|
29219
|
+
const resolveOpts = useMemo110(() => ({ yRuntime: editor?._yRuntime }), [editor?._yRuntime]);
|
|
29220
|
+
const resolvedCredentialKey = useMemo110(
|
|
28968
29221
|
() => resolveReferences(parsed.credentialKey || "", editorDocument, resolveOpts).trim(),
|
|
28969
29222
|
[parsed.credentialKey, editorDocument, resolveOpts]
|
|
28970
29223
|
);
|
|
28971
|
-
const resolvedCredential =
|
|
28972
|
-
const resolvedRoomId =
|
|
28973
|
-
const [submitting, setSubmitting] =
|
|
28974
|
-
const [error, setError] =
|
|
29224
|
+
const resolvedCredential = useMemo110(() => resolveReferences(parsed.credential || "", editorDocument, resolveOpts).trim(), [parsed.credential, editorDocument, resolveOpts]);
|
|
29225
|
+
const resolvedRoomId = useMemo110(() => resolveReferences(parsed.roomId || "", editorDocument, resolveOpts).trim(), [parsed.roomId, editorDocument, resolveOpts]);
|
|
29226
|
+
const [submitting, setSubmitting] = useState123(false);
|
|
29227
|
+
const [error, setError] = useState123(null);
|
|
28975
29228
|
const hasCredential = !!resolvedCredential;
|
|
28976
29229
|
const hasKey = !!resolvedCredentialKey;
|
|
28977
29230
|
const isCompleted = runtime.state === "completed";
|
|
@@ -29064,7 +29317,7 @@ var CredentialStoreFlowDetail = ({ inputs, editor, block, runtime, updateRuntime
|
|
|
29064
29317
|
ucanService,
|
|
29065
29318
|
updateRuntime
|
|
29066
29319
|
]);
|
|
29067
|
-
return /* @__PURE__ */
|
|
29320
|
+
return /* @__PURE__ */ React272.createElement(Stack189, { gap: "md" }, !hasKey && /* @__PURE__ */ React272.createElement(Alert52, { color: "yellow", styles: actionAlertStyles }, "No credential key configured. Set one in template mode."), hasKey && !hasCredential && !isCompleted && /* @__PURE__ */ React272.createElement(Alert52, { color: "yellow", styles: actionAlertStyles }, "Waiting for credential data. It will be provided by a block reference or at execution time."), hasKey && hasCredential && !isCompleted && /* @__PURE__ */ React272.createElement(Stack189, { gap: "xs" }, /* @__PURE__ */ React272.createElement(Text162, { size: "xs", c: "dimmed" }, "Credential key: ", resolvedCredentialKey), /* @__PURE__ */ React272.createElement(CredentialPreview, { value: resolvedCredential }), /* @__PURE__ */ React272.createElement(Button54, { leftSection: submitting ? /* @__PURE__ */ React272.createElement(Loader51, { size: 14 }) : /* @__PURE__ */ React272.createElement(IconShieldCheck15, { size: 14 }), onClick: handleExecute, disabled: isDisabled || submitting, size: "sm" }, submitting ? "Storing..." : "Store Credential")), isCompleted && /* @__PURE__ */ React272.createElement(Alert52, { color: runtime.output?.duplicate ? "yellow" : "green", styles: actionAlertStyles }, runtime.output?.duplicate ? `Credential already stored under key "${runtime.output?.credentialKey || resolvedCredentialKey}" (duplicate).` : `Credential stored successfully under key "${runtime.output?.credentialKey || resolvedCredentialKey}".`), error && /* @__PURE__ */ React272.createElement(Alert52, { color: "red", styles: actionAlertStyles }, error), runtime.error?.message && !error && /* @__PURE__ */ React272.createElement(Alert52, { color: "red", styles: actionAlertStyles }, runtime.error.message));
|
|
29068
29321
|
};
|
|
29069
29322
|
|
|
29070
29323
|
// src/mantine/blocks/action/actionTypes/credentialStore/index.ts
|
|
@@ -29074,8 +29327,8 @@ registerActionTypeUI("qi/credential.store", {
|
|
|
29074
29327
|
});
|
|
29075
29328
|
|
|
29076
29329
|
// src/mantine/blocks/action/actionTypes/payment/PaymentConfig.tsx
|
|
29077
|
-
import
|
|
29078
|
-
import { Stack as
|
|
29330
|
+
import React273, { useCallback as useCallback99, useEffect as useEffect99, useState as useState124 } from "react";
|
|
29331
|
+
import { Stack as Stack190, Text as Text163 } from "@mantine/core";
|
|
29079
29332
|
|
|
29080
29333
|
// src/mantine/blocks/action/actionTypes/payment/types.ts
|
|
29081
29334
|
function parsePaymentInputs(json) {
|
|
@@ -29108,8 +29361,8 @@ function isValidPaymentConfig(value) {
|
|
|
29108
29361
|
|
|
29109
29362
|
// src/mantine/blocks/action/actionTypes/payment/PaymentConfig.tsx
|
|
29110
29363
|
var PaymentConfig = ({ inputs, onInputsChange }) => {
|
|
29111
|
-
const [localConfig, setLocalConfig] =
|
|
29112
|
-
const [error, setError] =
|
|
29364
|
+
const [localConfig, setLocalConfig] = useState124(() => parsePaymentInputs(inputs).paymentConfig);
|
|
29365
|
+
const [error, setError] = useState124(null);
|
|
29113
29366
|
useEffect99(() => {
|
|
29114
29367
|
setLocalConfig(parsePaymentInputs(inputs).paymentConfig);
|
|
29115
29368
|
setError(null);
|
|
@@ -29130,7 +29383,7 @@ var PaymentConfig = ({ inputs, onInputsChange }) => {
|
|
|
29130
29383
|
},
|
|
29131
29384
|
[onInputsChange]
|
|
29132
29385
|
);
|
|
29133
|
-
return /* @__PURE__ */
|
|
29386
|
+
return /* @__PURE__ */ React273.createElement(Stack190, { gap: "xs" }, /* @__PURE__ */ React273.createElement(
|
|
29134
29387
|
BaseTextArea,
|
|
29135
29388
|
{
|
|
29136
29389
|
label: "Payment Configuration (JSON)",
|
|
@@ -29141,12 +29394,12 @@ var PaymentConfig = ({ inputs, onInputsChange }) => {
|
|
|
29141
29394
|
onChange: (event) => handleChange(event.currentTarget.value),
|
|
29142
29395
|
error
|
|
29143
29396
|
}
|
|
29144
|
-
), localConfig && !error && /* @__PURE__ */
|
|
29397
|
+
), localConfig && !error && /* @__PURE__ */ React273.createElement(Text163, { size: "xs", c: "green" }, "Valid JSON"));
|
|
29145
29398
|
};
|
|
29146
29399
|
|
|
29147
29400
|
// src/mantine/blocks/action/actionTypes/payment/PaymentFlowDetail.tsx
|
|
29148
|
-
import
|
|
29149
|
-
import { Alert as Alert53, Button as Button55, Code as Code11, Divider as Divider26, Group as
|
|
29401
|
+
import React274, { useCallback as useCallback100, useMemo as useMemo111, useState as useState125 } from "react";
|
|
29402
|
+
import { Alert as Alert53, Button as Button55, Code as Code11, Divider as Divider26, Group as Group102, Loader as Loader52, Stack as Stack191, Text as Text164 } from "@mantine/core";
|
|
29150
29403
|
import { IconAlertTriangle as IconAlertTriangle6, IconCash as IconCash2, IconSearch as IconSearch6, IconSend as IconSend7 } from "@tabler/icons-react";
|
|
29151
29404
|
function parsePrimarySkill3(rawSkill) {
|
|
29152
29405
|
const coerce = (candidate) => {
|
|
@@ -29221,32 +29474,32 @@ function getPaymentStatusColor(status) {
|
|
|
29221
29474
|
}
|
|
29222
29475
|
var PaymentFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisabled }) => {
|
|
29223
29476
|
const handlers = useBlocknoteHandlers();
|
|
29224
|
-
const services =
|
|
29225
|
-
const flowNode =
|
|
29226
|
-
const runtimeManager =
|
|
29227
|
-
const ucanService =
|
|
29228
|
-
const invocationStore =
|
|
29229
|
-
const flowId =
|
|
29230
|
-
const flowOwnerDid =
|
|
29231
|
-
const schemaVersion =
|
|
29232
|
-
const flowUri =
|
|
29477
|
+
const services = useMemo111(() => buildServicesFromHandlers(handlers), [handlers]);
|
|
29478
|
+
const flowNode = useMemo111(() => buildFlowNodeFromBlock(block), [block]);
|
|
29479
|
+
const runtimeManager = useMemo111(() => createRuntimeStateManager(editor), [editor]);
|
|
29480
|
+
const ucanService = useMemo111(() => editor?.getUcanService?.() || void 0, [editor]);
|
|
29481
|
+
const invocationStore = useMemo111(() => editor?._invocationStore || void 0, [editor]);
|
|
29482
|
+
const flowId = useMemo111(() => editor?.getFlowMetadata?.()?.doc_id || block.id, [editor, block.id]);
|
|
29483
|
+
const flowOwnerDid = useMemo111(() => editor?.getFlowOwnerDid?.() || "", [editor]);
|
|
29484
|
+
const schemaVersion = useMemo111(() => editor?.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
|
|
29485
|
+
const flowUri = useMemo111(() => {
|
|
29233
29486
|
const docId = editor?.getFlowMetadata?.()?.doc_id || block.id;
|
|
29234
29487
|
return `ixo:flow:${docId}`;
|
|
29235
29488
|
}, [editor, block.id]);
|
|
29236
|
-
const actorDid =
|
|
29489
|
+
const actorDid = useMemo111(() => {
|
|
29237
29490
|
try {
|
|
29238
29491
|
return handlers?.getCurrentUser?.()?.address || "";
|
|
29239
29492
|
} catch {
|
|
29240
29493
|
return "";
|
|
29241
29494
|
}
|
|
29242
29495
|
}, [handlers]);
|
|
29243
|
-
const parsed =
|
|
29244
|
-
const [submitting, setSubmitting] =
|
|
29245
|
-
const [error, setError] =
|
|
29496
|
+
const parsed = useMemo111(() => parsePaymentInputs(inputs), [inputs]);
|
|
29497
|
+
const [submitting, setSubmitting] = useState125(false);
|
|
29498
|
+
const [error, setError] = useState125(null);
|
|
29246
29499
|
const paymentStatus = block.props.paymentStatus || "";
|
|
29247
29500
|
const transactionId = block.props.transactionId || "";
|
|
29248
29501
|
const paymentError = block.props.paymentError || "";
|
|
29249
|
-
const proposal =
|
|
29502
|
+
const proposal = useMemo111(() => {
|
|
29250
29503
|
const raw = block.props.paymentProposal;
|
|
29251
29504
|
if (!raw) return null;
|
|
29252
29505
|
try {
|
|
@@ -29255,7 +29508,7 @@ var PaymentFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisa
|
|
|
29255
29508
|
return null;
|
|
29256
29509
|
}
|
|
29257
29510
|
}, [block.props.paymentProposal]);
|
|
29258
|
-
const summary =
|
|
29511
|
+
const summary = useMemo111(() => {
|
|
29259
29512
|
const raw = block.props.paymentSummary;
|
|
29260
29513
|
if (!raw) return null;
|
|
29261
29514
|
try {
|
|
@@ -29264,7 +29517,7 @@ var PaymentFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisa
|
|
|
29264
29517
|
return null;
|
|
29265
29518
|
}
|
|
29266
29519
|
}, [block.props.paymentSummary]);
|
|
29267
|
-
const paymentConfig =
|
|
29520
|
+
const paymentConfig = useMemo111(() => {
|
|
29268
29521
|
if (!parsed.paymentConfig) return null;
|
|
29269
29522
|
try {
|
|
29270
29523
|
return JSON.parse(parsed.paymentConfig);
|
|
@@ -29422,40 +29675,40 @@ var PaymentFlowDetail = ({ inputs, editor, block, runtime, updateRuntime, isDisa
|
|
|
29422
29675
|
setSubmitting(false);
|
|
29423
29676
|
}
|
|
29424
29677
|
}, [isDisabled, submitting, block, handlers, transactionId]);
|
|
29425
|
-
return /* @__PURE__ */
|
|
29678
|
+
return /* @__PURE__ */ React274.createElement(Stack191, { gap: "md" }, paymentConfig && !isProposed && !isTerminal && /* @__PURE__ */ React274.createElement(React274.Fragment, null, /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 600, c: "dimmed" }, "Payment Configuration"), /* @__PURE__ */ React274.createElement(Code11, { block: true, style: { fontSize: "11px", maxHeight: "200px", overflow: "auto" } }, JSON.stringify(paymentConfig, null, 2))), summary && /* @__PURE__ */ React274.createElement(React274.Fragment, null, /* @__PURE__ */ React274.createElement(Divider26, null), /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 600, c: "dimmed" }, "Payout Proposal"), /* @__PURE__ */ React274.createElement(Stack191, { gap: 4, style: { background: "var(--mantine-color-neutralColor-4)", borderRadius: 8, padding: 12 } }, Object.entries(summary).map(([key, value]) => /* @__PURE__ */ React274.createElement(Group102, { key, justify: "space-between", wrap: "nowrap" }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs", c: "dimmed", style: { textTransform: "capitalize" } }, key.replace(/_/g, " ")), /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 500, c: "white", style: { textAlign: "right", wordBreak: "break-all" } }, typeof value === "object" ? JSON.stringify(value) : String(value)))))), paymentStatus && /* @__PURE__ */ React274.createElement(React274.Fragment, null, /* @__PURE__ */ React274.createElement(Divider26, null), /* @__PURE__ */ React274.createElement(Group102, { justify: "space-between" }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 600, c: "dimmed" }, "Status"), /* @__PURE__ */ React274.createElement(Text164, { size: "sm", fw: 600, c: getPaymentStatusColor(paymentStatus), style: { textTransform: "capitalize" } }, paymentStatus))), transactionId && /* @__PURE__ */ React274.createElement(Group102, { justify: "space-between" }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 600, c: "dimmed" }, "Transaction ID"), /* @__PURE__ */ React274.createElement(Text164, { size: "xs", c: "white", style: { fontFamily: "monospace" } }, transactionId)), !isTerminal && /* @__PURE__ */ React274.createElement(React274.Fragment, null, /* @__PURE__ */ React274.createElement(Divider26, null), isSubmitted ? /* @__PURE__ */ React274.createElement(
|
|
29426
29679
|
Button55,
|
|
29427
29680
|
{
|
|
29428
29681
|
fullWidth: true,
|
|
29429
29682
|
variant: "light",
|
|
29430
29683
|
color: "blue",
|
|
29431
|
-
leftSection: submitting ? /* @__PURE__ */
|
|
29684
|
+
leftSection: submitting ? /* @__PURE__ */ React274.createElement(Loader52, { size: 14 }) : /* @__PURE__ */ React274.createElement(IconSearch6, { size: 14 }),
|
|
29432
29685
|
onClick: handleCheckStatus,
|
|
29433
29686
|
disabled: isDisabled || submitting
|
|
29434
29687
|
},
|
|
29435
29688
|
submitting ? "Checking..." : "Check Status"
|
|
29436
|
-
) : !isProposed ? /* @__PURE__ */
|
|
29689
|
+
) : !isProposed ? /* @__PURE__ */ React274.createElement(
|
|
29437
29690
|
Button55,
|
|
29438
29691
|
{
|
|
29439
29692
|
fullWidth: true,
|
|
29440
29693
|
variant: "light",
|
|
29441
29694
|
color: "violet",
|
|
29442
|
-
leftSection: submitting ? /* @__PURE__ */
|
|
29695
|
+
leftSection: submitting ? /* @__PURE__ */ React274.createElement(Loader52, { size: 14 }) : /* @__PURE__ */ React274.createElement(IconCash2, { size: 14 }),
|
|
29443
29696
|
onClick: handlePropose,
|
|
29444
29697
|
disabled: isDisabled || submitting || !paymentConfig
|
|
29445
29698
|
},
|
|
29446
29699
|
submitting ? "Requesting..." : "Calculate Payout"
|
|
29447
|
-
) : /* @__PURE__ */
|
|
29700
|
+
) : /* @__PURE__ */ React274.createElement(
|
|
29448
29701
|
Button55,
|
|
29449
29702
|
{
|
|
29450
29703
|
fullWidth: true,
|
|
29451
29704
|
variant: "light",
|
|
29452
29705
|
color: "green",
|
|
29453
|
-
leftSection: submitting ? /* @__PURE__ */
|
|
29706
|
+
leftSection: submitting ? /* @__PURE__ */ React274.createElement(Loader52, { size: 14 }) : /* @__PURE__ */ React274.createElement(IconSend7, { size: 14 }),
|
|
29454
29707
|
onClick: handleExecute,
|
|
29455
29708
|
disabled: isDisabled || submitting
|
|
29456
29709
|
},
|
|
29457
29710
|
submitting ? "Executing..." : "Execute Payout"
|
|
29458
|
-
)), paymentError && /* @__PURE__ */
|
|
29711
|
+
)), paymentError && /* @__PURE__ */ React274.createElement(Alert53, { icon: /* @__PURE__ */ React274.createElement(IconAlertTriangle6, { size: 16 }), title: "Payment Error", color: "red", styles: actionAlertStyles }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs" }, paymentError)), error && /* @__PURE__ */ React274.createElement(Alert53, { icon: /* @__PURE__ */ React274.createElement(IconAlertTriangle6, { size: 16 }), color: "red", styles: actionAlertStyles }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs" }, error)), runtime.error?.message && /* @__PURE__ */ React274.createElement(Alert53, { icon: /* @__PURE__ */ React274.createElement(IconAlertTriangle6, { size: 16 }), color: "red", styles: actionAlertStyles }, /* @__PURE__ */ React274.createElement(Text164, { size: "xs" }, runtime.error.message)), proposal && /* @__PURE__ */ React274.createElement(React274.Fragment, null, /* @__PURE__ */ React274.createElement(Divider26, null), /* @__PURE__ */ React274.createElement(Text164, { size: "xs", fw: 600, c: "dimmed" }, "Proposal Detail"), /* @__PURE__ */ React274.createElement(Code11, { block: true, style: { fontSize: "11px", maxHeight: "200px", overflow: "auto" } }, JSON.stringify(proposal, null, 2))));
|
|
29459
29712
|
};
|
|
29460
29713
|
|
|
29461
29714
|
// src/mantine/blocks/action/actionTypes/payment/index.ts
|
|
@@ -29465,8 +29718,8 @@ registerActionTypeUI("qi/payment.execute", {
|
|
|
29465
29718
|
});
|
|
29466
29719
|
|
|
29467
29720
|
// src/mantine/blocks/action/actionTypes/matrixDm/MatrixDmConfig.tsx
|
|
29468
|
-
import
|
|
29469
|
-
import { Flex as Flex34, Stack as
|
|
29721
|
+
import React275, { useCallback as useCallback101, useEffect as useEffect100, useMemo as useMemo112, useState as useState126 } from "react";
|
|
29722
|
+
import { Flex as Flex34, Stack as Stack192, Text as Text165 } from "@mantine/core";
|
|
29470
29723
|
|
|
29471
29724
|
// src/mantine/blocks/action/actionTypes/matrixDm/types.ts
|
|
29472
29725
|
function parseMatrixDmInputs(json) {
|
|
@@ -29490,9 +29743,9 @@ function serializeMatrixDmInputs(inputs) {
|
|
|
29490
29743
|
// src/mantine/blocks/action/actionTypes/matrixDm/MatrixDmConfig.tsx
|
|
29491
29744
|
var MatrixDmConfig = ({ inputs, onInputsChange, editor }) => {
|
|
29492
29745
|
const handlers = useBlocknoteHandlers();
|
|
29493
|
-
const [local, setLocal] =
|
|
29494
|
-
const [roomMembers, setRoomMembers] =
|
|
29495
|
-
const [searchValue, setSearchValue] =
|
|
29746
|
+
const [local, setLocal] = useState126(() => parseMatrixDmInputs(inputs));
|
|
29747
|
+
const [roomMembers, setRoomMembers] = useState126([]);
|
|
29748
|
+
const [searchValue, setSearchValue] = useState126("");
|
|
29496
29749
|
const roomId = editor?.getRoomId?.() || null;
|
|
29497
29750
|
const mx = editor?.getMatrixClient?.() || null;
|
|
29498
29751
|
useEffect100(() => {
|
|
@@ -29517,13 +29770,13 @@ var MatrixDmConfig = ({ inputs, onInputsChange, editor }) => {
|
|
|
29517
29770
|
},
|
|
29518
29771
|
[local, onInputsChange]
|
|
29519
29772
|
);
|
|
29520
|
-
const selectData =
|
|
29773
|
+
const selectData = useMemo112(() => {
|
|
29521
29774
|
return roomMembers.map((member) => ({
|
|
29522
29775
|
value: member.did,
|
|
29523
29776
|
label: member.name || member.did
|
|
29524
29777
|
}));
|
|
29525
29778
|
}, [roomMembers]);
|
|
29526
|
-
const memberLookup =
|
|
29779
|
+
const memberLookup = useMemo112(() => {
|
|
29527
29780
|
const lookup = {};
|
|
29528
29781
|
roomMembers.forEach((member) => {
|
|
29529
29782
|
lookup[member.did] = member;
|
|
@@ -29531,7 +29784,7 @@ var MatrixDmConfig = ({ inputs, onInputsChange, editor }) => {
|
|
|
29531
29784
|
return lookup;
|
|
29532
29785
|
}, [roomMembers]);
|
|
29533
29786
|
const selectedMember = local.targetDid ? memberLookup[local.targetDid] : void 0;
|
|
29534
|
-
return /* @__PURE__ */
|
|
29787
|
+
return /* @__PURE__ */ React275.createElement(Stack192, { gap: "md" }, /* @__PURE__ */ React275.createElement(
|
|
29535
29788
|
BaseSelect,
|
|
29536
29789
|
{
|
|
29537
29790
|
label: "Recipient",
|
|
@@ -29547,12 +29800,12 @@ var MatrixDmConfig = ({ inputs, onInputsChange, editor }) => {
|
|
|
29547
29800
|
required: true,
|
|
29548
29801
|
renderOption: ({ option, checked }) => {
|
|
29549
29802
|
const member = memberLookup[option.value];
|
|
29550
|
-
if (!member) return /* @__PURE__ */
|
|
29551
|
-
return /* @__PURE__ */
|
|
29803
|
+
if (!member) return /* @__PURE__ */ React275.createElement(Text165, { size: "sm" }, option.label);
|
|
29804
|
+
return /* @__PURE__ */ React275.createElement(Flex34, { align: "center", gap: "sm" }, /* @__PURE__ */ React275.createElement(BaseAvatar, { src: member.src, did: member.did, size: 24 }), /* @__PURE__ */ React275.createElement(Text165, { size: "sm", c: checked ? "accent" : void 0 }, option.label));
|
|
29552
29805
|
},
|
|
29553
|
-
leftSection: selectedMember ? /* @__PURE__ */
|
|
29806
|
+
leftSection: selectedMember ? /* @__PURE__ */ React275.createElement(BaseAvatar, { src: selectedMember.src, did: selectedMember.did, size: 20, withCenter: true }) : null
|
|
29554
29807
|
}
|
|
29555
|
-
), /* @__PURE__ */
|
|
29808
|
+
), /* @__PURE__ */ React275.createElement(
|
|
29556
29809
|
BaseTextArea,
|
|
29557
29810
|
{
|
|
29558
29811
|
label: "Message",
|
|
@@ -29576,7 +29829,7 @@ function ActionBlock({ editor, block }) {
|
|
|
29576
29829
|
const { docType } = useBlocknoteContext();
|
|
29577
29830
|
const { actions } = useBlockConditions(block, editor);
|
|
29578
29831
|
if (docType === "template") {
|
|
29579
|
-
return /* @__PURE__ */
|
|
29832
|
+
return /* @__PURE__ */ React276.createElement(ActionTemplateView, { editor, block });
|
|
29580
29833
|
}
|
|
29581
29834
|
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
29582
29835
|
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
@@ -29587,7 +29840,7 @@ function ActionBlock({ editor, block }) {
|
|
|
29587
29840
|
const hasEnable = hasEnableConditions(conditionConfig);
|
|
29588
29841
|
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
29589
29842
|
const shouldDisable = hasEnable && !enableActionExists;
|
|
29590
|
-
return /* @__PURE__ */
|
|
29843
|
+
return /* @__PURE__ */ React276.createElement(
|
|
29591
29844
|
ActionFlowView,
|
|
29592
29845
|
{
|
|
29593
29846
|
block,
|
|
@@ -29666,35 +29919,35 @@ var ActionBlockSpec = createReactBlockSpec20(
|
|
|
29666
29919
|
{
|
|
29667
29920
|
render: (props) => {
|
|
29668
29921
|
const ixoProps = props;
|
|
29669
|
-
return /* @__PURE__ */
|
|
29922
|
+
return /* @__PURE__ */ React277.createElement(ActionBlock, { ...ixoProps });
|
|
29670
29923
|
}
|
|
29671
29924
|
}
|
|
29672
29925
|
);
|
|
29673
29926
|
|
|
29674
29927
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
29675
|
-
import
|
|
29928
|
+
import React286 from "react";
|
|
29676
29929
|
import { createReactBlockSpec as createReactBlockSpec21 } from "@blocknote/react";
|
|
29677
29930
|
|
|
29678
29931
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
29679
|
-
import
|
|
29932
|
+
import React285 from "react";
|
|
29680
29933
|
|
|
29681
29934
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
29682
|
-
import
|
|
29683
|
-
import { Group as
|
|
29935
|
+
import React282, { useMemo as useMemo113 } from "react";
|
|
29936
|
+
import { Group as Group104, Stack as Stack194, Text as Text168 } from "@mantine/core";
|
|
29684
29937
|
import { IconMapPin } from "@tabler/icons-react";
|
|
29685
29938
|
|
|
29686
29939
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
29687
|
-
import
|
|
29940
|
+
import React280, { useCallback as useCallback103 } from "react";
|
|
29688
29941
|
import { IconSettings as IconSettings19 } from "@tabler/icons-react";
|
|
29689
29942
|
|
|
29690
29943
|
// src/mantine/blocks/location/template/GeneralTab.tsx
|
|
29691
|
-
import
|
|
29692
|
-
import { Box as
|
|
29944
|
+
import React279, { useEffect as useEffect102, useRef as useRef24, useState as useState129 } from "react";
|
|
29945
|
+
import { Box as Box58, Divider as Divider27, Stack as Stack193, Text as Text166 } from "@mantine/core";
|
|
29693
29946
|
|
|
29694
29947
|
// src/core/hooks/useUnlMap.ts
|
|
29695
|
-
import { useEffect as useEffect101, useState as
|
|
29948
|
+
import { useEffect as useEffect101, useState as useState127 } from "react";
|
|
29696
29949
|
function useUnlMap() {
|
|
29697
|
-
const [status, setStatus] =
|
|
29950
|
+
const [status, setStatus] = useState127("loading");
|
|
29698
29951
|
useEffect101(() => {
|
|
29699
29952
|
if (typeof window === "undefined") {
|
|
29700
29953
|
return;
|
|
@@ -29750,8 +30003,8 @@ function useUnlMap() {
|
|
|
29750
30003
|
}
|
|
29751
30004
|
|
|
29752
30005
|
// src/mantine/blocks/location/components/TileSelector.tsx
|
|
29753
|
-
import
|
|
29754
|
-
import { ActionIcon as ActionIcon37, Group as
|
|
30006
|
+
import React278, { useState as useState128, useCallback as useCallback102 } from "react";
|
|
30007
|
+
import { ActionIcon as ActionIcon37, Group as Group103, Tooltip as Tooltip24 } from "@mantine/core";
|
|
29755
30008
|
import { IconMap, IconMoon, IconSatellite, IconMountain } from "@tabler/icons-react";
|
|
29756
30009
|
var TILE_LAYERS = {
|
|
29757
30010
|
dark: {
|
|
@@ -29803,7 +30056,7 @@ function ensureLayer(map, config) {
|
|
|
29803
30056
|
);
|
|
29804
30057
|
}
|
|
29805
30058
|
var TileSelector = ({ mapRef }) => {
|
|
29806
|
-
const [active, setActive] =
|
|
30059
|
+
const [active, setActive] = useState128("map");
|
|
29807
30060
|
const switchTo = useCallback102(
|
|
29808
30061
|
(type) => {
|
|
29809
30062
|
const map = mapRef.current;
|
|
@@ -29822,11 +30075,11 @@ var TileSelector = ({ mapRef }) => {
|
|
|
29822
30075
|
[mapRef, active]
|
|
29823
30076
|
);
|
|
29824
30077
|
const items = [
|
|
29825
|
-
{ type: "map", label: "Map", icon: /* @__PURE__ */
|
|
30078
|
+
{ type: "map", label: "Map", icon: /* @__PURE__ */ React278.createElement(IconMap, { size: 14 }) },
|
|
29826
30079
|
...OVERLAY_KEYS.map((key) => ({ type: key, label: TILE_LAYERS[key].label, icon: TILE_LAYERS[key].icon }))
|
|
29827
30080
|
];
|
|
29828
|
-
return /* @__PURE__ */
|
|
29829
|
-
|
|
30081
|
+
return /* @__PURE__ */ React278.createElement(
|
|
30082
|
+
Group103,
|
|
29830
30083
|
{
|
|
29831
30084
|
gap: 2,
|
|
29832
30085
|
style: {
|
|
@@ -29839,7 +30092,7 @@ var TileSelector = ({ mapRef }) => {
|
|
|
29839
30092
|
padding: 2
|
|
29840
30093
|
}
|
|
29841
30094
|
},
|
|
29842
|
-
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */
|
|
30095
|
+
items.map(({ type, label, icon: icon2 }) => /* @__PURE__ */ React278.createElement(Tooltip24, { key: type, label, withArrow: true }, /* @__PURE__ */ React278.createElement(
|
|
29843
30096
|
ActionIcon37,
|
|
29844
30097
|
{
|
|
29845
30098
|
variant: active === type ? "filled" : "subtle",
|
|
@@ -29860,9 +30113,9 @@ var DEFAULT_CENTER = [0, 20];
|
|
|
29860
30113
|
var DEFAULT_ZOOM = 2;
|
|
29861
30114
|
var PLACED_ZOOM = 14;
|
|
29862
30115
|
var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, onDescriptionChange, onCoordinatesChange }) => {
|
|
29863
|
-
const [localTitle, setLocalTitle] =
|
|
29864
|
-
const [localDescription, setLocalDescription] =
|
|
29865
|
-
const [mapError, setMapError] =
|
|
30116
|
+
const [localTitle, setLocalTitle] = useState129(title);
|
|
30117
|
+
const [localDescription, setLocalDescription] = useState129(description);
|
|
30118
|
+
const [mapError, setMapError] = useState129(null);
|
|
29866
30119
|
const { status, UnlSdk } = useUnlMap();
|
|
29867
30120
|
const { mapConfig } = useBlocknoteContext();
|
|
29868
30121
|
const markerRef = useRef24(null);
|
|
@@ -29925,7 +30178,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29925
30178
|
markerRef.current = null;
|
|
29926
30179
|
};
|
|
29927
30180
|
}, [status, UnlSdk]);
|
|
29928
|
-
return /* @__PURE__ */
|
|
30181
|
+
return /* @__PURE__ */ React279.createElement(Stack193, { gap: "lg" }, /* @__PURE__ */ React279.createElement(Stack193, { gap: "xs" }, /* @__PURE__ */ React279.createElement(Text166, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React279.createElement(
|
|
29929
30182
|
BaseTextInput,
|
|
29930
30183
|
{
|
|
29931
30184
|
placeholder: "e.g. Project Location",
|
|
@@ -29936,7 +30189,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29936
30189
|
onTitleChange(v);
|
|
29937
30190
|
}
|
|
29938
30191
|
}
|
|
29939
|
-
)), /* @__PURE__ */
|
|
30192
|
+
)), /* @__PURE__ */ React279.createElement(Stack193, { gap: "xs" }, /* @__PURE__ */ React279.createElement(Text166, { size: "sm", fw: 600 }, "Description"), /* @__PURE__ */ React279.createElement(
|
|
29940
30193
|
BaseTextInput,
|
|
29941
30194
|
{
|
|
29942
30195
|
placeholder: "e.g. Main project site coordinates",
|
|
@@ -29947,8 +30200,8 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29947
30200
|
onDescriptionChange(v);
|
|
29948
30201
|
}
|
|
29949
30202
|
}
|
|
29950
|
-
)), /* @__PURE__ */
|
|
29951
|
-
|
|
30203
|
+
)), /* @__PURE__ */ React279.createElement(Divider27, { variant: "dashed" }), /* @__PURE__ */ React279.createElement(Stack193, { gap: "xs" }, /* @__PURE__ */ React279.createElement(Text166, { size: "sm", fw: 600 }, "Location"), /* @__PURE__ */ React279.createElement(Text166, { size: "xs", c: "dimmed" }, "Click on the map to set the location."), mapError ? /* @__PURE__ */ React279.createElement(Text166, { size: "sm", c: "red" }, mapError) : /* @__PURE__ */ React279.createElement(Box58, { ref: wrapperRef, mx: "auto", w: "100%", miw: 280, h: 300, style: { borderRadius: 12, position: "relative", overflow: "hidden" } }, /* @__PURE__ */ React279.createElement(
|
|
30204
|
+
Box58,
|
|
29952
30205
|
{
|
|
29953
30206
|
ref: containerRef,
|
|
29954
30207
|
style: {
|
|
@@ -29960,7 +30213,7 @@ var GeneralTab17 = ({ title, description, latitude, longitude, onTitleChange, on
|
|
|
29960
30213
|
height: "600px"
|
|
29961
30214
|
}
|
|
29962
30215
|
}
|
|
29963
|
-
), /* @__PURE__ */
|
|
30216
|
+
), /* @__PURE__ */ React279.createElement(TileSelector, { mapRef }))), /* @__PURE__ */ React279.createElement(Stack193, { gap: "xs" }, /* @__PURE__ */ React279.createElement(BaseTextInput, { label: "Latitude", value: latitude, readOnly: true, placeholder: "Not set" }), /* @__PURE__ */ React279.createElement(BaseTextInput, { label: "Longitude", value: longitude, readOnly: true, placeholder: "Not set" })));
|
|
29964
30217
|
};
|
|
29965
30218
|
|
|
29966
30219
|
// src/mantine/blocks/location/template/TemplateConfig.tsx
|
|
@@ -29983,7 +30236,7 @@ var TemplateConfig17 = ({ editor, block }) => {
|
|
|
29983
30236
|
label: "General",
|
|
29984
30237
|
value: "general",
|
|
29985
30238
|
icon: icon(IconSettings19),
|
|
29986
|
-
content: /* @__PURE__ */
|
|
30239
|
+
content: /* @__PURE__ */ React280.createElement(
|
|
29987
30240
|
GeneralTab17,
|
|
29988
30241
|
{
|
|
29989
30242
|
title: block.props.title || "",
|
|
@@ -29997,14 +30250,14 @@ var TemplateConfig17 = ({ editor, block }) => {
|
|
|
29997
30250
|
)
|
|
29998
30251
|
}
|
|
29999
30252
|
];
|
|
30000
|
-
return /* @__PURE__ */
|
|
30253
|
+
return /* @__PURE__ */ React280.createElement(BaseRightPanelLayout, { title: "Location Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
30001
30254
|
};
|
|
30002
30255
|
|
|
30003
30256
|
// src/mantine/blocks/location/components/LocationMap.tsx
|
|
30004
|
-
import
|
|
30005
|
-
import { Box as
|
|
30257
|
+
import React281, { useEffect as useEffect103, useRef as useRef25, useState as useState130 } from "react";
|
|
30258
|
+
import { Box as Box59, Flex as Flex35, Loader as Loader53, Text as Text167 } from "@mantine/core";
|
|
30006
30259
|
var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker = true, showTilesControl = false }) => {
|
|
30007
|
-
const [mapError, setMapError] =
|
|
30260
|
+
const [mapError, setMapError] = useState130(null);
|
|
30008
30261
|
const { mapConfig } = useBlocknoteContext();
|
|
30009
30262
|
const wrapperRef = useRef25(null);
|
|
30010
30263
|
const containerRef = useRef25(null);
|
|
@@ -30051,8 +30304,8 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
30051
30304
|
}
|
|
30052
30305
|
}, [latitude, longitude, showMarker]);
|
|
30053
30306
|
if (status === "loading") {
|
|
30054
|
-
return /* @__PURE__ */
|
|
30055
|
-
|
|
30307
|
+
return /* @__PURE__ */ React281.createElement(
|
|
30308
|
+
Box59,
|
|
30056
30309
|
{
|
|
30057
30310
|
style: {
|
|
30058
30311
|
borderRadius: 16,
|
|
@@ -30063,12 +30316,12 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
30063
30316
|
w,
|
|
30064
30317
|
h
|
|
30065
30318
|
},
|
|
30066
|
-
/* @__PURE__ */
|
|
30319
|
+
/* @__PURE__ */ React281.createElement(Loader53, null)
|
|
30067
30320
|
);
|
|
30068
30321
|
}
|
|
30069
30322
|
if (status === "error" || mapError) {
|
|
30070
|
-
return /* @__PURE__ */
|
|
30071
|
-
|
|
30323
|
+
return /* @__PURE__ */ React281.createElement(
|
|
30324
|
+
Box59,
|
|
30072
30325
|
{
|
|
30073
30326
|
style: {
|
|
30074
30327
|
borderRadius: 16,
|
|
@@ -30079,11 +30332,11 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
30079
30332
|
w,
|
|
30080
30333
|
h
|
|
30081
30334
|
},
|
|
30082
|
-
/* @__PURE__ */
|
|
30335
|
+
/* @__PURE__ */ React281.createElement(Text167, { size: "sm", c: "red" }, mapError || "Failed to load map")
|
|
30083
30336
|
);
|
|
30084
30337
|
}
|
|
30085
|
-
return /* @__PURE__ */
|
|
30086
|
-
|
|
30338
|
+
return /* @__PURE__ */ React281.createElement(Box59, { ref: wrapperRef, style: { position: "relative", borderRadius: 16, overflow: "hidden" }, w, h }, /* @__PURE__ */ React281.createElement(
|
|
30339
|
+
Box59,
|
|
30087
30340
|
{
|
|
30088
30341
|
ref: containerRef,
|
|
30089
30342
|
style: {
|
|
@@ -30095,54 +30348,54 @@ var UnlMap = ({ w = "100%", h = 200, latitude, longitude, zoom = 5, showMarker =
|
|
|
30095
30348
|
height: "600px"
|
|
30096
30349
|
}
|
|
30097
30350
|
}
|
|
30098
|
-
), showTilesControl && /* @__PURE__ */
|
|
30351
|
+
), showTilesControl && /* @__PURE__ */ React281.createElement(TileSelector, { mapRef }));
|
|
30099
30352
|
};
|
|
30100
30353
|
function LocationMap(props) {
|
|
30101
30354
|
if (props.latitude === void 0 || props.longitude === void 0)
|
|
30102
|
-
return /* @__PURE__ */
|
|
30103
|
-
return /* @__PURE__ */
|
|
30355
|
+
return /* @__PURE__ */ React281.createElement(Flex35, { w: "100%", h: 200, align: "center", justify: "center" }, /* @__PURE__ */ React281.createElement(Loader53, null));
|
|
30356
|
+
return /* @__PURE__ */ React281.createElement(UnlMap, { ...props });
|
|
30104
30357
|
}
|
|
30105
30358
|
|
|
30106
30359
|
// src/mantine/blocks/location/template/TemplateView.tsx
|
|
30107
30360
|
var LOCATION_TEMPLATE_PANEL_ID = "location-template-panel";
|
|
30108
30361
|
var LocationTemplateView = ({ editor, block }) => {
|
|
30109
30362
|
const panelId = `${LOCATION_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
30110
|
-
const panelContent =
|
|
30363
|
+
const panelContent = useMemo113(() => /* @__PURE__ */ React282.createElement(TemplateConfig17, { editor, block }), [editor, block]);
|
|
30111
30364
|
const { open } = usePanel(panelId, panelContent);
|
|
30112
30365
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
30113
|
-
return /* @__PURE__ */
|
|
30366
|
+
return /* @__PURE__ */ React282.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React282.createElement(Stack194, { gap: "xs", justify: "center" }, /* @__PURE__ */ React282.createElement(Group104, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React282.createElement(IconMapPin, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React282.createElement(Stack194, { gap: 2 }, /* @__PURE__ */ React282.createElement(Text168, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React282.createElement(Text168, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation && /* @__PURE__ */ React282.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-template-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true })));
|
|
30114
30367
|
};
|
|
30115
30368
|
|
|
30116
30369
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
30117
|
-
import
|
|
30118
|
-
import { Center as
|
|
30370
|
+
import React284, { useMemo as useMemo114 } from "react";
|
|
30371
|
+
import { Center as Center14, Group as Group105, Stack as Stack195, Text as Text169 } from "@mantine/core";
|
|
30119
30372
|
import { IconMapPin as IconMapPin2 } from "@tabler/icons-react";
|
|
30120
30373
|
|
|
30121
30374
|
// src/mantine/blocks/location/flow/FlowConfig.tsx
|
|
30122
|
-
import
|
|
30375
|
+
import React283 from "react";
|
|
30123
30376
|
var FlowConfig3 = ({ block }) => {
|
|
30124
30377
|
const { closePanel } = usePanelStore();
|
|
30125
30378
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
30126
|
-
return /* @__PURE__ */
|
|
30379
|
+
return /* @__PURE__ */ React283.createElement(BaseRightPanelLayout, { title: block.props.title || "Location", onClose: closePanel, isTemplate: false }, hasLocation ? /* @__PURE__ */ React283.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, h: 600, zoom: 14, showMarker: true, showTilesControl: true }) : null);
|
|
30127
30380
|
};
|
|
30128
30381
|
|
|
30129
30382
|
// src/mantine/blocks/location/flow/FlowView.tsx
|
|
30130
30383
|
var LOCATION_FLOW_PANEL_ID = "location-flow-panel";
|
|
30131
30384
|
var LocationFlowView = ({ editor, block }) => {
|
|
30132
30385
|
const panelId = `${LOCATION_FLOW_PANEL_ID}-${block.id}`;
|
|
30133
|
-
const panelContent =
|
|
30386
|
+
const panelContent = useMemo114(() => /* @__PURE__ */ React284.createElement(FlowConfig3, { editor, block }), [editor, block]);
|
|
30134
30387
|
const { open } = usePanel(panelId, panelContent);
|
|
30135
30388
|
const hasLocation = block.props.latitude && block.props.longitude;
|
|
30136
|
-
return /* @__PURE__ */
|
|
30389
|
+
return /* @__PURE__ */ React284.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React284.createElement(Stack195, { gap: "xs", justify: "center" }, /* @__PURE__ */ React284.createElement(Group105, { wrap: "nowrap", align: "center" }, /* @__PURE__ */ React284.createElement(IconMapPin2, { color: "white", size: 26, stroke: 1.5 }), /* @__PURE__ */ React284.createElement(Stack195, { gap: 2 }, /* @__PURE__ */ React284.createElement(Text169, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Location"), block.props.description && /* @__PURE__ */ React284.createElement(Text169, { size: "xs", c: "dimmed", contentEditable: false }, block.props.description))), hasLocation ? /* @__PURE__ */ React284.createElement(LocationMap, { latitude: block.props.latitude, longitude: block.props.longitude, mapId: `location-flow-map-${block.id}`, zoom: 14, showMarker: true, showTilesControl: true }) : /* @__PURE__ */ React284.createElement(Center14, { py: "md" }, /* @__PURE__ */ React284.createElement(Text169, { size: "sm", c: "dimmed" }, "Location not configured"))));
|
|
30137
30390
|
};
|
|
30138
30391
|
|
|
30139
30392
|
// src/mantine/blocks/location/LocationBlock.tsx
|
|
30140
30393
|
function LocationBlock({ editor, block }) {
|
|
30141
30394
|
const { docType } = useBlocknoteContext();
|
|
30142
30395
|
if (docType === "template") {
|
|
30143
|
-
return /* @__PURE__ */
|
|
30396
|
+
return /* @__PURE__ */ React285.createElement(LocationTemplateView, { editor, block });
|
|
30144
30397
|
}
|
|
30145
|
-
return /* @__PURE__ */
|
|
30398
|
+
return /* @__PURE__ */ React285.createElement(LocationFlowView, { editor, block });
|
|
30146
30399
|
}
|
|
30147
30400
|
|
|
30148
30401
|
// src/mantine/blocks/location/LocationBlockSpec.tsx
|
|
@@ -30161,29 +30414,29 @@ var LocationBlockSpec = createReactBlockSpec21(
|
|
|
30161
30414
|
{
|
|
30162
30415
|
render: (props) => {
|
|
30163
30416
|
const ixoProps = props;
|
|
30164
|
-
return /* @__PURE__ */
|
|
30417
|
+
return /* @__PURE__ */ React286.createElement(LocationBlock, { ...ixoProps });
|
|
30165
30418
|
}
|
|
30166
30419
|
}
|
|
30167
30420
|
);
|
|
30168
30421
|
|
|
30169
30422
|
// src/mantine/blocks/embed/EmbedBlockSpec.tsx
|
|
30170
|
-
import
|
|
30423
|
+
import React293 from "react";
|
|
30171
30424
|
import { createReactBlockSpec as createReactBlockSpec22 } from "@blocknote/react";
|
|
30172
30425
|
|
|
30173
30426
|
// src/mantine/blocks/embed/EmbedBlock.tsx
|
|
30174
|
-
import
|
|
30427
|
+
import React292 from "react";
|
|
30175
30428
|
|
|
30176
30429
|
// src/mantine/blocks/embed/template/TemplateView.tsx
|
|
30177
|
-
import
|
|
30178
|
-
import { Box as
|
|
30430
|
+
import React289, { useMemo as useMemo115 } from "react";
|
|
30431
|
+
import { Box as Box60, Group as Group106, Stack as Stack197, Text as Text171 } from "@mantine/core";
|
|
30179
30432
|
|
|
30180
30433
|
// src/mantine/blocks/embed/template/TemplateConfig.tsx
|
|
30181
|
-
import
|
|
30434
|
+
import React288, { useCallback as useCallback104 } from "react";
|
|
30182
30435
|
import { IconSettings as IconSettings20 } from "@tabler/icons-react";
|
|
30183
30436
|
|
|
30184
30437
|
// src/mantine/blocks/embed/template/GeneralTab.tsx
|
|
30185
|
-
import
|
|
30186
|
-
import { Stack as
|
|
30438
|
+
import React287, { useEffect as useEffect104, useState as useState131 } from "react";
|
|
30439
|
+
import { Stack as Stack196, Switch as Switch6, Text as Text170 } from "@mantine/core";
|
|
30187
30440
|
var GeneralTab18 = ({
|
|
30188
30441
|
url,
|
|
30189
30442
|
title,
|
|
@@ -30198,8 +30451,8 @@ var GeneralTab18 = ({
|
|
|
30198
30451
|
onHeightChange,
|
|
30199
30452
|
onAllowAuthChange
|
|
30200
30453
|
}) => {
|
|
30201
|
-
const [localUrl, setLocalUrl] =
|
|
30202
|
-
const [localHeight, setLocalHeight] =
|
|
30454
|
+
const [localUrl, setLocalUrl] = useState131(url);
|
|
30455
|
+
const [localHeight, setLocalHeight] = useState131(height);
|
|
30203
30456
|
const iconOptions = Object.keys(ICON_MAP).map((key) => ({
|
|
30204
30457
|
value: key,
|
|
30205
30458
|
label: key.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ")
|
|
@@ -30210,7 +30463,7 @@ var GeneralTab18 = ({
|
|
|
30210
30463
|
useEffect104(() => {
|
|
30211
30464
|
setLocalHeight(height);
|
|
30212
30465
|
}, [height]);
|
|
30213
|
-
return /* @__PURE__ */
|
|
30466
|
+
return /* @__PURE__ */ React287.createElement(Stack196, { gap: "md" }, /* @__PURE__ */ React287.createElement(Stack196, { gap: "xs" }, /* @__PURE__ */ React287.createElement(Text170, { size: "sm", fw: 600 }, "URL"), /* @__PURE__ */ React287.createElement(
|
|
30214
30467
|
BaseTextInput,
|
|
30215
30468
|
{
|
|
30216
30469
|
placeholder: "https://example.com",
|
|
@@ -30221,7 +30474,7 @@ var GeneralTab18 = ({
|
|
|
30221
30474
|
onUrlChange(v);
|
|
30222
30475
|
}
|
|
30223
30476
|
}
|
|
30224
|
-
), /* @__PURE__ */
|
|
30477
|
+
), /* @__PURE__ */ React287.createElement(Text170, { size: "xs", c: "dimmed" }, "Enter the URL of the page to embed.")), /* @__PURE__ */ React287.createElement(BaseTextInput, { label: "Title", placeholder: "e.g. Dashboard", value: title, onChange: (e) => onTitleChange(e.currentTarget.value) }), /* @__PURE__ */ React287.createElement(BaseTextArea, { label: "Description", placeholder: "Enter description", value: description, onChange: (e) => onDescriptionChange(e.currentTarget.value), minRows: 2 }), /* @__PURE__ */ React287.createElement(BaseSelect, { label: "Icon", placeholder: "Select an icon", value: icon2 || "code", onChange: (value) => onIconChange(value || "code"), data: iconOptions, searchable: true }), /* @__PURE__ */ React287.createElement(
|
|
30225
30478
|
BaseTextInput,
|
|
30226
30479
|
{
|
|
30227
30480
|
label: "Height (px)",
|
|
@@ -30234,7 +30487,7 @@ var GeneralTab18 = ({
|
|
|
30234
30487
|
onHeightChange(v);
|
|
30235
30488
|
}
|
|
30236
30489
|
}
|
|
30237
|
-
), /* @__PURE__ */
|
|
30490
|
+
), /* @__PURE__ */ React287.createElement(Stack196, { gap: "xs" }, /* @__PURE__ */ React287.createElement(Switch6, { label: "Allow authenticated embeds", checked: allowAuth, onChange: (event) => onAllowAuthChange(event.currentTarget.checked) }), /* @__PURE__ */ React287.createElement(Text170, { size: "xs", c: "dimmed" }, "Enable for services like Google Calendar that require cookie access. Only use with trusted URLs.")));
|
|
30238
30491
|
};
|
|
30239
30492
|
|
|
30240
30493
|
// src/mantine/blocks/embed/template/TemplateConfig.tsx
|
|
@@ -30251,7 +30504,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
30251
30504
|
label: "General",
|
|
30252
30505
|
value: "general",
|
|
30253
30506
|
icon: icon(IconSettings20),
|
|
30254
|
-
content: /* @__PURE__ */
|
|
30507
|
+
content: /* @__PURE__ */ React288.createElement(
|
|
30255
30508
|
GeneralTab18,
|
|
30256
30509
|
{
|
|
30257
30510
|
url: block.props.url || "",
|
|
@@ -30270,7 +30523,7 @@ var TemplateConfig18 = ({ editor, block }) => {
|
|
|
30270
30523
|
)
|
|
30271
30524
|
}
|
|
30272
30525
|
];
|
|
30273
|
-
return /* @__PURE__ */
|
|
30526
|
+
return /* @__PURE__ */ React288.createElement(BaseRightPanelLayout, { title: "Embed Settings", onClose: closePanel, tabs, context: { editor, block } });
|
|
30274
30527
|
};
|
|
30275
30528
|
|
|
30276
30529
|
// src/mantine/blocks/embed/sanitizeUrl.ts
|
|
@@ -30303,12 +30556,12 @@ function buildImageSrcdoc(url) {
|
|
|
30303
30556
|
var EMBED_TEMPLATE_PANEL_ID = "embed-template-panel";
|
|
30304
30557
|
var EmbedTemplateView = ({ editor, block }) => {
|
|
30305
30558
|
const panelId = `${EMBED_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
30306
|
-
const panelContent =
|
|
30559
|
+
const panelContent = useMemo115(() => /* @__PURE__ */ React289.createElement(TemplateConfig18, { editor, block }), [editor, block]);
|
|
30307
30560
|
const { open } = usePanel(panelId, panelContent);
|
|
30308
30561
|
const safeUrl = sanitizeEmbedUrl(block.props.url);
|
|
30309
30562
|
const height = Number(block.props.height) || 400;
|
|
30310
30563
|
const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
|
|
30311
|
-
return /* @__PURE__ */
|
|
30564
|
+
return /* @__PURE__ */ React289.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React289.createElement(Stack197, { gap: "xs", justify: "center" }, /* @__PURE__ */ React289.createElement(Group106, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React289.createElement(Stack197, { gap: 2 }, /* @__PURE__ */ React289.createElement(Text171, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React289.createElement(Text171, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "Click to configure"))), safeUrl && /* @__PURE__ */ React289.createElement(Box60, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React289.createElement(
|
|
30312
30565
|
"iframe",
|
|
30313
30566
|
{
|
|
30314
30567
|
...isImageUrl(safeUrl) ? { srcDoc: buildImageSrcdoc(safeUrl) } : { src: safeUrl },
|
|
@@ -30324,11 +30577,11 @@ var EmbedTemplateView = ({ editor, block }) => {
|
|
|
30324
30577
|
};
|
|
30325
30578
|
|
|
30326
30579
|
// src/mantine/blocks/embed/flow/FlowView.tsx
|
|
30327
|
-
import
|
|
30328
|
-
import { Box as
|
|
30580
|
+
import React291, { useMemo as useMemo116 } from "react";
|
|
30581
|
+
import { Box as Box61, Group as Group107, Stack as Stack198, Text as Text172 } from "@mantine/core";
|
|
30329
30582
|
|
|
30330
30583
|
// src/mantine/blocks/embed/flow/FlowConfig.tsx
|
|
30331
|
-
import
|
|
30584
|
+
import React290, { useCallback as useCallback105 } from "react";
|
|
30332
30585
|
import { IconSettings as IconSettings21 } from "@tabler/icons-react";
|
|
30333
30586
|
var FlowConfig4 = ({ editor, block }) => {
|
|
30334
30587
|
const { closePanel } = usePanelStore();
|
|
@@ -30343,7 +30596,7 @@ var FlowConfig4 = ({ editor, block }) => {
|
|
|
30343
30596
|
label: "General",
|
|
30344
30597
|
value: "general",
|
|
30345
30598
|
icon: icon(IconSettings21),
|
|
30346
|
-
content: /* @__PURE__ */
|
|
30599
|
+
content: /* @__PURE__ */ React290.createElement(
|
|
30347
30600
|
GeneralTab18,
|
|
30348
30601
|
{
|
|
30349
30602
|
url: block.props.url || "",
|
|
@@ -30362,19 +30615,19 @@ var FlowConfig4 = ({ editor, block }) => {
|
|
|
30362
30615
|
)
|
|
30363
30616
|
}
|
|
30364
30617
|
];
|
|
30365
|
-
return /* @__PURE__ */
|
|
30618
|
+
return /* @__PURE__ */ React290.createElement(BaseRightPanelLayout, { title: "Embed Settings", onClose: closePanel, tabs, context: { editor, block }, isTemplate: false });
|
|
30366
30619
|
};
|
|
30367
30620
|
|
|
30368
30621
|
// src/mantine/blocks/embed/flow/FlowView.tsx
|
|
30369
30622
|
var EMBED_FLOW_PANEL_ID = "embed-flow-panel";
|
|
30370
30623
|
var EmbedFlowView = ({ editor, block }) => {
|
|
30371
30624
|
const panelId = `${EMBED_FLOW_PANEL_ID}-${block.id}`;
|
|
30372
|
-
const panelContent =
|
|
30625
|
+
const panelContent = useMemo116(() => /* @__PURE__ */ React291.createElement(FlowConfig4, { editor, block }), [editor, block]);
|
|
30373
30626
|
const { open } = usePanel(panelId, panelContent);
|
|
30374
30627
|
const safeUrl = sanitizeEmbedUrl(block.props.url);
|
|
30375
30628
|
const height = Number(block.props.height) || 400;
|
|
30376
30629
|
const sandbox = block.props.allowAuth === "true" ? "allow-scripts allow-same-origin allow-forms allow-popups" : "allow-scripts allow-forms allow-popups";
|
|
30377
|
-
return /* @__PURE__ */
|
|
30630
|
+
return /* @__PURE__ */ React291.createElement(BaseContainer, { blockId: block.id, onClick: open, style: { minHeight: 90, justifyContent: "center" } }, /* @__PURE__ */ React291.createElement(Stack198, { gap: "xs", justify: "center" }, /* @__PURE__ */ React291.createElement(Group107, { wrap: "nowrap", align: "center" }, getIcon("code", block.props.icon), /* @__PURE__ */ React291.createElement(Stack198, { gap: 2 }, /* @__PURE__ */ React291.createElement(Text172, { fw: 500, size: "sm", contentEditable: false }, block.props.title || "Embed"), /* @__PURE__ */ React291.createElement(Text172, { size: "xs", c: "dimmed", contentEditable: false, lineClamp: 1 }, block.props.description || safeUrl || "No URL configured"))), safeUrl && /* @__PURE__ */ React291.createElement(Box61, { style: { borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ React291.createElement(
|
|
30378
30631
|
"iframe",
|
|
30379
30632
|
{
|
|
30380
30633
|
...isImageUrl(safeUrl) ? { srcDoc: buildImageSrcdoc(safeUrl) } : { src: safeUrl },
|
|
@@ -30393,9 +30646,9 @@ var EmbedFlowView = ({ editor, block }) => {
|
|
|
30393
30646
|
function EmbedBlock({ editor, block }) {
|
|
30394
30647
|
const { docType } = useBlocknoteContext();
|
|
30395
30648
|
if (docType === "template") {
|
|
30396
|
-
return /* @__PURE__ */
|
|
30649
|
+
return /* @__PURE__ */ React292.createElement(EmbedTemplateView, { editor, block });
|
|
30397
30650
|
}
|
|
30398
|
-
return /* @__PURE__ */
|
|
30651
|
+
return /* @__PURE__ */ React292.createElement(EmbedFlowView, { editor, block });
|
|
30399
30652
|
}
|
|
30400
30653
|
|
|
30401
30654
|
// src/mantine/blocks/embed/EmbedBlockSpec.tsx
|
|
@@ -30416,7 +30669,7 @@ var EmbedBlockSpec = createReactBlockSpec22(
|
|
|
30416
30669
|
{
|
|
30417
30670
|
render: (props) => {
|
|
30418
30671
|
const ixoProps = props;
|
|
30419
|
-
return /* @__PURE__ */
|
|
30672
|
+
return /* @__PURE__ */ React293.createElement(EmbedBlock, { ...ixoProps });
|
|
30420
30673
|
}
|
|
30421
30674
|
}
|
|
30422
30675
|
);
|
|
@@ -30656,10 +30909,10 @@ blockRegistry.register({
|
|
|
30656
30909
|
});
|
|
30657
30910
|
|
|
30658
30911
|
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
30659
|
-
import { useMemo as
|
|
30912
|
+
import { useMemo as useMemo117, useEffect as useEffect105, useState as useState132, useCallback as useCallback106 } from "react";
|
|
30660
30913
|
|
|
30661
30914
|
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
30662
|
-
import { useMemo as
|
|
30915
|
+
import { useMemo as useMemo118 } from "react";
|
|
30663
30916
|
|
|
30664
30917
|
// src/mantine/blocks/index.ts
|
|
30665
30918
|
var blockSpecs = {
|
|
@@ -31166,15 +31419,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
31166
31419
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
31167
31420
|
|
|
31168
31421
|
// src/core/hooks/useMatrixProvider.ts
|
|
31169
|
-
import { useEffect as useEffect106, useState as
|
|
31422
|
+
import { useEffect as useEffect106, useState as useState133, useRef as useRef26, useCallback as useCallback107, useMemo as useMemo119 } from "react";
|
|
31170
31423
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
31171
31424
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
31172
|
-
const [matrixProvider, setProvider] =
|
|
31173
|
-
const [status, setStatus] =
|
|
31425
|
+
const [matrixProvider, setProvider] = useState133(null);
|
|
31426
|
+
const [status, setStatus] = useState133("disconnected");
|
|
31174
31427
|
const isMountedRef = useRef26(true);
|
|
31175
31428
|
const providerRef = useRef26(null);
|
|
31176
31429
|
const retryTimeoutRef = useRef26(null);
|
|
31177
|
-
const providerOptions =
|
|
31430
|
+
const providerOptions = useMemo119(
|
|
31178
31431
|
() => ({
|
|
31179
31432
|
translator: {
|
|
31180
31433
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -31261,17 +31514,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
31261
31514
|
}
|
|
31262
31515
|
|
|
31263
31516
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
31264
|
-
import { useMemo as
|
|
31517
|
+
import { useMemo as useMemo120 } from "react";
|
|
31265
31518
|
import * as Y from "yjs";
|
|
31266
31519
|
function useCollaborativeYDoc(_options) {
|
|
31267
|
-
return
|
|
31520
|
+
return useMemo120(() => {
|
|
31268
31521
|
const doc = new Y.Doc();
|
|
31269
31522
|
return doc;
|
|
31270
31523
|
}, []);
|
|
31271
31524
|
}
|
|
31272
31525
|
|
|
31273
31526
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
31274
|
-
import { useMemo as
|
|
31527
|
+
import { useMemo as useMemo121, useEffect as useEffect108, useState as useState134, useRef as useRef28 } from "react";
|
|
31275
31528
|
|
|
31276
31529
|
// src/core/lib/matrixMetadata.ts
|
|
31277
31530
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -31896,7 +32149,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31896
32149
|
matrixClient,
|
|
31897
32150
|
permissions = { write: false }
|
|
31898
32151
|
} = options || {};
|
|
31899
|
-
const memoizedUser =
|
|
32152
|
+
const memoizedUser = useMemo121(
|
|
31900
32153
|
() => ({
|
|
31901
32154
|
id: user?.id || "",
|
|
31902
32155
|
name: user?.name || "",
|
|
@@ -31912,19 +32165,18 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31912
32165
|
matrixClient,
|
|
31913
32166
|
roomId: options.roomId
|
|
31914
32167
|
});
|
|
31915
|
-
const metadataManager =
|
|
32168
|
+
const metadataManager = useMemo121(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
31916
32169
|
useEffect108(() => {
|
|
31917
32170
|
return () => {
|
|
31918
32171
|
metadataManager.dispose();
|
|
31919
32172
|
};
|
|
31920
32173
|
}, [metadataManager]);
|
|
31921
|
-
const defaultUploadFile =
|
|
32174
|
+
const defaultUploadFile = useMemo121(
|
|
31922
32175
|
() => uploadFile || (async (file) => {
|
|
31923
32176
|
return new Promise((resolve, reject) => {
|
|
31924
32177
|
const reader = new FileReader();
|
|
31925
32178
|
reader.onloadend = () => {
|
|
31926
|
-
|
|
31927
|
-
resolve(dataUrl);
|
|
32179
|
+
resolve(reader.result);
|
|
31928
32180
|
};
|
|
31929
32181
|
reader.onerror = reject;
|
|
31930
32182
|
reader.readAsDataURL(file);
|
|
@@ -31932,7 +32184,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31932
32184
|
}),
|
|
31933
32185
|
[uploadFile]
|
|
31934
32186
|
);
|
|
31935
|
-
const schema =
|
|
32187
|
+
const schema = useMemo121(
|
|
31936
32188
|
() => BlockNoteSchema2.create({
|
|
31937
32189
|
blockSpecs: {
|
|
31938
32190
|
...defaultBlockSpecs2,
|
|
@@ -31947,14 +32199,14 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31947
32199
|
}),
|
|
31948
32200
|
[]
|
|
31949
32201
|
);
|
|
31950
|
-
const root =
|
|
31951
|
-
const documentFragment =
|
|
31952
|
-
const flowArray =
|
|
31953
|
-
const runtimeMap =
|
|
31954
|
-
const delegationsMap =
|
|
31955
|
-
const invocationsMap =
|
|
31956
|
-
const migrationMap =
|
|
31957
|
-
const ucanDelegationStore =
|
|
32202
|
+
const root = useMemo121(() => yDoc.getMap("root"), [yDoc]);
|
|
32203
|
+
const documentFragment = useMemo121(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
32204
|
+
const flowArray = useMemo121(() => yDoc.getArray("flow"), [yDoc]);
|
|
32205
|
+
const runtimeMap = useMemo121(() => yDoc.getMap("runtime"), [yDoc]);
|
|
32206
|
+
const delegationsMap = useMemo121(() => yDoc.getMap("delegations"), [yDoc]);
|
|
32207
|
+
const invocationsMap = useMemo121(() => yDoc.getMap("invocations"), [yDoc]);
|
|
32208
|
+
const migrationMap = useMemo121(() => yDoc.getMap("migration"), [yDoc]);
|
|
32209
|
+
const ucanDelegationStore = useMemo121(() => {
|
|
31958
32210
|
const store = createUcanDelegationStore(delegationsMap);
|
|
31959
32211
|
const originalSet = store.set;
|
|
31960
32212
|
store.set = (delegation) => {
|
|
@@ -31963,7 +32215,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31963
32215
|
};
|
|
31964
32216
|
return store;
|
|
31965
32217
|
}, [delegationsMap, matrixClient, options.roomId]);
|
|
31966
|
-
const invocationStore =
|
|
32218
|
+
const invocationStore = useMemo121(() => {
|
|
31967
32219
|
const store = createInvocationStore(invocationsMap);
|
|
31968
32220
|
const originalAdd = store.add;
|
|
31969
32221
|
store.add = (invocation) => {
|
|
@@ -31972,8 +32224,8 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31972
32224
|
};
|
|
31973
32225
|
return store;
|
|
31974
32226
|
}, [invocationsMap, matrixClient, options.roomId]);
|
|
31975
|
-
const userFragment =
|
|
31976
|
-
const collaborationConfig =
|
|
32227
|
+
const userFragment = useMemo121(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
32228
|
+
const collaborationConfig = useMemo121(
|
|
31977
32229
|
() => ({
|
|
31978
32230
|
provider: matrixProvider,
|
|
31979
32231
|
fragment: documentFragment,
|
|
@@ -31985,7 +32237,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
31985
32237
|
}),
|
|
31986
32238
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
31987
32239
|
);
|
|
31988
|
-
const ixoConfig =
|
|
32240
|
+
const ixoConfig = useMemo121(
|
|
31989
32241
|
() => ({
|
|
31990
32242
|
theme,
|
|
31991
32243
|
editable,
|
|
@@ -32005,7 +32257,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
32005
32257
|
collaboration: collaborationConfig,
|
|
32006
32258
|
pasteHandler: ixoPasteHandler
|
|
32007
32259
|
});
|
|
32008
|
-
const titleText =
|
|
32260
|
+
const titleText = useMemo121(() => yDoc.getText("title"), [yDoc]);
|
|
32009
32261
|
let ixoEditor;
|
|
32010
32262
|
if (editor) {
|
|
32011
32263
|
ixoEditor = editor;
|
|
@@ -32228,7 +32480,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
32228
32480
|
titleText.insert(0, options.title);
|
|
32229
32481
|
}
|
|
32230
32482
|
}, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
|
|
32231
|
-
const [connectedUsers, setConnectedUsers] =
|
|
32483
|
+
const [connectedUsers, setConnectedUsers] = useState134([]);
|
|
32232
32484
|
const activeBlockIdRef = useRef28(null);
|
|
32233
32485
|
const awarenessInstance = matrixProvider?.awarenessInstance ?? null;
|
|
32234
32486
|
useEffect108(() => {
|
|
@@ -32300,15 +32552,15 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
32300
32552
|
}
|
|
32301
32553
|
|
|
32302
32554
|
// src/mantine/IxoEditor.tsx
|
|
32303
|
-
import
|
|
32555
|
+
import React303 from "react";
|
|
32304
32556
|
import { SuggestionMenuController, getDefaultReactSlashMenuItems } from "@blocknote/react";
|
|
32305
32557
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
32306
32558
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
32307
32559
|
import { MantineProvider } from "@mantine/core";
|
|
32308
32560
|
|
|
32309
32561
|
// src/mantine/components/CommandPalette.tsx
|
|
32310
|
-
import
|
|
32311
|
-
import { Box as
|
|
32562
|
+
import React294, { useEffect as useEffect109, useRef as useRef29, useState as useState135, useMemo as useMemo122, useCallback as useCallback109 } from "react";
|
|
32563
|
+
import { Box as Box62, Text as Text173, Stack as Stack199 } from "@mantine/core";
|
|
32312
32564
|
var GROUP_ORDER = {
|
|
32313
32565
|
Headings: 0,
|
|
32314
32566
|
"Basic blocks": 1,
|
|
@@ -32322,15 +32574,15 @@ var GROUP_ORDER = {
|
|
|
32322
32574
|
};
|
|
32323
32575
|
function PaletteItem({ item, isSelected, onClick, id }) {
|
|
32324
32576
|
const ref = useRef29(null);
|
|
32325
|
-
const [hovered, setHovered] =
|
|
32577
|
+
const [hovered, setHovered] = useState135(false);
|
|
32326
32578
|
useEffect109(() => {
|
|
32327
32579
|
if (isSelected && ref.current) {
|
|
32328
32580
|
ref.current.scrollIntoView({ block: "nearest" });
|
|
32329
32581
|
}
|
|
32330
32582
|
}, [isSelected]);
|
|
32331
32583
|
const highlighted = isSelected || hovered;
|
|
32332
|
-
return /* @__PURE__ */
|
|
32333
|
-
|
|
32584
|
+
return /* @__PURE__ */ React294.createElement(
|
|
32585
|
+
Box62,
|
|
32334
32586
|
{
|
|
32335
32587
|
ref,
|
|
32336
32588
|
id,
|
|
@@ -32351,8 +32603,8 @@ function PaletteItem({ item, isSelected, onClick, id }) {
|
|
|
32351
32603
|
backgroundColor: highlighted ? "var(--mantine-color-neutralColor-4)" : "transparent"
|
|
32352
32604
|
}
|
|
32353
32605
|
},
|
|
32354
|
-
/* @__PURE__ */
|
|
32355
|
-
|
|
32606
|
+
/* @__PURE__ */ React294.createElement(
|
|
32607
|
+
Box62,
|
|
32356
32608
|
{
|
|
32357
32609
|
style: {
|
|
32358
32610
|
width: 32,
|
|
@@ -32368,8 +32620,8 @@ function PaletteItem({ item, isSelected, onClick, id }) {
|
|
|
32368
32620
|
},
|
|
32369
32621
|
item.icon
|
|
32370
32622
|
),
|
|
32371
|
-
/* @__PURE__ */
|
|
32372
|
-
|
|
32623
|
+
/* @__PURE__ */ React294.createElement(Stack199, { gap: 0, style: { overflow: "hidden", minWidth: 0, flex: 1 } }, /* @__PURE__ */ React294.createElement(
|
|
32624
|
+
Text173,
|
|
32373
32625
|
{
|
|
32374
32626
|
size: "sm",
|
|
32375
32627
|
fw: 500,
|
|
@@ -32379,8 +32631,8 @@ function PaletteItem({ item, isSelected, onClick, id }) {
|
|
|
32379
32631
|
}
|
|
32380
32632
|
},
|
|
32381
32633
|
item.title
|
|
32382
|
-
), item.subtext && /* @__PURE__ */
|
|
32383
|
-
|
|
32634
|
+
), item.subtext && /* @__PURE__ */ React294.createElement(
|
|
32635
|
+
Text173,
|
|
32384
32636
|
{
|
|
32385
32637
|
size: "xs",
|
|
32386
32638
|
truncate: true,
|
|
@@ -32393,7 +32645,7 @@ function PaletteItem({ item, isSelected, onClick, id }) {
|
|
|
32393
32645
|
);
|
|
32394
32646
|
}
|
|
32395
32647
|
function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
32396
|
-
const groupedItems =
|
|
32648
|
+
const groupedItems = useMemo122(() => {
|
|
32397
32649
|
const groups = [];
|
|
32398
32650
|
let currentGroup;
|
|
32399
32651
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -32413,8 +32665,8 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32413
32665
|
[onItemClick]
|
|
32414
32666
|
);
|
|
32415
32667
|
if (loadingState === "loading-initial") {
|
|
32416
|
-
return /* @__PURE__ */
|
|
32417
|
-
|
|
32668
|
+
return /* @__PURE__ */ React294.createElement(
|
|
32669
|
+
Box62,
|
|
32418
32670
|
{
|
|
32419
32671
|
style: {
|
|
32420
32672
|
width: 330,
|
|
@@ -32425,11 +32677,11 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32425
32677
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.2)"
|
|
32426
32678
|
}
|
|
32427
32679
|
},
|
|
32428
|
-
/* @__PURE__ */
|
|
32680
|
+
/* @__PURE__ */ React294.createElement(Text173, { size: "sm", style: { color: "var(--mantine-color-neutralColor-7) !important", textAlign: "center" } }, "Loading...")
|
|
32429
32681
|
);
|
|
32430
32682
|
}
|
|
32431
|
-
return /* @__PURE__ */
|
|
32432
|
-
|
|
32683
|
+
return /* @__PURE__ */ React294.createElement(
|
|
32684
|
+
Box62,
|
|
32433
32685
|
{
|
|
32434
32686
|
id: "bn-suggestion-menu",
|
|
32435
32687
|
role: "listbox",
|
|
@@ -32444,8 +32696,8 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32444
32696
|
padding: "6px 0"
|
|
32445
32697
|
}
|
|
32446
32698
|
},
|
|
32447
|
-
/* @__PURE__ */
|
|
32448
|
-
|
|
32699
|
+
/* @__PURE__ */ React294.createElement(
|
|
32700
|
+
Box62,
|
|
32449
32701
|
{
|
|
32450
32702
|
style: {
|
|
32451
32703
|
maxHeight: 338,
|
|
@@ -32455,8 +32707,8 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32455
32707
|
msOverflowStyle: "none"
|
|
32456
32708
|
}
|
|
32457
32709
|
},
|
|
32458
|
-
groupedItems.map((group) => /* @__PURE__ */
|
|
32459
|
-
|
|
32710
|
+
groupedItems.map((group) => /* @__PURE__ */ React294.createElement(React294.Fragment, { key: group.label }, /* @__PURE__ */ React294.createElement(
|
|
32711
|
+
Text173,
|
|
32460
32712
|
{
|
|
32461
32713
|
size: "xs",
|
|
32462
32714
|
fw: 600,
|
|
@@ -32469,7 +32721,7 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32469
32721
|
}
|
|
32470
32722
|
},
|
|
32471
32723
|
group.label
|
|
32472
|
-
), group.items.map(({ item, globalIndex }) => /* @__PURE__ */
|
|
32724
|
+
), group.items.map(({ item, globalIndex }) => /* @__PURE__ */ React294.createElement(
|
|
32473
32725
|
PaletteItem,
|
|
32474
32726
|
{
|
|
32475
32727
|
key: `${item.title}-${globalIndex}`,
|
|
@@ -32479,8 +32731,8 @@ function CommandPalette({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
32479
32731
|
id: `bn-suggestion-menu-item-${globalIndex}`
|
|
32480
32732
|
}
|
|
32481
32733
|
)))),
|
|
32482
|
-
items.length === 0 && (loadingState === "loaded" || loadingState === "loading") && /* @__PURE__ */
|
|
32483
|
-
|
|
32734
|
+
items.length === 0 && (loadingState === "loaded" || loadingState === "loading") && /* @__PURE__ */ React294.createElement(
|
|
32735
|
+
Text173,
|
|
32484
32736
|
{
|
|
32485
32737
|
size: "sm",
|
|
32486
32738
|
style: {
|
|
@@ -32507,17 +32759,17 @@ import {
|
|
|
32507
32759
|
IconPilcrow,
|
|
32508
32760
|
IconCode as IconCode4,
|
|
32509
32761
|
IconTable as IconTable2,
|
|
32510
|
-
IconPhoto as
|
|
32511
|
-
IconVideo,
|
|
32762
|
+
IconPhoto as IconPhoto6,
|
|
32763
|
+
IconVideo as IconVideo2,
|
|
32512
32764
|
IconVolume,
|
|
32513
|
-
IconFile as
|
|
32765
|
+
IconFile as IconFile6,
|
|
32514
32766
|
IconMoodSmile as IconMoodSmile2,
|
|
32515
32767
|
IconPageBreak
|
|
32516
32768
|
} from "@tabler/icons-react";
|
|
32517
32769
|
|
|
32518
32770
|
// src/mantine/components/PanelContent.tsx
|
|
32519
|
-
import
|
|
32520
|
-
import { Box as
|
|
32771
|
+
import React295 from "react";
|
|
32772
|
+
import { Box as Box63 } from "@mantine/core";
|
|
32521
32773
|
var panelStyles = {
|
|
32522
32774
|
light: {
|
|
32523
32775
|
backgroundColor: "#ffffff",
|
|
@@ -32546,8 +32798,8 @@ function PanelContent({ theme }) {
|
|
|
32546
32798
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
32547
32799
|
const isOpen = activePanel !== null;
|
|
32548
32800
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
32549
|
-
return /* @__PURE__ */
|
|
32550
|
-
|
|
32801
|
+
return /* @__PURE__ */ React295.createElement(
|
|
32802
|
+
Box63,
|
|
32551
32803
|
{
|
|
32552
32804
|
pos: "sticky",
|
|
32553
32805
|
right: 0,
|
|
@@ -32566,9 +32818,9 @@ function PanelContent({ theme }) {
|
|
|
32566
32818
|
}
|
|
32567
32819
|
|
|
32568
32820
|
// src/mantine/components/CoverImage.tsx
|
|
32569
|
-
import
|
|
32570
|
-
import { Box as
|
|
32571
|
-
import { IconMoodSmile, IconPhoto as
|
|
32821
|
+
import React300, { useState as useState139, useRef as useRef30, useEffect as useEffect112, useMemo as useMemo125 } from "react";
|
|
32822
|
+
import { Box as Box67, Group as Group111 } from "@mantine/core";
|
|
32823
|
+
import { IconMoodSmile, IconPhoto as IconPhoto5, IconSettings as IconSettings22, IconArrowsMove, IconTrash as IconTrash11, IconRefresh as IconRefresh6 } from "@tabler/icons-react";
|
|
32572
32824
|
|
|
32573
32825
|
// src/core/lib/imageTransform.ts
|
|
32574
32826
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -32701,12 +32953,12 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
32701
32953
|
}
|
|
32702
32954
|
|
|
32703
32955
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
32704
|
-
import
|
|
32705
|
-
import { UnstyledButton as
|
|
32956
|
+
import React296, { forwardRef, useState as useState136 } from "react";
|
|
32957
|
+
import { UnstyledButton as UnstyledButton7, Group as Group108, Text as Text174 } from "@mantine/core";
|
|
32706
32958
|
var CoverImageButton = forwardRef(function CoverImageButton2({ isActive = false, onClick, icon: icon2, children, style }, ref) {
|
|
32707
|
-
const [hovered, setHovered] =
|
|
32708
|
-
return /* @__PURE__ */
|
|
32709
|
-
|
|
32959
|
+
const [hovered, setHovered] = useState136(false);
|
|
32960
|
+
return /* @__PURE__ */ React296.createElement(
|
|
32961
|
+
UnstyledButton7,
|
|
32710
32962
|
{
|
|
32711
32963
|
ref,
|
|
32712
32964
|
onClick,
|
|
@@ -32721,7 +32973,7 @@ var CoverImageButton = forwardRef(function CoverImageButton2({ isActive = false,
|
|
|
32721
32973
|
...style
|
|
32722
32974
|
}
|
|
32723
32975
|
},
|
|
32724
|
-
/* @__PURE__ */
|
|
32976
|
+
/* @__PURE__ */ React296.createElement(Group108, { gap: 4, wrap: "nowrap" }, icon2 && /* @__PURE__ */ React296.createElement(
|
|
32725
32977
|
"span",
|
|
32726
32978
|
{
|
|
32727
32979
|
style: {
|
|
@@ -32731,8 +32983,8 @@ var CoverImageButton = forwardRef(function CoverImageButton2({ isActive = false,
|
|
|
32731
32983
|
}
|
|
32732
32984
|
},
|
|
32733
32985
|
icon2
|
|
32734
|
-
), /* @__PURE__ */
|
|
32735
|
-
|
|
32986
|
+
), /* @__PURE__ */ React296.createElement(
|
|
32987
|
+
Text174,
|
|
32736
32988
|
{
|
|
32737
32989
|
fz: 12,
|
|
32738
32990
|
style: {
|
|
@@ -32746,8 +32998,8 @@ var CoverImageButton = forwardRef(function CoverImageButton2({ isActive = false,
|
|
|
32746
32998
|
});
|
|
32747
32999
|
|
|
32748
33000
|
// src/mantine/components/Base/BaseIconPicker.tsx
|
|
32749
|
-
import
|
|
32750
|
-
import { TextInput as TextInput7, Tabs as Tabs4, Box as
|
|
33001
|
+
import React297, { useState as useState137, useMemo as useMemo123, useEffect as useEffect110 } from "react";
|
|
33002
|
+
import { TextInput as TextInput7, Tabs as Tabs4, Box as Box64, Stack as Stack200, UnstyledButton as UnstyledButton8, Text as Text175, Center as Center15, ScrollArea as ScrollArea9, Group as Group109, Popover as Popover6 } from "@mantine/core";
|
|
32751
33003
|
import * as TablerIcons2 from "@tabler/icons-react";
|
|
32752
33004
|
import { IconSearch as IconSearch7, IconX as IconX14, IconChevronLeft, IconChevronRight as IconChevronRight13 } from "@tabler/icons-react";
|
|
32753
33005
|
|
|
@@ -32779,14 +33031,14 @@ var localStorageService = {
|
|
|
32779
33031
|
var iconsKey = "editor_recent_icons";
|
|
32780
33032
|
var ICONS_PER_PAGE = 500;
|
|
32781
33033
|
function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove, children, currentIcon }) {
|
|
32782
|
-
const [searchQuery, setSearchQuery] =
|
|
32783
|
-
const [activeTab, setActiveTab] =
|
|
32784
|
-
const [currentPage, setCurrentPage] =
|
|
32785
|
-
const allIcons =
|
|
33034
|
+
const [searchQuery, setSearchQuery] = useState137("");
|
|
33035
|
+
const [activeTab, setActiveTab] = useState137("icons");
|
|
33036
|
+
const [currentPage, setCurrentPage] = useState137(1);
|
|
33037
|
+
const allIcons = useMemo123(() => {
|
|
32786
33038
|
const iconEntries = Object.entries(TablerIcons2).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
|
|
32787
33039
|
return iconEntries;
|
|
32788
33040
|
}, []);
|
|
32789
|
-
const filteredIcons =
|
|
33041
|
+
const filteredIcons = useMemo123(() => {
|
|
32790
33042
|
if (!searchQuery) return allIcons;
|
|
32791
33043
|
const query = searchQuery.toLowerCase();
|
|
32792
33044
|
return allIcons.filter(([name]) => name.toLowerCase().includes(query));
|
|
@@ -32794,13 +33046,13 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32794
33046
|
useEffect110(() => {
|
|
32795
33047
|
setCurrentPage(1);
|
|
32796
33048
|
}, [searchQuery]);
|
|
32797
|
-
const paginatedIcons =
|
|
33049
|
+
const paginatedIcons = useMemo123(() => {
|
|
32798
33050
|
const startIndex = (currentPage - 1) * ICONS_PER_PAGE;
|
|
32799
33051
|
const endIndex = startIndex + ICONS_PER_PAGE;
|
|
32800
33052
|
return filteredIcons.slice(startIndex, endIndex);
|
|
32801
33053
|
}, [filteredIcons, currentPage]);
|
|
32802
33054
|
const totalPages = Math.ceil(filteredIcons.length / ICONS_PER_PAGE);
|
|
32803
|
-
const recentIcons =
|
|
33055
|
+
const recentIcons = useMemo123(() => {
|
|
32804
33056
|
const recentIconNames = localStorageService.get(iconsKey);
|
|
32805
33057
|
if (!recentIconNames || recentIconNames.length === 0) return [];
|
|
32806
33058
|
return recentIconNames.slice(0, 24).map((iconName) => allIcons.find(([name]) => name === iconName)).filter((entry) => entry !== void 0);
|
|
@@ -32815,10 +33067,10 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32815
33067
|
};
|
|
32816
33068
|
const renderIconGrid = (icons) => {
|
|
32817
33069
|
if (icons.length === 0) {
|
|
32818
|
-
return /* @__PURE__ */
|
|
33070
|
+
return /* @__PURE__ */ React297.createElement(Center15, { py: "xl" }, /* @__PURE__ */ React297.createElement(Text175, { c: "dimmed", size: "sm" }, "No icons found"));
|
|
32819
33071
|
}
|
|
32820
|
-
return /* @__PURE__ */
|
|
32821
|
-
|
|
33072
|
+
return /* @__PURE__ */ React297.createElement(
|
|
33073
|
+
Box64,
|
|
32822
33074
|
{
|
|
32823
33075
|
style: {
|
|
32824
33076
|
display: "grid",
|
|
@@ -32829,8 +33081,8 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32829
33081
|
},
|
|
32830
33082
|
icons.map(([name, IconComponent]) => {
|
|
32831
33083
|
const isSelected = currentIcon === name.replace("Icon", "").replace(/([A-Z])/g, "-$1").toLowerCase().slice(1);
|
|
32832
|
-
return /* @__PURE__ */
|
|
32833
|
-
|
|
33084
|
+
return /* @__PURE__ */ React297.createElement(
|
|
33085
|
+
UnstyledButton8,
|
|
32834
33086
|
{
|
|
32835
33087
|
key: name,
|
|
32836
33088
|
onClick: () => handleIconClick(name),
|
|
@@ -32855,12 +33107,12 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32855
33107
|
}
|
|
32856
33108
|
}
|
|
32857
33109
|
},
|
|
32858
|
-
/* @__PURE__ */
|
|
33110
|
+
/* @__PURE__ */ React297.createElement(IconComponent, { size: 24, stroke: 1.5, style: { color: "var(--mantine-color-neutralColor-8) !important" } })
|
|
32859
33111
|
);
|
|
32860
33112
|
})
|
|
32861
33113
|
);
|
|
32862
33114
|
};
|
|
32863
|
-
return /* @__PURE__ */
|
|
33115
|
+
return /* @__PURE__ */ React297.createElement(Popover6, { opened, onClose, position: "right", width: 500, shadow: "xl" }, /* @__PURE__ */ React297.createElement(Popover6.Target, null, children), /* @__PURE__ */ React297.createElement(
|
|
32864
33116
|
Popover6.Dropdown,
|
|
32865
33117
|
{
|
|
32866
33118
|
style: {
|
|
@@ -32870,8 +33122,8 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32870
33122
|
},
|
|
32871
33123
|
p: 0
|
|
32872
33124
|
},
|
|
32873
|
-
onRemove && /* @__PURE__ */
|
|
32874
|
-
|
|
33125
|
+
onRemove && /* @__PURE__ */ React297.createElement(
|
|
33126
|
+
UnstyledButton8,
|
|
32875
33127
|
{
|
|
32876
33128
|
onClick: () => {
|
|
32877
33129
|
onRemove();
|
|
@@ -32888,17 +33140,17 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32888
33140
|
transition: "background 0.15s ease"
|
|
32889
33141
|
}
|
|
32890
33142
|
},
|
|
32891
|
-
/* @__PURE__ */
|
|
33143
|
+
/* @__PURE__ */ React297.createElement(Group109, { gap: 4, wrap: "nowrap" }, /* @__PURE__ */ React297.createElement(IconX14, { size: 14 }), /* @__PURE__ */ React297.createElement(Text175, { fz: 12, style: { color: "var(--mantine-color-neutralColor-7) !important", whiteSpace: "nowrap" } }, "Remove"))
|
|
32892
33144
|
),
|
|
32893
|
-
/* @__PURE__ */
|
|
33145
|
+
/* @__PURE__ */ React297.createElement(Stack200, { gap: "md", p: "md" }, /* @__PURE__ */ React297.createElement(Tabs4, { value: activeTab, onChange: setActiveTab, variant: "pills" }, /* @__PURE__ */ React297.createElement(Tabs4.List, null, /* @__PURE__ */ React297.createElement(Tabs4.Tab, { value: "icons" }, "Icons"), /* @__PURE__ */ React297.createElement(Tabs4.Tab, { value: "upload" }, "Upload")), /* @__PURE__ */ React297.createElement(Tabs4.Panel, { value: "icons", pt: "md" }, /* @__PURE__ */ React297.createElement(
|
|
32894
33146
|
TextInput7,
|
|
32895
33147
|
{
|
|
32896
33148
|
mb: "md",
|
|
32897
33149
|
placeholder: "Filter",
|
|
32898
|
-
leftSection: /* @__PURE__ */
|
|
33150
|
+
leftSection: /* @__PURE__ */ React297.createElement(IconSearch7, { size: 18 }),
|
|
32899
33151
|
value: searchQuery,
|
|
32900
33152
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
32901
|
-
rightSection: searchQuery && /* @__PURE__ */
|
|
33153
|
+
rightSection: searchQuery && /* @__PURE__ */ React297.createElement(UnstyledButton8, { onClick: () => setSearchQuery("") }, /* @__PURE__ */ React297.createElement(IconX14, { size: 18 })),
|
|
32902
33154
|
style: { flex: 1 },
|
|
32903
33155
|
styles: {
|
|
32904
33156
|
input: {
|
|
@@ -32908,26 +33160,26 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, onRemove
|
|
|
32908
33160
|
}
|
|
32909
33161
|
}
|
|
32910
33162
|
}
|
|
32911
|
-
), !searchQuery && /* @__PURE__ */
|
|
33163
|
+
), !searchQuery && /* @__PURE__ */ React297.createElement(Box64, { mb: "md" }, /* @__PURE__ */ React297.createElement(Text175, { size: "sm", fw: 500, mb: "xs", px: "xs" }, "Recent"), /* @__PURE__ */ React297.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 60 }, renderIconGrid(recentIcons))), /* @__PURE__ */ React297.createElement(Box64, null, /* @__PURE__ */ React297.createElement(Group109, { justify: "space-between", mb: "xs", px: "xs" }, /* @__PURE__ */ React297.createElement(Text175, { size: "sm", fw: 500 }, searchQuery ? "Results" : "Icons"), totalPages > 1 && /* @__PURE__ */ React297.createElement(Group109, { gap: "xs" }, /* @__PURE__ */ React297.createElement(Text175, { size: "xs", c: "dimmed" }, "Page ", currentPage, " of ", totalPages, " (", filteredIcons.length, " total)"), /* @__PURE__ */ React297.createElement(BaseButton, { size: "xs", onClick: () => setCurrentPage((p) => Math.max(1, p - 1)), disabled: currentPage === 1, leftSection: /* @__PURE__ */ React297.createElement(IconChevronLeft, { size: 14 }) }, "Prev"), /* @__PURE__ */ React297.createElement(
|
|
32912
33164
|
BaseButton,
|
|
32913
33165
|
{
|
|
32914
33166
|
size: "xs",
|
|
32915
33167
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
32916
33168
|
disabled: currentPage === totalPages,
|
|
32917
|
-
leftSection: /* @__PURE__ */
|
|
33169
|
+
leftSection: /* @__PURE__ */ React297.createElement(IconChevronRight13, { size: 14 })
|
|
32918
33170
|
},
|
|
32919
33171
|
"Next"
|
|
32920
|
-
))), /* @__PURE__ */
|
|
33172
|
+
))), /* @__PURE__ */ React297.createElement(ScrollArea9.Autosize, { scrollbarSize: 0, mah: 200 }, renderIconGrid(paginatedIcons)))), /* @__PURE__ */ React297.createElement(Tabs4.Panel, { value: "upload", pt: "md" }, /* @__PURE__ */ React297.createElement(Center15, { py: "xl" }, /* @__PURE__ */ React297.createElement(Stack200, { align: "center", gap: "md" }, /* @__PURE__ */ React297.createElement(Text175, { size: "sm", c: "dimmed", ta: "center" }, "Upload a custom icon image", /* @__PURE__ */ React297.createElement("br", null), "(PNG, JPG, SVG)"), /* @__PURE__ */ React297.createElement(CoverImageButton, { onClick: onUploadClick }, "Choose File"))))))
|
|
32921
33173
|
));
|
|
32922
33174
|
}
|
|
32923
33175
|
|
|
32924
33176
|
// src/mantine/components/Base/PageIcon.tsx
|
|
32925
|
-
import
|
|
32926
|
-
import { Center as
|
|
33177
|
+
import React298, { useMemo as useMemo124 } from "react";
|
|
33178
|
+
import { Center as Center16, Box as Box65 } from "@mantine/core";
|
|
32927
33179
|
import * as TablerIcons3 from "@tabler/icons-react";
|
|
32928
33180
|
function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
32929
33181
|
const isIconName = src && !src.startsWith("http");
|
|
32930
|
-
const IconComponent =
|
|
33182
|
+
const IconComponent = useMemo124(() => {
|
|
32931
33183
|
if (!isIconName || !src) return null;
|
|
32932
33184
|
const iconComponent = TablerIcons3[src];
|
|
32933
33185
|
if (iconComponent) {
|
|
@@ -32935,10 +33187,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
32935
33187
|
}
|
|
32936
33188
|
return null;
|
|
32937
33189
|
}, [isIconName, src]);
|
|
32938
|
-
const Container = useCenter ?
|
|
33190
|
+
const Container = useCenter ? Center16 : Box65;
|
|
32939
33191
|
if (!src) return null;
|
|
32940
33192
|
if (IconComponent) {
|
|
32941
|
-
return /* @__PURE__ */
|
|
33193
|
+
return /* @__PURE__ */ React298.createElement(
|
|
32942
33194
|
Container,
|
|
32943
33195
|
{
|
|
32944
33196
|
style: {
|
|
@@ -32950,10 +33202,10 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
32950
33202
|
...style
|
|
32951
33203
|
}
|
|
32952
33204
|
},
|
|
32953
|
-
/* @__PURE__ */
|
|
33205
|
+
/* @__PURE__ */ React298.createElement(IconComponent, { size: iconSize, stroke: 1.5, style: { color: "var(--mantine-color-neutralColor-8) !important" } })
|
|
32954
33206
|
);
|
|
32955
33207
|
}
|
|
32956
|
-
return /* @__PURE__ */
|
|
33208
|
+
return /* @__PURE__ */ React298.createElement(
|
|
32957
33209
|
"img",
|
|
32958
33210
|
{
|
|
32959
33211
|
src,
|
|
@@ -32974,13 +33226,13 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
|
|
|
32974
33226
|
import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
|
|
32975
33227
|
|
|
32976
33228
|
// src/mantine/components/FlowSettingsPanel.tsx
|
|
32977
|
-
import
|
|
32978
|
-
import { Stack as
|
|
33229
|
+
import React299, { useState as useState138, useEffect as useEffect111, useCallback as useCallback110 } from "react";
|
|
33230
|
+
import { Stack as Stack201, Group as Group110, Button as Button56, ActionIcon as ActionIcon38, Text as Text176, Box as Box66 } from "@mantine/core";
|
|
32979
33231
|
import { IconPlus as IconPlus10, IconTrash as IconTrash10 } from "@tabler/icons-react";
|
|
32980
33232
|
var SYSTEM_KEYS = /* @__PURE__ */ new Set(["@context", "_type", "schema_version", "doc_id", "title", "createdAt", "createdBy", "flowOwnerDid"]);
|
|
32981
33233
|
var FlowSettingsPanel = ({ editor }) => {
|
|
32982
33234
|
const { closePanel } = usePanelStore();
|
|
32983
|
-
const [rows, setRows] =
|
|
33235
|
+
const [rows, setRows] = useState138([]);
|
|
32984
33236
|
const loadSettings = useCallback110(() => {
|
|
32985
33237
|
const metadata = editor.getFlowMetadata?.();
|
|
32986
33238
|
if (!metadata) return;
|
|
@@ -33041,21 +33293,21 @@ var FlowSettingsPanel = ({ editor }) => {
|
|
|
33041
33293
|
},
|
|
33042
33294
|
[editor]
|
|
33043
33295
|
);
|
|
33044
|
-
const subtitle = /* @__PURE__ */
|
|
33045
|
-
return /* @__PURE__ */
|
|
33296
|
+
const subtitle = /* @__PURE__ */ React299.createElement(Box66, { px: 40, mb: "md" }, /* @__PURE__ */ React299.createElement(Text176, { size: "sm", c: "dimmed" }, "Add key-value settings for this flow. These are available to oracles and action blocks at runtime."));
|
|
33297
|
+
return /* @__PURE__ */ React299.createElement(BaseRightPanelLayout, { title: "Flow Details", onClose: closePanel, isTemplate: true, captionContent: subtitle }, /* @__PURE__ */ React299.createElement(Stack201, { gap: "lg" }, rows.map((row, index) => /* @__PURE__ */ React299.createElement(Stack201, { key: index, gap: "xs" }, /* @__PURE__ */ React299.createElement(Group110, { gap: "xs", align: "center", wrap: "nowrap" }, /* @__PURE__ */ React299.createElement(BaseTextInput, { placeholder: "Key (e.g. protocolDid)", value: row.key, onChange: (e) => handleKeyChange(index, e.currentTarget.value), style: { flex: 1 } }), /* @__PURE__ */ React299.createElement(ActionIcon38, { variant: "subtle", color: "red", onClick: () => handleDelete(index), size: "lg" }, /* @__PURE__ */ React299.createElement(IconTrash10, { size: 16 }))), /* @__PURE__ */ React299.createElement(BaseTextArea, { placeholder: "Value", value: row.value, onChange: (e) => handleValueChange(index, e.currentTarget.value), minRows: 1, maxRows: 8 }))), /* @__PURE__ */ React299.createElement(Button56, { variant: "subtle", leftSection: /* @__PURE__ */ React299.createElement(IconPlus10, { size: 16 }), onClick: handleAdd, size: "sm" }, "Add detail")));
|
|
33046
33298
|
};
|
|
33047
33299
|
|
|
33048
33300
|
// src/mantine/components/CoverImage.tsx
|
|
33049
33301
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
33050
33302
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
33051
|
-
const [isHovering, setIsHovering] =
|
|
33052
|
-
const [isRepositioning, setIsRepositioning] =
|
|
33053
|
-
const [coverPosition, setCoverPosition] =
|
|
33303
|
+
const [isHovering, setIsHovering] = useState139(false);
|
|
33304
|
+
const [isRepositioning, setIsRepositioning] = useState139(false);
|
|
33305
|
+
const [coverPosition, setCoverPosition] = useState139(() => editor?.getPageMetadata?.()?.coverPosition ?? 50);
|
|
33054
33306
|
const coverFileInputRef = useRef30(null);
|
|
33055
33307
|
const logoFileInputRef = useRef30(null);
|
|
33056
33308
|
const [opened, { open, close }] = useDisclosure7(false);
|
|
33057
|
-
const [metadata, setMetadata] =
|
|
33058
|
-
const settingsPanelContent =
|
|
33309
|
+
const [metadata, setMetadata] = useState139(() => editor?.getPageMetadata?.() || null);
|
|
33310
|
+
const settingsPanelContent = useMemo125(() => editor ? /* @__PURE__ */ React300.createElement(FlowSettingsPanel, { editor }) : null, [editor]);
|
|
33059
33311
|
const { open: openSettings } = usePanel("flow-settings-panel", settingsPanelContent);
|
|
33060
33312
|
useEffect112(() => {
|
|
33061
33313
|
if (!editor?._metadataManager) {
|
|
@@ -33145,8 +33397,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33145
33397
|
return null;
|
|
33146
33398
|
}
|
|
33147
33399
|
if (!hasCover) {
|
|
33148
|
-
return /* @__PURE__ */
|
|
33149
|
-
|
|
33400
|
+
return /* @__PURE__ */ React300.createElement(
|
|
33401
|
+
Box67,
|
|
33150
33402
|
{
|
|
33151
33403
|
style: {
|
|
33152
33404
|
position: "relative",
|
|
@@ -33157,8 +33409,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33157
33409
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
33158
33410
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
33159
33411
|
},
|
|
33160
|
-
/* @__PURE__ */
|
|
33161
|
-
|
|
33412
|
+
/* @__PURE__ */ React300.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", minHeight: "inherit" } }, /* @__PURE__ */ React300.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React300.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), logoSrc && /* @__PURE__ */ React300.createElement(
|
|
33413
|
+
Box67,
|
|
33162
33414
|
{
|
|
33163
33415
|
style: {
|
|
33164
33416
|
position: "relative",
|
|
@@ -33170,8 +33422,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33170
33422
|
zIndex: 11
|
|
33171
33423
|
}
|
|
33172
33424
|
},
|
|
33173
|
-
/* @__PURE__ */
|
|
33174
|
-
editable && /* @__PURE__ */
|
|
33425
|
+
/* @__PURE__ */ React300.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
|
|
33426
|
+
editable && /* @__PURE__ */ React300.createElement(
|
|
33175
33427
|
BaseIconPicker,
|
|
33176
33428
|
{
|
|
33177
33429
|
opened,
|
|
@@ -33181,8 +33433,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33181
33433
|
onUploadClick: () => logoFileInputRef.current?.click(),
|
|
33182
33434
|
onRemove: handleRemoveLogo
|
|
33183
33435
|
},
|
|
33184
|
-
/* @__PURE__ */
|
|
33185
|
-
|
|
33436
|
+
/* @__PURE__ */ React300.createElement(
|
|
33437
|
+
Box67,
|
|
33186
33438
|
{
|
|
33187
33439
|
onClick: open,
|
|
33188
33440
|
style: {
|
|
@@ -33194,7 +33446,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33194
33446
|
}
|
|
33195
33447
|
)
|
|
33196
33448
|
)
|
|
33197
|
-
), editable && (isHovering || opened) && /* @__PURE__ */
|
|
33449
|
+
), editable && (isHovering || opened) && /* @__PURE__ */ React300.createElement(Group111, { gap: 4, style: { position: "absolute", bottom: hasLogo ? -18 : 0, left: 0, zIndex: 10 } }, !logoSrc && /* @__PURE__ */ React300.createElement(
|
|
33198
33450
|
BaseIconPicker,
|
|
33199
33451
|
{
|
|
33200
33452
|
opened,
|
|
@@ -33203,12 +33455,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33203
33455
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
33204
33456
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
33205
33457
|
},
|
|
33206
|
-
/* @__PURE__ */
|
|
33207
|
-
), /* @__PURE__ */
|
|
33458
|
+
/* @__PURE__ */ React300.createElement(CoverImageButton, { onClick: open, icon: /* @__PURE__ */ React300.createElement(IconMoodSmile, { size: 14 }) }, "Add icon")
|
|
33459
|
+
), /* @__PURE__ */ React300.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click(), icon: /* @__PURE__ */ React300.createElement(IconPhoto5, { size: 14 }) }, "Add cover"), /* @__PURE__ */ React300.createElement(CoverImageButton, { onClick: openSettings, icon: /* @__PURE__ */ React300.createElement(IconSettings22, { size: 14 }) }, "Details")))
|
|
33208
33460
|
);
|
|
33209
33461
|
}
|
|
33210
|
-
return /* @__PURE__ */
|
|
33211
|
-
|
|
33462
|
+
return /* @__PURE__ */ React300.createElement(
|
|
33463
|
+
Box67,
|
|
33212
33464
|
{
|
|
33213
33465
|
style: {
|
|
33214
33466
|
position: "relative",
|
|
@@ -33235,7 +33487,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33235
33487
|
}
|
|
33236
33488
|
}
|
|
33237
33489
|
},
|
|
33238
|
-
/* @__PURE__ */
|
|
33490
|
+
/* @__PURE__ */ React300.createElement(
|
|
33239
33491
|
"img",
|
|
33240
33492
|
{
|
|
33241
33493
|
src: coverUrl,
|
|
@@ -33253,8 +33505,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33253
33505
|
}
|
|
33254
33506
|
}
|
|
33255
33507
|
),
|
|
33256
|
-
editable && isHovering && /* @__PURE__ */
|
|
33257
|
-
|
|
33508
|
+
editable && isHovering && /* @__PURE__ */ React300.createElement(
|
|
33509
|
+
Group111,
|
|
33258
33510
|
{
|
|
33259
33511
|
gap: "xs",
|
|
33260
33512
|
style: {
|
|
@@ -33264,8 +33516,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33264
33516
|
zIndex: 10
|
|
33265
33517
|
}
|
|
33266
33518
|
},
|
|
33267
|
-
/* @__PURE__ */
|
|
33268
|
-
/* @__PURE__ */
|
|
33519
|
+
/* @__PURE__ */ React300.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click(), icon: /* @__PURE__ */ React300.createElement(IconRefresh6, { size: 14 }) }, "Change cover"),
|
|
33520
|
+
/* @__PURE__ */ React300.createElement(
|
|
33269
33521
|
CoverImageButton,
|
|
33270
33522
|
{
|
|
33271
33523
|
onClick: () => {
|
|
@@ -33275,14 +33527,14 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33275
33527
|
setIsRepositioning(!isRepositioning);
|
|
33276
33528
|
},
|
|
33277
33529
|
isActive: isRepositioning,
|
|
33278
|
-
icon: /* @__PURE__ */
|
|
33530
|
+
icon: /* @__PURE__ */ React300.createElement(IconArrowsMove, { size: 14 })
|
|
33279
33531
|
},
|
|
33280
33532
|
isRepositioning ? "Done" : "Reposition"
|
|
33281
33533
|
),
|
|
33282
|
-
/* @__PURE__ */
|
|
33534
|
+
/* @__PURE__ */ React300.createElement(CoverImageButton, { onClick: handleRemoveCover, icon: /* @__PURE__ */ React300.createElement(IconTrash11, { size: 14 }) }, "Remove")
|
|
33283
33535
|
),
|
|
33284
|
-
/* @__PURE__ */
|
|
33285
|
-
|
|
33536
|
+
/* @__PURE__ */ React300.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: 0, right: 0, height: "70px" } }, /* @__PURE__ */ React300.createElement(
|
|
33537
|
+
Box67,
|
|
33286
33538
|
{
|
|
33287
33539
|
style: {
|
|
33288
33540
|
position: "absolute",
|
|
@@ -33293,7 +33545,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33293
33545
|
zIndex: 11
|
|
33294
33546
|
}
|
|
33295
33547
|
},
|
|
33296
|
-
logoSrc ? /* @__PURE__ */
|
|
33548
|
+
logoSrc ? /* @__PURE__ */ React300.createElement(React300.Fragment, null, /* @__PURE__ */ React300.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }), editable && /* @__PURE__ */ React300.createElement(
|
|
33297
33549
|
BaseIconPicker,
|
|
33298
33550
|
{
|
|
33299
33551
|
opened,
|
|
@@ -33303,8 +33555,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33303
33555
|
onUploadClick: () => logoFileInputRef.current?.click(),
|
|
33304
33556
|
onRemove: handleRemoveLogo
|
|
33305
33557
|
},
|
|
33306
|
-
/* @__PURE__ */
|
|
33307
|
-
|
|
33558
|
+
/* @__PURE__ */ React300.createElement(
|
|
33559
|
+
Box67,
|
|
33308
33560
|
{
|
|
33309
33561
|
onClick: open,
|
|
33310
33562
|
style: {
|
|
@@ -33315,7 +33567,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33315
33567
|
}
|
|
33316
33568
|
}
|
|
33317
33569
|
)
|
|
33318
|
-
)) : editable && isHovering && /* @__PURE__ */
|
|
33570
|
+
)) : editable && isHovering && /* @__PURE__ */ React300.createElement(
|
|
33319
33571
|
BaseIconPicker,
|
|
33320
33572
|
{
|
|
33321
33573
|
opened,
|
|
@@ -33324,11 +33576,11 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33324
33576
|
onSelectIcon: (name) => handleSelectLogoIcon(name),
|
|
33325
33577
|
onUploadClick: () => logoFileInputRef.current?.click()
|
|
33326
33578
|
},
|
|
33327
|
-
/* @__PURE__ */
|
|
33579
|
+
/* @__PURE__ */ React300.createElement(
|
|
33328
33580
|
CoverImageButton,
|
|
33329
33581
|
{
|
|
33330
33582
|
onClick: open,
|
|
33331
|
-
icon: /* @__PURE__ */
|
|
33583
|
+
icon: /* @__PURE__ */ React300.createElement(IconMoodSmile, { size: 14 }),
|
|
33332
33584
|
style: {
|
|
33333
33585
|
position: "absolute",
|
|
33334
33586
|
top: "50%",
|
|
@@ -33341,14 +33593,14 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
33341
33593
|
)
|
|
33342
33594
|
)
|
|
33343
33595
|
)),
|
|
33344
|
-
/* @__PURE__ */
|
|
33345
|
-
/* @__PURE__ */
|
|
33596
|
+
/* @__PURE__ */ React300.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
33597
|
+
/* @__PURE__ */ React300.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
33346
33598
|
);
|
|
33347
33599
|
}
|
|
33348
33600
|
|
|
33349
33601
|
// src/mantine/components/PageTitle.tsx
|
|
33350
|
-
import
|
|
33351
|
-
import { Box as
|
|
33602
|
+
import React301, { useState as useState140, useEffect as useEffect113, useRef as useRef31, useCallback as useCallback111 } from "react";
|
|
33603
|
+
import { Box as Box68 } from "@mantine/core";
|
|
33352
33604
|
var DEFAULT_TITLE = "New page";
|
|
33353
33605
|
function isUserTitle(name) {
|
|
33354
33606
|
if (!name) return "";
|
|
@@ -33363,8 +33615,8 @@ function cleanEmptyEditable(el) {
|
|
|
33363
33615
|
}
|
|
33364
33616
|
}
|
|
33365
33617
|
function PageTitle({ editor, editable }) {
|
|
33366
|
-
const [title, setTitle] =
|
|
33367
|
-
const [hasIcon, setHasIcon] =
|
|
33618
|
+
const [title, setTitle] = useState140("");
|
|
33619
|
+
const [hasIcon, setHasIcon] = useState140(false);
|
|
33368
33620
|
const titleRef = useRef31(null);
|
|
33369
33621
|
const isComposing = useRef31(false);
|
|
33370
33622
|
useEffect113(() => {
|
|
@@ -33460,8 +33712,8 @@ function PageTitle({ editor, editable }) {
|
|
|
33460
33712
|
const text = e.clipboardData.getData("text/plain").replace(/\n/g, " ");
|
|
33461
33713
|
document.execCommand("insertText", false, text);
|
|
33462
33714
|
}, []);
|
|
33463
|
-
return /* @__PURE__ */
|
|
33464
|
-
|
|
33715
|
+
return /* @__PURE__ */ React301.createElement(Box68, { maw: 900, mx: "auto", w: "100%" }, /* @__PURE__ */ React301.createElement(
|
|
33716
|
+
Box68,
|
|
33465
33717
|
{
|
|
33466
33718
|
ref: titleRef,
|
|
33467
33719
|
component: "div",
|
|
@@ -33517,8 +33769,8 @@ if (typeof document !== "undefined") {
|
|
|
33517
33769
|
}
|
|
33518
33770
|
|
|
33519
33771
|
// src/mantine/components/ExternalDropZone.tsx
|
|
33520
|
-
import
|
|
33521
|
-
import { Box as
|
|
33772
|
+
import React302, { useCallback as useCallback112, useEffect as useEffect114, useRef as useRef32, useState as useState141 } from "react";
|
|
33773
|
+
import { Box as Box69 } from "@mantine/core";
|
|
33522
33774
|
var SCROLL_ZONE_SIZE = 80;
|
|
33523
33775
|
var SCROLL_SPEED = 12;
|
|
33524
33776
|
var ExternalDropZone = ({
|
|
@@ -33531,9 +33783,9 @@ var ExternalDropZone = ({
|
|
|
33531
33783
|
children
|
|
33532
33784
|
}) => {
|
|
33533
33785
|
const containerRef = useRef32(null);
|
|
33534
|
-
const [isValidDrag, setIsValidDrag] =
|
|
33535
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
33536
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
33786
|
+
const [isValidDrag, setIsValidDrag] = useState141(false);
|
|
33787
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState141(false);
|
|
33788
|
+
const [indicatorStyle, setIndicatorStyle] = useState141({});
|
|
33537
33789
|
const dropPositionRef = useRef32(null);
|
|
33538
33790
|
const scrollAnimationRef = useRef32(null);
|
|
33539
33791
|
const scrollDirectionRef = useRef32(null);
|
|
@@ -33798,12 +34050,12 @@ var ExternalDropZone = ({
|
|
|
33798
34050
|
}
|
|
33799
34051
|
};
|
|
33800
34052
|
}, []);
|
|
33801
|
-
const indicatorWithPosition = dropIndicator &&
|
|
34053
|
+
const indicatorWithPosition = dropIndicator && React302.isValidElement(dropIndicator) ? React302.cloneElement(dropIndicator, {
|
|
33802
34054
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
33803
34055
|
}) : dropIndicator;
|
|
33804
34056
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
33805
|
-
return /* @__PURE__ */
|
|
33806
|
-
|
|
34057
|
+
return /* @__PURE__ */ React302.createElement(
|
|
34058
|
+
Box69,
|
|
33807
34059
|
{
|
|
33808
34060
|
ref: containerRef,
|
|
33809
34061
|
style: {
|
|
@@ -33818,8 +34070,8 @@ var ExternalDropZone = ({
|
|
|
33818
34070
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
33819
34071
|
},
|
|
33820
34072
|
children,
|
|
33821
|
-
isPlacementMode && /* @__PURE__ */
|
|
33822
|
-
|
|
34073
|
+
isPlacementMode && /* @__PURE__ */ React302.createElement(
|
|
34074
|
+
Box69,
|
|
33823
34075
|
{
|
|
33824
34076
|
style: {
|
|
33825
34077
|
position: "absolute",
|
|
@@ -33838,7 +34090,7 @@ var ExternalDropZone = ({
|
|
|
33838
34090
|
onWheel: handleOverlayWheel
|
|
33839
34091
|
}
|
|
33840
34092
|
),
|
|
33841
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
34093
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React302.createElement(Box69, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
33842
34094
|
);
|
|
33843
34095
|
};
|
|
33844
34096
|
|
|
@@ -33854,10 +34106,10 @@ var DEFAULT_ICON_MAP = {
|
|
|
33854
34106
|
Paragraph: icon(IconPilcrow),
|
|
33855
34107
|
"Code Block": icon(IconCode4),
|
|
33856
34108
|
Table: icon(IconTable2),
|
|
33857
|
-
Image: icon(
|
|
33858
|
-
Video: icon(
|
|
34109
|
+
Image: icon(IconPhoto6),
|
|
34110
|
+
Video: icon(IconVideo2),
|
|
33859
34111
|
Audio: icon(IconVolume),
|
|
33860
|
-
File: icon(
|
|
34112
|
+
File: icon(IconFile6),
|
|
33861
34113
|
Emoji: icon(IconMoodSmile2),
|
|
33862
34114
|
"Page Break": icon(IconPageBreak)
|
|
33863
34115
|
};
|
|
@@ -33880,7 +34132,7 @@ function IxoEditorContent({
|
|
|
33880
34132
|
}) {
|
|
33881
34133
|
const { activePanel } = usePanelStore();
|
|
33882
34134
|
const isPanelOpen = activePanel !== null;
|
|
33883
|
-
const editorContent = /* @__PURE__ */
|
|
34135
|
+
const editorContent = /* @__PURE__ */ React303.createElement(
|
|
33884
34136
|
BlockNoteView,
|
|
33885
34137
|
{
|
|
33886
34138
|
editor,
|
|
@@ -33895,7 +34147,7 @@ function IxoEditorContent({
|
|
|
33895
34147
|
onChange,
|
|
33896
34148
|
onSelectionChange
|
|
33897
34149
|
},
|
|
33898
|
-
config.slashMenu && /* @__PURE__ */
|
|
34150
|
+
config.slashMenu && /* @__PURE__ */ React303.createElement(
|
|
33899
34151
|
SuggestionMenuController,
|
|
33900
34152
|
{
|
|
33901
34153
|
triggerCharacter: "/",
|
|
@@ -33920,7 +34172,7 @@ function IxoEditorContent({
|
|
|
33920
34172
|
),
|
|
33921
34173
|
children
|
|
33922
34174
|
);
|
|
33923
|
-
return /* @__PURE__ */
|
|
34175
|
+
return /* @__PURE__ */ React303.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React303.createElement(
|
|
33924
34176
|
"div",
|
|
33925
34177
|
{
|
|
33926
34178
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -33929,9 +34181,9 @@ function IxoEditorContent({
|
|
|
33929
34181
|
transition: "width 0.2s ease"
|
|
33930
34182
|
}
|
|
33931
34183
|
},
|
|
33932
|
-
/* @__PURE__ */
|
|
33933
|
-
/* @__PURE__ */
|
|
33934
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
34184
|
+
/* @__PURE__ */ React303.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
34185
|
+
/* @__PURE__ */ React303.createElement(PageTitle, { editor, editable: isEditable }),
|
|
34186
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React303.createElement(
|
|
33935
34187
|
ExternalDropZone,
|
|
33936
34188
|
{
|
|
33937
34189
|
editor,
|
|
@@ -33944,7 +34196,7 @@ function IxoEditorContent({
|
|
|
33944
34196
|
},
|
|
33945
34197
|
editorContent
|
|
33946
34198
|
) : editorContent
|
|
33947
|
-
), isPanelVisible && /* @__PURE__ */
|
|
34199
|
+
), isPanelVisible && /* @__PURE__ */ React303.createElement(PanelContent, { theme: config.theme }));
|
|
33948
34200
|
}
|
|
33949
34201
|
function IxoEditor({
|
|
33950
34202
|
editor,
|
|
@@ -33985,7 +34237,7 @@ function IxoEditor({
|
|
|
33985
34237
|
tableHandles: true
|
|
33986
34238
|
};
|
|
33987
34239
|
const isEditable = editable;
|
|
33988
|
-
const editorContent = /* @__PURE__ */
|
|
34240
|
+
const editorContent = /* @__PURE__ */ React303.createElement(
|
|
33989
34241
|
BlocknoteProvider,
|
|
33990
34242
|
{
|
|
33991
34243
|
editor,
|
|
@@ -34000,7 +34252,7 @@ function IxoEditor({
|
|
|
34000
34252
|
connectedUsers,
|
|
34001
34253
|
awarenessInstance
|
|
34002
34254
|
},
|
|
34003
|
-
/* @__PURE__ */
|
|
34255
|
+
/* @__PURE__ */ React303.createElement(
|
|
34004
34256
|
IxoEditorContent,
|
|
34005
34257
|
{
|
|
34006
34258
|
isPanelVisible,
|
|
@@ -34022,13 +34274,13 @@ function IxoEditor({
|
|
|
34022
34274
|
)
|
|
34023
34275
|
);
|
|
34024
34276
|
if (mantineTheme) {
|
|
34025
|
-
return /* @__PURE__ */
|
|
34277
|
+
return /* @__PURE__ */ React303.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
34026
34278
|
}
|
|
34027
34279
|
return editorContent;
|
|
34028
34280
|
}
|
|
34029
34281
|
|
|
34030
34282
|
// src/mantine/components/DebugButton.tsx
|
|
34031
|
-
import
|
|
34283
|
+
import React304 from "react";
|
|
34032
34284
|
function DebugButton({ editor }) {
|
|
34033
34285
|
const yMapToObject = (map) => {
|
|
34034
34286
|
if (!map) return null;
|
|
@@ -34055,7 +34307,7 @@ function DebugButton({ editor }) {
|
|
|
34055
34307
|
const json = JSON.stringify(dump, null, 2);
|
|
34056
34308
|
console.log("Editor Debug Dump:\n" + json);
|
|
34057
34309
|
};
|
|
34058
|
-
return /* @__PURE__ */
|
|
34310
|
+
return /* @__PURE__ */ React304.createElement(
|
|
34059
34311
|
"button",
|
|
34060
34312
|
{
|
|
34061
34313
|
onClick: handleClick,
|
|
@@ -34081,7 +34333,7 @@ function DebugButton({ editor }) {
|
|
|
34081
34333
|
}
|
|
34082
34334
|
|
|
34083
34335
|
// src/mantine/components/PageHeader.tsx
|
|
34084
|
-
import
|
|
34336
|
+
import React305, { useState as useState142, useRef as useRef33, useEffect as useEffect115 } from "react";
|
|
34085
34337
|
function PageHeader({
|
|
34086
34338
|
title = "New page",
|
|
34087
34339
|
icon: icon2,
|
|
@@ -34093,8 +34345,8 @@ function PageHeader({
|
|
|
34093
34345
|
isFavorited = false,
|
|
34094
34346
|
menuItems = []
|
|
34095
34347
|
}) {
|
|
34096
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
34097
|
-
const [isPrivacyOpen, setIsPrivacyOpen] =
|
|
34348
|
+
const [isMenuOpen, setIsMenuOpen] = useState142(false);
|
|
34349
|
+
const [isPrivacyOpen, setIsPrivacyOpen] = useState142(false);
|
|
34098
34350
|
const menuRef = useRef33(null);
|
|
34099
34351
|
const privacyRef = useRef33(null);
|
|
34100
34352
|
useEffect115(() => {
|
|
@@ -34119,7 +34371,7 @@ function PageHeader({
|
|
|
34119
34371
|
setIsMenuOpen(false);
|
|
34120
34372
|
}
|
|
34121
34373
|
};
|
|
34122
|
-
return /* @__PURE__ */
|
|
34374
|
+
return /* @__PURE__ */ React305.createElement("div", { style: styles.container }, /* @__PURE__ */ React305.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React305.createElement("span", { style: styles.icon }, icon2 || "\u{1F4C4}"), /* @__PURE__ */ React305.createElement("span", { style: styles.title }, title), /* @__PURE__ */ React305.createElement("div", { style: styles.privacyContainer, ref: privacyRef }, /* @__PURE__ */ React305.createElement("button", { style: styles.privacyBadge, onClick: () => onPrivacyChange && setIsPrivacyOpen(!isPrivacyOpen) }, /* @__PURE__ */ React305.createElement("span", { style: styles.lockIcon }, isPrivate ? "\u{1F512}" : "\u{1F310}"), /* @__PURE__ */ React305.createElement("span", null, isPrivate ? "Private" : "Public"), onPrivacyChange && /* @__PURE__ */ React305.createElement("span", { style: styles.chevron }, "\u25BE")), isPrivacyOpen && onPrivacyChange && /* @__PURE__ */ React305.createElement("div", { style: styles.dropdown }, /* @__PURE__ */ React305.createElement(
|
|
34123
34375
|
"button",
|
|
34124
34376
|
{
|
|
34125
34377
|
style: {
|
|
@@ -34131,9 +34383,9 @@ function PageHeader({
|
|
|
34131
34383
|
setIsPrivacyOpen(false);
|
|
34132
34384
|
}
|
|
34133
34385
|
},
|
|
34134
|
-
/* @__PURE__ */
|
|
34135
|
-
/* @__PURE__ */
|
|
34136
|
-
), /* @__PURE__ */
|
|
34386
|
+
/* @__PURE__ */ React305.createElement("span", { style: styles.menuItemIcon }, "\u{1F512}"),
|
|
34387
|
+
/* @__PURE__ */ React305.createElement("span", null, "Private")
|
|
34388
|
+
), /* @__PURE__ */ React305.createElement(
|
|
34137
34389
|
"button",
|
|
34138
34390
|
{
|
|
34139
34391
|
style: {
|
|
@@ -34145,9 +34397,9 @@ function PageHeader({
|
|
|
34145
34397
|
setIsPrivacyOpen(false);
|
|
34146
34398
|
}
|
|
34147
34399
|
},
|
|
34148
|
-
/* @__PURE__ */
|
|
34149
|
-
/* @__PURE__ */
|
|
34150
|
-
)))), /* @__PURE__ */
|
|
34400
|
+
/* @__PURE__ */ React305.createElement("span", { style: styles.menuItemIcon }, "\u{1F310}"),
|
|
34401
|
+
/* @__PURE__ */ React305.createElement("span", null, "Public")
|
|
34402
|
+
)))), /* @__PURE__ */ React305.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React305.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React305.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React305.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React305.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React305.createElement("button", { style: styles.menuButton, onClick: () => setIsMenuOpen(!isMenuOpen), "aria-label": "Menu" }, /* @__PURE__ */ React305.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor" }, /* @__PURE__ */ React305.createElement("circle", { cx: "3", cy: "8", r: "1.5" }), /* @__PURE__ */ React305.createElement("circle", { cx: "8", cy: "8", r: "1.5" }), /* @__PURE__ */ React305.createElement("circle", { cx: "13", cy: "8", r: "1.5" }))), isMenuOpen && /* @__PURE__ */ React305.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React305.createElement(React305.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React305.createElement("div", { style: styles.divider }), /* @__PURE__ */ React305.createElement(
|
|
34151
34403
|
"button",
|
|
34152
34404
|
{
|
|
34153
34405
|
style: {
|
|
@@ -34157,8 +34409,8 @@ function PageHeader({
|
|
|
34157
34409
|
onClick: () => handleMenuItemClick(item),
|
|
34158
34410
|
disabled: item.disabled
|
|
34159
34411
|
},
|
|
34160
|
-
item.icon && /* @__PURE__ */
|
|
34161
|
-
/* @__PURE__ */
|
|
34412
|
+
item.icon && /* @__PURE__ */ React305.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
34413
|
+
/* @__PURE__ */ React305.createElement("span", null, item.label)
|
|
34162
34414
|
)))))));
|
|
34163
34415
|
}
|
|
34164
34416
|
var styles = {
|
|
@@ -34295,15 +34547,15 @@ var styles = {
|
|
|
34295
34547
|
};
|
|
34296
34548
|
|
|
34297
34549
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
34298
|
-
import
|
|
34299
|
-
import { Modal as
|
|
34550
|
+
import React306, { useState as useState143 } from "react";
|
|
34551
|
+
import { Modal as Modal4, Stack as Stack202, Text as Text177, TextInput as TextInput8, Button as Button57, Alert as Alert54, Group as Group112 } from "@mantine/core";
|
|
34300
34552
|
import { IconAlertCircle as IconAlertCircle20, IconCheck as IconCheck23, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
34301
34553
|
var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) => {
|
|
34302
|
-
const [pin, setPin] =
|
|
34303
|
-
const [confirmPin, setConfirmPin] =
|
|
34304
|
-
const [loading, setLoading] =
|
|
34305
|
-
const [error, setError] =
|
|
34306
|
-
const [success, setSuccess] =
|
|
34554
|
+
const [pin, setPin] = useState143("");
|
|
34555
|
+
const [confirmPin, setConfirmPin] = useState143("");
|
|
34556
|
+
const [loading, setLoading] = useState143(false);
|
|
34557
|
+
const [error, setError] = useState143(null);
|
|
34558
|
+
const [success, setSuccess] = useState143(false);
|
|
34307
34559
|
const handleSetup = async () => {
|
|
34308
34560
|
if (pin.length < 4) {
|
|
34309
34561
|
setError("PIN must be at least 4 characters");
|
|
@@ -34343,15 +34595,15 @@ var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) =
|
|
|
34343
34595
|
setSuccess(false);
|
|
34344
34596
|
}
|
|
34345
34597
|
};
|
|
34346
|
-
return /* @__PURE__ */
|
|
34347
|
-
|
|
34598
|
+
return /* @__PURE__ */ React306.createElement(
|
|
34599
|
+
Modal4,
|
|
34348
34600
|
{
|
|
34349
34601
|
opened,
|
|
34350
34602
|
onClose: handleClose,
|
|
34351
|
-
title: /* @__PURE__ */
|
|
34603
|
+
title: /* @__PURE__ */ React306.createElement(Group112, { gap: "xs" }, /* @__PURE__ */ React306.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React306.createElement(Text177, { fw: 600 }, "Entity Signing Setup")),
|
|
34352
34604
|
size: "md"
|
|
34353
34605
|
},
|
|
34354
|
-
/* @__PURE__ */
|
|
34606
|
+
/* @__PURE__ */ React306.createElement(Stack202, { gap: "md" }, success ? /* @__PURE__ */ React306.createElement(Alert54, { color: "green", icon: /* @__PURE__ */ React306.createElement(IconCheck23, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React306.createElement(React306.Fragment, null, /* @__PURE__ */ React306.createElement(Text177, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React306.createElement(Text177, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React306.createElement(Alert54, { color: "blue", variant: "light" }, /* @__PURE__ */ React306.createElement(Text177, { size: "sm" }, "This is a ", /* @__PURE__ */ React306.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React306.createElement(Stack202, { gap: "xs" }, /* @__PURE__ */ React306.createElement(Text177, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React306.createElement(Text177, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React306.createElement(Text177, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React306.createElement(Text177, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React306.createElement(
|
|
34355
34607
|
TextInput8,
|
|
34356
34608
|
{
|
|
34357
34609
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -34362,19 +34614,19 @@ var EntitySigningSetup = ({ opened, onClose, entityDid, entityName, onSetup }) =
|
|
|
34362
34614
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
34363
34615
|
disabled: loading
|
|
34364
34616
|
}
|
|
34365
|
-
), /* @__PURE__ */
|
|
34617
|
+
), /* @__PURE__ */ React306.createElement(TextInput8, { label: "Confirm PIN", type: "password", placeholder: "Confirm PIN", value: confirmPin, onChange: (e) => setConfirmPin(e.currentTarget.value), disabled: loading }), error && /* @__PURE__ */ React306.createElement(Alert54, { color: "red", icon: /* @__PURE__ */ React306.createElement(IconAlertCircle20, { size: 16 }) }, error), /* @__PURE__ */ React306.createElement(Group112, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React306.createElement(Button57, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React306.createElement(Button57, { onClick: handleSetup, loading, leftSection: /* @__PURE__ */ React306.createElement(IconKey2, { size: 16 }) }, "Setup Entity Signing"))))
|
|
34366
34618
|
);
|
|
34367
34619
|
};
|
|
34368
34620
|
|
|
34369
34621
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
34370
|
-
import
|
|
34371
|
-
import { Stack as
|
|
34622
|
+
import React307, { useState as useState144, useEffect as useEffect116, useMemo as useMemo126 } from "react";
|
|
34623
|
+
import { Stack as Stack203, Text as Text178, Paper as Paper19, Group as Group113, Badge as Badge46, Button as Button58, ActionIcon as ActionIcon39, Loader as Loader54, Alert as Alert55, Divider as Divider28 } from "@mantine/core";
|
|
34372
34624
|
import { IconPlus as IconPlus11, IconTrash as IconTrash12, IconShieldCheck as IconShieldCheck16, IconUser as IconUser14, IconRobot as IconRobot4, IconBuilding as IconBuilding2 } from "@tabler/icons-react";
|
|
34373
34625
|
var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission, onRevokePermission, getUserDisplayName }) => {
|
|
34374
|
-
const [delegations, setDelegations] =
|
|
34375
|
-
const [loading, setLoading] =
|
|
34376
|
-
const [revoking, setRevoking] =
|
|
34377
|
-
const rootDelegation =
|
|
34626
|
+
const [delegations, setDelegations] = useState144([]);
|
|
34627
|
+
const [loading, setLoading] = useState144(true);
|
|
34628
|
+
const [revoking, setRevoking] = useState144(null);
|
|
34629
|
+
const rootDelegation = useMemo126(() => {
|
|
34378
34630
|
if (editor.getUcanService) {
|
|
34379
34631
|
return editor.getUcanService()?.getRootDelegation() || null;
|
|
34380
34632
|
}
|
|
@@ -34422,11 +34674,11 @@ var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission,
|
|
|
34422
34674
|
const getIcon2 = (type) => {
|
|
34423
34675
|
switch (type) {
|
|
34424
34676
|
case "oracle":
|
|
34425
|
-
return /* @__PURE__ */
|
|
34677
|
+
return /* @__PURE__ */ React307.createElement(IconRobot4, { size: 16 });
|
|
34426
34678
|
case "entity":
|
|
34427
|
-
return /* @__PURE__ */
|
|
34679
|
+
return /* @__PURE__ */ React307.createElement(IconBuilding2, { size: 16 });
|
|
34428
34680
|
default:
|
|
34429
|
-
return /* @__PURE__ */
|
|
34681
|
+
return /* @__PURE__ */ React307.createElement(IconUser14, { size: 16 });
|
|
34430
34682
|
}
|
|
34431
34683
|
};
|
|
34432
34684
|
const formatCapabilities = (caps) => {
|
|
@@ -34445,31 +34697,31 @@ var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission,
|
|
|
34445
34697
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
34446
34698
|
return date.toLocaleDateString();
|
|
34447
34699
|
};
|
|
34448
|
-
return /* @__PURE__ */
|
|
34700
|
+
return /* @__PURE__ */ React307.createElement(Stack203, { gap: "md" }, /* @__PURE__ */ React307.createElement(Stack203, { gap: "xs" }, /* @__PURE__ */ React307.createElement(Text178, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React307.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React307.createElement(Group113, { gap: "xs" }, /* @__PURE__ */ React307.createElement(IconShieldCheck16, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React307.createElement(Stack203, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React307.createElement(Text178, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React307.createElement(Text178, { size: "xs", c: "dimmed" }, rootDelegation ? `Granted: ${new Date(rootDelegation.createdAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React307.createElement(Badge46, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React307.createElement(Divider28, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React307.createElement(Group113, { justify: "center", py: "xl" }, /* @__PURE__ */ React307.createElement(Loader54, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React307.createElement(Alert55, { color: "gray", variant: "light" }, /* @__PURE__ */ React307.createElement(Text178, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React307.createElement(Stack203, { gap: "xs" }, delegations.map(({ delegation, displayName, type }) => /* @__PURE__ */ React307.createElement(Paper19, { key: delegation.cid, p: "sm", withBorder: true }, /* @__PURE__ */ React307.createElement(Group113, { justify: "space-between" }, /* @__PURE__ */ React307.createElement(Group113, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React307.createElement(Stack203, { gap: 2 }, /* @__PURE__ */ React307.createElement(Text178, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React307.createElement(Text178, { size: "xs", c: "dimmed" }, formatCapabilities(delegation.capabilities)), /* @__PURE__ */ React307.createElement(Group113, { gap: "xs" }, /* @__PURE__ */ React307.createElement(Text178, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(delegation.expiration)), /* @__PURE__ */ React307.createElement(Text178, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React307.createElement(Text178, { size: "xs", c: "dimmed" }, "Granted by: ", delegation.issuerDid === entityDid ? "Entity" : delegation.issuerDid.slice(-8))))), /* @__PURE__ */ React307.createElement(ActionIcon39, { color: "red", variant: "subtle", onClick: () => handleRevoke(delegation.cid), loading: revoking === delegation.cid, disabled: !!revoking }, /* @__PURE__ */ React307.createElement(IconTrash12, { size: 16 })))))), /* @__PURE__ */ React307.createElement(Button58, { leftSection: /* @__PURE__ */ React307.createElement(IconPlus11, { size: 16 }), variant: "light", onClick: onGrantPermission }, "Grant Permission"));
|
|
34449
34701
|
};
|
|
34450
34702
|
|
|
34451
34703
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
34452
|
-
import
|
|
34453
|
-
import { Modal as
|
|
34704
|
+
import React308, { useState as useState145, useCallback as useCallback113 } from "react";
|
|
34705
|
+
import { Modal as Modal5, Stack as Stack204, Text as Text179, TextInput as TextInput9, Button as Button59, Group as Group114, Radio as Radio5, Checkbox as Checkbox13, Alert as Alert56, Paper as Paper20, Loader as Loader55, Badge as Badge47, ActionIcon as ActionIcon40, Divider as Divider29, NumberInput as NumberInput3 } from "@mantine/core";
|
|
34454
34706
|
import { IconSearch as IconSearch8, IconUser as IconUser15, IconRobot as IconRobot5, IconX as IconX15, IconShieldPlus as IconShieldPlus4 } from "@tabler/icons-react";
|
|
34455
34707
|
var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, searchUsers, getOracles, onGrant }) => {
|
|
34456
34708
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
34457
34709
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
34458
34710
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
34459
|
-
const [recipientType, setRecipientType] =
|
|
34460
|
-
const [searchQuery, setSearchQuery] =
|
|
34461
|
-
const [searchResults, setSearchResults] =
|
|
34462
|
-
const [searching, setSearching] =
|
|
34463
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
34464
|
-
const [manualDid, setManualDid] =
|
|
34465
|
-
const [scopeType, setScopeType] =
|
|
34466
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
34467
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
34468
|
-
const [expirationDays, setExpirationDays] =
|
|
34469
|
-
const [canDelegate, setCanDelegate] =
|
|
34470
|
-
const [pin, setPin] =
|
|
34471
|
-
const [loading, setLoading] =
|
|
34472
|
-
const [error, setError] =
|
|
34711
|
+
const [recipientType, setRecipientType] = useState145("user");
|
|
34712
|
+
const [searchQuery, setSearchQuery] = useState145("");
|
|
34713
|
+
const [searchResults, setSearchResults] = useState145([]);
|
|
34714
|
+
const [searching, setSearching] = useState145(false);
|
|
34715
|
+
const [selectedRecipient, setSelectedRecipient] = useState145(null);
|
|
34716
|
+
const [manualDid, setManualDid] = useState145("");
|
|
34717
|
+
const [scopeType, setScopeType] = useState145("full");
|
|
34718
|
+
const [selectedBlocks, setSelectedBlocks] = useState145([]);
|
|
34719
|
+
const [expirationEnabled, setExpirationEnabled] = useState145(false);
|
|
34720
|
+
const [expirationDays, setExpirationDays] = useState145(30);
|
|
34721
|
+
const [canDelegate, setCanDelegate] = useState145(false);
|
|
34722
|
+
const [pin, setPin] = useState145("");
|
|
34723
|
+
const [loading, setLoading] = useState145(false);
|
|
34724
|
+
const [error, setError] = useState145(null);
|
|
34473
34725
|
const handleSearch = useCallback113(async () => {
|
|
34474
34726
|
if (searchQuery.length < 2) return;
|
|
34475
34727
|
setSearching(true);
|
|
@@ -34557,15 +34809,15 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
34557
34809
|
resetForm();
|
|
34558
34810
|
}
|
|
34559
34811
|
};
|
|
34560
|
-
return /* @__PURE__ */
|
|
34561
|
-
|
|
34812
|
+
return /* @__PURE__ */ React308.createElement(
|
|
34813
|
+
Modal5,
|
|
34562
34814
|
{
|
|
34563
34815
|
opened,
|
|
34564
34816
|
onClose: handleClose,
|
|
34565
|
-
title: /* @__PURE__ */
|
|
34817
|
+
title: /* @__PURE__ */ React308.createElement(Group114, { gap: "xs" }, /* @__PURE__ */ React308.createElement(IconShieldPlus4, { size: 20 }), /* @__PURE__ */ React308.createElement(Text179, { fw: 600 }, "Grant Permission")),
|
|
34566
34818
|
size: "lg"
|
|
34567
34819
|
},
|
|
34568
|
-
/* @__PURE__ */
|
|
34820
|
+
/* @__PURE__ */ React308.createElement(Stack204, { gap: "md" }, /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, /* @__PURE__ */ React308.createElement(Text179, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React308.createElement(
|
|
34569
34821
|
Radio5.Group,
|
|
34570
34822
|
{
|
|
34571
34823
|
value: recipientType,
|
|
@@ -34575,23 +34827,23 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
34575
34827
|
setSearchResults([]);
|
|
34576
34828
|
}
|
|
34577
34829
|
},
|
|
34578
|
-
/* @__PURE__ */
|
|
34579
|
-
)), recipientType !== "manual" ? /* @__PURE__ */
|
|
34830
|
+
/* @__PURE__ */ React308.createElement(Group114, null, /* @__PURE__ */ React308.createElement(Radio5, { value: "user", label: "User" }), /* @__PURE__ */ React308.createElement(Radio5, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React308.createElement(Radio5, { value: "manual", label: "Enter DID" }))
|
|
34831
|
+
)), recipientType !== "manual" ? /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, /* @__PURE__ */ React308.createElement(
|
|
34580
34832
|
TextInput9,
|
|
34581
34833
|
{
|
|
34582
34834
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
34583
|
-
leftSection: /* @__PURE__ */
|
|
34584
|
-
rightSection: searching ? /* @__PURE__ */
|
|
34835
|
+
leftSection: /* @__PURE__ */ React308.createElement(IconSearch8, { size: 16 }),
|
|
34836
|
+
rightSection: searching ? /* @__PURE__ */ React308.createElement(Loader55, { size: 14 }) : null,
|
|
34585
34837
|
value: searchQuery,
|
|
34586
34838
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
34587
34839
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
34588
34840
|
}
|
|
34589
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
34841
|
+
), selectedRecipient ? /* @__PURE__ */ React308.createElement(Paper20, { p: "sm", withBorder: true }, /* @__PURE__ */ React308.createElement(Group114, { justify: "space-between" }, /* @__PURE__ */ React308.createElement(Group114, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React308.createElement(IconRobot5, { size: 16 }) : /* @__PURE__ */ React308.createElement(IconUser15, { size: 16 }), /* @__PURE__ */ React308.createElement(Text179, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React308.createElement(Badge47, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React308.createElement(ActionIcon40, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React308.createElement(IconX15, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React308.createElement(Paper20, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React308.createElement(Stack204, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React308.createElement(Button59, { key: result.did, variant: "subtle", size: "sm", justify: "flex-start", onClick: () => setSelectedRecipient(result) }, result.displayName)))) : null) : /* @__PURE__ */ React308.createElement(TextInput9, { label: "Recipient DID", placeholder: "did:ixo:...", value: manualDid, onChange: (e) => setManualDid(e.currentTarget.value) }), /* @__PURE__ */ React308.createElement(Divider29, null), /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, /* @__PURE__ */ React308.createElement(Text179, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
34590
34842
|
// Single block mode: show fixed block info
|
|
34591
|
-
/* @__PURE__ */
|
|
34843
|
+
/* @__PURE__ */ React308.createElement(Paper20, { p: "sm", withBorder: true }, /* @__PURE__ */ React308.createElement(Group114, { gap: "xs" }, /* @__PURE__ */ React308.createElement(Badge47, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React308.createElement(Text179, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React308.createElement(Text179, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
34592
34844
|
) : (
|
|
34593
34845
|
// Multi-block mode: show scope selection
|
|
34594
|
-
/* @__PURE__ */
|
|
34846
|
+
/* @__PURE__ */ React308.createElement(React308.Fragment, null, /* @__PURE__ */ React308.createElement(Radio5.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, /* @__PURE__ */ React308.createElement(Radio5, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React308.createElement(Radio5, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React308.createElement(Paper20, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React308.createElement(
|
|
34595
34847
|
Checkbox13,
|
|
34596
34848
|
{
|
|
34597
34849
|
key: block.id,
|
|
@@ -34606,7 +34858,7 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
34606
34858
|
}
|
|
34607
34859
|
}
|
|
34608
34860
|
)))))
|
|
34609
|
-
)), /* @__PURE__ */
|
|
34861
|
+
)), /* @__PURE__ */ React308.createElement(Divider29, null), /* @__PURE__ */ React308.createElement(Stack204, { gap: "xs" }, /* @__PURE__ */ React308.createElement(Checkbox13, { label: "Set expiration", checked: expirationEnabled, onChange: (e) => setExpirationEnabled(e.currentTarget.checked) }), expirationEnabled && /* @__PURE__ */ React308.createElement(NumberInput3, { label: "Expires in (days)", placeholder: "30", value: expirationDays, onChange: setExpirationDays, min: 1, max: 365 })), /* @__PURE__ */ React308.createElement(
|
|
34610
34862
|
Checkbox13,
|
|
34611
34863
|
{
|
|
34612
34864
|
label: "Recipient can grant permissions to others",
|
|
@@ -34614,7 +34866,7 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
34614
34866
|
checked: canDelegate,
|
|
34615
34867
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
34616
34868
|
}
|
|
34617
|
-
), /* @__PURE__ */
|
|
34869
|
+
), /* @__PURE__ */ React308.createElement(Divider29, null), /* @__PURE__ */ React308.createElement(TextInput9, { label: "Enter your PIN to sign this delegation", type: "password", placeholder: "PIN", value: pin, onChange: (e) => setPin(e.currentTarget.value) }), error && /* @__PURE__ */ React308.createElement(Alert56, { color: "red" }, error), /* @__PURE__ */ React308.createElement(Group114, { justify: "flex-end" }, /* @__PURE__ */ React308.createElement(Button59, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React308.createElement(Button59, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
34618
34870
|
);
|
|
34619
34871
|
};
|
|
34620
34872
|
|
|
@@ -34728,4 +34980,4 @@ export {
|
|
|
34728
34980
|
getExtraSlashMenuItems,
|
|
34729
34981
|
useCreateIxoEditor
|
|
34730
34982
|
};
|
|
34731
|
-
//# sourceMappingURL=chunk-
|
|
34983
|
+
//# sourceMappingURL=chunk-5POKGPCS.mjs.map
|