@ixo/editor 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-LNFOOQY3.mjs → chunk-AOSYWSEN.mjs} +2359 -418
- package/dist/chunk-AOSYWSEN.mjs.map +1 -0
- package/dist/{graphql-client-Cmq6iMJk.d.ts → graphql-client-D-a_Xr2T.d.ts} +295 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/mantine/index.d.ts +2 -2
- package/dist/mantine/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-LNFOOQY3.mjs.map +0 -1
|
@@ -69,7 +69,7 @@ var BlocknoteContext = createContext({
|
|
|
69
69
|
throw new Error("BlocknoteContext not initialized");
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editable, visualizationRenderer, getDynamicListData, dynamicListPanelRenderer }) => {
|
|
72
|
+
var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editable, visualizationRenderer, getDynamicListData, dynamicListPanelRenderer, domainCardRenderer }) => {
|
|
73
73
|
const [sharedProposals, setSharedProposals] = useState({});
|
|
74
74
|
const sharedProposalsRef = useRef2({});
|
|
75
75
|
const [activeDrawerId, setActiveDrawerId] = useState(null);
|
|
@@ -165,7 +165,8 @@ var BlocknoteProvider = ({ children, editor, handlers, blockRequirements, editab
|
|
|
165
165
|
closeDrawer,
|
|
166
166
|
visualizationRenderer,
|
|
167
167
|
getDynamicListData,
|
|
168
|
-
dynamicListPanelRenderer
|
|
168
|
+
dynamicListPanelRenderer,
|
|
169
|
+
domainCardRenderer
|
|
169
170
|
}
|
|
170
171
|
},
|
|
171
172
|
children
|
|
@@ -704,8 +705,8 @@ function PropertyValueInput({ property, value, onChange, disabled = false }) {
|
|
|
704
705
|
// src/mantine/components/Base/BaseContainer.tsx
|
|
705
706
|
import { Card } from "@mantine/core";
|
|
706
707
|
import React6 from "react";
|
|
707
|
-
function BaseContainer({ children, onClick }) {
|
|
708
|
-
return /* @__PURE__ */ React6.createElement(Card, { withBorder: true, radius: "lg", style: { width: "100%", cursor: onClick ? "pointer" : "default", position: "relative" }, onClick }, children);
|
|
708
|
+
function BaseContainer({ children, onClick, style }) {
|
|
709
|
+
return /* @__PURE__ */ React6.createElement(Card, { withBorder: true, radius: "lg", style: { width: "100%", cursor: onClick ? "pointer" : "default", position: "relative", ...style }, onClick }, children);
|
|
709
710
|
}
|
|
710
711
|
|
|
711
712
|
// src/mantine/blocks/components/ConditionBuilder/ConditionRow.tsx
|
|
@@ -1060,6 +1061,10 @@ function BaseTextArea({ ...props }) {
|
|
|
1060
1061
|
Textarea,
|
|
1061
1062
|
{
|
|
1062
1063
|
minRows: 2,
|
|
1064
|
+
draggable: true,
|
|
1065
|
+
autosize: true,
|
|
1066
|
+
maxRows: 10,
|
|
1067
|
+
resize: "vertical",
|
|
1063
1068
|
radius: "md",
|
|
1064
1069
|
styles: {
|
|
1065
1070
|
input: {
|
|
@@ -1319,7 +1324,19 @@ import { Checkbox, Group as Group2, Stack as Stack7, Text as Text4 } from "@mant
|
|
|
1319
1324
|
|
|
1320
1325
|
// src/mantine/utils/iconMap.tsx
|
|
1321
1326
|
import React16 from "react";
|
|
1322
|
-
import {
|
|
1327
|
+
import {
|
|
1328
|
+
IconSquareCheck,
|
|
1329
|
+
IconPlus,
|
|
1330
|
+
IconUserDollar,
|
|
1331
|
+
IconFileText,
|
|
1332
|
+
IconCheckbox,
|
|
1333
|
+
IconNote,
|
|
1334
|
+
IconChecklist,
|
|
1335
|
+
IconThumbUp,
|
|
1336
|
+
IconBell,
|
|
1337
|
+
IconFeather,
|
|
1338
|
+
IconDotsCircleHorizontal
|
|
1339
|
+
} from "@tabler/icons-react";
|
|
1323
1340
|
var ICON_MAP = {
|
|
1324
1341
|
"square-check": IconSquareCheck,
|
|
1325
1342
|
"file-text": IconFileText,
|
|
@@ -1329,7 +1346,9 @@ var ICON_MAP = {
|
|
|
1329
1346
|
"thumb-up": IconThumbUp,
|
|
1330
1347
|
bell: IconBell,
|
|
1331
1348
|
plus: IconPlus,
|
|
1332
|
-
"dollar-sign": IconUserDollar
|
|
1349
|
+
"dollar-sign": IconUserDollar,
|
|
1350
|
+
feather: IconFeather,
|
|
1351
|
+
"dots-circle": IconDotsCircleHorizontal
|
|
1333
1352
|
};
|
|
1334
1353
|
var getIcon = (fallback = "square-check", key, color = "white", size = 26, stroke = 1.5) => {
|
|
1335
1354
|
const validKey = key in ICON_MAP ? key : fallback;
|
|
@@ -15768,208 +15787,2021 @@ var DomainCreatorBlockSpec = createReactBlockSpec13(
|
|
|
15768
15787
|
}
|
|
15769
15788
|
);
|
|
15770
15789
|
|
|
15771
|
-
// src/mantine/blocks/
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
this.blocks = /* @__PURE__ */ new Map();
|
|
15775
|
-
}
|
|
15776
|
-
register(entry) {
|
|
15777
|
-
this.blocks.set(entry.type, entry);
|
|
15778
|
-
}
|
|
15779
|
-
get(type) {
|
|
15780
|
-
return this.blocks.get(type);
|
|
15781
|
-
}
|
|
15782
|
-
getAll() {
|
|
15783
|
-
return new Map(this.blocks);
|
|
15784
|
-
}
|
|
15785
|
-
getValidDependencies(type) {
|
|
15786
|
-
const entry = this.get(type);
|
|
15787
|
-
return entry?.validDependencies || [];
|
|
15788
|
-
}
|
|
15789
|
-
getPropSchema(type) {
|
|
15790
|
-
const entry = this.get(type);
|
|
15791
|
-
return entry?.propSchema;
|
|
15792
|
-
}
|
|
15793
|
-
isValidDependency(blockType, dependencyType) {
|
|
15794
|
-
const validDeps = this.getValidDependencies(blockType);
|
|
15795
|
-
return validDeps.includes(dependencyType);
|
|
15796
|
-
}
|
|
15797
|
-
};
|
|
15798
|
-
var blockRegistry = new BlockRegistry();
|
|
15799
|
-
blockRegistry.register({
|
|
15800
|
-
type: "proposal",
|
|
15801
|
-
propSchema: {
|
|
15802
|
-
title: "",
|
|
15803
|
-
description: "",
|
|
15804
|
-
icon: "\u{1F4DD}",
|
|
15805
|
-
proposalId: "",
|
|
15806
|
-
status: "draft",
|
|
15807
|
-
contractAddress: "",
|
|
15808
|
-
coreAddress: "",
|
|
15809
|
-
createdProposalId: ""
|
|
15810
|
-
},
|
|
15811
|
-
validDependencies: [],
|
|
15812
|
-
defaultProps: {
|
|
15813
|
-
icon: "\u{1F4DD}",
|
|
15814
|
-
status: "draft"
|
|
15815
|
-
}
|
|
15816
|
-
});
|
|
15817
|
-
blockRegistry.register({
|
|
15818
|
-
type: "proposalVote",
|
|
15819
|
-
propSchema: {
|
|
15820
|
-
title: "",
|
|
15821
|
-
subtitle: "",
|
|
15822
|
-
icon: "\u{1F5F3}\uFE0F",
|
|
15823
|
-
status: "open",
|
|
15824
|
-
daysLeft: 0,
|
|
15825
|
-
proposalId: "",
|
|
15826
|
-
proposalBlockId: "",
|
|
15827
|
-
proposalContractAddress: ""
|
|
15828
|
-
},
|
|
15829
|
-
validDependencies: ["proposal"],
|
|
15830
|
-
defaultProps: {
|
|
15831
|
-
icon: "\u{1F5F3}\uFE0F",
|
|
15832
|
-
status: "open",
|
|
15833
|
-
daysLeft: 0,
|
|
15834
|
-
proposalBlockId: ""
|
|
15835
|
-
}
|
|
15836
|
-
});
|
|
15837
|
-
blockRegistry.register({
|
|
15838
|
-
type: "list",
|
|
15839
|
-
propSchema: {
|
|
15840
|
-
title: "",
|
|
15841
|
-
did: "",
|
|
15842
|
-
fragmentIdentifier: ""
|
|
15843
|
-
},
|
|
15844
|
-
validDependencies: [],
|
|
15845
|
-
defaultProps: {}
|
|
15846
|
-
});
|
|
15847
|
-
blockRegistry.register({
|
|
15848
|
-
type: "overview",
|
|
15849
|
-
propSchema: {
|
|
15850
|
-
did: ""
|
|
15851
|
-
},
|
|
15852
|
-
validDependencies: [],
|
|
15853
|
-
defaultProps: {}
|
|
15854
|
-
});
|
|
15855
|
-
blockRegistry.register({
|
|
15856
|
-
type: "enumChecklist",
|
|
15857
|
-
propSchema: {
|
|
15858
|
-
listType: "",
|
|
15859
|
-
listConfig: "{}"
|
|
15860
|
-
},
|
|
15861
|
-
validDependencies: [],
|
|
15862
|
-
defaultProps: {}
|
|
15863
|
-
});
|
|
15864
|
-
blockRegistry.register({
|
|
15865
|
-
type: "notify",
|
|
15866
|
-
propSchema: {
|
|
15867
|
-
title: "",
|
|
15868
|
-
description: "",
|
|
15869
|
-
icon: "bell",
|
|
15870
|
-
channel: "email",
|
|
15871
|
-
to: "[]",
|
|
15872
|
-
cc: "[]",
|
|
15873
|
-
bcc: "[]",
|
|
15874
|
-
subject: "",
|
|
15875
|
-
body: "",
|
|
15876
|
-
bodyType: "text",
|
|
15877
|
-
from: "",
|
|
15878
|
-
replyTo: "",
|
|
15879
|
-
templateId: "",
|
|
15880
|
-
templateVariables: "{}",
|
|
15881
|
-
status: "idle",
|
|
15882
|
-
messageId: "",
|
|
15883
|
-
sentAt: "",
|
|
15884
|
-
errorMessage: "",
|
|
15885
|
-
conditions: ""
|
|
15886
|
-
},
|
|
15887
|
-
validDependencies: [],
|
|
15888
|
-
defaultProps: {
|
|
15889
|
-
icon: "bell",
|
|
15890
|
-
channel: "email",
|
|
15891
|
-
bodyType: "text",
|
|
15892
|
-
status: "idle"
|
|
15893
|
-
}
|
|
15894
|
-
});
|
|
15895
|
-
blockRegistry.register({
|
|
15896
|
-
type: "bid",
|
|
15897
|
-
propSchema: {
|
|
15898
|
-
title: "",
|
|
15899
|
-
description: "",
|
|
15900
|
-
did: "",
|
|
15901
|
-
selectedCollections: "[]",
|
|
15902
|
-
adminAddress: ""
|
|
15903
|
-
},
|
|
15904
|
-
validDependencies: [],
|
|
15905
|
-
defaultProps: {}
|
|
15906
|
-
});
|
|
15907
|
-
blockRegistry.register({
|
|
15908
|
-
type: "claim",
|
|
15909
|
-
propSchema: {
|
|
15910
|
-
title: "",
|
|
15911
|
-
description: "",
|
|
15912
|
-
icon: "square-check",
|
|
15913
|
-
deedDid: "",
|
|
15914
|
-
selectedCollections: "[]",
|
|
15915
|
-
adminAddress: ""
|
|
15916
|
-
},
|
|
15917
|
-
validDependencies: [],
|
|
15918
|
-
defaultProps: {
|
|
15919
|
-
icon: "square-check"
|
|
15920
|
-
}
|
|
15921
|
-
});
|
|
15922
|
-
blockRegistry.register({
|
|
15923
|
-
type: "domainCreator",
|
|
15924
|
-
propSchema: {
|
|
15925
|
-
title: "",
|
|
15926
|
-
description: "",
|
|
15927
|
-
icon: "file-text",
|
|
15928
|
-
surveySchema: "",
|
|
15929
|
-
answers: "",
|
|
15930
|
-
lastSubmission: ""
|
|
15931
|
-
},
|
|
15932
|
-
validDependencies: [],
|
|
15933
|
-
defaultProps: {
|
|
15934
|
-
icon: "file-text",
|
|
15935
|
-
surveySchema: "",
|
|
15936
|
-
answers: "",
|
|
15937
|
-
lastSubmission: ""
|
|
15938
|
-
}
|
|
15939
|
-
});
|
|
15790
|
+
// src/mantine/blocks/protocolSelector/ProtocolSelectorBlockSpec.tsx
|
|
15791
|
+
import React173 from "react";
|
|
15792
|
+
import { createReactBlockSpec as createReactBlockSpec14 } from "@blocknote/react";
|
|
15940
15793
|
|
|
15941
|
-
// src/mantine/blocks/
|
|
15942
|
-
import
|
|
15794
|
+
// src/mantine/blocks/protocolSelector/ProtocolSelectorBlock.tsx
|
|
15795
|
+
import React172 from "react";
|
|
15943
15796
|
|
|
15944
|
-
// src/mantine/blocks/
|
|
15945
|
-
import { useMemo as useMemo49 } from "react";
|
|
15797
|
+
// src/mantine/blocks/protocolSelector/template/TemplateView.tsx
|
|
15798
|
+
import React168, { useMemo as useMemo49 } from "react";
|
|
15946
15799
|
|
|
15947
|
-
// src/mantine/blocks/
|
|
15948
|
-
|
|
15949
|
-
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
|
|
15960
|
-
|
|
15961
|
-
|
|
15800
|
+
// src/mantine/blocks/protocolSelector/template/TemplateConfig.tsx
|
|
15801
|
+
import React167, { useCallback as useCallback40 } from "react";
|
|
15802
|
+
|
|
15803
|
+
// src/mantine/blocks/protocolSelector/template/GeneralTab.tsx
|
|
15804
|
+
import React166, { useEffect as useEffect42, useMemo as useMemo48, useState as useState59 } from "react";
|
|
15805
|
+
import { Divider as Divider11, Stack as Stack113, Text as Text86, PillsInput as PillsInput2, Pill as Pill2, Box as Box30 } from "@mantine/core";
|
|
15806
|
+
var GeneralTab10 = ({ title, description, protocolDids, onTitleChange, onDescriptionChange, onProtocolDidsChange }) => {
|
|
15807
|
+
const [localTitle, setLocalTitle] = useState59(title || "");
|
|
15808
|
+
const [localDescription, setLocalDescription] = useState59(description || "");
|
|
15809
|
+
const [inputValue, setInputValue] = useState59("");
|
|
15810
|
+
const localDids = useMemo48(() => {
|
|
15811
|
+
try {
|
|
15812
|
+
const parsed = JSON.parse(protocolDids || "[]");
|
|
15813
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
15814
|
+
} catch {
|
|
15815
|
+
return [];
|
|
15816
|
+
}
|
|
15817
|
+
}, [protocolDids]);
|
|
15818
|
+
useEffect42(() => {
|
|
15819
|
+
setLocalTitle(title || "");
|
|
15820
|
+
}, [title]);
|
|
15821
|
+
useEffect42(() => {
|
|
15822
|
+
setLocalDescription(description || "");
|
|
15823
|
+
}, [description]);
|
|
15824
|
+
const handleAddDid = () => {
|
|
15825
|
+
const trimmed = inputValue.trim();
|
|
15826
|
+
if (trimmed && !localDids.includes(trimmed)) {
|
|
15827
|
+
const newDids = [...localDids, trimmed];
|
|
15828
|
+
onProtocolDidsChange(JSON.stringify(newDids));
|
|
15829
|
+
setInputValue("");
|
|
15830
|
+
}
|
|
15831
|
+
};
|
|
15832
|
+
const handleRemoveDid = (didToRemove) => {
|
|
15833
|
+
const newDids = localDids.filter((did) => did !== didToRemove);
|
|
15834
|
+
onProtocolDidsChange(JSON.stringify(newDids));
|
|
15835
|
+
};
|
|
15836
|
+
return /* @__PURE__ */ React166.createElement(Stack113, { gap: "lg" }, /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React166.createElement(
|
|
15837
|
+
BaseTextInput,
|
|
15838
|
+
{
|
|
15839
|
+
placeholder: "e.g. Select type of the domain",
|
|
15840
|
+
value: localTitle,
|
|
15841
|
+
onChange: (event) => {
|
|
15842
|
+
const newTitle = event.currentTarget.value;
|
|
15843
|
+
setLocalTitle(newTitle);
|
|
15844
|
+
onTitleChange(newTitle);
|
|
15845
|
+
}
|
|
15846
|
+
}
|
|
15847
|
+
)), /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(
|
|
15848
|
+
BaseTextArea,
|
|
15849
|
+
{
|
|
15850
|
+
label: "Description",
|
|
15851
|
+
placeholder: "Describe what this selection is for",
|
|
15852
|
+
minRows: 3,
|
|
15853
|
+
value: localDescription,
|
|
15854
|
+
onChange: (event) => {
|
|
15855
|
+
const newDescription = event.currentTarget.value;
|
|
15856
|
+
setLocalDescription(newDescription);
|
|
15857
|
+
onDescriptionChange(newDescription);
|
|
15858
|
+
}
|
|
15859
|
+
}
|
|
15860
|
+
)), /* @__PURE__ */ React166.createElement(Divider11, { variant: "dashed" }), /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "sm", fw: 600 }, "Protocol DIDs"), /* @__PURE__ */ React166.createElement(Text86, { size: "xs", c: "dimmed" }, "Add the protocol DIDs that users can select from. Enter a DID and press Enter to add it."), /* @__PURE__ */ React166.createElement(PillsInput2, null, /* @__PURE__ */ React166.createElement(Pill2.Group, null, localDids.map((did) => /* @__PURE__ */ React166.createElement(Pill2, { key: did, withRemoveButton: true, onRemove: () => handleRemoveDid(did) }, did.length > 30 ? `${did.slice(0, 15)}...${did.slice(-12)}` : did)), /* @__PURE__ */ React166.createElement(
|
|
15861
|
+
PillsInput2.Field,
|
|
15862
|
+
{
|
|
15863
|
+
placeholder: localDids.length === 0 ? "Enter protocol DID and press Enter" : "",
|
|
15864
|
+
value: inputValue,
|
|
15865
|
+
onChange: (event) => setInputValue(event.currentTarget.value),
|
|
15866
|
+
onKeyDown: (event) => {
|
|
15867
|
+
if (event.key === "Enter") {
|
|
15868
|
+
event.preventDefault();
|
|
15869
|
+
handleAddDid();
|
|
15870
|
+
}
|
|
15871
|
+
}
|
|
15872
|
+
}
|
|
15873
|
+
))), localDids.length > 0 && /* @__PURE__ */ React166.createElement(Box30, { mt: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "xs", c: "dimmed" }, localDids.length, " protocol", localDids.length !== 1 ? "s" : "", " configured"))));
|
|
15962
15874
|
};
|
|
15963
|
-
|
|
15964
|
-
|
|
15875
|
+
|
|
15876
|
+
// src/mantine/blocks/protocolSelector/template/TemplateConfig.tsx
|
|
15877
|
+
var TemplateConfig10 = ({ editor, block }) => {
|
|
15878
|
+
const { closePanel } = usePanelStore();
|
|
15879
|
+
const updateProp = useCallback40(
|
|
15880
|
+
(key, value) => {
|
|
15881
|
+
editor.updateBlock(block, {
|
|
15882
|
+
props: {
|
|
15883
|
+
...block.props,
|
|
15884
|
+
[key]: value
|
|
15885
|
+
}
|
|
15886
|
+
});
|
|
15887
|
+
},
|
|
15888
|
+
[editor, block]
|
|
15889
|
+
);
|
|
15890
|
+
return /* @__PURE__ */ React167.createElement(BaseRightPanelLayout, { title: "Protocol Selector Settings", onClose: closePanel }, /* @__PURE__ */ React167.createElement(
|
|
15891
|
+
ReusablePanel,
|
|
15965
15892
|
{
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15893
|
+
extraTabs: [
|
|
15894
|
+
{
|
|
15895
|
+
label: "General",
|
|
15896
|
+
value: "general",
|
|
15897
|
+
content: /* @__PURE__ */ React167.createElement(
|
|
15898
|
+
GeneralTab10,
|
|
15970
15899
|
{
|
|
15971
|
-
|
|
15972
|
-
|
|
15900
|
+
title: block.props.title || "",
|
|
15901
|
+
description: block.props.description || "",
|
|
15902
|
+
protocolDids: block.props.protocolDids || "[]",
|
|
15903
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
15904
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
15905
|
+
onProtocolDidsChange: (value) => updateProp("protocolDids", value)
|
|
15906
|
+
}
|
|
15907
|
+
)
|
|
15908
|
+
}
|
|
15909
|
+
],
|
|
15910
|
+
context: { editor, block }
|
|
15911
|
+
}
|
|
15912
|
+
));
|
|
15913
|
+
};
|
|
15914
|
+
|
|
15915
|
+
// src/mantine/blocks/protocolSelector/template/TemplateView.tsx
|
|
15916
|
+
import { Box as Box31, Group as Group51, Stack as Stack114, Text as Text87 } from "@mantine/core";
|
|
15917
|
+
import { IconCircleDashed as IconCircleDashed2 } from "@tabler/icons-react";
|
|
15918
|
+
var PROTOCOL_SELECTOR_TEMPLATE_PANEL_ID = "protocol-selector-template-panel";
|
|
15919
|
+
var ProtocolSelectorTemplateView = ({ editor, block }) => {
|
|
15920
|
+
const panelId = `${PROTOCOL_SELECTOR_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
15921
|
+
const panelContent = useMemo49(() => /* @__PURE__ */ React168.createElement(TemplateConfig10, { editor, block }), [editor, block]);
|
|
15922
|
+
const { open } = usePanel(panelId, panelContent);
|
|
15923
|
+
const protocolDids = useMemo49(() => {
|
|
15924
|
+
try {
|
|
15925
|
+
const parsed = JSON.parse(block.props.protocolDids || "[]");
|
|
15926
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
15927
|
+
} catch {
|
|
15928
|
+
return [];
|
|
15929
|
+
}
|
|
15930
|
+
}, [block.props.protocolDids]);
|
|
15931
|
+
return /* @__PURE__ */ React168.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React168.createElement(Group51, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React168.createElement(Group51, { wrap: "nowrap", align: "center", gap: "md" }, /* @__PURE__ */ React168.createElement(
|
|
15932
|
+
Box31,
|
|
15933
|
+
{
|
|
15934
|
+
style: {
|
|
15935
|
+
width: 40,
|
|
15936
|
+
height: 40,
|
|
15937
|
+
borderRadius: "50%",
|
|
15938
|
+
border: "2px dashed var(--mantine-color-dark-3)",
|
|
15939
|
+
display: "flex",
|
|
15940
|
+
alignItems: "center",
|
|
15941
|
+
justifyContent: "center"
|
|
15942
|
+
}
|
|
15943
|
+
},
|
|
15944
|
+
/* @__PURE__ */ React168.createElement(IconCircleDashed2, { size: 20, color: "var(--mantine-color-dark-3)" })
|
|
15945
|
+
), /* @__PURE__ */ React168.createElement(Stack114, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React168.createElement(Text87, { fw: 500, size: "sm", contentEditable: false, lineClamp: 1 }, block.props.title || "Select type of the do..."), /* @__PURE__ */ React168.createElement(Text87, { size: "xs", c: "dimmed", contentEditable: false }, "Selection"))), /* @__PURE__ */ React168.createElement(Stack114, { gap: 2, align: "flex-end" }, /* @__PURE__ */ React168.createElement(Text87, { size: "sm", c: "dimmed", contentEditable: false }, "Pending"), /* @__PURE__ */ React168.createElement(Text87, { size: "xs", c: "dimmed", contentEditable: false }, protocolDids.length, " protocol", protocolDids.length !== 1 ? "s" : "", " configured"))));
|
|
15946
|
+
};
|
|
15947
|
+
|
|
15948
|
+
// src/mantine/blocks/protocolSelector/flow/FlowView.tsx
|
|
15949
|
+
import React171, { useMemo as useMemo51 } from "react";
|
|
15950
|
+
import { Badge as Badge24, Box as Box33, Group as Group53, Stack as Stack116, Text as Text89, Tooltip as Tooltip16 } from "@mantine/core";
|
|
15951
|
+
import { IconCircleDashed as IconCircleDashed3, IconChecks } from "@tabler/icons-react";
|
|
15952
|
+
|
|
15953
|
+
// src/mantine/blocks/protocolSelector/flow/ProtocolSelectionPanel.tsx
|
|
15954
|
+
import React170, { useState as useState60, useEffect as useEffect43, useMemo as useMemo50, useCallback as useCallback41 } from "react";
|
|
15955
|
+
import { Paper as Paper16, CloseButton as CloseButton9, Stack as Stack115, Text as Text88, Box as Box32, Group as Group52, Loader as Loader23 } from "@mantine/core";
|
|
15956
|
+
|
|
15957
|
+
// src/icons/EntityAvatar.tsx
|
|
15958
|
+
import React169 from "react";
|
|
15959
|
+
var EntityAvatar = ({ size = 32, style }) => {
|
|
15960
|
+
return /* @__PURE__ */ React169.createElement("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", style }, /* @__PURE__ */ React169.createElement("rect", { width: "32", height: "32", rx: "16", fill: "#0B478E" }), /* @__PURE__ */ React169.createElement(
|
|
15961
|
+
"path",
|
|
15962
|
+
{
|
|
15963
|
+
fillRule: "evenodd",
|
|
15964
|
+
clipRule: "evenodd",
|
|
15965
|
+
d: "M22.4037 7.66251V10.0977H24.839C25.8991 10.0977 26.7482 10.0977 27.3639 10.1847C27.9691 10.2703 28.5581 10.4667 28.8008 11.0525C29.0434 11.6382 28.7658 12.1937 28.3983 12.6821C28.0245 13.179 27.4242 13.7794 26.6746 14.529L24.9528 16.2507L26.6745 17.9724C27.4242 18.722 28.0245 19.3224 28.3983 19.8194C28.7658 20.3077 29.0434 20.8632 28.8008 21.449C28.5581 22.0347 27.9691 22.2311 27.3639 22.3167C26.7482 22.4038 25.8991 22.4037 24.839 22.4037H22.4037V24.839C22.4037 25.8991 22.4038 26.7482 22.3167 27.3639C22.2311 27.9691 22.0347 28.5581 21.449 28.8008C20.8632 29.0434 20.3077 28.7658 19.8194 28.3983C19.3224 28.0245 18.7221 27.4242 17.9725 26.6746L16.2507 24.9528L14.529 26.6746C13.7794 27.4242 13.179 28.0245 12.6821 28.3983C12.1937 28.7658 11.6382 29.0434 11.0525 28.8008C10.4667 28.5581 10.2703 27.9691 10.1847 27.3639C10.0977 26.7482 10.0977 25.8991 10.0977 24.839V22.4037H7.6625C6.60236 22.4037 5.75328 22.4038 5.13756 22.3167C4.53241 22.2311 3.94331 22.0347 3.70068 21.449C3.45805 20.8632 3.73572 20.3077 4.10312 19.8194C4.47692 19.3224 5.07731 18.722 5.82693 17.9724L7.54864 16.2507L5.82695 14.529C5.07732 13.7794 4.47692 13.179 4.10312 12.6821C3.73572 12.1937 3.45805 11.6382 3.70068 11.0525C3.94331 10.4667 4.53241 10.2703 5.13756 10.1847C5.75327 10.0977 6.60233 10.0977 7.66245 10.0977H10.0977V7.66245C10.0977 6.60235 10.0977 5.75328 10.1847 5.13756C10.2703 4.53241 10.4667 3.94331 11.0525 3.70068C11.6382 3.45805 12.1937 3.73572 12.6821 4.10312C13.179 4.47692 13.7794 5.07731 14.529 5.82693L16.2507 7.54864L17.9724 5.82693C18.722 5.07732 19.3224 4.47692 19.8194 4.10312C20.3077 3.73572 20.8632 3.45805 21.449 3.70068C22.0347 3.94331 22.2311 4.53241 22.3167 5.13756C22.4038 5.75328 22.4037 6.60235 22.4037 7.66251ZM18.6213 6.53568C19.4077 5.74933 19.9604 5.19831 20.3964 4.8703C20.8476 4.53092 21.0089 4.55749 21.0816 4.58761C21.1543 4.61772 21.2871 4.71298 21.3662 5.27197C21.4426 5.81227 21.4437 6.59269 21.4437 7.7048V10.0977H18.7998L16.9295 8.22747L18.6213 6.53568ZM19.7598 11.0577H21.4437V12.7417L19.7598 11.0577ZM22.4037 11.0577V13.7017L24.274 15.5719L25.9658 13.8802C26.7521 13.0938 27.3031 12.5411 27.6311 12.105C27.9706 11.6539 27.944 11.4926 27.9139 11.4199C27.8837 11.3471 27.7885 11.2143 27.2295 11.1353C26.6892 11.0589 25.9087 11.0577 24.7967 11.0577H22.4037ZM20.9577 13.6132L21.4437 14.0993V14.7848C21.5751 15.2509 21.6453 15.7427 21.6453 16.2508C21.6453 16.7589 21.5751 17.2507 21.4437 17.7168V18.4022L20.9578 18.8881C20.4717 19.7538 19.7537 20.4718 18.8879 20.958L18.4022 21.4437H17.7171C17.2508 21.5751 16.759 21.6454 16.2507 21.6454C15.7423 21.6454 15.2505 21.5751 14.7842 21.4437H14.0993L13.6137 20.9581C12.7477 20.472 12.0294 19.7538 11.5433 18.8877L11.0577 18.4022V17.7173C10.9263 17.251 10.856 16.7591 10.856 16.2508C10.856 15.7425 10.9263 15.2506 11.0577 14.7842V14.0993L11.5434 13.6136C12.0295 12.7478 12.7476 12.0297 13.6134 11.5436L14.0993 11.0577H14.7846C15.2507 10.9264 15.7425 10.8561 16.2507 10.8561C16.7588 10.8561 17.2506 10.9264 17.7167 11.0577H18.4022L18.8882 11.5437C19.7538 12.0298 20.4716 12.7477 20.9577 13.6132ZM22.4037 15.0593V17.4422L23.5952 16.2507L22.4037 15.0593ZM19.7598 21.4437L21.4437 19.7598V21.4437H19.7598ZM22.4037 18.7998V21.4437H24.7967C25.9087 21.4437 26.6892 21.4426 27.2295 21.3662C27.7885 21.2871 27.8837 21.1543 27.9139 21.0816C27.944 21.0089 27.9706 20.8476 27.6311 20.3964C27.3031 19.9604 26.7521 19.4077 25.9658 18.6213L24.274 16.9295L22.4037 18.7998ZM18.7998 22.4037H21.4437V24.7967C21.4437 25.9087 21.4426 26.6892 21.3662 27.2295C21.2871 27.7885 21.1543 27.8837 21.0816 27.9139C21.0089 27.944 20.8476 27.9706 20.3964 27.6311C19.9604 27.3031 19.4077 26.7521 18.6213 25.9658L16.9295 24.274L18.7998 22.4037ZM17.4422 22.4037L16.2507 23.5952L15.0593 22.4037H17.4422ZM11.0577 19.7598L12.7417 21.4437H11.0577V19.7598ZM13.7017 22.4037H11.0577V24.7967C11.0577 25.9087 11.0589 26.6892 11.1353 27.2295C11.2143 27.7885 11.3471 27.8837 11.4199 27.9139C11.4926 27.944 11.6539 27.9706 12.105 27.6311C12.5411 27.3031 13.0938 26.7521 13.8802 25.9658L15.5719 24.274L13.7017 22.4037ZM10.0977 18.7998V21.4437H7.70477C6.59272 21.4437 5.81224 21.4426 5.27197 21.3662C4.71298 21.2871 4.61772 21.1543 4.58761 21.0816C4.55749 21.0089 4.53092 20.8476 4.8703 20.3964C5.19831 19.9604 5.74935 19.4077 6.53569 18.6213L8.22747 16.9295L10.0977 18.7998ZM10.0977 17.4422L8.90629 16.2507L10.0977 15.0593V17.4422ZM12.7417 11.0577L11.0577 12.7417V11.0577H12.7417ZM10.0977 13.7017V11.0577H7.70477C6.59272 11.0577 5.81224 11.0589 5.27197 11.1353C4.71298 11.2143 4.61772 11.3471 4.58761 11.4199C4.55749 11.4926 4.53092 11.6539 4.8703 12.105C5.19831 12.5411 5.74935 13.0938 6.53569 13.8802L8.22747 15.5719L10.0977 13.7017ZM13.7017 10.0977H11.0577V7.70475C11.0577 6.59269 11.0589 5.81227 11.1353 5.27197C11.2143 4.71298 11.3471 4.61772 11.4199 4.58761C11.4926 4.55749 11.6539 4.53092 12.105 4.8703C12.5411 5.19831 13.0938 5.74933 13.8802 6.53568L15.5719 8.22747L13.7017 10.0977ZM15.0593 10.0977L16.2507 8.90629L17.4422 10.0977H15.0593Z",
|
|
15966
|
+
fill: "url(#paint0_linear_entity)"
|
|
15967
|
+
}
|
|
15968
|
+
), /* @__PURE__ */ React169.createElement(
|
|
15969
|
+
"path",
|
|
15970
|
+
{
|
|
15971
|
+
fillRule: "evenodd",
|
|
15972
|
+
clipRule: "evenodd",
|
|
15973
|
+
d: "M19.5819 8.21266L18.65 5.96285C18.2443 4.98338 17.9194 4.19893 17.6034 3.6634C17.2928 3.13706 16.8858 2.66797 16.2518 2.66797C15.6178 2.66797 15.2109 3.13706 14.9002 3.6634C14.5842 4.19892 14.2593 4.98336 13.8536 5.9628L12.9218 8.21229L10.6723 7.2805C9.69293 6.8748 8.9085 6.54989 8.30632 6.39469C7.71449 6.24216 7.09507 6.19821 6.64675 6.64653C6.19843 7.09485 6.24241 7.71426 6.39493 8.3061C6.55011 8.90824 6.87504 9.69266 7.28074 10.6721L8.21266 12.922L5.96279 13.8539C4.98336 14.2596 4.19892 14.5845 3.6634 14.9006C3.13706 15.2112 2.66797 15.6181 2.66797 16.2521C2.66797 16.8862 3.13706 17.2931 3.6634 17.6037C4.19891 17.9198 4.98331 18.2447 5.96269 18.6503L8.21229 19.5822L7.28052 21.8316C6.87482 22.8111 6.54988 23.5955 6.3947 24.1976C6.24218 24.7895 6.1982 25.4089 6.64652 25.8572C7.09484 26.3055 7.71426 26.2616 8.3061 26.109C8.90824 25.9538 9.69272 25.6289 10.6721 25.2232L12.922 24.2913L13.8539 26.5412C14.2596 27.5206 14.5845 28.305 14.9006 28.8406C15.2112 29.3669 15.6181 29.836 16.2521 29.836C16.8862 29.836 17.2931 29.3669 17.6037 28.8406C17.9198 28.305 18.2447 27.5207 18.6503 26.5413L19.5822 24.2916L21.8315 25.2234C22.811 25.6291 23.5955 25.9541 24.1976 26.1093C24.7895 26.2618 25.4089 26.3058 25.8572 25.8575C26.3055 25.4091 26.2616 24.7897 26.109 24.1979C25.9538 23.5957 25.6289 22.8113 25.2232 21.8319L24.2913 19.5819L26.5411 18.65C27.5206 18.2443 28.305 17.9194 28.8406 17.6034C29.3669 17.2928 29.836 16.8858 29.836 16.2518C29.836 15.6178 29.3669 15.2109 28.8406 14.9002C28.305 14.5842 27.5206 14.2593 26.5411 13.8536L24.2916 12.9218L25.2234 10.6723C25.6291 9.69293 25.9541 8.90845 26.1093 8.30632C26.2618 7.71448 26.3058 7.09506 25.8575 6.64674C25.4091 6.19842 24.7897 6.24242 24.1979 6.3949C23.5957 6.5501 22.8113 6.87506 21.8319 7.28072L19.5819 8.21266ZM15.727 4.15134C15.4497 4.62125 15.1499 5.34184 14.7243 6.36925L13.8088 8.57965L16.2524 9.59186L18.6951 8.58008L17.7793 6.36925C17.3537 5.34184 17.0539 4.62125 16.7766 4.15134C16.4897 3.66514 16.3305 3.62797 16.2518 3.62797C16.1731 3.62797 16.0139 3.66514 15.727 4.15134ZM19.0624 9.46701L17.5067 10.1114L19.7069 11.0227L19.0624 9.46701ZM20.9611 11.5423L19.9494 9.0996L22.1601 8.18386C23.1875 7.75832 23.9091 7.46072 24.4375 7.32456C24.9841 7.18365 25.123 7.26994 25.1786 7.32557C25.2343 7.3812 25.3206 7.52008 25.1796 8.06674C25.0435 8.59512 24.7459 9.31666 24.3203 10.3441L23.4048 12.5545L20.9611 11.5423ZM19.5888 12.013C19.9236 12.2768 20.2264 12.5795 20.4903 12.9142C21.0909 13.6758 21.4906 14.6031 21.6096 15.6163C21.634 15.8248 21.6466 16.037 21.6466 16.2521C21.6466 16.4674 21.6341 16.6798 21.6095 16.8886C21.4905 17.9012 21.091 18.828 20.4909 19.5893C20.2272 19.9237 19.9247 20.2263 19.5903 20.49C18.8286 21.091 17.9008 21.4909 16.8872 21.6097C16.6788 21.6342 16.4668 21.6468 16.252 21.6468C16.0367 21.6468 15.8244 21.6342 15.6159 21.6097C14.603 21.4907 13.6759 21.0911 12.9145 20.4907C12.5801 20.2271 12.2776 19.9247 12.0139 19.5904C11.4131 18.8287 11.0132 17.9009 10.8943 16.8874C10.8699 16.6791 10.8572 16.467 10.8572 16.2521C10.8572 16.0367 10.8699 15.8243 10.8944 15.6155C11.0135 14.603 11.4129 13.6762 12.013 12.915C12.2768 12.5803 12.5795 12.2776 12.9141 12.0137C13.6756 11.4132 14.603 11.0135 15.6161 10.8945C15.8246 10.87 16.0368 10.8574 16.252 10.8574C16.4674 10.8574 16.68 10.87 16.8889 10.8946C17.9012 11.0137 18.8278 11.4131 19.5888 12.013ZM22.3926 14.998L21.4807 12.7966L23.0374 13.4414L22.3926 14.998ZM22.3926 17.5067L21.4812 19.7068L23.037 19.0624L22.3926 17.5067ZM23.9239 18.6951L22.9121 16.2524L23.9243 13.8088L26.1347 14.7243C27.1621 15.1499 27.8827 15.4497 28.3526 15.727C28.8388 16.0139 28.876 16.1731 28.876 16.2518C28.876 16.3305 28.8388 16.4897 28.3526 16.7766C27.8827 17.0539 27.1621 17.3537 26.1347 17.7793L23.9239 18.6951ZM23.4043 19.9494L20.9617 20.9611L19.9495 23.4048L22.1599 24.3203C23.1873 24.7459 23.9088 25.0435 24.4372 25.1796C24.9839 25.3206 25.1227 25.2343 25.1784 25.1786C25.2341 25.123 25.3203 24.9841 25.1794 24.4375C25.0432 23.9091 24.7457 23.1875 24.3201 22.1601L23.4043 19.9494ZM19.0626 23.0374L19.7074 21.4807L17.5059 22.3926L19.0626 23.0374ZM14.9973 22.3926L12.7971 21.4812L13.4416 23.037L14.9973 22.3926ZM13.8089 23.9239L16.2516 22.9121L18.6952 23.9243L17.7796 26.1347C17.354 27.1621 17.0543 27.8827 16.777 28.3526C16.49 28.8388 16.3308 28.876 16.2521 28.876C16.1735 28.876 16.0143 28.8388 15.7273 28.3526C15.45 27.8827 15.1502 27.1621 14.7247 26.1347L13.8089 23.9239ZM12.5546 23.4043L11.5428 20.9617L9.09922 19.9495L8.18365 22.1599C7.75808 23.1873 7.46049 23.9088 7.32432 24.4372C7.18343 24.9839 7.26969 25.1227 7.32534 25.1784C7.38099 25.2341 7.51982 25.3203 8.06653 25.1794C8.5949 25.0432 9.3164 24.7457 10.3438 24.3201L12.5546 23.4043ZM9.46658 19.0626L11.0233 19.7074L10.1114 17.5059L9.46658 19.0626ZM10.1114 14.9973L11.0227 12.7971L9.46701 13.4416L10.1114 14.9973ZM8.58008 13.8089L9.59186 16.2516L8.57965 18.6952L6.36926 17.7796C5.34186 17.354 4.62125 17.0543 4.15134 16.777C3.66514 16.49 3.62797 16.3308 3.62797 16.2521C3.62797 16.1735 3.66514 16.0143 4.15134 15.7273C4.62125 15.45 5.34186 15.1502 6.36926 14.7247L8.58008 13.8089ZM9.0996 12.5546L11.5423 11.5428L12.5545 9.09922L10.3441 8.18365C9.31666 7.75805 8.59512 7.4605 8.06674 7.32434C7.52005 7.18344 7.38122 7.26968 7.32557 7.32536C7.26992 7.38098 7.18366 7.51981 7.32455 8.06653C7.46072 8.5949 7.7583 9.3164 8.18386 10.3438L9.0996 12.5546ZM13.4414 9.46658L12.7966 11.0233L14.998 10.1114L13.4414 9.46658Z",
|
|
15974
|
+
fill: "url(#paint1_linear_entity)"
|
|
15975
|
+
}
|
|
15976
|
+
), /* @__PURE__ */ React169.createElement("defs", null, /* @__PURE__ */ React169.createElement("linearGradient", { id: "paint0_linear_entity", x1: "16.2507", y1: "2.55445", x2: "16.2507", y2: "29.947", gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ React169.createElement("stop", { stopColor: "#2BFFBF" }), /* @__PURE__ */ React169.createElement("stop", { offset: "1", stopColor: "#1BA897" })), /* @__PURE__ */ React169.createElement("linearGradient", { id: "paint1_linear_entity", x1: "10.3207", y1: "1.12708", x2: "20.2572", y2: "30.2205", gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ React169.createElement("stop", { stopColor: "#58F5FF" }), /* @__PURE__ */ React169.createElement("stop", { offset: "1", stopColor: "#1A7E8C" }))));
|
|
15977
|
+
};
|
|
15978
|
+
var EntityAvatar_default = EntityAvatar;
|
|
15979
|
+
|
|
15980
|
+
// src/mantine/blocks/protocolSelector/flow/ProtocolSelectionPanel.tsx
|
|
15981
|
+
var ProtocolSelectionPanel = ({ editor, block }) => {
|
|
15982
|
+
const { closePanel } = usePanelStore();
|
|
15983
|
+
const handlers = useBlocknoteHandlers();
|
|
15984
|
+
const protocolDids = useMemo50(() => {
|
|
15985
|
+
try {
|
|
15986
|
+
const parsed = JSON.parse(block.props.protocolDids || "[]");
|
|
15987
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
15988
|
+
} catch {
|
|
15989
|
+
return [];
|
|
15990
|
+
}
|
|
15991
|
+
}, [block.props.protocolDids]);
|
|
15992
|
+
const [protocols, setProtocols] = useState60([]);
|
|
15993
|
+
useEffect43(() => {
|
|
15994
|
+
if (protocolDids.length === 0) {
|
|
15995
|
+
setProtocols([]);
|
|
15996
|
+
return;
|
|
15997
|
+
}
|
|
15998
|
+
const initialProtocols = protocolDids.map((did) => ({
|
|
15999
|
+
did,
|
|
16000
|
+
name: did,
|
|
16001
|
+
type: "Protocol",
|
|
16002
|
+
description: "",
|
|
16003
|
+
loading: true
|
|
16004
|
+
}));
|
|
16005
|
+
setProtocols(initialProtocols);
|
|
16006
|
+
protocolDids.forEach(async (did, index) => {
|
|
16007
|
+
try {
|
|
16008
|
+
if (handlers.getEntity) {
|
|
16009
|
+
const entity = await handlers.getEntity(did);
|
|
16010
|
+
console.log("entity", entity);
|
|
16011
|
+
let metadata = {};
|
|
16012
|
+
if (entity?.metadata) {
|
|
16013
|
+
try {
|
|
16014
|
+
metadata = typeof entity.metadata === "string" ? JSON.parse(entity.metadata) : entity.metadata;
|
|
16015
|
+
} catch {
|
|
16016
|
+
}
|
|
16017
|
+
}
|
|
16018
|
+
const rawType = entity?.type || "";
|
|
16019
|
+
const extractedType = rawType.includes("/") ? rawType.split("/").pop() || rawType : rawType;
|
|
16020
|
+
const displayType = extractedType.charAt(0).toUpperCase() + extractedType.slice(1);
|
|
16021
|
+
setProtocols(
|
|
16022
|
+
(prev) => prev.map(
|
|
16023
|
+
(p, i) => i === index ? {
|
|
16024
|
+
...p,
|
|
16025
|
+
name: metadata?.name || entity?.id || did,
|
|
16026
|
+
type: displayType || "Protocol",
|
|
16027
|
+
description: metadata?.description || "",
|
|
16028
|
+
loading: false
|
|
16029
|
+
} : p
|
|
16030
|
+
)
|
|
16031
|
+
);
|
|
16032
|
+
} else {
|
|
16033
|
+
setProtocols(
|
|
16034
|
+
(prev) => prev.map(
|
|
16035
|
+
(p, i) => i === index ? {
|
|
16036
|
+
...p,
|
|
16037
|
+
name: `Protocol ${index + 1}`,
|
|
16038
|
+
type: "Protocol",
|
|
16039
|
+
description: `DID: ${did}`,
|
|
16040
|
+
loading: false
|
|
16041
|
+
} : p
|
|
16042
|
+
)
|
|
16043
|
+
);
|
|
16044
|
+
}
|
|
16045
|
+
} catch (_error) {
|
|
16046
|
+
setProtocols(
|
|
16047
|
+
(prev) => prev.map(
|
|
16048
|
+
(p, i) => i === index ? {
|
|
16049
|
+
...p,
|
|
16050
|
+
name: `Protocol ${index + 1}`,
|
|
16051
|
+
type: "Protocol",
|
|
16052
|
+
description: `DID: ${did}`,
|
|
16053
|
+
loading: false,
|
|
16054
|
+
error: "Failed to fetch entity info"
|
|
16055
|
+
} : p
|
|
16056
|
+
)
|
|
16057
|
+
);
|
|
16058
|
+
}
|
|
16059
|
+
});
|
|
16060
|
+
}, [protocolDids, handlers]);
|
|
16061
|
+
const handleSelectProtocol = useCallback41(
|
|
16062
|
+
(protocol) => {
|
|
16063
|
+
editor.updateBlock(block, {
|
|
16064
|
+
props: {
|
|
16065
|
+
...block.props,
|
|
16066
|
+
selectedProtocolDid: protocol.did,
|
|
16067
|
+
selectedProtocolName: protocol.name,
|
|
16068
|
+
selectedProtocolType: protocol.type,
|
|
16069
|
+
status: "completed"
|
|
16070
|
+
}
|
|
16071
|
+
});
|
|
16072
|
+
closePanel();
|
|
16073
|
+
},
|
|
16074
|
+
[editor, block, closePanel]
|
|
16075
|
+
);
|
|
16076
|
+
const selectedDid = block.props.selectedProtocolDid;
|
|
16077
|
+
return /* @__PURE__ */ React170.createElement(
|
|
16078
|
+
Paper16,
|
|
16079
|
+
{
|
|
16080
|
+
p: "md",
|
|
16081
|
+
shadow: "sm",
|
|
16082
|
+
style: {
|
|
16083
|
+
height: "100%",
|
|
16084
|
+
display: "flex",
|
|
16085
|
+
flexDirection: "column",
|
|
16086
|
+
position: "relative"
|
|
16087
|
+
}
|
|
16088
|
+
},
|
|
16089
|
+
/* @__PURE__ */ React170.createElement(Group52, { justify: "space-between", align: "center", mb: "xl" }, /* @__PURE__ */ React170.createElement(Text88, { fz: 16, fw: 600 }, block.props.title || "Select Protocol"), /* @__PURE__ */ React170.createElement(CloseButton9, { onClick: closePanel })),
|
|
16090
|
+
/* @__PURE__ */ React170.createElement(Stack115, { gap: "sm", style: { flex: 1, overflow: "auto" } }, protocols.length === 0 ? /* @__PURE__ */ React170.createElement(Box32, { py: "md" }, /* @__PURE__ */ React170.createElement(Text88, { c: "dimmed", ta: "center" }, "No protocols configured.", /* @__PURE__ */ React170.createElement("br", null), "Add protocol DIDs in template mode.")) : protocols.map((protocol) => {
|
|
16091
|
+
const isSelected = protocol.did === selectedDid;
|
|
16092
|
+
return /* @__PURE__ */ React170.createElement(
|
|
16093
|
+
Box32,
|
|
16094
|
+
{
|
|
16095
|
+
key: protocol.did,
|
|
16096
|
+
onClick: () => !protocol.loading && handleSelectProtocol(protocol),
|
|
16097
|
+
style: {
|
|
16098
|
+
padding: "12px 16px",
|
|
16099
|
+
borderRadius: 12,
|
|
16100
|
+
border: isSelected ? "2px solid var(--mantine-primary-color-filled)" : "1px solid var(--mantine-color-dark-4)",
|
|
16101
|
+
backgroundColor: isSelected ? "var(--mantine-color-dark-6)" : "var(--mantine-color-dark-7)",
|
|
16102
|
+
cursor: protocol.loading ? "wait" : "pointer",
|
|
16103
|
+
transition: "all 0.15s ease",
|
|
16104
|
+
"&:hover": {
|
|
16105
|
+
backgroundColor: "var(--mantine-color-dark-6)"
|
|
16106
|
+
}
|
|
16107
|
+
}
|
|
16108
|
+
},
|
|
16109
|
+
/* @__PURE__ */ React170.createElement(Group52, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React170.createElement(Group52, { wrap: "nowrap", align: "center", gap: "md", style: { flex: 1 } }, protocol.loading ? /* @__PURE__ */ React170.createElement(Loader23, { size: "xs", color: "white" }) : /* @__PURE__ */ React170.createElement(EntityAvatar_default, { size: 24 }), /* @__PURE__ */ React170.createElement(Stack115, { gap: 2, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React170.createElement(Text88, { fw: 500, size: "sm", lineClamp: 1 }, protocol.loading ? "Loading..." : protocol.type), /* @__PURE__ */ React170.createElement(Text88, { size: "xs", c: "dimmed", lineClamp: 2 }, protocol.loading ? "Fetching protocol info..." : protocol.description || protocol.did))))
|
|
16110
|
+
);
|
|
16111
|
+
}))
|
|
16112
|
+
);
|
|
16113
|
+
};
|
|
16114
|
+
|
|
16115
|
+
// src/mantine/blocks/protocolSelector/flow/FlowView.tsx
|
|
16116
|
+
var PROTOCOL_SELECTOR_FLOW_PANEL_ID = "protocol-selector-flow-panel";
|
|
16117
|
+
var ProtocolSelectorFlowView = ({ editor, block, isDisabled }) => {
|
|
16118
|
+
const disabled = isDisabled?.isDisabled === "disable";
|
|
16119
|
+
const panelId = `${PROTOCOL_SELECTOR_FLOW_PANEL_ID}-${block.id}`;
|
|
16120
|
+
const isCompleted = block.props.status === "completed" && block.props.selectedProtocolDid;
|
|
16121
|
+
const panelContent = useMemo51(() => /* @__PURE__ */ React171.createElement(ProtocolSelectionPanel, { editor, block }), [editor, block]);
|
|
16122
|
+
const { open } = usePanel(panelId, panelContent);
|
|
16123
|
+
const handleClick = () => {
|
|
16124
|
+
if (disabled) return;
|
|
16125
|
+
open();
|
|
16126
|
+
};
|
|
16127
|
+
const containerContent = /* @__PURE__ */ React171.createElement(BaseContainer, { onClick: disabled ? void 0 : handleClick }, /* @__PURE__ */ React171.createElement(Group53, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React171.createElement(Group53, { wrap: "nowrap", align: "center", gap: "md" }, /* @__PURE__ */ React171.createElement(
|
|
16128
|
+
Box33,
|
|
16129
|
+
{
|
|
16130
|
+
style: {
|
|
16131
|
+
display: "flex",
|
|
16132
|
+
alignItems: "center",
|
|
16133
|
+
justifyContent: "center",
|
|
16134
|
+
opacity: disabled ? 0.5 : 1
|
|
16135
|
+
}
|
|
16136
|
+
},
|
|
16137
|
+
/* @__PURE__ */ React171.createElement(IconCircleDashed3, { size: 26, color: "white" })
|
|
16138
|
+
), /* @__PURE__ */ React171.createElement(Stack116, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React171.createElement(Text89, { fw: 500, size: "sm", lineClamp: 1, style: { opacity: disabled ? 0.5 : 1 } }, block.props.title || "Select Protocol"), isCompleted && block.props.selectedProtocolType ? /* @__PURE__ */ React171.createElement(Badge24, { size: "sm", styles: { root: { backgroundColor: "var(--mantine-primary-color-light)", color: "var(--mantine-primary-color-filled)" } } }, block.props.selectedProtocolType) : /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed", style: { opacity: disabled ? 0.5 : 1 } }, "Selection"))), /* @__PURE__ */ React171.createElement(Stack116, { gap: 2, align: "flex-end" }, isCompleted ? /* @__PURE__ */ React171.createElement(React171.Fragment, null, /* @__PURE__ */ React171.createElement(Group53, { gap: 4 }, /* @__PURE__ */ React171.createElement(IconChecks, { size: 16, color: "var(--mantine-color-green-4)" }), /* @__PURE__ */ React171.createElement(Text89, { size: "sm", c: "green.4", fw: 500 }, "Completed")), /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed", lineClamp: 1 }, block.props.selectedProtocolName || block.props.selectedProtocolDid)) : /* @__PURE__ */ React171.createElement(React171.Fragment, null, /* @__PURE__ */ React171.createElement(Text89, { size: "sm" }, "Pending"), /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed" }, "Complete now")))));
|
|
16139
|
+
if (disabled && isDisabled?.message) {
|
|
16140
|
+
return /* @__PURE__ */ React171.createElement(Tooltip16, { label: isDisabled.message, position: "top", withArrow: true }, /* @__PURE__ */ React171.createElement(Box33, { style: { cursor: "not-allowed" } }, containerContent));
|
|
16141
|
+
}
|
|
16142
|
+
return containerContent;
|
|
16143
|
+
};
|
|
16144
|
+
|
|
16145
|
+
// src/mantine/blocks/protocolSelector/ProtocolSelectorBlock.tsx
|
|
16146
|
+
function ProtocolSelectorBlock({ editor, block }) {
|
|
16147
|
+
const { docType } = useBlocknoteContext();
|
|
16148
|
+
const { actions } = useBlockConditions(block, editor);
|
|
16149
|
+
if (docType === "template") {
|
|
16150
|
+
return /* @__PURE__ */ React172.createElement(ProtocolSelectorTemplateView, { editor, block });
|
|
16151
|
+
}
|
|
16152
|
+
const conditionConfig = parseConditionConfig(block.props.conditions);
|
|
16153
|
+
const hasVisibility = hasVisibilityConditions(conditionConfig);
|
|
16154
|
+
const showActionExists = actions.some((a) => a.action === "show");
|
|
16155
|
+
const shouldHide = hasVisibility && !showActionExists;
|
|
16156
|
+
if (shouldHide) {
|
|
16157
|
+
return null;
|
|
16158
|
+
}
|
|
16159
|
+
const hasEnable = hasEnableConditions(conditionConfig);
|
|
16160
|
+
const enableActionExists = actions.some((a) => a.action === "enable");
|
|
16161
|
+
const shouldDisable = hasEnable && !enableActionExists;
|
|
16162
|
+
return /* @__PURE__ */ React172.createElement(
|
|
16163
|
+
ProtocolSelectorFlowView,
|
|
16164
|
+
{
|
|
16165
|
+
block,
|
|
16166
|
+
editor,
|
|
16167
|
+
isDisabled: shouldDisable ? {
|
|
16168
|
+
isDisabled: "disable",
|
|
16169
|
+
message: "This protocol selector is currently disabled by conditions"
|
|
16170
|
+
} : void 0
|
|
16171
|
+
}
|
|
16172
|
+
);
|
|
16173
|
+
}
|
|
16174
|
+
|
|
16175
|
+
// src/mantine/blocks/protocolSelector/ProtocolSelectorBlockSpec.tsx
|
|
16176
|
+
var ProtocolSelectorBlockSpec = createReactBlockSpec14(
|
|
16177
|
+
{
|
|
16178
|
+
type: "protocolSelector",
|
|
16179
|
+
propSchema: {
|
|
16180
|
+
title: {
|
|
16181
|
+
default: ""
|
|
16182
|
+
},
|
|
16183
|
+
description: {
|
|
16184
|
+
default: ""
|
|
16185
|
+
},
|
|
16186
|
+
icon: {
|
|
16187
|
+
default: "git-branch"
|
|
16188
|
+
},
|
|
16189
|
+
protocolDids: {
|
|
16190
|
+
default: "[]"
|
|
16191
|
+
},
|
|
16192
|
+
selectedProtocolDid: {
|
|
16193
|
+
default: ""
|
|
16194
|
+
},
|
|
16195
|
+
selectedProtocolName: {
|
|
16196
|
+
default: ""
|
|
16197
|
+
},
|
|
16198
|
+
selectedProtocolType: {
|
|
16199
|
+
default: ""
|
|
16200
|
+
},
|
|
16201
|
+
status: {
|
|
16202
|
+
default: "pending"
|
|
16203
|
+
},
|
|
16204
|
+
conditions: {
|
|
16205
|
+
default: ""
|
|
16206
|
+
}
|
|
16207
|
+
},
|
|
16208
|
+
content: "none"
|
|
16209
|
+
},
|
|
16210
|
+
{
|
|
16211
|
+
render: (props) => {
|
|
16212
|
+
const ixoProps = props;
|
|
16213
|
+
return /* @__PURE__ */ React173.createElement(ProtocolSelectorBlock, { ...ixoProps });
|
|
16214
|
+
}
|
|
16215
|
+
}
|
|
16216
|
+
);
|
|
16217
|
+
|
|
16218
|
+
// src/mantine/blocks/form/FormBlockSpec.tsx
|
|
16219
|
+
import React180 from "react";
|
|
16220
|
+
import { createReactBlockSpec as createReactBlockSpec15 } from "@blocknote/react";
|
|
16221
|
+
|
|
16222
|
+
// src/mantine/blocks/form/FormBlock.tsx
|
|
16223
|
+
import React179 from "react";
|
|
16224
|
+
|
|
16225
|
+
// src/mantine/blocks/form/template/TemplateView.tsx
|
|
16226
|
+
import React176, { useMemo as useMemo52 } from "react";
|
|
16227
|
+
import { Badge as Badge25, Group as Group54, Stack as Stack117, Text as Text91 } from "@mantine/core";
|
|
16228
|
+
|
|
16229
|
+
// src/mantine/blocks/form/template/TemplateConfig.tsx
|
|
16230
|
+
import React175, { useCallback as useCallback42 } from "react";
|
|
16231
|
+
import { Paper as Paper17, CloseButton as CloseButton10, Title as Title13 } from "@mantine/core";
|
|
16232
|
+
|
|
16233
|
+
// src/mantine/blocks/form/template/GeneralTab.tsx
|
|
16234
|
+
import React174, { useEffect as useEffect44, useState as useState61 } from "react";
|
|
16235
|
+
import { Text as Text90 } from "@mantine/core";
|
|
16236
|
+
var GeneralTab11 = ({ title, description, icon, surveySchema, onTitleChange, onDescriptionChange, onIconChange, onSurveySchemaChange }) => {
|
|
16237
|
+
const [localTitle, setLocalTitle] = useState61(title || "");
|
|
16238
|
+
const [localDescription, setLocalDescription] = useState61(description || "");
|
|
16239
|
+
const [localIcon, setLocalIcon] = useState61(icon || "checklist");
|
|
16240
|
+
const [localSchema, setLocalSchema] = useState61(surveySchema || "");
|
|
16241
|
+
const [schemaError, setSchemaError] = useState61(null);
|
|
16242
|
+
useEffect44(() => setLocalTitle(title || ""), [title]);
|
|
16243
|
+
useEffect44(() => setLocalDescription(description || ""), [description]);
|
|
16244
|
+
useEffect44(() => setLocalIcon(icon || "checklist"), [icon]);
|
|
16245
|
+
useEffect44(() => setLocalSchema(surveySchema || ""), [surveySchema]);
|
|
16246
|
+
const handleSchemaChange = (value) => {
|
|
16247
|
+
setLocalSchema(value);
|
|
16248
|
+
setSchemaError(null);
|
|
16249
|
+
if (value.trim()) {
|
|
16250
|
+
try {
|
|
16251
|
+
JSON.parse(value);
|
|
16252
|
+
onSurveySchemaChange(value);
|
|
16253
|
+
} catch {
|
|
16254
|
+
setSchemaError("Invalid JSON format");
|
|
16255
|
+
}
|
|
16256
|
+
} else {
|
|
16257
|
+
onSurveySchemaChange("");
|
|
16258
|
+
}
|
|
16259
|
+
};
|
|
16260
|
+
return /* @__PURE__ */ React174.createElement(BaseSection, null, /* @__PURE__ */ React174.createElement(
|
|
16261
|
+
BaseTextInput,
|
|
16262
|
+
{
|
|
16263
|
+
label: "Title",
|
|
16264
|
+
placeholder: "e.g. Basic Information",
|
|
16265
|
+
value: localTitle,
|
|
16266
|
+
onChange: (event) => {
|
|
16267
|
+
const newValue = event.currentTarget.value;
|
|
16268
|
+
setLocalTitle(newValue);
|
|
16269
|
+
onTitleChange(newValue);
|
|
16270
|
+
}
|
|
16271
|
+
}
|
|
16272
|
+
), /* @__PURE__ */ React174.createElement(
|
|
16273
|
+
BaseTextArea,
|
|
16274
|
+
{
|
|
16275
|
+
label: "Description",
|
|
16276
|
+
placeholder: "Short description of the form",
|
|
16277
|
+
minRows: 2,
|
|
16278
|
+
value: localDescription,
|
|
16279
|
+
onChange: (event) => {
|
|
16280
|
+
const newValue = event.currentTarget.value;
|
|
16281
|
+
setLocalDescription(newValue);
|
|
16282
|
+
onDescriptionChange(newValue);
|
|
16283
|
+
}
|
|
16284
|
+
}
|
|
16285
|
+
), /* @__PURE__ */ React174.createElement(
|
|
16286
|
+
BaseTextInput,
|
|
16287
|
+
{
|
|
16288
|
+
label: "Icon",
|
|
16289
|
+
description: "Use a supported icon key (e.g. checklist, file-text, checkbox)",
|
|
16290
|
+
placeholder: "checklist",
|
|
16291
|
+
value: localIcon,
|
|
16292
|
+
onChange: (event) => {
|
|
16293
|
+
const newValue = event.currentTarget.value;
|
|
16294
|
+
setLocalIcon(newValue);
|
|
16295
|
+
onIconChange(newValue);
|
|
16296
|
+
}
|
|
16297
|
+
}
|
|
16298
|
+
), /* @__PURE__ */ React174.createElement(
|
|
16299
|
+
BaseTextArea,
|
|
16300
|
+
{
|
|
16301
|
+
label: "Survey Schema (JSON)",
|
|
16302
|
+
description: "Paste your SurveyJS schema JSON here",
|
|
16303
|
+
placeholder: '{"elements": [{"type": "text", "name": "question1", "title": "Your question"}]}',
|
|
16304
|
+
minRows: 8,
|
|
16305
|
+
value: localSchema,
|
|
16306
|
+
onChange: (event) => handleSchemaChange(event.currentTarget.value),
|
|
16307
|
+
error: schemaError
|
|
16308
|
+
}
|
|
16309
|
+
), localSchema && !schemaError && /* @__PURE__ */ React174.createElement(Text90, { size: "xs", c: "green" }, "\u2713 Valid JSON schema"));
|
|
16310
|
+
};
|
|
16311
|
+
|
|
16312
|
+
// src/mantine/blocks/form/template/TemplateConfig.tsx
|
|
16313
|
+
var TemplateConfig11 = ({ editor, block }) => {
|
|
16314
|
+
const { closePanel } = usePanelStore();
|
|
16315
|
+
const updateProp = useCallback42(
|
|
16316
|
+
(key, value) => {
|
|
16317
|
+
editor.updateBlock(block, {
|
|
16318
|
+
props: {
|
|
16319
|
+
...block.props,
|
|
16320
|
+
[key]: value
|
|
16321
|
+
}
|
|
16322
|
+
});
|
|
16323
|
+
},
|
|
16324
|
+
[editor, block]
|
|
16325
|
+
);
|
|
16326
|
+
return /* @__PURE__ */ React175.createElement(
|
|
16327
|
+
Paper17,
|
|
16328
|
+
{
|
|
16329
|
+
p: "md",
|
|
16330
|
+
shadow: "sm",
|
|
16331
|
+
style: {
|
|
16332
|
+
height: "100%",
|
|
16333
|
+
display: "flex",
|
|
16334
|
+
flexDirection: "column"
|
|
16335
|
+
}
|
|
16336
|
+
},
|
|
16337
|
+
/* @__PURE__ */ React175.createElement(
|
|
16338
|
+
"div",
|
|
16339
|
+
{
|
|
16340
|
+
style: {
|
|
16341
|
+
display: "flex",
|
|
16342
|
+
justifyContent: "space-between",
|
|
16343
|
+
alignItems: "center",
|
|
16344
|
+
marginBottom: "1rem"
|
|
16345
|
+
}
|
|
16346
|
+
},
|
|
16347
|
+
/* @__PURE__ */ React175.createElement(Title13, { order: 3 }, "Form Settings"),
|
|
16348
|
+
/* @__PURE__ */ React175.createElement(CloseButton10, { onClick: closePanel })
|
|
16349
|
+
),
|
|
16350
|
+
/* @__PURE__ */ React175.createElement(
|
|
16351
|
+
ReusablePanel,
|
|
16352
|
+
{
|
|
16353
|
+
extraTabs: [
|
|
16354
|
+
{
|
|
16355
|
+
label: "General",
|
|
16356
|
+
value: "general",
|
|
16357
|
+
content: /* @__PURE__ */ React175.createElement(
|
|
16358
|
+
GeneralTab11,
|
|
16359
|
+
{
|
|
16360
|
+
title: block.props.title || "",
|
|
16361
|
+
description: block.props.description || "",
|
|
16362
|
+
icon: block.props.icon || "checklist",
|
|
16363
|
+
surveySchema: block.props.surveySchema || "",
|
|
16364
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
16365
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
16366
|
+
onIconChange: (value) => updateProp("icon", value),
|
|
16367
|
+
onSurveySchemaChange: (value) => updateProp("surveySchema", value)
|
|
16368
|
+
}
|
|
16369
|
+
)
|
|
16370
|
+
}
|
|
16371
|
+
],
|
|
16372
|
+
context: { editor, block }
|
|
16373
|
+
}
|
|
16374
|
+
)
|
|
16375
|
+
);
|
|
16376
|
+
};
|
|
16377
|
+
|
|
16378
|
+
// src/mantine/blocks/form/template/TemplateView.tsx
|
|
16379
|
+
var FORM_TEMPLATE_PANEL_ID = "form-template-panel";
|
|
16380
|
+
var FormTemplateView = ({ editor, block }) => {
|
|
16381
|
+
const panelId = `${FORM_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
16382
|
+
const panelContent = useMemo52(() => /* @__PURE__ */ React176.createElement(TemplateConfig11, { editor, block }), [editor, block]);
|
|
16383
|
+
const { open } = usePanel(panelId, panelContent);
|
|
16384
|
+
const hasSchema = Boolean(block.props.surveySchema);
|
|
16385
|
+
return /* @__PURE__ */ React176.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React176.createElement(Badge25, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React176.createElement(Group54, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React176.createElement(Group54, { wrap: "nowrap", align: "center" }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React176.createElement(Stack117, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React176.createElement(Text91, { fw: 500, size: "sm" }, block.props.title || "Form"), /* @__PURE__ */ React176.createElement(Text91, { size: "xs", c: "dimmed" }, hasSchema ? "Form configured" : "Click to configure form schema")))));
|
|
16386
|
+
};
|
|
16387
|
+
|
|
16388
|
+
// src/mantine/blocks/form/flow/FlowView.tsx
|
|
16389
|
+
import React178, { useMemo as useMemo54, useState as useState62, useCallback as useCallback44 } from "react";
|
|
16390
|
+
import { ActionIcon as ActionIcon26, Badge as Badge26, Group as Group56, Stack as Stack119, Text as Text93, Tooltip as Tooltip17 } from "@mantine/core";
|
|
16391
|
+
import { IconChevronRight as IconChevronRight7 } from "@tabler/icons-react";
|
|
16392
|
+
|
|
16393
|
+
// src/mantine/blocks/form/flow/FormPanel.tsx
|
|
16394
|
+
import React177, { useCallback as useCallback43, useEffect as useEffect45, useMemo as useMemo53, useRef as useRef10 } from "react";
|
|
16395
|
+
import { Alert as Alert23, CloseButton as CloseButton11, Group as Group55, Stack as Stack118, Text as Text92, Title as Title14 } from "@mantine/core";
|
|
16396
|
+
import { useDebouncedCallback as useDebouncedCallback2 } from "@mantine/hooks";
|
|
16397
|
+
import { IconAlertCircle as IconAlertCircle10 } from "@tabler/icons-react";
|
|
16398
|
+
import { Survey as Survey6, SurveyModel as SurveyModel6 } from "@ixo/surveys";
|
|
16399
|
+
var SYNC_DEBOUNCE_MS2 = 300;
|
|
16400
|
+
function deepEqual2(a, b) {
|
|
16401
|
+
if (a === b) return true;
|
|
16402
|
+
if (a === null || b === null) return a === b;
|
|
16403
|
+
if (typeof a !== typeof b) return false;
|
|
16404
|
+
if (typeof a !== "object") return false;
|
|
16405
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
16406
|
+
if (a.length !== b.length) return false;
|
|
16407
|
+
return a.every((item, index) => deepEqual2(item, b[index]));
|
|
16408
|
+
}
|
|
16409
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
16410
|
+
const aObj = a;
|
|
16411
|
+
const bObj = b;
|
|
16412
|
+
const aKeys = Object.keys(aObj);
|
|
16413
|
+
const bKeys = Object.keys(bObj);
|
|
16414
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
16415
|
+
return aKeys.every((key) => deepEqual2(aObj[key], bObj[key]));
|
|
16416
|
+
}
|
|
16417
|
+
var FormPanel = ({ editor, block, onComplete }) => {
|
|
16418
|
+
const { closePanel } = usePanelStore();
|
|
16419
|
+
const isUpdatingFromProp = useRef10(false);
|
|
16420
|
+
const lastSyncedAnswers = useRef10("");
|
|
16421
|
+
const surveySchema = useMemo53(() => {
|
|
16422
|
+
if (!block.props.surveySchema) return null;
|
|
16423
|
+
try {
|
|
16424
|
+
return JSON.parse(block.props.surveySchema);
|
|
16425
|
+
} catch {
|
|
16426
|
+
return null;
|
|
16427
|
+
}
|
|
16428
|
+
}, [block.props.surveySchema]);
|
|
16429
|
+
const surveyModel = useMemo53(() => {
|
|
16430
|
+
if (!surveySchema) return null;
|
|
16431
|
+
const model = new SurveyModel6(surveySchema);
|
|
16432
|
+
model.applyTheme(surveyTheme);
|
|
16433
|
+
model.showQuestionNumbers = "off";
|
|
16434
|
+
model.questionsOnPageMode = "singlePage";
|
|
16435
|
+
model.completeText = "Complete";
|
|
16436
|
+
return model;
|
|
16437
|
+
}, [surveySchema]);
|
|
16438
|
+
const syncPropToSurvey = useCallback43(
|
|
16439
|
+
(answersJson) => {
|
|
16440
|
+
if (!surveyModel || !answersJson || answersJson === lastSyncedAnswers.current) return;
|
|
16441
|
+
try {
|
|
16442
|
+
const answers = JSON.parse(answersJson);
|
|
16443
|
+
isUpdatingFromProp.current = true;
|
|
16444
|
+
Object.entries(answers).forEach(([key, value]) => {
|
|
16445
|
+
const currentValue = surveyModel.getValue(key);
|
|
16446
|
+
if (!deepEqual2(currentValue, value)) {
|
|
16447
|
+
surveyModel.setValue(key, value);
|
|
16448
|
+
}
|
|
16449
|
+
});
|
|
16450
|
+
lastSyncedAnswers.current = answersJson;
|
|
16451
|
+
} catch (err) {
|
|
16452
|
+
console.error("Failed to parse answers prop:", err);
|
|
16453
|
+
} finally {
|
|
16454
|
+
isUpdatingFromProp.current = false;
|
|
16455
|
+
}
|
|
16456
|
+
},
|
|
16457
|
+
[surveyModel]
|
|
16458
|
+
);
|
|
16459
|
+
const syncSurveyToProp = useDebouncedCallback2((data) => {
|
|
16460
|
+
const newAnswersJson = JSON.stringify(data);
|
|
16461
|
+
if (newAnswersJson === lastSyncedAnswers.current) return;
|
|
16462
|
+
lastSyncedAnswers.current = newAnswersJson;
|
|
16463
|
+
editor.updateBlock(block, {
|
|
16464
|
+
props: {
|
|
16465
|
+
...block.props,
|
|
16466
|
+
answers: newAnswersJson
|
|
16467
|
+
}
|
|
16468
|
+
});
|
|
16469
|
+
}, SYNC_DEBOUNCE_MS2);
|
|
16470
|
+
useEffect45(() => {
|
|
16471
|
+
const answersJson = block.props.answers;
|
|
16472
|
+
if (answersJson) {
|
|
16473
|
+
syncPropToSurvey(answersJson);
|
|
16474
|
+
}
|
|
16475
|
+
}, [block.props.answers, syncPropToSurvey]);
|
|
16476
|
+
useEffect45(() => {
|
|
16477
|
+
if (!surveyModel) return;
|
|
16478
|
+
const handleValueChanged = () => {
|
|
16479
|
+
if (isUpdatingFromProp.current) return;
|
|
16480
|
+
syncSurveyToProp(surveyModel.data);
|
|
16481
|
+
};
|
|
16482
|
+
surveyModel.onValueChanged.add(handleValueChanged);
|
|
16483
|
+
return () => {
|
|
16484
|
+
surveyModel.onValueChanged.remove(handleValueChanged);
|
|
16485
|
+
};
|
|
16486
|
+
}, [surveyModel, syncSurveyToProp]);
|
|
16487
|
+
const handleSurveyComplete = useCallback43(
|
|
16488
|
+
(sender) => {
|
|
16489
|
+
const data = sender.data || {};
|
|
16490
|
+
const finalAnswersJson = JSON.stringify(data);
|
|
16491
|
+
lastSyncedAnswers.current = finalAnswersJson;
|
|
16492
|
+
editor.updateBlock(block, {
|
|
16493
|
+
props: {
|
|
16494
|
+
...block.props,
|
|
16495
|
+
answers: finalAnswersJson,
|
|
16496
|
+
status: "completed",
|
|
16497
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
16498
|
+
}
|
|
16499
|
+
});
|
|
16500
|
+
onComplete?.();
|
|
16501
|
+
},
|
|
16502
|
+
[editor, block, onComplete]
|
|
16503
|
+
);
|
|
16504
|
+
useEffect45(() => {
|
|
16505
|
+
if (!surveyModel) return;
|
|
16506
|
+
surveyModel.onComplete.add(handleSurveyComplete);
|
|
16507
|
+
return () => {
|
|
16508
|
+
surveyModel.onComplete.remove(handleSurveyComplete);
|
|
16509
|
+
};
|
|
16510
|
+
}, [handleSurveyComplete, surveyModel]);
|
|
16511
|
+
const handleClose = useCallback43(() => {
|
|
16512
|
+
closePanel();
|
|
16513
|
+
}, [closePanel]);
|
|
16514
|
+
if (!surveySchema) {
|
|
16515
|
+
return /* @__PURE__ */ React177.createElement(Stack118, { gap: "md", p: "md" }, /* @__PURE__ */ React177.createElement(Group55, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React177.createElement(Title14, { order: 5 }, block.props.title || "Form"), /* @__PURE__ */ React177.createElement(CloseButton11, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React177.createElement(Alert23, { icon: /* @__PURE__ */ React177.createElement(IconAlertCircle10, { size: 16 }), title: "Form Not Configured", color: "yellow" }, /* @__PURE__ */ React177.createElement(Text92, { size: "sm" }, "No survey schema has been configured for this form. Please configure it in template mode.")));
|
|
16516
|
+
}
|
|
16517
|
+
return /* @__PURE__ */ React177.createElement(Stack118, { bg: "#1a1a1a", gap: "md", p: "md" }, /* @__PURE__ */ React177.createElement(Group55, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React177.createElement(Stack118, { gap: 4 }, /* @__PURE__ */ React177.createElement(Title14, { order: 5 }, block.props.title || "Form"), block.props.description && /* @__PURE__ */ React177.createElement(Text92, { size: "sm", c: "dimmed" }, block.props.description)), /* @__PURE__ */ React177.createElement(CloseButton11, { onClick: handleClose, title: "Close panel" })), surveyModel && /* @__PURE__ */ React177.createElement(Survey6, { model: surveyModel }));
|
|
16518
|
+
};
|
|
16519
|
+
|
|
16520
|
+
// src/mantine/blocks/form/flow/FlowView.tsx
|
|
16521
|
+
var FORM_FLOW_PANEL_ID = "form-flow-panel";
|
|
16522
|
+
var FormFlowView = ({ editor, block }) => {
|
|
16523
|
+
const [hasOpened, setHasOpened] = useState62(false);
|
|
16524
|
+
const status = block.props.status || "pending";
|
|
16525
|
+
const isCompleted = status === "completed";
|
|
16526
|
+
const handleComplete = useCallback44(() => {
|
|
16527
|
+
editor.updateBlock(block, {
|
|
16528
|
+
props: {
|
|
16529
|
+
...block.props,
|
|
16530
|
+
status: "completed",
|
|
16531
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
16532
|
+
}
|
|
16533
|
+
});
|
|
16534
|
+
}, [editor, block]);
|
|
16535
|
+
const panelId = `${FORM_FLOW_PANEL_ID}-${block.id}`;
|
|
16536
|
+
const panelContent = useMemo54(() => /* @__PURE__ */ React178.createElement(FormPanel, { editor, block, onComplete: handleComplete }), [editor, block, handleComplete]);
|
|
16537
|
+
const { open } = usePanel(panelId, panelContent);
|
|
16538
|
+
const handleOpen = () => {
|
|
16539
|
+
setHasOpened(true);
|
|
16540
|
+
if (status === "pending") {
|
|
16541
|
+
editor.updateBlock(block, {
|
|
16542
|
+
props: {
|
|
16543
|
+
...block.props,
|
|
16544
|
+
status: "in_progress"
|
|
16545
|
+
}
|
|
16546
|
+
});
|
|
16547
|
+
}
|
|
16548
|
+
open();
|
|
16549
|
+
};
|
|
16550
|
+
const getBadgeProps = () => {
|
|
16551
|
+
if (isCompleted) {
|
|
16552
|
+
return { variant: "light", color: "green", text: "Completed" };
|
|
16553
|
+
}
|
|
16554
|
+
if (status === "in_progress" || hasOpened) {
|
|
16555
|
+
return { variant: "light", color: "blue", text: "In Progress" };
|
|
16556
|
+
}
|
|
16557
|
+
return { variant: "light", color: "gray", text: "Pending" };
|
|
16558
|
+
};
|
|
16559
|
+
const badgeProps = getBadgeProps();
|
|
16560
|
+
const hasSchema = Boolean(block.props.surveySchema);
|
|
16561
|
+
return /* @__PURE__ */ React178.createElement(BaseContainer, { onClick: handleOpen }, /* @__PURE__ */ React178.createElement(Group56, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React178.createElement(Group56, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React178.createElement(Stack119, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React178.createElement(Group56, { gap: "xs", align: "center" }, /* @__PURE__ */ React178.createElement(Text93, { fw: 600, size: "sm" }, block.props.title || "Form"), /* @__PURE__ */ React178.createElement(
|
|
16562
|
+
Badge26,
|
|
16563
|
+
{
|
|
16564
|
+
size: "xs",
|
|
16565
|
+
variant: badgeProps.variant,
|
|
16566
|
+
color: badgeProps.color,
|
|
16567
|
+
styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } }
|
|
16568
|
+
},
|
|
16569
|
+
badgeProps.text
|
|
16570
|
+
)), /* @__PURE__ */ React178.createElement(Text93, { size: "xs", c: "dimmed", lineClamp: 2 }, isCompleted ? `Completed on ${new Date(block.props.completedAt).toLocaleDateString()}` : (
|
|
16571
|
+
// : block.props.description || (hasSchema ? 'Click to fill out the form' : 'Form not configured')}
|
|
16572
|
+
hasSchema ? "Click to fill out the form" : "Form not configured"
|
|
16573
|
+
)))), /* @__PURE__ */ React178.createElement(Tooltip17, { label: isCompleted ? "View form" : "Fill form", withArrow: true }, /* @__PURE__ */ React178.createElement(ActionIcon26, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React178.createElement(IconChevronRight7, { size: 18 })))));
|
|
16574
|
+
};
|
|
16575
|
+
|
|
16576
|
+
// src/mantine/blocks/form/FormBlock.tsx
|
|
16577
|
+
function FormBlock({ editor, block }) {
|
|
16578
|
+
const { docType } = useBlocknoteContext();
|
|
16579
|
+
if (docType === "template") {
|
|
16580
|
+
return /* @__PURE__ */ React179.createElement(FormTemplateView, { editor, block });
|
|
16581
|
+
}
|
|
16582
|
+
return /* @__PURE__ */ React179.createElement(FormFlowView, { editor, block });
|
|
16583
|
+
}
|
|
16584
|
+
|
|
16585
|
+
// src/mantine/blocks/form/FormBlockSpec.tsx
|
|
16586
|
+
var FormBlockSpec = createReactBlockSpec15(
|
|
16587
|
+
{
|
|
16588
|
+
type: "form",
|
|
16589
|
+
propSchema: {
|
|
16590
|
+
title: { default: "" },
|
|
16591
|
+
description: { default: "" },
|
|
16592
|
+
icon: { default: "checklist" },
|
|
16593
|
+
surveySchema: { default: "" },
|
|
16594
|
+
answers: { default: "" },
|
|
16595
|
+
status: { default: "pending" },
|
|
16596
|
+
completedAt: { default: "" }
|
|
16597
|
+
},
|
|
16598
|
+
content: "none"
|
|
16599
|
+
},
|
|
16600
|
+
{
|
|
16601
|
+
render: (props) => {
|
|
16602
|
+
const ixoProps = props;
|
|
16603
|
+
return /* @__PURE__ */ React180.createElement(FormBlock, { ...ixoProps });
|
|
16604
|
+
}
|
|
16605
|
+
}
|
|
16606
|
+
);
|
|
16607
|
+
|
|
16608
|
+
// src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlockSpec.tsx
|
|
16609
|
+
import React187 from "react";
|
|
16610
|
+
import { createReactBlockSpec as createReactBlockSpec16 } from "@blocknote/react";
|
|
16611
|
+
|
|
16612
|
+
// src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlock.tsx
|
|
16613
|
+
import React186 from "react";
|
|
16614
|
+
|
|
16615
|
+
// src/mantine/blocks/domainCreatorSign/template/TemplateView.tsx
|
|
16616
|
+
import React183, { useMemo as useMemo55 } from "react";
|
|
16617
|
+
import { Badge as Badge27, Group as Group57, Stack as Stack120, Text as Text94 } from "@mantine/core";
|
|
16618
|
+
|
|
16619
|
+
// src/mantine/blocks/domainCreatorSign/template/TemplateConfig.tsx
|
|
16620
|
+
import React182, { useCallback as useCallback45 } from "react";
|
|
16621
|
+
import { Paper as Paper18, CloseButton as CloseButton12, Title as Title15 } from "@mantine/core";
|
|
16622
|
+
|
|
16623
|
+
// src/mantine/blocks/domainCreatorSign/template/GeneralTab.tsx
|
|
16624
|
+
import React181, { useEffect as useEffect46, useState as useState63 } from "react";
|
|
16625
|
+
var GeneralTab12 = ({ title, description, icon, onTitleChange, onDescriptionChange, onIconChange }) => {
|
|
16626
|
+
const [localTitle, setLocalTitle] = useState63(title || "");
|
|
16627
|
+
const [localDescription, setLocalDescription] = useState63(description || "");
|
|
16628
|
+
const [localIcon, setLocalIcon] = useState63(icon || "file-text");
|
|
16629
|
+
useEffect46(() => setLocalTitle(title || ""), [title]);
|
|
16630
|
+
useEffect46(() => setLocalDescription(description || ""), [description]);
|
|
16631
|
+
useEffect46(() => setLocalIcon(icon || "file-text"), [icon]);
|
|
16632
|
+
return /* @__PURE__ */ React181.createElement(BaseSection, null, /* @__PURE__ */ React181.createElement(
|
|
16633
|
+
BaseTextInput,
|
|
16634
|
+
{
|
|
16635
|
+
label: "Title",
|
|
16636
|
+
placeholder: "e.g. Sign to Create Domain",
|
|
16637
|
+
value: localTitle,
|
|
16638
|
+
onChange: (event) => {
|
|
16639
|
+
const newValue = event.currentTarget.value;
|
|
16640
|
+
setLocalTitle(newValue);
|
|
16641
|
+
onTitleChange(newValue);
|
|
16642
|
+
}
|
|
16643
|
+
}
|
|
16644
|
+
), /* @__PURE__ */ React181.createElement(
|
|
16645
|
+
BaseTextArea,
|
|
16646
|
+
{
|
|
16647
|
+
label: "Description",
|
|
16648
|
+
placeholder: "Short description",
|
|
16649
|
+
minRows: 2,
|
|
16650
|
+
value: localDescription,
|
|
16651
|
+
onChange: (event) => {
|
|
16652
|
+
const newValue = event.currentTarget.value;
|
|
16653
|
+
setLocalDescription(newValue);
|
|
16654
|
+
onDescriptionChange(newValue);
|
|
16655
|
+
}
|
|
16656
|
+
}
|
|
16657
|
+
), /* @__PURE__ */ React181.createElement(
|
|
16658
|
+
BaseTextInput,
|
|
16659
|
+
{
|
|
16660
|
+
label: "Icon",
|
|
16661
|
+
description: "Use a supported icon key (e.g. file-text, checklist)",
|
|
16662
|
+
placeholder: "file-text",
|
|
16663
|
+
value: localIcon,
|
|
16664
|
+
onChange: (event) => {
|
|
16665
|
+
const newValue = event.currentTarget.value;
|
|
16666
|
+
setLocalIcon(newValue);
|
|
16667
|
+
onIconChange(newValue);
|
|
16668
|
+
}
|
|
16669
|
+
}
|
|
16670
|
+
));
|
|
16671
|
+
};
|
|
16672
|
+
|
|
16673
|
+
// src/mantine/blocks/domainCreatorSign/template/TemplateConfig.tsx
|
|
16674
|
+
var TemplateConfig12 = ({ editor, block }) => {
|
|
16675
|
+
const { closePanel } = usePanelStore();
|
|
16676
|
+
const updateProp = useCallback45(
|
|
16677
|
+
(key, value) => {
|
|
16678
|
+
editor.updateBlock(block, {
|
|
16679
|
+
props: {
|
|
16680
|
+
...block.props,
|
|
16681
|
+
[key]: value
|
|
16682
|
+
}
|
|
16683
|
+
});
|
|
16684
|
+
},
|
|
16685
|
+
[editor, block]
|
|
16686
|
+
);
|
|
16687
|
+
return /* @__PURE__ */ React182.createElement(
|
|
16688
|
+
Paper18,
|
|
16689
|
+
{
|
|
16690
|
+
p: "md",
|
|
16691
|
+
shadow: "sm",
|
|
16692
|
+
style: {
|
|
16693
|
+
height: "100%",
|
|
16694
|
+
display: "flex",
|
|
16695
|
+
flexDirection: "column"
|
|
16696
|
+
}
|
|
16697
|
+
},
|
|
16698
|
+
/* @__PURE__ */ React182.createElement(
|
|
16699
|
+
"div",
|
|
16700
|
+
{
|
|
16701
|
+
style: {
|
|
16702
|
+
display: "flex",
|
|
16703
|
+
justifyContent: "space-between",
|
|
16704
|
+
alignItems: "center",
|
|
16705
|
+
marginBottom: "1rem"
|
|
16706
|
+
}
|
|
16707
|
+
},
|
|
16708
|
+
/* @__PURE__ */ React182.createElement(Title15, { order: 5 }, "Sign to Create Settings"),
|
|
16709
|
+
/* @__PURE__ */ React182.createElement(CloseButton12, { onClick: closePanel })
|
|
16710
|
+
),
|
|
16711
|
+
/* @__PURE__ */ React182.createElement(
|
|
16712
|
+
ReusablePanel,
|
|
16713
|
+
{
|
|
16714
|
+
extraTabs: [
|
|
16715
|
+
{
|
|
16716
|
+
label: "General",
|
|
16717
|
+
value: "general",
|
|
16718
|
+
content: /* @__PURE__ */ React182.createElement(
|
|
16719
|
+
GeneralTab12,
|
|
16720
|
+
{
|
|
16721
|
+
title: block.props.title || "",
|
|
16722
|
+
description: block.props.description || "",
|
|
16723
|
+
icon: block.props.icon || "file-text",
|
|
16724
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
16725
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
16726
|
+
onIconChange: (value) => updateProp("icon", value)
|
|
16727
|
+
}
|
|
16728
|
+
)
|
|
16729
|
+
}
|
|
16730
|
+
],
|
|
16731
|
+
context: { editor, block }
|
|
16732
|
+
}
|
|
16733
|
+
)
|
|
16734
|
+
);
|
|
16735
|
+
};
|
|
16736
|
+
|
|
16737
|
+
// src/mantine/blocks/domainCreatorSign/template/TemplateView.tsx
|
|
16738
|
+
var DOMAIN_CREATOR_SIGN_TEMPLATE_PANEL_ID = "domain-creator-sign-template-panel";
|
|
16739
|
+
var DomainCreatorSignTemplateView = ({ editor, block }) => {
|
|
16740
|
+
const panelId = `${DOMAIN_CREATOR_SIGN_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
16741
|
+
const panelContent = useMemo55(() => /* @__PURE__ */ React183.createElement(TemplateConfig12, { editor, block }), [editor, block]);
|
|
16742
|
+
const { open } = usePanel(panelId, panelContent);
|
|
16743
|
+
return /* @__PURE__ */ React183.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React183.createElement(Badge27, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React183.createElement(Group57, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React183.createElement(Group57, { wrap: "nowrap", align: "center" }, getIcon("feather", block.props.icon), /* @__PURE__ */ React183.createElement(Stack120, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React183.createElement(Text94, { fw: 500, size: "sm" }, block.props.title || "Sign to Create"), /* @__PURE__ */ React183.createElement(Text94, { size: "xs", c: "dimmed" }, "Sign")))));
|
|
16744
|
+
};
|
|
16745
|
+
|
|
16746
|
+
// src/mantine/blocks/domainCreatorSign/flow/FlowView.tsx
|
|
16747
|
+
import React185, { useCallback as useCallback47, useMemo as useMemo56, useEffect as useEffect47 } from "react";
|
|
16748
|
+
import { ActionIcon as ActionIcon27, Badge as Badge28, Button as Button33, Group as Group59, Stack as Stack122, Text as Text96, Tooltip as Tooltip18 } from "@mantine/core";
|
|
16749
|
+
import { IconChevronRight as IconChevronRight8, IconTestPipe, IconTrash as IconTrash5 } from "@tabler/icons-react";
|
|
16750
|
+
|
|
16751
|
+
// src/mantine/blocks/domainCreatorSign/flow/SignPanel.tsx
|
|
16752
|
+
import React184, { useCallback as useCallback46, useState as useState64 } from "react";
|
|
16753
|
+
import { Alert as Alert24, Button as Button32, CloseButton as CloseButton13, Group as Group58, Loader as Loader24, Stack as Stack121, Text as Text95, Title as Title16 } from "@mantine/core";
|
|
16754
|
+
import { IconAlertCircle as IconAlertCircle11, IconCheck as IconCheck5, IconSignature } from "@tabler/icons-react";
|
|
16755
|
+
var SignPanel = ({ editor, block, onComplete, onError }) => {
|
|
16756
|
+
const { closePanel } = usePanelStore();
|
|
16757
|
+
const { handlers } = useBlocknoteContext();
|
|
16758
|
+
const [flowStep, setFlowStep] = useState64(block.props.status === "completed" ? "success" : block.props.status === "error" ? "error" : "ready");
|
|
16759
|
+
const [error, setError] = useState64(block.props.errorMessage || null);
|
|
16760
|
+
const [createdEntityDid, setCreatedEntityDid] = useState64(block.props.entityDid || null);
|
|
16761
|
+
const getDomainCardData = useCallback46(() => {
|
|
16762
|
+
try {
|
|
16763
|
+
return JSON.parse(block.props.domainCardData || "{}");
|
|
16764
|
+
} catch {
|
|
16765
|
+
return null;
|
|
16766
|
+
}
|
|
16767
|
+
}, [block.props.domainCardData]);
|
|
16768
|
+
const processSignAndCreate = useCallback46(async () => {
|
|
16769
|
+
if (!handlers) {
|
|
16770
|
+
throw new Error("Handlers not available");
|
|
16771
|
+
}
|
|
16772
|
+
if (!handlers.signCredential) {
|
|
16773
|
+
throw new Error("signCredential handler not implemented");
|
|
16774
|
+
}
|
|
16775
|
+
if (!handlers.publicFileUpload) {
|
|
16776
|
+
throw new Error("publicFileUpload handler not available");
|
|
16777
|
+
}
|
|
16778
|
+
if (!handlers.createDomain) {
|
|
16779
|
+
throw new Error("createDomain handler not implemented");
|
|
16780
|
+
}
|
|
16781
|
+
if (!handlers.requestPin) {
|
|
16782
|
+
throw new Error("requestPin handler not available");
|
|
16783
|
+
}
|
|
16784
|
+
const domainCardData2 = getDomainCardData();
|
|
16785
|
+
if (!domainCardData2 || !domainCardData2.name) {
|
|
16786
|
+
throw new Error("Domain card data is missing or invalid");
|
|
16787
|
+
}
|
|
16788
|
+
const entityType = block.props.entityType || domainCardData2.type?.[0]?.replace("ixo:", "") || "dao";
|
|
16789
|
+
const issuerDid = handlers.getEntityDid?.() || handlers.getCurrentUser?.()?.address;
|
|
16790
|
+
if (!issuerDid) {
|
|
16791
|
+
throw new Error("Unable to determine issuer DID");
|
|
16792
|
+
}
|
|
16793
|
+
const entityDid = "did:ixo:entity:pending";
|
|
16794
|
+
const credentialSubject = {
|
|
16795
|
+
...domainCardData2,
|
|
16796
|
+
id: entityDid
|
|
16797
|
+
};
|
|
16798
|
+
const unsignedCredential = buildVerifiableCredential({
|
|
16799
|
+
entityDid,
|
|
16800
|
+
issuerDid,
|
|
16801
|
+
credentialSubject,
|
|
16802
|
+
validFrom: domainCardData2.validFrom || (/* @__PURE__ */ new Date()).toISOString(),
|
|
16803
|
+
validUntil: domainCardData2.validUntil
|
|
16804
|
+
});
|
|
16805
|
+
setFlowStep("signing");
|
|
16806
|
+
editor.updateBlock(block, { props: { ...block.props, status: "signing" } });
|
|
16807
|
+
const pin = await handlers.requestPin({
|
|
16808
|
+
title: "Sign Domain Card",
|
|
16809
|
+
description: "Enter your PIN to sign the Domain Card credential",
|
|
16810
|
+
submitText: "Sign"
|
|
16811
|
+
});
|
|
16812
|
+
const { signedCredential } = await handlers.signCredential({
|
|
16813
|
+
issuerDid,
|
|
16814
|
+
issuerType: "user",
|
|
16815
|
+
credential: unsignedCredential,
|
|
16816
|
+
pin
|
|
16817
|
+
});
|
|
16818
|
+
setFlowStep("uploading");
|
|
16819
|
+
editor.updateBlock(block, { props: { ...block.props, status: "uploading" } });
|
|
16820
|
+
const credentialBlob = new Blob([JSON.stringify(signedCredential, null, 2)], {
|
|
16821
|
+
type: "application/json"
|
|
16822
|
+
});
|
|
16823
|
+
const credentialFile = new File([credentialBlob], "domainCard.json", {
|
|
16824
|
+
type: "application/json"
|
|
16825
|
+
});
|
|
16826
|
+
const uploadResult = await handlers.publicFileUpload(credentialFile);
|
|
16827
|
+
const domainCardLinkedResource = buildDomainCardLinkedResource({
|
|
16828
|
+
entityDid,
|
|
16829
|
+
cid: uploadResult.cid,
|
|
16830
|
+
serviceEndpoint: uploadResult.url,
|
|
16831
|
+
description: `Domain Card for ${domainCardData2.name || "Domain"}`
|
|
16832
|
+
});
|
|
16833
|
+
setFlowStep("creating");
|
|
16834
|
+
editor.updateBlock(block, { props: { ...block.props, status: "creating" } });
|
|
16835
|
+
const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
|
|
16836
|
+
entityType,
|
|
16837
|
+
linkedResource: [domainCardLinkedResource],
|
|
16838
|
+
startDate: domainCardData2.validFrom,
|
|
16839
|
+
endDate: domainCardData2.validUntil
|
|
16840
|
+
});
|
|
16841
|
+
return {
|
|
16842
|
+
entityDid: newEntityDid,
|
|
16843
|
+
entityType,
|
|
16844
|
+
transactionHash
|
|
16845
|
+
};
|
|
16846
|
+
}, [handlers, getDomainCardData, block, editor]);
|
|
16847
|
+
const handleSign = useCallback46(async () => {
|
|
16848
|
+
try {
|
|
16849
|
+
const result = await processSignAndCreate();
|
|
16850
|
+
setCreatedEntityDid(result.entityDid);
|
|
16851
|
+
setFlowStep("success");
|
|
16852
|
+
onComplete?.(result);
|
|
16853
|
+
} catch (err) {
|
|
16854
|
+
console.error("Sign and create failed:", err);
|
|
16855
|
+
const errorMessage = err instanceof Error ? err.message : "Sign and create failed";
|
|
16856
|
+
setError(errorMessage);
|
|
16857
|
+
setFlowStep("error");
|
|
16858
|
+
onError?.(errorMessage);
|
|
16859
|
+
}
|
|
16860
|
+
}, [processSignAndCreate, onComplete, onError]);
|
|
16861
|
+
const handleRetry = useCallback46(() => {
|
|
16862
|
+
setFlowStep("ready");
|
|
16863
|
+
setError(null);
|
|
16864
|
+
editor.updateBlock(block, {
|
|
16865
|
+
props: {
|
|
16866
|
+
...block.props,
|
|
16867
|
+
status: "ready",
|
|
16868
|
+
errorMessage: ""
|
|
16869
|
+
}
|
|
16870
|
+
});
|
|
16871
|
+
}, [editor, block]);
|
|
16872
|
+
const handleClose = useCallback46(() => {
|
|
16873
|
+
closePanel();
|
|
16874
|
+
}, [closePanel]);
|
|
16875
|
+
const handleVisitEntity = useCallback46(() => {
|
|
16876
|
+
const entityType = block.props.entityType || "dao";
|
|
16877
|
+
if (createdEntityDid && handlers?.redirectToEntityOverview) {
|
|
16878
|
+
handlers.redirectToEntityOverview(createdEntityDid, entityType);
|
|
16879
|
+
}
|
|
16880
|
+
}, [createdEntityDid, block.props.entityType, handlers]);
|
|
16881
|
+
if (flowStep === "signing" || flowStep === "uploading" || flowStep === "creating") {
|
|
16882
|
+
const stepMessages = {
|
|
16883
|
+
signing: "Signing Domain Card credential...",
|
|
16884
|
+
uploading: "Uploading credential to storage...",
|
|
16885
|
+
creating: "Creating domain entity..."
|
|
16886
|
+
};
|
|
16887
|
+
return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md", align: "center", justify: "center", style: { minHeight: 300 } }, /* @__PURE__ */ React184.createElement(Loader24, { size: "lg" }), /* @__PURE__ */ React184.createElement(Text95, { size: "sm", c: "dimmed" }, stepMessages[flowStep]));
|
|
16888
|
+
}
|
|
16889
|
+
if (flowStep === "success") {
|
|
16890
|
+
return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Alert24, { icon: /* @__PURE__ */ React184.createElement(IconCheck5, { size: 16 }), title: "Domain Created Successfully", color: "green" }, /* @__PURE__ */ React184.createElement(Stack121, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "sm" }, "Your domain has been created and the Domain Card credential has been signed and stored."), createdEntityDid && /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed" }, "Entity DID: ", createdEntityDid))), /* @__PURE__ */ React184.createElement(Button32, { onClick: handleVisitEntity }, "Visit Entity"));
|
|
16891
|
+
}
|
|
16892
|
+
if (flowStep === "error") {
|
|
16893
|
+
return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Alert24, { icon: /* @__PURE__ */ React184.createElement(IconAlertCircle11, { size: 16 }), title: "Domain Creation Failed", color: "red" }, /* @__PURE__ */ React184.createElement(Text95, { size: "sm" }, error || "An unexpected error occurred")), /* @__PURE__ */ React184.createElement(Group58, null, /* @__PURE__ */ React184.createElement(Button32, { variant: "outline", onClick: handleRetry }, "Try Again"), /* @__PURE__ */ React184.createElement(Button32, { variant: "subtle", onClick: handleClose }, "Close")));
|
|
16894
|
+
}
|
|
16895
|
+
const domainCardData = getDomainCardData();
|
|
16896
|
+
return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Stack121, { gap: 4 }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(Text95, { size: "sm", c: "dimmed" }, "Review and sign to create your domain.")), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Stack121, { gap: "xs", p: "md", style: { backgroundColor: "var(--mantine-color-dark-6)", borderRadius: 8 } }, /* @__PURE__ */ React184.createElement(Text95, { fw: 600, size: "sm" }, "Domain Card Summary"), /* @__PURE__ */ React184.createElement(Group58, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Name:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs" }, domainCardData?.name || "Not set")), /* @__PURE__ */ React184.createElement(Group58, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Type:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs" }, block.props.entityType || domainCardData?.type?.[0] || "dao")), domainCardData?.description && /* @__PURE__ */ React184.createElement(Group58, { gap: "xs", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Description:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs", lineClamp: 2, style: { flex: 1 } }, domainCardData.description))), /* @__PURE__ */ React184.createElement(Button32, { leftSection: /* @__PURE__ */ React184.createElement(IconSignature, { size: 18 }), onClick: handleSign, fullWidth: true }, "Sign & Create Domain"));
|
|
16897
|
+
};
|
|
16898
|
+
|
|
16899
|
+
// src/data/domainCard.ts
|
|
16900
|
+
var dummyDomainCardData = {
|
|
16901
|
+
id: "6fcb075108d95d7418a1336e81b07fd5b4bc28b6edf96f1d75a34bfaa40b146e",
|
|
16902
|
+
issuer: "did:ixo:issuer:blueventures",
|
|
16903
|
+
credential_type: ["VerifiableCredential", "ixo:DomainCard"],
|
|
16904
|
+
valid_from: "2025-01-15T08:00:00.000Z",
|
|
16905
|
+
schema_id: "https://github.com/ixofoundation/docs",
|
|
16906
|
+
entity_type: ["schema:Organization", "schema:NGO"],
|
|
16907
|
+
name: "Blue Ventures",
|
|
16908
|
+
alternate_names: ["Blue Ventures Conservation"],
|
|
16909
|
+
description: "Blue Ventures is an award-winning marine conservation organization supporting community-led management of coastal ecosystems across Madagascar, East Africa, Southeast Asia, and the Caribbean. Their work focuses on blue carbon restoration, sustainable fisheries, locally managed marine areas (LMMAs), and strengthening coastal community resilience through science-based conservation practices.",
|
|
16910
|
+
keywords: [
|
|
16911
|
+
"Marine Conservation",
|
|
16912
|
+
"Blue Carbon",
|
|
16913
|
+
"Mangrove Restoration",
|
|
16914
|
+
"Seagrass Conservation",
|
|
16915
|
+
"Sustainable Fisheries",
|
|
16916
|
+
"Biodiversity Protection",
|
|
16917
|
+
"Climate Resilience",
|
|
16918
|
+
"Community-Led Conservation",
|
|
16919
|
+
"LMMAs",
|
|
16920
|
+
"Coastal Livelihoods"
|
|
16921
|
+
],
|
|
16922
|
+
categories: ["ixo:project"],
|
|
16923
|
+
knows_about: [
|
|
16924
|
+
"community-based conservation models",
|
|
16925
|
+
"blue carbon ecosystems",
|
|
16926
|
+
"mangrove reforestation",
|
|
16927
|
+
"seagrass mapping",
|
|
16928
|
+
"marine protected area development",
|
|
16929
|
+
"sustainable small-scale fisheries"
|
|
16930
|
+
],
|
|
16931
|
+
url: "https://blueventures.org/",
|
|
16932
|
+
same_as: [
|
|
16933
|
+
"https://twitter.com/blueventures",
|
|
16934
|
+
"https://github.com/blueventures",
|
|
16935
|
+
"https://linkedin.com/company/blue-ventures",
|
|
16936
|
+
"https://facebook.com/blueventuresorg",
|
|
16937
|
+
"https://instagram.com/blueventures"
|
|
16938
|
+
],
|
|
16939
|
+
logo_url: {
|
|
16940
|
+
url: "https://blueventures.org/wp-content/uploads/2023/08/BlueVentures_logo.png",
|
|
16941
|
+
alt: "The page returned a 404 Not Found error, indicating the requested resource could not be located. The server is running nginx, which is a web server software."
|
|
16942
|
+
},
|
|
16943
|
+
image_urls: [
|
|
16944
|
+
{
|
|
16945
|
+
url: "https://blueventures.org/wp-content/uploads/2024/01/bluecarbon_seascape.jpg",
|
|
16946
|
+
alt: "The page returned a 404 Not Found error, indicating the requested resource could not be located. The server is running nginx, which is a web server software.",
|
|
16947
|
+
type: "schema:ImageObject"
|
|
16948
|
+
}
|
|
16949
|
+
],
|
|
16950
|
+
contact: {
|
|
16951
|
+
email: "info@blueventures.org",
|
|
16952
|
+
website: "https://blueventures.org/",
|
|
16953
|
+
location: "22-26 Station Road, Bristol, England, BS1 4RQ, GB",
|
|
16954
|
+
socialLinks: []
|
|
16955
|
+
},
|
|
16956
|
+
location: "22-26 Station Road, Bristol, England, BS1 4RQ, GB",
|
|
16957
|
+
coordinates: {
|
|
16958
|
+
type: "Point",
|
|
16959
|
+
coordinates: [-2.674898, 51.487256]
|
|
16960
|
+
},
|
|
16961
|
+
address: "22-26 Station Road, Bristol, England, BS1 4RQ, GB",
|
|
16962
|
+
area_served: "Global Coastal Regions",
|
|
16963
|
+
relationships: {
|
|
16964
|
+
memberOf: ["The Blue Carbon Initiative"],
|
|
16965
|
+
partners: ["WWF", "The Nature Conservancy", "IUCN Mangrove Specialist Group"],
|
|
16966
|
+
funders: ["UK Aid / FCDO"]
|
|
16967
|
+
},
|
|
16968
|
+
additional_properties: {
|
|
16969
|
+
attributes: [
|
|
16970
|
+
{
|
|
16971
|
+
"@type": "schema:PropertyValue",
|
|
16972
|
+
"@id": "urn:ixo:attr:projects",
|
|
16973
|
+
name: "Active Conservation Sites",
|
|
16974
|
+
value: "40+"
|
|
16975
|
+
},
|
|
16976
|
+
{
|
|
16977
|
+
"@type": "schema:PropertyValue",
|
|
16978
|
+
"@id": "urn:ixo:attr:focus",
|
|
16979
|
+
name: "Core Focus Areas",
|
|
16980
|
+
value: "Blue carbon, fisheries, biodiversity"
|
|
16981
|
+
}
|
|
16982
|
+
],
|
|
16983
|
+
content_hashes: {
|
|
16984
|
+
"https://blueventures.org/": "1765daf4a048e042bc651e13d6ed88d7f70f576c1b16ac4bc00cd42e78a9fcb0"
|
|
16985
|
+
},
|
|
16986
|
+
content_summaries: {
|
|
16987
|
+
"https://blueventures.org/": "The content highlights Blue Ventures' community-centered approach to marine conservation, emphasizing the critical role of coastal communities in sustaining fisheries and protecting ocean ecosystems. The organization works across 11 countries\u2014including Madagascar, Timor-Leste, Indonesia, and Belize\u2014supporting Locally Managed Marine Areas (LMMAs), community-led fisheries management, and the recognition of traditional governance systems like Tara Bandu. Key strategies include empowering local institutions, promoting data-driven decision-making, strengthening co-management partnerships, and advocating for small-scale fishers' rights. Blue Ventures also addresses social challenges by integrating healthcare access and supporting women-led initiatives. With a vision of 'Thriving Communities. Thriving Oceans,' the organization aims to scale locally led conservation to combat climate change, overfishing, and industrial exploitation, ensuring long-term resilience for both people and nature."
|
|
16988
|
+
},
|
|
16989
|
+
last_fetch_date: "2025-12-11T16:32:33.260Z"
|
|
16990
|
+
},
|
|
16991
|
+
faq: [
|
|
16992
|
+
{
|
|
16993
|
+
question: "What is Marine Conservation Partnerships and what problem does it solve?",
|
|
16994
|
+
answer: "Marine Conservation Partnerships is a service offering that enables NGOs, governments, and coastal communities to implement community-led marine conservation models\u2014primarily Locally Managed Marine Areas (LMMAs)\u2014to address threats to coastal ecosystems. It combines governance frameworks, science-based monitoring, and livelihoods support to deliver measurable conservation and community benefits."
|
|
16995
|
+
},
|
|
16996
|
+
{
|
|
16997
|
+
question: "How does Marine Conservation Partnerships work technically?",
|
|
16998
|
+
answer: "It works by designing and deploying locally led governance structures (LMMA frameworks), conducting science-driven monitoring (ecological surveys, standardized catch surveys), and enabling community-led patrols and fishery closures. The program also integrates mangrove blue carbon initiatives and drone-assisted seagrass mapping to track ecosystem change."
|
|
16999
|
+
},
|
|
17000
|
+
{
|
|
17001
|
+
question: "What can you do with Marine Conservation Partnerships?",
|
|
17002
|
+
answer: "You can establish LMMA networks, implement seasonal or spatial fishery closures, develop mangrove blue carbon projects, and leverage open-access research to inform policy. The offering supports capacity building, governance design, and community-driven stewardship with data-backed decision making."
|
|
17003
|
+
},
|
|
17004
|
+
{
|
|
17005
|
+
question: "Who uses Marine Conservation Partnerships?",
|
|
17006
|
+
answer: "NGOs and governments seeking community-based conservation models, researchers studying blue carbon and tropical fisheries, and funders supporting high-impact coastal restoration programs use Marine Conservation Partnerships. Communities actively participate in planning, monitoring, and stewardship."
|
|
17007
|
+
},
|
|
17008
|
+
{
|
|
17009
|
+
question: "What outcomes does Marine Conservation Partnerships aim to achieve?",
|
|
17010
|
+
answer: "The program targets verified ecological gains such as mangrove restoration and biomass accumulation, improved fisheries performance, and biodiversity rebound, supported by science-based monitoring and governance metrics. These outcomes are designed to be scalable across regions and inform broader conservation strategies."
|
|
17011
|
+
}
|
|
17012
|
+
],
|
|
17013
|
+
summary: "Blue Ventures is a marine conservation NGO advancing community-led coastal stewardship across Madagascar, East Africa, Southeast Asia, and the Caribbean, focusing on blue carbon restoration, mangroves, seagrass meadows, and sustainable small-scale fisheries. Through Marine Conservation Partnerships, it enables NGOs, governments, and coastal communities to design Locally Managed Marine Areas (LMMAs), conduct science-based monitoring, and implement mangrove blue carbon initiatives and drone-assisted seagrass mapping. The organization differentiates itself by pioneering the LMMA model in Madagascar and integrating ecological science with livelihoods and conservation financing within a network that includes the Blue Carbon Initiative, WWF, The Nature Conservancy, and IUCN Mangrove Specialist Group, funded by UK Aid / FCDO.",
|
|
17014
|
+
overview: "### Mission & Technical Foundation\nBlue Ventures is a globally recognized marine conservation NGO focused on community-led management of coastal ecosystems. Its mission centers on empowering coastal communities to design, govern, and sustain their own marine management systems, with primary ecosystems including mangroves, coral reefs, seagrass meadows, and small-scale fisheries. The organization operates across Madagascar, East Africa, Southeast Asia, and the Caribbean, and maintains a science-driven program portfolio that integrates ecological surveys, fisheries data, and socioeconomic research to deliver measurable conservation and livelihood outcomes. The core technical approach combines governance design, field monitoring, and community-based stewardship to translate science into locally governed restoration and management.\n\n### Ecosystem & Capabilities\nBlue Ventures positions itself within a collaborative ecosystem that includes the Blue Carbon Initiative, Global Mangrove Alliance, WWF, IUCN, and The Nature Conservancy. Its flagship offering, Marine Conservation Partnerships, enables NGOs, governments, and coastal communities to implement Locally Managed Marine Areas (LMMAs), integrating governance frameworks, science-based monitoring, and livelihoods support to achieve scalable, community-first conservation. Key capabilities include LMMA design and governance, drone-assisted seagrass mapping, standardized catch surveys for fisheries monitoring, mangrove blue carbon initiatives, and community patrols with seasonal or spatial fishery closures. The organization also produces open-access research used by global conservation networks and pursues partnerships that expand mangrove restoration and blue carbon across regions. Notable collaborations include the Blue Carbon Initiative, Global Mangrove Alliance, and partnerships with WWF, IUCN, and TNC, with UK Aid / FCDO as a principal funder. Upcoming engagement includes the Global Mangrove Alliance \u2013 Annual Gathering 2025 in Dar es Salaam, reflecting a commitment to scale and knowledge exchange across Africa, Southeast Asia, and the Caribbean.",
|
|
17015
|
+
events: ["81382424481d6291b3caaaf6bb1d16eef568fe24a96fd2c1a3fddec9b368f165"],
|
|
17016
|
+
agents: [],
|
|
17017
|
+
indexed_at: "2025-12-11T16:32:33.260Z",
|
|
17018
|
+
updated_at: "2025-12-11T16:32:33.260Z",
|
|
17019
|
+
research_profile: {
|
|
17020
|
+
type: "ixo:ResearchProfile",
|
|
17021
|
+
"ixo:seedQueries": ["Blue Ventures blue carbon community conservation", "mangrove restoration Madagascar community management"],
|
|
17022
|
+
citation: [
|
|
17023
|
+
{
|
|
17024
|
+
type: "schema:CreativeWork",
|
|
17025
|
+
name: "Blue Carbon Ecosystems in Madagascar",
|
|
17026
|
+
url: "https://blueventures.org/blue-carbon/",
|
|
17027
|
+
publisher: "Blue Ventures",
|
|
17028
|
+
datePublished: "2023-11-14"
|
|
17029
|
+
}
|
|
17030
|
+
],
|
|
17031
|
+
dateModified: "2025-01-15"
|
|
17032
|
+
}
|
|
17033
|
+
};
|
|
17034
|
+
|
|
17035
|
+
// src/mantine/blocks/domainCreatorSign/flow/FlowView.tsx
|
|
17036
|
+
var DOMAIN_CREATOR_SIGN_FLOW_PANEL_ID = "domain-creator-sign-flow-panel";
|
|
17037
|
+
var IS_DEV = false;
|
|
17038
|
+
function isDomainCardDataReady(domainCardData) {
|
|
17039
|
+
if (!domainCardData || domainCardData === "{}") return false;
|
|
17040
|
+
try {
|
|
17041
|
+
const parsed = JSON.parse(domainCardData);
|
|
17042
|
+
return Boolean(parsed && typeof parsed === "object" && parsed.name);
|
|
17043
|
+
} catch {
|
|
17044
|
+
return false;
|
|
17045
|
+
}
|
|
17046
|
+
}
|
|
17047
|
+
var DomainCreatorSignFlowView = ({ editor, block }) => {
|
|
17048
|
+
const status = block.props.status || "pending";
|
|
17049
|
+
const domainCardData = block.props.domainCardData || "{}";
|
|
17050
|
+
const isDataReady = isDomainCardDataReady(domainCardData);
|
|
17051
|
+
useEffect47(() => {
|
|
17052
|
+
if (status === "pending" && isDataReady) {
|
|
17053
|
+
editor.updateBlock(block, {
|
|
17054
|
+
props: {
|
|
17055
|
+
...block.props,
|
|
17056
|
+
status: "ready"
|
|
17057
|
+
}
|
|
17058
|
+
});
|
|
17059
|
+
}
|
|
17060
|
+
}, [isDataReady, status, editor, block]);
|
|
17061
|
+
const handleComplete = useCallback47(
|
|
17062
|
+
(result) => {
|
|
17063
|
+
editor.updateBlock(block, {
|
|
17064
|
+
props: {
|
|
17065
|
+
...block.props,
|
|
17066
|
+
status: "completed",
|
|
17067
|
+
entityDid: result.entityDid,
|
|
17068
|
+
transactionHash: result.transactionHash
|
|
17069
|
+
}
|
|
17070
|
+
});
|
|
17071
|
+
},
|
|
17072
|
+
[editor, block]
|
|
17073
|
+
);
|
|
17074
|
+
const handleError = useCallback47(
|
|
17075
|
+
(errorMessage) => {
|
|
17076
|
+
editor.updateBlock(block, {
|
|
17077
|
+
props: {
|
|
17078
|
+
...block.props,
|
|
17079
|
+
status: "error",
|
|
17080
|
+
errorMessage
|
|
17081
|
+
}
|
|
17082
|
+
});
|
|
17083
|
+
},
|
|
17084
|
+
[editor, block]
|
|
17085
|
+
);
|
|
17086
|
+
const panelId = `${DOMAIN_CREATOR_SIGN_FLOW_PANEL_ID}-${block.id}`;
|
|
17087
|
+
const panelContent = useMemo56(() => /* @__PURE__ */ React185.createElement(SignPanel, { editor, block, onComplete: handleComplete, onError: handleError }), [editor, block, handleComplete, handleError]);
|
|
17088
|
+
const { open } = usePanel(panelId, panelContent);
|
|
17089
|
+
const handleOpen = () => {
|
|
17090
|
+
if (isDataReady || status === "completed" || status === "error") {
|
|
17091
|
+
open();
|
|
17092
|
+
}
|
|
17093
|
+
};
|
|
17094
|
+
const getBadgeProps = () => {
|
|
17095
|
+
switch (status) {
|
|
17096
|
+
case "completed":
|
|
17097
|
+
return { color: "green", text: "Created" };
|
|
17098
|
+
case "error":
|
|
17099
|
+
return { color: "red", text: "Error" };
|
|
17100
|
+
case "signing":
|
|
17101
|
+
case "uploading":
|
|
17102
|
+
case "creating":
|
|
17103
|
+
return { color: "blue", text: "In Progress" };
|
|
17104
|
+
case "ready":
|
|
17105
|
+
return { color: "teal", text: "Ready to sign" };
|
|
17106
|
+
default:
|
|
17107
|
+
return { color: "gray", text: "Waiting for data" };
|
|
17108
|
+
}
|
|
17109
|
+
};
|
|
17110
|
+
const badgeProps = getBadgeProps();
|
|
17111
|
+
const isClickable = isDataReady || status === "completed" || status === "error";
|
|
17112
|
+
const handlePrefillDummyData = useCallback47(
|
|
17113
|
+
(e) => {
|
|
17114
|
+
e.stopPropagation();
|
|
17115
|
+
editor.updateBlock(block, {
|
|
17116
|
+
props: {
|
|
17117
|
+
...block.props,
|
|
17118
|
+
domainCardData: JSON.stringify(dummyDomainCardData),
|
|
17119
|
+
entityType: "dao"
|
|
17120
|
+
}
|
|
17121
|
+
});
|
|
17122
|
+
},
|
|
17123
|
+
[editor, block]
|
|
17124
|
+
);
|
|
17125
|
+
const handleClearDummyData = useCallback47(
|
|
17126
|
+
(e) => {
|
|
17127
|
+
e.stopPropagation();
|
|
17128
|
+
editor.updateBlock(block, {
|
|
17129
|
+
props: {
|
|
17130
|
+
...block.props,
|
|
17131
|
+
domainCardData: "{}",
|
|
17132
|
+
entityType: "",
|
|
17133
|
+
status: "pending"
|
|
17134
|
+
}
|
|
17135
|
+
});
|
|
17136
|
+
},
|
|
17137
|
+
[editor, block]
|
|
17138
|
+
);
|
|
17139
|
+
const getDescriptionText = () => {
|
|
17140
|
+
switch (status) {
|
|
17141
|
+
case "completed":
|
|
17142
|
+
return `Entity created: ${block.props.entityDid}`;
|
|
17143
|
+
case "error":
|
|
17144
|
+
return block.props.errorMessage || "An error occurred";
|
|
17145
|
+
case "ready":
|
|
17146
|
+
return "Click to sign and create the domain";
|
|
17147
|
+
default:
|
|
17148
|
+
return "Waiting for domain card data to be filled";
|
|
17149
|
+
}
|
|
17150
|
+
};
|
|
17151
|
+
return /* @__PURE__ */ React185.createElement(BaseContainer, { onClick: isClickable ? handleOpen : void 0, style: { opacity: isClickable ? 1 : 0.7, cursor: isClickable ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React185.createElement(Group59, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React185.createElement(Group59, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("feather", block.props.icon), /* @__PURE__ */ React185.createElement(Stack122, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React185.createElement(Group59, { gap: "xs", align: "center" }, /* @__PURE__ */ React185.createElement(Text96, { fw: 600, size: "sm" }, block.props.title || "Sign to Create"), /* @__PURE__ */ React185.createElement(Badge28, { size: "xs", variant: "filled", color: badgeProps.color, styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } } }, badgeProps.text)), /* @__PURE__ */ React185.createElement(Text96, { size: "xs", c: "dimmed", lineClamp: 2 }, getDescriptionText()))), IS_DEV && status === "pending" && !isDataReady && /* @__PURE__ */ React185.createElement(Button33, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React185.createElement(IconTestPipe, { size: 14 }), onClick: handlePrefillDummyData }, "Test Data"), IS_DEV && isDataReady && /* @__PURE__ */ React185.createElement(Button33, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React185.createElement(IconTrash5, { size: 14 }), onClick: handleClearDummyData }, "Clear Data"), isClickable && /* @__PURE__ */ React185.createElement(Tooltip18, { label: status === "completed" ? "View details" : "Sign & Create", withArrow: true }, /* @__PURE__ */ React185.createElement(ActionIcon27, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React185.createElement(IconChevronRight8, { size: 18 })))));
|
|
17152
|
+
};
|
|
17153
|
+
|
|
17154
|
+
// src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlock.tsx
|
|
17155
|
+
function DomainCreatorSignBlock({ editor, block }) {
|
|
17156
|
+
const { docType } = useBlocknoteContext();
|
|
17157
|
+
if (docType === "template") {
|
|
17158
|
+
return /* @__PURE__ */ React186.createElement(DomainCreatorSignTemplateView, { editor, block });
|
|
17159
|
+
}
|
|
17160
|
+
return /* @__PURE__ */ React186.createElement(DomainCreatorSignFlowView, { editor, block });
|
|
17161
|
+
}
|
|
17162
|
+
|
|
17163
|
+
// src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlockSpec.tsx
|
|
17164
|
+
var DomainCreatorSignBlockSpec = createReactBlockSpec16(
|
|
17165
|
+
{
|
|
17166
|
+
type: "domainCreatorSign",
|
|
17167
|
+
propSchema: {
|
|
17168
|
+
title: { default: "" },
|
|
17169
|
+
description: { default: "" },
|
|
17170
|
+
icon: { default: "file-text" },
|
|
17171
|
+
// JSON string of credential subject data (oracle fills this)
|
|
17172
|
+
domainCardData: { default: "{}" },
|
|
17173
|
+
// Entity type from protocol selector or oracle
|
|
17174
|
+
entityType: { default: "" },
|
|
17175
|
+
// Status: pending | ready | signing | uploading | creating | completed | error
|
|
17176
|
+
status: { default: "pending" },
|
|
17177
|
+
// Created entity DID (after success)
|
|
17178
|
+
entityDid: { default: "" },
|
|
17179
|
+
// Transaction hash (after success)
|
|
17180
|
+
transactionHash: { default: "" },
|
|
17181
|
+
// Error message if failed
|
|
17182
|
+
errorMessage: { default: "" }
|
|
17183
|
+
},
|
|
17184
|
+
content: "none"
|
|
17185
|
+
},
|
|
17186
|
+
{
|
|
17187
|
+
render: (props) => {
|
|
17188
|
+
const ixoProps = props;
|
|
17189
|
+
return /* @__PURE__ */ React187.createElement(DomainCreatorSignBlock, { ...ixoProps });
|
|
17190
|
+
}
|
|
17191
|
+
}
|
|
17192
|
+
);
|
|
17193
|
+
|
|
17194
|
+
// src/mantine/blocks/domainCardViewer/DomainCardViewerBlockSpec.tsx
|
|
17195
|
+
import React194 from "react";
|
|
17196
|
+
import { createReactBlockSpec as createReactBlockSpec17 } from "@blocknote/react";
|
|
17197
|
+
|
|
17198
|
+
// src/mantine/blocks/domainCardViewer/DomainCardViewerBlock.tsx
|
|
17199
|
+
import React193 from "react";
|
|
17200
|
+
|
|
17201
|
+
// src/mantine/blocks/domainCardViewer/template/TemplateView.tsx
|
|
17202
|
+
import React190, { useMemo as useMemo57 } from "react";
|
|
17203
|
+
import { Badge as Badge29, Group as Group60, Stack as Stack123, Text as Text97 } from "@mantine/core";
|
|
17204
|
+
|
|
17205
|
+
// src/mantine/blocks/domainCardViewer/template/TemplateConfig.tsx
|
|
17206
|
+
import React189, { useCallback as useCallback48 } from "react";
|
|
17207
|
+
import { Paper as Paper19, CloseButton as CloseButton14, Title as Title17 } from "@mantine/core";
|
|
17208
|
+
|
|
17209
|
+
// src/mantine/blocks/domainCardViewer/template/GeneralTab.tsx
|
|
17210
|
+
import React188, { useEffect as useEffect48, useState as useState65 } from "react";
|
|
17211
|
+
var GeneralTab13 = ({ title, description, icon, onTitleChange, onDescriptionChange, onIconChange }) => {
|
|
17212
|
+
const [localTitle, setLocalTitle] = useState65(title || "");
|
|
17213
|
+
const [localDescription, setLocalDescription] = useState65(description || "");
|
|
17214
|
+
const [localIcon, setLocalIcon] = useState65(icon || "dots-circle");
|
|
17215
|
+
useEffect48(() => setLocalTitle(title || ""), [title]);
|
|
17216
|
+
useEffect48(() => setLocalDescription(description || ""), [description]);
|
|
17217
|
+
useEffect48(() => setLocalIcon(icon || "dots-circle"), [icon]);
|
|
17218
|
+
return /* @__PURE__ */ React188.createElement(BaseSection, null, /* @__PURE__ */ React188.createElement(
|
|
17219
|
+
BaseTextInput,
|
|
17220
|
+
{
|
|
17221
|
+
label: "Title",
|
|
17222
|
+
placeholder: "e.g. Domain Card Preview",
|
|
17223
|
+
value: localTitle,
|
|
17224
|
+
onChange: (event) => {
|
|
17225
|
+
const newValue = event.currentTarget.value;
|
|
17226
|
+
setLocalTitle(newValue);
|
|
17227
|
+
onTitleChange(newValue);
|
|
17228
|
+
}
|
|
17229
|
+
}
|
|
17230
|
+
), /* @__PURE__ */ React188.createElement(
|
|
17231
|
+
BaseTextArea,
|
|
17232
|
+
{
|
|
17233
|
+
label: "Description",
|
|
17234
|
+
placeholder: "Short description shown on the block",
|
|
17235
|
+
minRows: 2,
|
|
17236
|
+
value: localDescription,
|
|
17237
|
+
onChange: (event) => {
|
|
17238
|
+
const newValue = event.currentTarget.value;
|
|
17239
|
+
setLocalDescription(newValue);
|
|
17240
|
+
onDescriptionChange(newValue);
|
|
17241
|
+
}
|
|
17242
|
+
}
|
|
17243
|
+
), /* @__PURE__ */ React188.createElement(
|
|
17244
|
+
BaseTextInput,
|
|
17245
|
+
{
|
|
17246
|
+
label: "Icon",
|
|
17247
|
+
description: "Use a supported icon key (e.g. id-badge, file-text, eye)",
|
|
17248
|
+
placeholder: "id-badge",
|
|
17249
|
+
value: localIcon,
|
|
17250
|
+
onChange: (event) => {
|
|
17251
|
+
const newValue = event.currentTarget.value;
|
|
17252
|
+
setLocalIcon(newValue);
|
|
17253
|
+
onIconChange(newValue);
|
|
17254
|
+
}
|
|
17255
|
+
}
|
|
17256
|
+
));
|
|
17257
|
+
};
|
|
17258
|
+
|
|
17259
|
+
// src/mantine/blocks/domainCardViewer/template/TemplateConfig.tsx
|
|
17260
|
+
var TemplateConfig13 = ({ editor, block }) => {
|
|
17261
|
+
const { closePanel } = usePanelStore();
|
|
17262
|
+
const updateProp = useCallback48(
|
|
17263
|
+
(key, value) => {
|
|
17264
|
+
editor.updateBlock(block, {
|
|
17265
|
+
props: {
|
|
17266
|
+
...block.props,
|
|
17267
|
+
[key]: value
|
|
17268
|
+
}
|
|
17269
|
+
});
|
|
17270
|
+
},
|
|
17271
|
+
[editor, block]
|
|
17272
|
+
);
|
|
17273
|
+
return /* @__PURE__ */ React189.createElement(
|
|
17274
|
+
Paper19,
|
|
17275
|
+
{
|
|
17276
|
+
p: "md",
|
|
17277
|
+
shadow: "sm",
|
|
17278
|
+
style: {
|
|
17279
|
+
height: "100%",
|
|
17280
|
+
display: "flex",
|
|
17281
|
+
flexDirection: "column"
|
|
17282
|
+
}
|
|
17283
|
+
},
|
|
17284
|
+
/* @__PURE__ */ React189.createElement(
|
|
17285
|
+
"div",
|
|
17286
|
+
{
|
|
17287
|
+
style: {
|
|
17288
|
+
display: "flex",
|
|
17289
|
+
justifyContent: "space-between",
|
|
17290
|
+
alignItems: "center",
|
|
17291
|
+
marginBottom: "1rem"
|
|
17292
|
+
}
|
|
17293
|
+
},
|
|
17294
|
+
/* @__PURE__ */ React189.createElement(Title17, { order: 5 }, "Domain Card Settings"),
|
|
17295
|
+
/* @__PURE__ */ React189.createElement(CloseButton14, { onClick: closePanel })
|
|
17296
|
+
),
|
|
17297
|
+
/* @__PURE__ */ React189.createElement(
|
|
17298
|
+
ReusablePanel,
|
|
17299
|
+
{
|
|
17300
|
+
extraTabs: [
|
|
17301
|
+
{
|
|
17302
|
+
label: "General",
|
|
17303
|
+
value: "general",
|
|
17304
|
+
content: /* @__PURE__ */ React189.createElement(
|
|
17305
|
+
GeneralTab13,
|
|
17306
|
+
{
|
|
17307
|
+
title: block.props.title || "",
|
|
17308
|
+
description: block.props.description || "",
|
|
17309
|
+
icon: block.props.icon || "dots-circle",
|
|
17310
|
+
onTitleChange: (value) => updateProp("title", value),
|
|
17311
|
+
onDescriptionChange: (value) => updateProp("description", value),
|
|
17312
|
+
onIconChange: (value) => updateProp("icon", value)
|
|
17313
|
+
}
|
|
17314
|
+
)
|
|
17315
|
+
}
|
|
17316
|
+
],
|
|
17317
|
+
context: { editor, block }
|
|
17318
|
+
}
|
|
17319
|
+
)
|
|
17320
|
+
);
|
|
17321
|
+
};
|
|
17322
|
+
|
|
17323
|
+
// src/mantine/blocks/domainCardViewer/template/TemplateView.tsx
|
|
17324
|
+
var DOMAIN_CARD_VIEWER_TEMPLATE_PANEL_ID = "domain-card-viewer-template-panel";
|
|
17325
|
+
var DomainCardViewerTemplateView = ({ editor, block }) => {
|
|
17326
|
+
const panelId = `${DOMAIN_CARD_VIEWER_TEMPLATE_PANEL_ID}-${block.id}`;
|
|
17327
|
+
const panelContent = useMemo57(() => /* @__PURE__ */ React190.createElement(TemplateConfig13, { editor, block }), [editor, block]);
|
|
17328
|
+
const { open } = usePanel(panelId, panelContent);
|
|
17329
|
+
return /* @__PURE__ */ React190.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React190.createElement(Badge29, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React190.createElement(Group60, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React190.createElement(Group60, { wrap: "nowrap", align: "center" }, getIcon("dots-circle", block.props.icon), /* @__PURE__ */ React190.createElement(Stack123, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React190.createElement(Text97, { fw: 500, size: "sm" }, block.props.title || "Domain Card"), /* @__PURE__ */ React190.createElement(Text97, { size: "xs", c: "dimmed" }, block.props.description || "Preview domain card generated by AI")))));
|
|
17330
|
+
};
|
|
17331
|
+
|
|
17332
|
+
// src/mantine/blocks/domainCardViewer/flow/FlowView.tsx
|
|
17333
|
+
import React192, { useMemo as useMemo59, useCallback as useCallback49, useEffect as useEffect49, useRef as useRef11 } from "react";
|
|
17334
|
+
import { ActionIcon as ActionIcon28, Badge as Badge30, Button as Button35, Group as Group61, Stack as Stack125, Text as Text99, Tooltip as Tooltip19 } from "@mantine/core";
|
|
17335
|
+
import { IconChevronRight as IconChevronRight9, IconLoader, IconTestPipe as IconTestPipe2, IconTrash as IconTrash6 } from "@tabler/icons-react";
|
|
17336
|
+
|
|
17337
|
+
// src/mantine/blocks/domainCardViewer/flow/ViewerPanel.tsx
|
|
17338
|
+
import React191, { useMemo as useMemo58 } from "react";
|
|
17339
|
+
import { Paper as Paper20, CloseButton as CloseButton15, Title as Title18, Stack as Stack124, Text as Text98, Loader as Loader25, Alert as Alert25, Button as Button34, Box as Box34, ScrollArea as ScrollArea6, Code as Code6 } from "@mantine/core";
|
|
17340
|
+
import { IconAlertCircle as IconAlertCircle12, IconCheck as IconCheck6, IconSparkles as IconSparkles3 } from "@tabler/icons-react";
|
|
17341
|
+
function parseDomainCardData(jsonString) {
|
|
17342
|
+
if (!jsonString || jsonString === "{}") return null;
|
|
17343
|
+
try {
|
|
17344
|
+
return JSON.parse(jsonString);
|
|
17345
|
+
} catch {
|
|
17346
|
+
return null;
|
|
17347
|
+
}
|
|
17348
|
+
}
|
|
17349
|
+
var JsonViewer = ({ data }) => {
|
|
17350
|
+
return /* @__PURE__ */ React191.createElement(ScrollArea6, { h: "100%", offsetScrollbars: true }, /* @__PURE__ */ React191.createElement(Stack124, { gap: "md" }, data.name && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600 }, "Name"), /* @__PURE__ */ React191.createElement(Text98, { size: "lg", fw: 600 }, data.name)), data.summary && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600 }, "Summary"), /* @__PURE__ */ React191.createElement(Text98, { size: "sm" }, data.summary)), data.description && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600 }, "Description"), /* @__PURE__ */ React191.createElement(Text98, { size: "sm" }, data.description)), data.entity_type && data.entity_type.length > 0 && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600 }, "Type"), /* @__PURE__ */ React191.createElement(Text98, { size: "sm" }, data.entity_type.join(", "))), data.keywords && data.keywords.length > 0 && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600 }, "Keywords"), /* @__PURE__ */ React191.createElement(Text98, { size: "sm" }, data.keywords.join(", "))), data.faq && data.faq.length > 0 && /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600, mb: "xs" }, "FAQ"), /* @__PURE__ */ React191.createElement(Stack124, { gap: "sm" }, data.faq.map((item, index) => /* @__PURE__ */ React191.createElement(Box34, { key: index, p: "sm", style: { borderRadius: 8, backgroundColor: "var(--mantine-color-dark-6)" } }, /* @__PURE__ */ React191.createElement(Text98, { size: "sm", fw: 500, mb: 4 }, item.question), /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed" }, item.answer))))), /* @__PURE__ */ React191.createElement(Box34, null, /* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", tt: "uppercase", fw: 600, mb: "xs" }, "Raw Data"), /* @__PURE__ */ React191.createElement(Code6, { block: true, style: { fontSize: 11, maxHeight: 200, overflow: "auto" } }, JSON.stringify(data, null, 2)))));
|
|
17351
|
+
};
|
|
17352
|
+
var ViewerPanel = ({ block, onApprove }) => {
|
|
17353
|
+
const { closePanel } = usePanelStore();
|
|
17354
|
+
const { domainCardRenderer } = useBlocknoteContext();
|
|
17355
|
+
const status = block.props.status || "pending";
|
|
17356
|
+
const loadingMessage = block.props.loadingMessage || "Agents is generating your domain data...";
|
|
17357
|
+
const errorMessage = block.props.errorMessage || "An error occurred while generating the domain data.";
|
|
17358
|
+
const domainCardData = useMemo58(() => parseDomainCardData(block.props.domainCardData || "{}"), [block.props.domainCardData]);
|
|
17359
|
+
const isLoading = status === "loading";
|
|
17360
|
+
const isError = status === "error";
|
|
17361
|
+
const isReady = status === "ready";
|
|
17362
|
+
const isApproved = status === "approved";
|
|
17363
|
+
const hasData = domainCardData !== null;
|
|
17364
|
+
return /* @__PURE__ */ React191.createElement(
|
|
17365
|
+
Paper20,
|
|
17366
|
+
{
|
|
17367
|
+
p: "md",
|
|
17368
|
+
shadow: "sm",
|
|
17369
|
+
style: {
|
|
17370
|
+
height: "100%",
|
|
17371
|
+
display: "flex",
|
|
17372
|
+
flexDirection: "column"
|
|
17373
|
+
}
|
|
17374
|
+
},
|
|
17375
|
+
/* @__PURE__ */ React191.createElement(
|
|
17376
|
+
"div",
|
|
17377
|
+
{
|
|
17378
|
+
style: {
|
|
17379
|
+
display: "flex",
|
|
17380
|
+
justifyContent: "space-between",
|
|
17381
|
+
alignItems: "center",
|
|
17382
|
+
marginBottom: "1rem",
|
|
17383
|
+
flexShrink: 0
|
|
17384
|
+
}
|
|
17385
|
+
},
|
|
17386
|
+
/* @__PURE__ */ React191.createElement(Title18, { order: 5 }, block.props.title || "Domain Card"),
|
|
17387
|
+
/* @__PURE__ */ React191.createElement(CloseButton15, { onClick: closePanel })
|
|
17388
|
+
),
|
|
17389
|
+
/* @__PURE__ */ React191.createElement(Box34, { style: { flex: 1, overflow: "hidden", display: "flex", flexDirection: "column" } }, isLoading && /* @__PURE__ */ React191.createElement(Stack124, { align: "center", justify: "center", style: { flex: 1 }, gap: "md" }, /* @__PURE__ */ React191.createElement(Loader25, { size: "lg", color: "blue" }), /* @__PURE__ */ React191.createElement(Stack124, { align: "center", gap: "xs" }, /* @__PURE__ */ React191.createElement(IconSparkles3, { size: 24, color: "var(--mantine-color-blue-5)" }), /* @__PURE__ */ React191.createElement(Text98, { size: "sm", c: "dimmed", ta: "center" }, loadingMessage))), isError && /* @__PURE__ */ React191.createElement(Stack124, { style: { flex: 1 }, gap: "md" }, /* @__PURE__ */ React191.createElement(Alert25, { icon: /* @__PURE__ */ React191.createElement(IconAlertCircle12, { size: 16 }), title: "Error", color: "red", variant: "light" }, errorMessage), /* @__PURE__ */ React191.createElement(Text98, { size: "sm", c: "dimmed", ta: "center" }, "Please ask the oracle to try again.")), (isReady || isApproved) && hasData && /* @__PURE__ */ React191.createElement(Box34, { style: { flex: 1, overflow: "hidden" } }, domainCardRenderer ? (
|
|
17390
|
+
// Use custom renderer from web app
|
|
17391
|
+
/* @__PURE__ */ React191.createElement(ScrollArea6, { h: "100%", offsetScrollbars: true }, domainCardRenderer(domainCardData))
|
|
17392
|
+
) : (
|
|
17393
|
+
// Fallback to JSON viewer
|
|
17394
|
+
/* @__PURE__ */ React191.createElement(JsonViewer, { data: domainCardData })
|
|
17395
|
+
)), !isLoading && !isError && !hasData && /* @__PURE__ */ React191.createElement(Stack124, { align: "center", justify: "center", style: { flex: 1 }, gap: "md" }, /* @__PURE__ */ React191.createElement(Text98, { size: "sm", c: "dimmed", ta: "center" }, "No domain data available yet."))),
|
|
17396
|
+
isReady && hasData && /* @__PURE__ */ React191.createElement(
|
|
17397
|
+
Box34,
|
|
17398
|
+
{
|
|
17399
|
+
pt: "md",
|
|
17400
|
+
mt: "md",
|
|
17401
|
+
style: {
|
|
17402
|
+
borderTop: "1px solid var(--mantine-color-dark-4)",
|
|
17403
|
+
flexShrink: 0
|
|
17404
|
+
}
|
|
17405
|
+
},
|
|
17406
|
+
/* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", ta: "center", mb: "0" }, "This shows the domain details to see if the narrative aligns with what the domain is about."),
|
|
17407
|
+
/* @__PURE__ */ React191.createElement(Text98, { size: "xs", c: "dimmed", ta: "center", mb: "md" }, "If you'd like changes, ask the oracle to make changes for you."),
|
|
17408
|
+
/* @__PURE__ */ React191.createElement(Button34, { fullWidth: true, color: "teal", leftSection: /* @__PURE__ */ React191.createElement(IconCheck6, { size: 16 }), onClick: onApprove }, "Approve")
|
|
17409
|
+
),
|
|
17410
|
+
isApproved && /* @__PURE__ */ React191.createElement(
|
|
17411
|
+
Box34,
|
|
17412
|
+
{
|
|
17413
|
+
pt: "md",
|
|
17414
|
+
mt: "md",
|
|
17415
|
+
style: {
|
|
17416
|
+
borderTop: "1px solid var(--mantine-color-dark-4)",
|
|
17417
|
+
flexShrink: 0
|
|
17418
|
+
}
|
|
17419
|
+
},
|
|
17420
|
+
/* @__PURE__ */ React191.createElement(Alert25, { icon: /* @__PURE__ */ React191.createElement(IconCheck6, { size: 16 }), color: "green", variant: "light" }, "Domain data approved. You can proceed to sign and create the domain.")
|
|
17421
|
+
)
|
|
17422
|
+
);
|
|
17423
|
+
};
|
|
17424
|
+
|
|
17425
|
+
// src/mantine/blocks/domainCardViewer/flow/FlowView.tsx
|
|
17426
|
+
var DOMAIN_CARD_VIEWER_FLOW_PANEL_ID = "domain-card-viewer-flow-panel";
|
|
17427
|
+
var IS_DEV2 = false;
|
|
17428
|
+
function isDomainCardDataReady2(domainCardData) {
|
|
17429
|
+
if (!domainCardData || domainCardData === "{}") return false;
|
|
17430
|
+
try {
|
|
17431
|
+
const parsed = JSON.parse(domainCardData);
|
|
17432
|
+
return Boolean(parsed && typeof parsed === "object" && parsed.name);
|
|
17433
|
+
} catch {
|
|
17434
|
+
return false;
|
|
17435
|
+
}
|
|
17436
|
+
}
|
|
17437
|
+
function syncToDomainCreatorSignBlocks(editor, domainCardData) {
|
|
17438
|
+
const allBlocks = editor.document;
|
|
17439
|
+
for (const block of allBlocks) {
|
|
17440
|
+
if (block.type === "domainCreatorSign") {
|
|
17441
|
+
if (block.props.domainCardData !== domainCardData) {
|
|
17442
|
+
editor.updateBlock(block, {
|
|
17443
|
+
props: {
|
|
17444
|
+
...block.props,
|
|
17445
|
+
domainCardData,
|
|
17446
|
+
// Also update status if data is ready
|
|
17447
|
+
status: isDomainCardDataReady2(domainCardData) ? "ready" : "pending"
|
|
17448
|
+
}
|
|
17449
|
+
});
|
|
17450
|
+
}
|
|
17451
|
+
}
|
|
17452
|
+
}
|
|
17453
|
+
}
|
|
17454
|
+
var DomainCardViewerFlowView = ({ editor, block }) => {
|
|
17455
|
+
const status = block.props.status || "pending";
|
|
17456
|
+
const domainCardData = block.props.domainCardData || "{}";
|
|
17457
|
+
const isDataReady = isDomainCardDataReady2(domainCardData);
|
|
17458
|
+
const prevDomainCardDataRef = useRef11(domainCardData);
|
|
17459
|
+
useEffect49(() => {
|
|
17460
|
+
if (prevDomainCardDataRef.current !== domainCardData && isDataReady) {
|
|
17461
|
+
syncToDomainCreatorSignBlocks(editor, domainCardData);
|
|
17462
|
+
}
|
|
17463
|
+
prevDomainCardDataRef.current = domainCardData;
|
|
17464
|
+
}, [domainCardData, isDataReady, editor]);
|
|
17465
|
+
useEffect49(() => {
|
|
17466
|
+
if (status === "pending" && isDataReady) {
|
|
17467
|
+
editor.updateBlock(block, {
|
|
17468
|
+
props: {
|
|
17469
|
+
...block.props,
|
|
17470
|
+
status: "ready"
|
|
17471
|
+
}
|
|
17472
|
+
});
|
|
17473
|
+
}
|
|
17474
|
+
}, [isDataReady, status, editor, block]);
|
|
17475
|
+
const handleApprove = useCallback49(() => {
|
|
17476
|
+
editor.updateBlock(block, {
|
|
17477
|
+
props: {
|
|
17478
|
+
...block.props,
|
|
17479
|
+
status: "approved"
|
|
17480
|
+
}
|
|
17481
|
+
});
|
|
17482
|
+
}, [editor, block]);
|
|
17483
|
+
const panelId = `${DOMAIN_CARD_VIEWER_FLOW_PANEL_ID}-${block.id}`;
|
|
17484
|
+
const panelContent = useMemo59(() => /* @__PURE__ */ React192.createElement(ViewerPanel, { editor, block, onApprove: handleApprove }), [editor, block, handleApprove]);
|
|
17485
|
+
const { open } = usePanel(panelId, panelContent);
|
|
17486
|
+
const handleInjectDummyData = useCallback49(
|
|
17487
|
+
(e) => {
|
|
17488
|
+
e.stopPropagation();
|
|
17489
|
+
editor.updateBlock(block, {
|
|
17490
|
+
props: {
|
|
17491
|
+
...block.props,
|
|
17492
|
+
domainCardData: JSON.stringify(dummyDomainCardData),
|
|
17493
|
+
status: "ready",
|
|
17494
|
+
loadingMessage: "",
|
|
17495
|
+
errorMessage: ""
|
|
17496
|
+
}
|
|
17497
|
+
});
|
|
17498
|
+
},
|
|
17499
|
+
[editor, block]
|
|
17500
|
+
);
|
|
17501
|
+
const handleSetLoading = useCallback49(
|
|
17502
|
+
(e) => {
|
|
17503
|
+
e.stopPropagation();
|
|
17504
|
+
editor.updateBlock(block, {
|
|
17505
|
+
props: {
|
|
17506
|
+
...block.props,
|
|
17507
|
+
status: "loading",
|
|
17508
|
+
loadingMessage: "Agents are analyzing your domain information..."
|
|
17509
|
+
}
|
|
17510
|
+
});
|
|
17511
|
+
},
|
|
17512
|
+
[editor, block]
|
|
17513
|
+
);
|
|
17514
|
+
const handleClearData = useCallback49(
|
|
17515
|
+
(e) => {
|
|
17516
|
+
e.stopPropagation();
|
|
17517
|
+
editor.updateBlock(block, {
|
|
17518
|
+
props: {
|
|
17519
|
+
...block.props,
|
|
17520
|
+
domainCardData: "{}",
|
|
17521
|
+
status: "pending",
|
|
17522
|
+
loadingMessage: "",
|
|
17523
|
+
errorMessage: ""
|
|
17524
|
+
}
|
|
17525
|
+
});
|
|
17526
|
+
},
|
|
17527
|
+
[editor, block]
|
|
17528
|
+
);
|
|
17529
|
+
const getBadgeProps = () => {
|
|
17530
|
+
switch (status) {
|
|
17531
|
+
case "approved":
|
|
17532
|
+
return { color: "green", text: "Approved" };
|
|
17533
|
+
case "error":
|
|
17534
|
+
return { color: "red", text: "Error" };
|
|
17535
|
+
case "loading":
|
|
17536
|
+
return { color: "blue", text: "Generating..." };
|
|
17537
|
+
case "ready":
|
|
17538
|
+
return { color: "teal", text: "Ready to Review" };
|
|
17539
|
+
default:
|
|
17540
|
+
return { color: "gray", text: "Waiting" };
|
|
17541
|
+
}
|
|
17542
|
+
};
|
|
17543
|
+
const badgeProps = getBadgeProps();
|
|
17544
|
+
const getDescriptionText = () => {
|
|
17545
|
+
switch (status) {
|
|
17546
|
+
case "approved":
|
|
17547
|
+
return "Domain data approved";
|
|
17548
|
+
case "error":
|
|
17549
|
+
return block.props.errorMessage || "An error occurred";
|
|
17550
|
+
case "loading":
|
|
17551
|
+
return block.props.loadingMessage || "Agents are generating domain data...";
|
|
17552
|
+
case "ready":
|
|
17553
|
+
return "Click to review and approve";
|
|
17554
|
+
default:
|
|
17555
|
+
return "Waiting for agents to generate domain data";
|
|
17556
|
+
}
|
|
17557
|
+
};
|
|
17558
|
+
const canOpenPanel = status !== "pending";
|
|
17559
|
+
return /* @__PURE__ */ React192.createElement(BaseContainer, { onClick: canOpenPanel ? open : void 0, style: { opacity: canOpenPanel ? 1 : 0.7, cursor: canOpenPanel ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React192.createElement(Group61, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React192.createElement(Group61, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("dots-circle", block.props.icon), /* @__PURE__ */ React192.createElement(Stack125, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React192.createElement(Group61, { gap: "xs", align: "center" }, /* @__PURE__ */ React192.createElement(Text99, { fw: 600, size: "sm" }, block.props.title || "Domain Card"), /* @__PURE__ */ React192.createElement(Badge30, { size: "xs", variant: "filled", color: badgeProps.color, styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } } }, badgeProps.text)), /* @__PURE__ */ React192.createElement(Text99, { size: "xs", c: "dimmed", lineClamp: 2 }, getDescriptionText()))), IS_DEV2 && status === "pending" && /* @__PURE__ */ React192.createElement(React192.Fragment, null, /* @__PURE__ */ React192.createElement(Button35, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React192.createElement(IconTestPipe2, { size: 14 }), onClick: handleInjectDummyData }, "Test Data"), /* @__PURE__ */ React192.createElement(Button35, { size: "compact-xs", variant: "light", color: "blue", leftSection: /* @__PURE__ */ React192.createElement(IconLoader, { size: 14 }), onClick: handleSetLoading }, "Loading")), IS_DEV2 && (status === "ready" || status === "approved" || status === "loading") && /* @__PURE__ */ React192.createElement(Button35, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React192.createElement(IconTrash6, { size: 14 }), onClick: handleClearData }, "Clear"), canOpenPanel && /* @__PURE__ */ React192.createElement(Tooltip19, { label: status === "approved" ? "View domain data" : "Review domain data", withArrow: true }, /* @__PURE__ */ React192.createElement(ActionIcon28, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React192.createElement(IconChevronRight9, { size: 18 })))));
|
|
17560
|
+
};
|
|
17561
|
+
|
|
17562
|
+
// src/mantine/blocks/domainCardViewer/DomainCardViewerBlock.tsx
|
|
17563
|
+
function DomainCardViewerBlock({ editor, block }) {
|
|
17564
|
+
const { docType } = useBlocknoteContext();
|
|
17565
|
+
if (docType === "template") {
|
|
17566
|
+
return /* @__PURE__ */ React193.createElement(DomainCardViewerTemplateView, { editor, block });
|
|
17567
|
+
}
|
|
17568
|
+
return /* @__PURE__ */ React193.createElement(DomainCardViewerFlowView, { editor, block });
|
|
17569
|
+
}
|
|
17570
|
+
|
|
17571
|
+
// src/mantine/blocks/domainCardViewer/DomainCardViewerBlockSpec.tsx
|
|
17572
|
+
var DomainCardViewerBlockSpec = createReactBlockSpec17(
|
|
17573
|
+
{
|
|
17574
|
+
type: "domainCardViewer",
|
|
17575
|
+
propSchema: {
|
|
17576
|
+
title: { default: "" },
|
|
17577
|
+
description: { default: "" },
|
|
17578
|
+
icon: { default: "dots-circle" },
|
|
17579
|
+
// Core domain card data (JSON string, injected by oracle)
|
|
17580
|
+
domainCardData: { default: "{}" },
|
|
17581
|
+
// Status tracking for oracle workflow
|
|
17582
|
+
status: { default: "pending" },
|
|
17583
|
+
// 'pending' | 'loading' | 'ready' | 'approved' | 'error'
|
|
17584
|
+
// Loading message from oracle
|
|
17585
|
+
loadingMessage: { default: "" },
|
|
17586
|
+
// Error message if something goes wrong
|
|
17587
|
+
errorMessage: { default: "" }
|
|
17588
|
+
},
|
|
17589
|
+
content: "none"
|
|
17590
|
+
},
|
|
17591
|
+
{
|
|
17592
|
+
render: (props) => {
|
|
17593
|
+
const ixoProps = props;
|
|
17594
|
+
return /* @__PURE__ */ React194.createElement(DomainCardViewerBlock, { ...ixoProps });
|
|
17595
|
+
}
|
|
17596
|
+
}
|
|
17597
|
+
);
|
|
17598
|
+
|
|
17599
|
+
// src/mantine/blocks/registry/blockRegistry.ts
|
|
17600
|
+
var BlockRegistry = class {
|
|
17601
|
+
constructor() {
|
|
17602
|
+
this.blocks = /* @__PURE__ */ new Map();
|
|
17603
|
+
}
|
|
17604
|
+
register(entry) {
|
|
17605
|
+
this.blocks.set(entry.type, entry);
|
|
17606
|
+
}
|
|
17607
|
+
get(type) {
|
|
17608
|
+
return this.blocks.get(type);
|
|
17609
|
+
}
|
|
17610
|
+
getAll() {
|
|
17611
|
+
return new Map(this.blocks);
|
|
17612
|
+
}
|
|
17613
|
+
getValidDependencies(type) {
|
|
17614
|
+
const entry = this.get(type);
|
|
17615
|
+
return entry?.validDependencies || [];
|
|
17616
|
+
}
|
|
17617
|
+
getPropSchema(type) {
|
|
17618
|
+
const entry = this.get(type);
|
|
17619
|
+
return entry?.propSchema;
|
|
17620
|
+
}
|
|
17621
|
+
isValidDependency(blockType, dependencyType) {
|
|
17622
|
+
const validDeps = this.getValidDependencies(blockType);
|
|
17623
|
+
return validDeps.includes(dependencyType);
|
|
17624
|
+
}
|
|
17625
|
+
};
|
|
17626
|
+
var blockRegistry = new BlockRegistry();
|
|
17627
|
+
blockRegistry.register({
|
|
17628
|
+
type: "proposal",
|
|
17629
|
+
propSchema: {
|
|
17630
|
+
title: "",
|
|
17631
|
+
description: "",
|
|
17632
|
+
icon: "\u{1F4DD}",
|
|
17633
|
+
proposalId: "",
|
|
17634
|
+
status: "draft",
|
|
17635
|
+
contractAddress: "",
|
|
17636
|
+
coreAddress: "",
|
|
17637
|
+
createdProposalId: ""
|
|
17638
|
+
},
|
|
17639
|
+
validDependencies: [],
|
|
17640
|
+
defaultProps: {
|
|
17641
|
+
icon: "\u{1F4DD}",
|
|
17642
|
+
status: "draft"
|
|
17643
|
+
}
|
|
17644
|
+
});
|
|
17645
|
+
blockRegistry.register({
|
|
17646
|
+
type: "proposalVote",
|
|
17647
|
+
propSchema: {
|
|
17648
|
+
title: "",
|
|
17649
|
+
subtitle: "",
|
|
17650
|
+
icon: "\u{1F5F3}\uFE0F",
|
|
17651
|
+
status: "open",
|
|
17652
|
+
daysLeft: 0,
|
|
17653
|
+
proposalId: "",
|
|
17654
|
+
proposalBlockId: "",
|
|
17655
|
+
proposalContractAddress: ""
|
|
17656
|
+
},
|
|
17657
|
+
validDependencies: ["proposal"],
|
|
17658
|
+
defaultProps: {
|
|
17659
|
+
icon: "\u{1F5F3}\uFE0F",
|
|
17660
|
+
status: "open",
|
|
17661
|
+
daysLeft: 0,
|
|
17662
|
+
proposalBlockId: ""
|
|
17663
|
+
}
|
|
17664
|
+
});
|
|
17665
|
+
blockRegistry.register({
|
|
17666
|
+
type: "list",
|
|
17667
|
+
propSchema: {
|
|
17668
|
+
title: "",
|
|
17669
|
+
did: "",
|
|
17670
|
+
fragmentIdentifier: ""
|
|
17671
|
+
},
|
|
17672
|
+
validDependencies: [],
|
|
17673
|
+
defaultProps: {}
|
|
17674
|
+
});
|
|
17675
|
+
blockRegistry.register({
|
|
17676
|
+
type: "overview",
|
|
17677
|
+
propSchema: {
|
|
17678
|
+
did: ""
|
|
17679
|
+
},
|
|
17680
|
+
validDependencies: [],
|
|
17681
|
+
defaultProps: {}
|
|
17682
|
+
});
|
|
17683
|
+
blockRegistry.register({
|
|
17684
|
+
type: "enumChecklist",
|
|
17685
|
+
propSchema: {
|
|
17686
|
+
listType: "",
|
|
17687
|
+
listConfig: "{}"
|
|
17688
|
+
},
|
|
17689
|
+
validDependencies: [],
|
|
17690
|
+
defaultProps: {}
|
|
17691
|
+
});
|
|
17692
|
+
blockRegistry.register({
|
|
17693
|
+
type: "notify",
|
|
17694
|
+
propSchema: {
|
|
17695
|
+
title: "",
|
|
17696
|
+
description: "",
|
|
17697
|
+
icon: "bell",
|
|
17698
|
+
channel: "email",
|
|
17699
|
+
to: "[]",
|
|
17700
|
+
cc: "[]",
|
|
17701
|
+
bcc: "[]",
|
|
17702
|
+
subject: "",
|
|
17703
|
+
body: "",
|
|
17704
|
+
bodyType: "text",
|
|
17705
|
+
from: "",
|
|
17706
|
+
replyTo: "",
|
|
17707
|
+
templateId: "",
|
|
17708
|
+
templateVariables: "{}",
|
|
17709
|
+
status: "idle",
|
|
17710
|
+
messageId: "",
|
|
17711
|
+
sentAt: "",
|
|
17712
|
+
errorMessage: "",
|
|
17713
|
+
conditions: ""
|
|
17714
|
+
},
|
|
17715
|
+
validDependencies: [],
|
|
17716
|
+
defaultProps: {
|
|
17717
|
+
icon: "bell",
|
|
17718
|
+
channel: "email",
|
|
17719
|
+
bodyType: "text",
|
|
17720
|
+
status: "idle"
|
|
17721
|
+
}
|
|
17722
|
+
});
|
|
17723
|
+
blockRegistry.register({
|
|
17724
|
+
type: "bid",
|
|
17725
|
+
propSchema: {
|
|
17726
|
+
title: "",
|
|
17727
|
+
description: "",
|
|
17728
|
+
did: "",
|
|
17729
|
+
selectedCollections: "[]",
|
|
17730
|
+
adminAddress: ""
|
|
17731
|
+
},
|
|
17732
|
+
validDependencies: [],
|
|
17733
|
+
defaultProps: {}
|
|
17734
|
+
});
|
|
17735
|
+
blockRegistry.register({
|
|
17736
|
+
type: "claim",
|
|
17737
|
+
propSchema: {
|
|
17738
|
+
title: "",
|
|
17739
|
+
description: "",
|
|
17740
|
+
icon: "square-check",
|
|
17741
|
+
deedDid: "",
|
|
17742
|
+
selectedCollections: "[]",
|
|
17743
|
+
adminAddress: ""
|
|
17744
|
+
},
|
|
17745
|
+
validDependencies: [],
|
|
17746
|
+
defaultProps: {
|
|
17747
|
+
icon: "square-check"
|
|
17748
|
+
}
|
|
17749
|
+
});
|
|
17750
|
+
blockRegistry.register({
|
|
17751
|
+
type: "domainCreator",
|
|
17752
|
+
propSchema: {
|
|
17753
|
+
title: "",
|
|
17754
|
+
description: "",
|
|
17755
|
+
icon: "file-text",
|
|
17756
|
+
surveySchema: "",
|
|
17757
|
+
answers: "",
|
|
17758
|
+
lastSubmission: ""
|
|
17759
|
+
},
|
|
17760
|
+
validDependencies: [],
|
|
17761
|
+
defaultProps: {
|
|
17762
|
+
icon: "file-text",
|
|
17763
|
+
surveySchema: "",
|
|
17764
|
+
answers: "",
|
|
17765
|
+
lastSubmission: ""
|
|
17766
|
+
}
|
|
17767
|
+
});
|
|
17768
|
+
|
|
17769
|
+
// src/mantine/blocks/hooks/useBlockDependencies.ts
|
|
17770
|
+
import { useMemo as useMemo60, useEffect as useEffect50, useState as useState66, useCallback as useCallback50 } from "react";
|
|
17771
|
+
|
|
17772
|
+
// src/mantine/blocks/hooks/useDependsOn.ts
|
|
17773
|
+
import { useMemo as useMemo61 } from "react";
|
|
17774
|
+
|
|
17775
|
+
// src/mantine/blocks/index.ts
|
|
17776
|
+
var blockSpecs = {
|
|
17777
|
+
checkbox: CheckboxBlockSpec,
|
|
17778
|
+
list: ListBlockSpec,
|
|
17779
|
+
enumChecklist: EnumChecklistBlock,
|
|
17780
|
+
overview: OverviewBlock,
|
|
17781
|
+
proposal: ProposalBlockSpec,
|
|
17782
|
+
apiRequest: ApiRequestBlockSpec,
|
|
17783
|
+
notify: NotifyBlockSpec,
|
|
17784
|
+
claim: ClaimBlockSpec,
|
|
17785
|
+
bid: BidBlockSpec,
|
|
17786
|
+
evaluator: EvaluatorBlockSpec,
|
|
17787
|
+
domainCreator: DomainCreatorBlockSpec,
|
|
17788
|
+
visualization: VisualizationBlockSpec,
|
|
17789
|
+
dynamicList: DynamicListBlockSpec,
|
|
17790
|
+
protocolSelector: ProtocolSelectorBlockSpec,
|
|
17791
|
+
form: FormBlockSpec,
|
|
17792
|
+
domainCreatorSign: DomainCreatorSignBlockSpec,
|
|
17793
|
+
domainCardViewer: DomainCardViewerBlockSpec
|
|
17794
|
+
};
|
|
17795
|
+
var getExtraSlashMenuItems = (editor) => {
|
|
17796
|
+
const slashMenuList = [
|
|
17797
|
+
{
|
|
17798
|
+
title: "Checkbox",
|
|
17799
|
+
onItemClick: () => {
|
|
17800
|
+
editor.insertBlocks(
|
|
17801
|
+
[
|
|
17802
|
+
{
|
|
17803
|
+
type: "checkbox",
|
|
17804
|
+
props: {
|
|
15973
17805
|
checked: false,
|
|
15974
17806
|
allowedCheckers: "all",
|
|
15975
17807
|
initialChecked: false,
|
|
@@ -16226,6 +18058,113 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
16226
18058
|
aliases: ["dynamic-list", "action-list", "ag-ui-list", "oracle-list"],
|
|
16227
18059
|
group: "Basics",
|
|
16228
18060
|
subtext: "Add a dynamic list from AG-UI with snapshot support"
|
|
18061
|
+
},
|
|
18062
|
+
{
|
|
18063
|
+
title: "Protocol Selector",
|
|
18064
|
+
onItemClick: () => {
|
|
18065
|
+
editor.insertBlocks(
|
|
18066
|
+
[
|
|
18067
|
+
{
|
|
18068
|
+
type: "protocolSelector",
|
|
18069
|
+
props: {
|
|
18070
|
+
title: "",
|
|
18071
|
+
description: "",
|
|
18072
|
+
icon: "git-branch",
|
|
18073
|
+
protocolDids: "[]",
|
|
18074
|
+
selectedProtocolDid: "",
|
|
18075
|
+
selectedProtocolName: "",
|
|
18076
|
+
status: "pending",
|
|
18077
|
+
conditions: ""
|
|
18078
|
+
}
|
|
18079
|
+
}
|
|
18080
|
+
],
|
|
18081
|
+
editor.getTextCursorPosition().block,
|
|
18082
|
+
"after"
|
|
18083
|
+
);
|
|
18084
|
+
},
|
|
18085
|
+
aliases: ["protocol", "protocol-selector", "select-protocol", "domain-type"],
|
|
18086
|
+
group: "Domains",
|
|
18087
|
+
subtext: "Select a protocol from a predefined list"
|
|
18088
|
+
},
|
|
18089
|
+
{
|
|
18090
|
+
title: "Form",
|
|
18091
|
+
onItemClick: () => {
|
|
18092
|
+
editor.insertBlocks(
|
|
18093
|
+
[
|
|
18094
|
+
{
|
|
18095
|
+
type: "form",
|
|
18096
|
+
props: {
|
|
18097
|
+
title: "",
|
|
18098
|
+
description: "",
|
|
18099
|
+
icon: "checklist",
|
|
18100
|
+
surveySchema: "",
|
|
18101
|
+
answers: "",
|
|
18102
|
+
status: "pending",
|
|
18103
|
+
completedAt: ""
|
|
18104
|
+
}
|
|
18105
|
+
}
|
|
18106
|
+
],
|
|
18107
|
+
editor.getTextCursorPosition().block,
|
|
18108
|
+
"after"
|
|
18109
|
+
);
|
|
18110
|
+
},
|
|
18111
|
+
aliases: ["form", "survey", "questionnaire", "input"],
|
|
18112
|
+
group: "Basics",
|
|
18113
|
+
subtext: "Add a configurable form with SurveyJS"
|
|
18114
|
+
},
|
|
18115
|
+
{
|
|
18116
|
+
title: "Sign to Create",
|
|
18117
|
+
onItemClick: () => {
|
|
18118
|
+
editor.insertBlocks(
|
|
18119
|
+
[
|
|
18120
|
+
{
|
|
18121
|
+
type: "domainCreatorSign",
|
|
18122
|
+
props: {
|
|
18123
|
+
title: "",
|
|
18124
|
+
description: "",
|
|
18125
|
+
icon: "feather",
|
|
18126
|
+
domainCardData: "{}",
|
|
18127
|
+
entityType: "",
|
|
18128
|
+
status: "pending",
|
|
18129
|
+
entityDid: "",
|
|
18130
|
+
transactionHash: "",
|
|
18131
|
+
errorMessage: ""
|
|
18132
|
+
}
|
|
18133
|
+
}
|
|
18134
|
+
],
|
|
18135
|
+
editor.getTextCursorPosition().block,
|
|
18136
|
+
"after"
|
|
18137
|
+
);
|
|
18138
|
+
},
|
|
18139
|
+
aliases: ["domain-sign"],
|
|
18140
|
+
group: "Domains",
|
|
18141
|
+
subtext: "Sign domain card and create entity on-chain"
|
|
18142
|
+
},
|
|
18143
|
+
{
|
|
18144
|
+
title: "Domain Card",
|
|
18145
|
+
onItemClick: () => {
|
|
18146
|
+
editor.insertBlocks(
|
|
18147
|
+
[
|
|
18148
|
+
{
|
|
18149
|
+
type: "domainCardViewer",
|
|
18150
|
+
props: {
|
|
18151
|
+
title: "",
|
|
18152
|
+
description: "",
|
|
18153
|
+
icon: "dots-circle",
|
|
18154
|
+
domainCardData: "{}",
|
|
18155
|
+
status: "pending",
|
|
18156
|
+
loadingMessage: "",
|
|
18157
|
+
errorMessage: ""
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
18160
|
+
],
|
|
18161
|
+
editor.getTextCursorPosition().block,
|
|
18162
|
+
"after"
|
|
18163
|
+
);
|
|
18164
|
+
},
|
|
18165
|
+
aliases: ["domain-card", "domain-viewer", "card-preview"],
|
|
18166
|
+
group: "Domains",
|
|
18167
|
+
subtext: "Preview domain card before signing"
|
|
16229
18168
|
}
|
|
16230
18169
|
];
|
|
16231
18170
|
const yRoot = editor?._yRoot;
|
|
@@ -16306,15 +18245,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
|
|
|
16306
18245
|
import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
|
|
16307
18246
|
|
|
16308
18247
|
// src/core/hooks/useMatrixProvider.ts
|
|
16309
|
-
import { useEffect as
|
|
18248
|
+
import { useEffect as useEffect51, useState as useState67, useRef as useRef12, useCallback as useCallback51, useMemo as useMemo62 } from "react";
|
|
16310
18249
|
import { MatrixProvider } from "@ixo/matrix-crdt";
|
|
16311
18250
|
function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
16312
|
-
const [matrixProvider, setProvider] =
|
|
16313
|
-
const [status, setStatus] =
|
|
16314
|
-
const isMountedRef =
|
|
16315
|
-
const providerRef =
|
|
16316
|
-
const retryTimeoutRef =
|
|
16317
|
-
const providerOptions =
|
|
18251
|
+
const [matrixProvider, setProvider] = useState67(null);
|
|
18252
|
+
const [status, setStatus] = useState67("disconnected");
|
|
18253
|
+
const isMountedRef = useRef12(true);
|
|
18254
|
+
const providerRef = useRef12(null);
|
|
18255
|
+
const retryTimeoutRef = useRef12(null);
|
|
18256
|
+
const providerOptions = useMemo62(
|
|
16318
18257
|
() => ({
|
|
16319
18258
|
translator: {
|
|
16320
18259
|
updateEventType: "matrix-crdt.doc_update",
|
|
@@ -16327,22 +18266,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
16327
18266
|
}),
|
|
16328
18267
|
[]
|
|
16329
18268
|
);
|
|
16330
|
-
const handleDocumentAvailable =
|
|
18269
|
+
const handleDocumentAvailable = useCallback51(() => {
|
|
16331
18270
|
if (isMountedRef.current) {
|
|
16332
18271
|
setStatus("connected");
|
|
16333
18272
|
}
|
|
16334
18273
|
}, []);
|
|
16335
|
-
const handleDocumentUnavailable =
|
|
18274
|
+
const handleDocumentUnavailable = useCallback51(() => {
|
|
16336
18275
|
if (isMountedRef.current) {
|
|
16337
18276
|
setStatus("failed");
|
|
16338
18277
|
}
|
|
16339
18278
|
}, []);
|
|
16340
|
-
const handleCanWriteChanged =
|
|
18279
|
+
const handleCanWriteChanged = useCallback51(() => {
|
|
16341
18280
|
if (isMountedRef.current && providerRef.current) {
|
|
16342
18281
|
setStatus(providerRef.current.canWrite ? "connected" : "failed");
|
|
16343
18282
|
}
|
|
16344
18283
|
}, []);
|
|
16345
|
-
const initProvider =
|
|
18284
|
+
const initProvider = useCallback51(async () => {
|
|
16346
18285
|
if (!isMountedRef.current) return;
|
|
16347
18286
|
if (retryTimeoutRef.current) {
|
|
16348
18287
|
clearTimeout(retryTimeoutRef.current);
|
|
@@ -16375,7 +18314,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
16375
18314
|
}
|
|
16376
18315
|
}
|
|
16377
18316
|
}, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
|
|
16378
|
-
|
|
18317
|
+
useEffect51(() => {
|
|
16379
18318
|
isMountedRef.current = true;
|
|
16380
18319
|
initProvider();
|
|
16381
18320
|
return () => {
|
|
@@ -16392,7 +18331,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
16392
18331
|
setStatus("disconnected");
|
|
16393
18332
|
};
|
|
16394
18333
|
}, [initProvider]);
|
|
16395
|
-
|
|
18334
|
+
useEffect51(() => {
|
|
16396
18335
|
return () => {
|
|
16397
18336
|
isMountedRef.current = false;
|
|
16398
18337
|
};
|
|
@@ -16401,17 +18340,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
|
|
|
16401
18340
|
}
|
|
16402
18341
|
|
|
16403
18342
|
// src/mantine/hooks/useCollaborativeYDoc.ts
|
|
16404
|
-
import { useMemo as
|
|
18343
|
+
import { useMemo as useMemo63 } from "react";
|
|
16405
18344
|
import * as Y from "yjs";
|
|
16406
18345
|
function useCollaborativeYDoc(_options) {
|
|
16407
|
-
return
|
|
18346
|
+
return useMemo63(() => {
|
|
16408
18347
|
const doc = new Y.Doc();
|
|
16409
18348
|
return doc;
|
|
16410
18349
|
}, []);
|
|
16411
18350
|
}
|
|
16412
18351
|
|
|
16413
18352
|
// src/mantine/hooks/useCollaborativeIxoEditor.ts
|
|
16414
|
-
import { useMemo as
|
|
18353
|
+
import { useMemo as useMemo64, useEffect as useEffect52 } from "react";
|
|
16415
18354
|
|
|
16416
18355
|
// src/core/lib/matrixMetadata.ts
|
|
16417
18356
|
var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
|
|
@@ -16580,7 +18519,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16580
18519
|
matrixClient,
|
|
16581
18520
|
permissions = { write: false }
|
|
16582
18521
|
} = options || {};
|
|
16583
|
-
const memoizedUser =
|
|
18522
|
+
const memoizedUser = useMemo64(
|
|
16584
18523
|
() => ({
|
|
16585
18524
|
id: user?.id || "",
|
|
16586
18525
|
name: user?.name || "",
|
|
@@ -16595,13 +18534,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16595
18534
|
matrixClient,
|
|
16596
18535
|
roomId: options.roomId
|
|
16597
18536
|
});
|
|
16598
|
-
const metadataManager =
|
|
16599
|
-
|
|
18537
|
+
const metadataManager = useMemo64(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
|
|
18538
|
+
useEffect52(() => {
|
|
16600
18539
|
return () => {
|
|
16601
18540
|
metadataManager.dispose();
|
|
16602
18541
|
};
|
|
16603
18542
|
}, [metadataManager]);
|
|
16604
|
-
const defaultUploadFile =
|
|
18543
|
+
const defaultUploadFile = useMemo64(
|
|
16605
18544
|
() => uploadFile || (async (file) => {
|
|
16606
18545
|
return new Promise((resolve, reject) => {
|
|
16607
18546
|
const reader = new FileReader();
|
|
@@ -16615,7 +18554,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16615
18554
|
}),
|
|
16616
18555
|
[uploadFile]
|
|
16617
18556
|
);
|
|
16618
|
-
const schema =
|
|
18557
|
+
const schema = useMemo64(
|
|
16619
18558
|
() => BlockNoteSchema2.create({
|
|
16620
18559
|
blockSpecs: {
|
|
16621
18560
|
...defaultBlockSpecs2,
|
|
@@ -16630,13 +18569,13 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16630
18569
|
}),
|
|
16631
18570
|
[]
|
|
16632
18571
|
);
|
|
16633
|
-
const root =
|
|
16634
|
-
const documentFragment =
|
|
16635
|
-
const flowArray =
|
|
16636
|
-
const runtimeMap =
|
|
16637
|
-
const delegationsMap =
|
|
16638
|
-
const userFragment =
|
|
16639
|
-
const collaborationConfig =
|
|
18572
|
+
const root = useMemo64(() => yDoc.getMap("root"), [yDoc]);
|
|
18573
|
+
const documentFragment = useMemo64(() => yDoc.getXmlFragment("document"), [yDoc]);
|
|
18574
|
+
const flowArray = useMemo64(() => yDoc.getArray("flow"), [yDoc]);
|
|
18575
|
+
const runtimeMap = useMemo64(() => yDoc.getMap("runtime"), [yDoc]);
|
|
18576
|
+
const delegationsMap = useMemo64(() => yDoc.getMap("delegations"), [yDoc]);
|
|
18577
|
+
const userFragment = useMemo64(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
|
|
18578
|
+
const collaborationConfig = useMemo64(
|
|
16640
18579
|
() => ({
|
|
16641
18580
|
provider: matrixProvider,
|
|
16642
18581
|
fragment: documentFragment,
|
|
@@ -16648,7 +18587,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16648
18587
|
}),
|
|
16649
18588
|
[matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
|
|
16650
18589
|
);
|
|
16651
|
-
const ixoConfig =
|
|
18590
|
+
const ixoConfig = useMemo64(
|
|
16652
18591
|
() => ({
|
|
16653
18592
|
theme,
|
|
16654
18593
|
editable,
|
|
@@ -16667,7 +18606,7 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16667
18606
|
uploadFile: defaultUploadFile,
|
|
16668
18607
|
collaboration: collaborationConfig
|
|
16669
18608
|
});
|
|
16670
|
-
const titleText =
|
|
18609
|
+
const titleText = useMemo64(() => yDoc.getText("title"), [yDoc]);
|
|
16671
18610
|
let ixoEditor;
|
|
16672
18611
|
if (editor) {
|
|
16673
18612
|
ixoEditor = editor;
|
|
@@ -16817,12 +18756,12 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16817
18756
|
return void 0;
|
|
16818
18757
|
};
|
|
16819
18758
|
}
|
|
16820
|
-
|
|
18759
|
+
useEffect52(() => {
|
|
16821
18760
|
if (ixoEditor) {
|
|
16822
18761
|
ixoEditor.isEditable = editable;
|
|
16823
18762
|
}
|
|
16824
18763
|
}, [ixoEditor, editable]);
|
|
16825
|
-
|
|
18764
|
+
useEffect52(() => {
|
|
16826
18765
|
if (connectionStatus !== "connected") {
|
|
16827
18766
|
return;
|
|
16828
18767
|
}
|
|
@@ -16855,8 +18794,8 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
16855
18794
|
}
|
|
16856
18795
|
|
|
16857
18796
|
// src/mantine/components/CoverImage.tsx
|
|
16858
|
-
import
|
|
16859
|
-
import { Box as
|
|
18797
|
+
import React196, { useState as useState68, useRef as useRef13, useEffect as useEffect53 } from "react";
|
|
18798
|
+
import { Box as Box35, Group as Group62 } from "@mantine/core";
|
|
16860
18799
|
|
|
16861
18800
|
// src/core/lib/imageTransform.ts
|
|
16862
18801
|
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
@@ -16989,11 +18928,11 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
|
16989
18928
|
}
|
|
16990
18929
|
|
|
16991
18930
|
// src/mantine/components/Base/CoverImageButton.tsx
|
|
16992
|
-
import
|
|
16993
|
-
import { Button as
|
|
18931
|
+
import React195 from "react";
|
|
18932
|
+
import { Button as Button36 } from "@mantine/core";
|
|
16994
18933
|
function CoverImageButton({ isActive = false, children, onClick, style }) {
|
|
16995
|
-
return /* @__PURE__ */
|
|
16996
|
-
|
|
18934
|
+
return /* @__PURE__ */ React195.createElement(
|
|
18935
|
+
Button36,
|
|
16997
18936
|
{
|
|
16998
18937
|
onClick,
|
|
16999
18938
|
variant: "filled",
|
|
@@ -17015,13 +18954,13 @@ function CoverImageButton({ isActive = false, children, onClick, style }) {
|
|
|
17015
18954
|
// src/mantine/components/CoverImage.tsx
|
|
17016
18955
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
17017
18956
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
17018
|
-
const [isHovering, setIsHovering] =
|
|
17019
|
-
const [isRepositioning, setIsRepositioning] =
|
|
17020
|
-
const [coverPosition, setCoverPosition] =
|
|
17021
|
-
const coverFileInputRef =
|
|
17022
|
-
const logoFileInputRef =
|
|
17023
|
-
const [metadata, setMetadata] =
|
|
17024
|
-
|
|
18957
|
+
const [isHovering, setIsHovering] = useState68(false);
|
|
18958
|
+
const [isRepositioning, setIsRepositioning] = useState68(false);
|
|
18959
|
+
const [coverPosition, setCoverPosition] = useState68(50);
|
|
18960
|
+
const coverFileInputRef = useRef13(null);
|
|
18961
|
+
const logoFileInputRef = useRef13(null);
|
|
18962
|
+
const [metadata, setMetadata] = useState68(() => editor?.getPageMetadata?.() || null);
|
|
18963
|
+
useEffect53(() => {
|
|
17025
18964
|
if (!editor?._metadataManager) {
|
|
17026
18965
|
return;
|
|
17027
18966
|
}
|
|
@@ -17112,8 +19051,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17112
19051
|
return null;
|
|
17113
19052
|
}
|
|
17114
19053
|
if (!hasCover) {
|
|
17115
|
-
return /* @__PURE__ */
|
|
17116
|
-
|
|
19054
|
+
return /* @__PURE__ */ React196.createElement(
|
|
19055
|
+
Box35,
|
|
17117
19056
|
{
|
|
17118
19057
|
style: {
|
|
17119
19058
|
position: "relative",
|
|
@@ -17125,8 +19064,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17125
19064
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
17126
19065
|
onMouseLeave: () => editable && setIsHovering(false)
|
|
17127
19066
|
},
|
|
17128
|
-
/* @__PURE__ */
|
|
17129
|
-
|
|
19067
|
+
/* @__PURE__ */ React196.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React196.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React196.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React196.createElement(
|
|
19068
|
+
Group62,
|
|
17130
19069
|
{
|
|
17131
19070
|
gap: "xs",
|
|
17132
19071
|
style: {
|
|
@@ -17136,10 +19075,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17136
19075
|
zIndex: 10
|
|
17137
19076
|
}
|
|
17138
19077
|
},
|
|
17139
|
-
/* @__PURE__ */
|
|
17140
|
-
/* @__PURE__ */
|
|
17141
|
-
), logoSrc && /* @__PURE__ */
|
|
17142
|
-
|
|
19078
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleAddLogo }, "Add icon"),
|
|
19079
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
|
|
19080
|
+
), logoSrc && /* @__PURE__ */ React196.createElement(
|
|
19081
|
+
Box35,
|
|
17143
19082
|
{
|
|
17144
19083
|
style: {
|
|
17145
19084
|
position: "relative",
|
|
@@ -17152,7 +19091,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17152
19091
|
zIndex: 11
|
|
17153
19092
|
}
|
|
17154
19093
|
},
|
|
17155
|
-
/* @__PURE__ */
|
|
19094
|
+
/* @__PURE__ */ React196.createElement(
|
|
17156
19095
|
"img",
|
|
17157
19096
|
{
|
|
17158
19097
|
src: logoSrc,
|
|
@@ -17166,7 +19105,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17166
19105
|
}
|
|
17167
19106
|
}
|
|
17168
19107
|
),
|
|
17169
|
-
editable && isHovering && /* @__PURE__ */
|
|
19108
|
+
editable && isHovering && /* @__PURE__ */ React196.createElement(
|
|
17170
19109
|
"div",
|
|
17171
19110
|
{
|
|
17172
19111
|
style: {
|
|
@@ -17181,15 +19120,15 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17181
19120
|
alignItems: "center"
|
|
17182
19121
|
}
|
|
17183
19122
|
},
|
|
17184
|
-
/* @__PURE__ */
|
|
17185
|
-
/* @__PURE__ */
|
|
17186
|
-
/* @__PURE__ */
|
|
19123
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
|
|
19124
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
|
|
19125
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
|
|
17187
19126
|
)
|
|
17188
19127
|
))
|
|
17189
19128
|
);
|
|
17190
19129
|
}
|
|
17191
|
-
return /* @__PURE__ */
|
|
17192
|
-
|
|
19130
|
+
return /* @__PURE__ */ React196.createElement(
|
|
19131
|
+
Box35,
|
|
17193
19132
|
{
|
|
17194
19133
|
style: {
|
|
17195
19134
|
position: "relative",
|
|
@@ -17209,7 +19148,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17209
19148
|
onMouseMove: handleMouseMove,
|
|
17210
19149
|
onClick: () => isRepositioning && setIsRepositioning(false)
|
|
17211
19150
|
},
|
|
17212
|
-
/* @__PURE__ */
|
|
19151
|
+
/* @__PURE__ */ React196.createElement(
|
|
17213
19152
|
"img",
|
|
17214
19153
|
{
|
|
17215
19154
|
src: coverUrl,
|
|
@@ -17227,8 +19166,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17227
19166
|
}
|
|
17228
19167
|
}
|
|
17229
19168
|
),
|
|
17230
|
-
editable && isHovering && /* @__PURE__ */
|
|
17231
|
-
|
|
19169
|
+
editable && isHovering && /* @__PURE__ */ React196.createElement(
|
|
19170
|
+
Group62,
|
|
17232
19171
|
{
|
|
17233
19172
|
gap: "xs",
|
|
17234
19173
|
style: {
|
|
@@ -17238,12 +19177,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17238
19177
|
zIndex: 10
|
|
17239
19178
|
}
|
|
17240
19179
|
},
|
|
17241
|
-
/* @__PURE__ */
|
|
17242
|
-
/* @__PURE__ */
|
|
17243
|
-
/* @__PURE__ */
|
|
19180
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleChangeCover }, "Change cover"),
|
|
19181
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleReposition, isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
|
|
19182
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
|
|
17244
19183
|
),
|
|
17245
|
-
/* @__PURE__ */
|
|
17246
|
-
|
|
19184
|
+
/* @__PURE__ */ React196.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React196.createElement(
|
|
19185
|
+
Box35,
|
|
17247
19186
|
{
|
|
17248
19187
|
style: {
|
|
17249
19188
|
position: "absolute",
|
|
@@ -17254,7 +19193,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17254
19193
|
zIndex: 11
|
|
17255
19194
|
}
|
|
17256
19195
|
},
|
|
17257
|
-
logoSrc && /* @__PURE__ */
|
|
19196
|
+
logoSrc && /* @__PURE__ */ React196.createElement(
|
|
17258
19197
|
"img",
|
|
17259
19198
|
{
|
|
17260
19199
|
src: logoSrc,
|
|
@@ -17268,10 +19207,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17268
19207
|
}
|
|
17269
19208
|
}
|
|
17270
19209
|
),
|
|
17271
|
-
editable && isHovering && /* @__PURE__ */
|
|
19210
|
+
editable && isHovering && /* @__PURE__ */ React196.createElement(React196.Fragment, null, logoSrc ? (
|
|
17272
19211
|
// Logo exists: Show Change/Remove buttons when hovering on cover
|
|
17273
|
-
/* @__PURE__ */
|
|
17274
|
-
|
|
19212
|
+
/* @__PURE__ */ React196.createElement(
|
|
19213
|
+
Group62,
|
|
17275
19214
|
{
|
|
17276
19215
|
gap: "xs",
|
|
17277
19216
|
style: {
|
|
@@ -17281,12 +19220,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17281
19220
|
zIndex: 12
|
|
17282
19221
|
}
|
|
17283
19222
|
},
|
|
17284
|
-
/* @__PURE__ */
|
|
17285
|
-
/* @__PURE__ */
|
|
19223
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
|
|
19224
|
+
/* @__PURE__ */ React196.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
|
|
17286
19225
|
)
|
|
17287
19226
|
) : (
|
|
17288
19227
|
// No logo: Show "Add icon" button when hovering anywhere on cover
|
|
17289
|
-
/* @__PURE__ */
|
|
19228
|
+
/* @__PURE__ */ React196.createElement(
|
|
17290
19229
|
CoverImageButton,
|
|
17291
19230
|
{
|
|
17292
19231
|
onClick: handleAddLogo,
|
|
@@ -17302,13 +19241,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
17302
19241
|
)
|
|
17303
19242
|
))
|
|
17304
19243
|
)),
|
|
17305
|
-
/* @__PURE__ */
|
|
17306
|
-
/* @__PURE__ */
|
|
19244
|
+
/* @__PURE__ */ React196.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
|
|
19245
|
+
/* @__PURE__ */ React196.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
|
|
17307
19246
|
);
|
|
17308
19247
|
}
|
|
17309
19248
|
|
|
17310
19249
|
// src/mantine/components/PageHeader.tsx
|
|
17311
|
-
import
|
|
19250
|
+
import React197, { useState as useState69, useRef as useRef14, useEffect as useEffect54 } from "react";
|
|
17312
19251
|
function PageHeader({
|
|
17313
19252
|
title = "New page",
|
|
17314
19253
|
icon,
|
|
@@ -17319,9 +19258,9 @@ function PageHeader({
|
|
|
17319
19258
|
isFavorited = false,
|
|
17320
19259
|
menuItems = []
|
|
17321
19260
|
}) {
|
|
17322
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
17323
|
-
const menuRef =
|
|
17324
|
-
|
|
19261
|
+
const [isMenuOpen, setIsMenuOpen] = useState69(false);
|
|
19262
|
+
const menuRef = useRef14(null);
|
|
19263
|
+
useEffect54(() => {
|
|
17325
19264
|
function handleClickOutside(event) {
|
|
17326
19265
|
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
17327
19266
|
setIsMenuOpen(false);
|
|
@@ -17340,14 +19279,14 @@ function PageHeader({
|
|
|
17340
19279
|
setIsMenuOpen(false);
|
|
17341
19280
|
}
|
|
17342
19281
|
};
|
|
17343
|
-
return /* @__PURE__ */
|
|
19282
|
+
return /* @__PURE__ */ React197.createElement("div", { style: styles.container }, /* @__PURE__ */ React197.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React197.createElement("span", { style: styles.icon }, icon || "\u{1F4C4}"), /* @__PURE__ */ React197.createElement("span", { style: styles.title }, title), isPrivate && /* @__PURE__ */ React197.createElement("button", { style: styles.privacyBadge }, /* @__PURE__ */ React197.createElement("span", { style: styles.lockIcon }, "\u{1F512}"), /* @__PURE__ */ React197.createElement("span", null, "Private"), /* @__PURE__ */ React197.createElement("span", { style: styles.chevron }, "\u25BE"))), /* @__PURE__ */ React197.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React197.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React197.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React197.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React197.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React197.createElement(
|
|
17344
19283
|
"button",
|
|
17345
19284
|
{
|
|
17346
19285
|
style: styles.menuButton,
|
|
17347
19286
|
onClick: () => setIsMenuOpen(!isMenuOpen),
|
|
17348
19287
|
"aria-label": "Menu"
|
|
17349
19288
|
},
|
|
17350
|
-
/* @__PURE__ */
|
|
19289
|
+
/* @__PURE__ */ React197.createElement(
|
|
17351
19290
|
"svg",
|
|
17352
19291
|
{
|
|
17353
19292
|
width: "16",
|
|
@@ -17355,11 +19294,11 @@ function PageHeader({
|
|
|
17355
19294
|
viewBox: "0 0 16 16",
|
|
17356
19295
|
fill: "currentColor"
|
|
17357
19296
|
},
|
|
17358
|
-
/* @__PURE__ */
|
|
17359
|
-
/* @__PURE__ */
|
|
17360
|
-
/* @__PURE__ */
|
|
19297
|
+
/* @__PURE__ */ React197.createElement("circle", { cx: "3", cy: "8", r: "1.5" }),
|
|
19298
|
+
/* @__PURE__ */ React197.createElement("circle", { cx: "8", cy: "8", r: "1.5" }),
|
|
19299
|
+
/* @__PURE__ */ React197.createElement("circle", { cx: "13", cy: "8", r: "1.5" })
|
|
17361
19300
|
)
|
|
17362
|
-
), isMenuOpen && /* @__PURE__ */
|
|
19301
|
+
), isMenuOpen && /* @__PURE__ */ React197.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React197.createElement(React197.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React197.createElement("div", { style: styles.divider }), /* @__PURE__ */ React197.createElement(
|
|
17363
19302
|
"button",
|
|
17364
19303
|
{
|
|
17365
19304
|
style: {
|
|
@@ -17369,8 +19308,8 @@ function PageHeader({
|
|
|
17369
19308
|
onClick: () => handleMenuItemClick(item),
|
|
17370
19309
|
disabled: item.disabled
|
|
17371
19310
|
},
|
|
17372
|
-
item.icon && /* @__PURE__ */
|
|
17373
|
-
/* @__PURE__ */
|
|
19311
|
+
item.icon && /* @__PURE__ */ React197.createElement("span", { style: styles.menuItemIcon }, item.icon),
|
|
19312
|
+
/* @__PURE__ */ React197.createElement("span", null, item.label)
|
|
17374
19313
|
)))))));
|
|
17375
19314
|
}
|
|
17376
19315
|
var styles = {
|
|
@@ -17501,8 +19440,8 @@ var styles = {
|
|
|
17501
19440
|
};
|
|
17502
19441
|
|
|
17503
19442
|
// src/mantine/components/ExternalDropZone.tsx
|
|
17504
|
-
import
|
|
17505
|
-
import { Box as
|
|
19443
|
+
import React198, { useCallback as useCallback52, useEffect as useEffect55, useRef as useRef15, useState as useState70 } from "react";
|
|
19444
|
+
import { Box as Box36 } from "@mantine/core";
|
|
17506
19445
|
var SCROLL_ZONE_SIZE = 80;
|
|
17507
19446
|
var SCROLL_SPEED = 12;
|
|
17508
19447
|
var ExternalDropZone = ({
|
|
@@ -17514,20 +19453,20 @@ var ExternalDropZone = ({
|
|
|
17514
19453
|
onPlacementCancel,
|
|
17515
19454
|
children
|
|
17516
19455
|
}) => {
|
|
17517
|
-
const containerRef =
|
|
17518
|
-
const [isValidDrag, setIsValidDrag] =
|
|
17519
|
-
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] =
|
|
17520
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
17521
|
-
const dropPositionRef =
|
|
17522
|
-
const scrollAnimationRef =
|
|
17523
|
-
const scrollDirectionRef =
|
|
17524
|
-
const scrollContainerRef =
|
|
17525
|
-
const getBlockElements =
|
|
19456
|
+
const containerRef = useRef15(null);
|
|
19457
|
+
const [isValidDrag, setIsValidDrag] = useState70(false);
|
|
19458
|
+
const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState70(false);
|
|
19459
|
+
const [indicatorStyle, setIndicatorStyle] = useState70({});
|
|
19460
|
+
const dropPositionRef = useRef15(null);
|
|
19461
|
+
const scrollAnimationRef = useRef15(null);
|
|
19462
|
+
const scrollDirectionRef = useRef15(null);
|
|
19463
|
+
const scrollContainerRef = useRef15(null);
|
|
19464
|
+
const getBlockElements = useCallback52(() => {
|
|
17526
19465
|
if (!containerRef.current) return [];
|
|
17527
19466
|
const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
|
|
17528
19467
|
return Array.from(blocks);
|
|
17529
19468
|
}, []);
|
|
17530
|
-
const getScrollContainer =
|
|
19469
|
+
const getScrollContainer = useCallback52(() => {
|
|
17531
19470
|
if (scrollContainerRef.current) return scrollContainerRef.current;
|
|
17532
19471
|
let element = containerRef.current;
|
|
17533
19472
|
while (element) {
|
|
@@ -17542,7 +19481,7 @@ var ExternalDropZone = ({
|
|
|
17542
19481
|
scrollContainerRef.current = window;
|
|
17543
19482
|
return window;
|
|
17544
19483
|
}, []);
|
|
17545
|
-
const performScroll =
|
|
19484
|
+
const performScroll = useCallback52(() => {
|
|
17546
19485
|
const container = getScrollContainer();
|
|
17547
19486
|
const direction = scrollDirectionRef.current;
|
|
17548
19487
|
if (!direction) {
|
|
@@ -17557,7 +19496,7 @@ var ExternalDropZone = ({
|
|
|
17557
19496
|
}
|
|
17558
19497
|
scrollAnimationRef.current = requestAnimationFrame(performScroll);
|
|
17559
19498
|
}, [getScrollContainer]);
|
|
17560
|
-
const startAutoScroll =
|
|
19499
|
+
const startAutoScroll = useCallback52(
|
|
17561
19500
|
(direction) => {
|
|
17562
19501
|
if (scrollDirectionRef.current === direction) return;
|
|
17563
19502
|
scrollDirectionRef.current = direction;
|
|
@@ -17567,14 +19506,14 @@ var ExternalDropZone = ({
|
|
|
17567
19506
|
},
|
|
17568
19507
|
[performScroll]
|
|
17569
19508
|
);
|
|
17570
|
-
const stopAutoScroll =
|
|
19509
|
+
const stopAutoScroll = useCallback52(() => {
|
|
17571
19510
|
scrollDirectionRef.current = null;
|
|
17572
19511
|
if (scrollAnimationRef.current) {
|
|
17573
19512
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
17574
19513
|
scrollAnimationRef.current = null;
|
|
17575
19514
|
}
|
|
17576
19515
|
}, []);
|
|
17577
|
-
const checkAutoScroll =
|
|
19516
|
+
const checkAutoScroll = useCallback52(
|
|
17578
19517
|
(clientY) => {
|
|
17579
19518
|
const container = getScrollContainer();
|
|
17580
19519
|
let containerTop;
|
|
@@ -17597,7 +19536,7 @@ var ExternalDropZone = ({
|
|
|
17597
19536
|
},
|
|
17598
19537
|
[getScrollContainer, startAutoScroll, stopAutoScroll]
|
|
17599
19538
|
);
|
|
17600
|
-
const findDropPosition =
|
|
19539
|
+
const findDropPosition = useCallback52(
|
|
17601
19540
|
(clientY) => {
|
|
17602
19541
|
const blocks = getBlockElements();
|
|
17603
19542
|
if (blocks.length === 0 || !editor?.document) return null;
|
|
@@ -17630,7 +19569,7 @@ var ExternalDropZone = ({
|
|
|
17630
19569
|
},
|
|
17631
19570
|
[getBlockElements, editor]
|
|
17632
19571
|
);
|
|
17633
|
-
const handleDragOver =
|
|
19572
|
+
const handleDragOver = useCallback52(
|
|
17634
19573
|
(e) => {
|
|
17635
19574
|
if (!e.dataTransfer.types.includes(acceptedType)) return;
|
|
17636
19575
|
e.preventDefault();
|
|
@@ -17653,7 +19592,7 @@ var ExternalDropZone = ({
|
|
|
17653
19592
|
},
|
|
17654
19593
|
[acceptedType, findDropPosition, checkAutoScroll]
|
|
17655
19594
|
);
|
|
17656
|
-
const handleDragLeave =
|
|
19595
|
+
const handleDragLeave = useCallback52(
|
|
17657
19596
|
(e) => {
|
|
17658
19597
|
if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
|
|
17659
19598
|
setIsValidDrag(false);
|
|
@@ -17663,7 +19602,7 @@ var ExternalDropZone = ({
|
|
|
17663
19602
|
},
|
|
17664
19603
|
[stopAutoScroll]
|
|
17665
19604
|
);
|
|
17666
|
-
const handleDrop =
|
|
19605
|
+
const handleDrop = useCallback52(
|
|
17667
19606
|
(e) => {
|
|
17668
19607
|
e.preventDefault();
|
|
17669
19608
|
e.stopPropagation();
|
|
@@ -17677,7 +19616,7 @@ var ExternalDropZone = ({
|
|
|
17677
19616
|
},
|
|
17678
19617
|
[onDrop, stopAutoScroll]
|
|
17679
19618
|
);
|
|
17680
|
-
|
|
19619
|
+
useEffect55(() => {
|
|
17681
19620
|
const handleGlobalDragEnd = () => {
|
|
17682
19621
|
setIsValidDrag(false);
|
|
17683
19622
|
dropPositionRef.current = null;
|
|
@@ -17686,7 +19625,7 @@ var ExternalDropZone = ({
|
|
|
17686
19625
|
window.addEventListener("dragend", handleGlobalDragEnd);
|
|
17687
19626
|
return () => window.removeEventListener("dragend", handleGlobalDragEnd);
|
|
17688
19627
|
}, [stopAutoScroll]);
|
|
17689
|
-
const handleOverlayMouseMove =
|
|
19628
|
+
const handleOverlayMouseMove = useCallback52(
|
|
17690
19629
|
(e) => {
|
|
17691
19630
|
setIsHoveringInPlacementMode(true);
|
|
17692
19631
|
checkAutoScroll(e.clientY);
|
|
@@ -17705,12 +19644,12 @@ var ExternalDropZone = ({
|
|
|
17705
19644
|
},
|
|
17706
19645
|
[findDropPosition, checkAutoScroll]
|
|
17707
19646
|
);
|
|
17708
|
-
const handleOverlayMouseLeave =
|
|
19647
|
+
const handleOverlayMouseLeave = useCallback52(() => {
|
|
17709
19648
|
setIsHoveringInPlacementMode(false);
|
|
17710
19649
|
dropPositionRef.current = null;
|
|
17711
19650
|
stopAutoScroll();
|
|
17712
19651
|
}, [stopAutoScroll]);
|
|
17713
|
-
const handleOverlayClick =
|
|
19652
|
+
const handleOverlayClick = useCallback52(
|
|
17714
19653
|
(e) => {
|
|
17715
19654
|
e.preventDefault();
|
|
17716
19655
|
e.stopPropagation();
|
|
@@ -17724,7 +19663,7 @@ var ExternalDropZone = ({
|
|
|
17724
19663
|
},
|
|
17725
19664
|
[onDrop, stopAutoScroll]
|
|
17726
19665
|
);
|
|
17727
|
-
const handleOverlayWheel =
|
|
19666
|
+
const handleOverlayWheel = useCallback52(
|
|
17728
19667
|
(e) => {
|
|
17729
19668
|
const container = getScrollContainer();
|
|
17730
19669
|
if (container === window) {
|
|
@@ -17735,7 +19674,7 @@ var ExternalDropZone = ({
|
|
|
17735
19674
|
},
|
|
17736
19675
|
[getScrollContainer]
|
|
17737
19676
|
);
|
|
17738
|
-
|
|
19677
|
+
useEffect55(() => {
|
|
17739
19678
|
if (!isPlacementMode) return;
|
|
17740
19679
|
const handleKeyDown = (e) => {
|
|
17741
19680
|
if (e.key === "Escape") {
|
|
@@ -17758,13 +19697,13 @@ var ExternalDropZone = ({
|
|
|
17758
19697
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
17759
19698
|
};
|
|
17760
19699
|
}, [isPlacementMode, onPlacementCancel]);
|
|
17761
|
-
|
|
19700
|
+
useEffect55(() => {
|
|
17762
19701
|
if (!isPlacementMode) {
|
|
17763
19702
|
setIsHoveringInPlacementMode(false);
|
|
17764
19703
|
dropPositionRef.current = null;
|
|
17765
19704
|
}
|
|
17766
19705
|
}, [isPlacementMode]);
|
|
17767
|
-
|
|
19706
|
+
useEffect55(() => {
|
|
17768
19707
|
const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
17769
19708
|
if (isActive) {
|
|
17770
19709
|
document.body.classList.add("external-artifact-drag-active");
|
|
@@ -17775,19 +19714,19 @@ var ExternalDropZone = ({
|
|
|
17775
19714
|
document.body.classList.remove("external-artifact-drag-active");
|
|
17776
19715
|
};
|
|
17777
19716
|
}, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
|
|
17778
|
-
|
|
19717
|
+
useEffect55(() => {
|
|
17779
19718
|
return () => {
|
|
17780
19719
|
if (scrollAnimationRef.current) {
|
|
17781
19720
|
cancelAnimationFrame(scrollAnimationRef.current);
|
|
17782
19721
|
}
|
|
17783
19722
|
};
|
|
17784
19723
|
}, []);
|
|
17785
|
-
const indicatorWithPosition = dropIndicator &&
|
|
19724
|
+
const indicatorWithPosition = dropIndicator && React198.isValidElement(dropIndicator) ? React198.cloneElement(dropIndicator, {
|
|
17786
19725
|
indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
|
|
17787
19726
|
}) : dropIndicator;
|
|
17788
19727
|
const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
|
|
17789
|
-
return /* @__PURE__ */
|
|
17790
|
-
|
|
19728
|
+
return /* @__PURE__ */ React198.createElement(
|
|
19729
|
+
Box36,
|
|
17791
19730
|
{
|
|
17792
19731
|
ref: containerRef,
|
|
17793
19732
|
style: {
|
|
@@ -17802,8 +19741,8 @@ var ExternalDropZone = ({
|
|
|
17802
19741
|
"data-placement-mode": isPlacementMode ? "true" : void 0
|
|
17803
19742
|
},
|
|
17804
19743
|
children,
|
|
17805
|
-
isPlacementMode && /* @__PURE__ */
|
|
17806
|
-
|
|
19744
|
+
isPlacementMode && /* @__PURE__ */ React198.createElement(
|
|
19745
|
+
Box36,
|
|
17807
19746
|
{
|
|
17808
19747
|
style: {
|
|
17809
19748
|
position: "absolute",
|
|
@@ -17822,20 +19761,20 @@ var ExternalDropZone = ({
|
|
|
17822
19761
|
onWheel: handleOverlayWheel
|
|
17823
19762
|
}
|
|
17824
19763
|
),
|
|
17825
|
-
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */
|
|
19764
|
+
shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React198.createElement(Box36, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
|
|
17826
19765
|
);
|
|
17827
19766
|
};
|
|
17828
19767
|
|
|
17829
19768
|
// src/mantine/IxoEditor.tsx
|
|
17830
|
-
import
|
|
19769
|
+
import React200 from "react";
|
|
17831
19770
|
import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
|
|
17832
19771
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
17833
19772
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
17834
19773
|
import { MantineProvider } from "@mantine/core";
|
|
17835
19774
|
|
|
17836
19775
|
// src/mantine/components/PanelContent.tsx
|
|
17837
|
-
import
|
|
17838
|
-
import { Box as
|
|
19776
|
+
import React199 from "react";
|
|
19777
|
+
import { Box as Box37 } from "@mantine/core";
|
|
17839
19778
|
var panelStyles = {
|
|
17840
19779
|
light: {
|
|
17841
19780
|
backgroundColor: "#ffffff",
|
|
@@ -17864,8 +19803,8 @@ function PanelContent({ theme }) {
|
|
|
17864
19803
|
const { activePanel, registeredPanels } = usePanelStore();
|
|
17865
19804
|
const isOpen = activePanel !== null;
|
|
17866
19805
|
const content = activePanel ? registeredPanels.get(activePanel) : null;
|
|
17867
|
-
return /* @__PURE__ */
|
|
17868
|
-
|
|
19806
|
+
return /* @__PURE__ */ React199.createElement(
|
|
19807
|
+
Box37,
|
|
17869
19808
|
{
|
|
17870
19809
|
pos: "sticky",
|
|
17871
19810
|
right: 0,
|
|
@@ -17905,7 +19844,7 @@ function IxoEditorContent({
|
|
|
17905
19844
|
}) {
|
|
17906
19845
|
const { activePanel } = usePanelStore();
|
|
17907
19846
|
const isPanelOpen = activePanel !== null;
|
|
17908
|
-
const editorContent = /* @__PURE__ */
|
|
19847
|
+
const editorContent = /* @__PURE__ */ React200.createElement(
|
|
17909
19848
|
BlockNoteView,
|
|
17910
19849
|
{
|
|
17911
19850
|
editor,
|
|
@@ -17920,7 +19859,7 @@ function IxoEditorContent({
|
|
|
17920
19859
|
onChange,
|
|
17921
19860
|
onSelectionChange
|
|
17922
19861
|
},
|
|
17923
|
-
config.slashMenu && /* @__PURE__ */
|
|
19862
|
+
config.slashMenu && /* @__PURE__ */ React200.createElement(
|
|
17924
19863
|
SuggestionMenuController,
|
|
17925
19864
|
{
|
|
17926
19865
|
triggerCharacter: "/",
|
|
@@ -17933,7 +19872,7 @@ function IxoEditorContent({
|
|
|
17933
19872
|
),
|
|
17934
19873
|
children
|
|
17935
19874
|
);
|
|
17936
|
-
return /* @__PURE__ */
|
|
19875
|
+
return /* @__PURE__ */ React200.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React200.createElement(
|
|
17937
19876
|
"div",
|
|
17938
19877
|
{
|
|
17939
19878
|
className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
|
|
@@ -17942,9 +19881,9 @@ function IxoEditorContent({
|
|
|
17942
19881
|
transition: "width 0.2s ease"
|
|
17943
19882
|
}
|
|
17944
19883
|
},
|
|
17945
|
-
selfNav && /* @__PURE__ */
|
|
17946
|
-
/* @__PURE__ */
|
|
17947
|
-
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */
|
|
19884
|
+
selfNav && /* @__PURE__ */ React200.createElement(PageHeader, { ...pageHeaderProps }),
|
|
19885
|
+
/* @__PURE__ */ React200.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
19886
|
+
(onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React200.createElement(
|
|
17948
19887
|
ExternalDropZone,
|
|
17949
19888
|
{
|
|
17950
19889
|
editor,
|
|
@@ -17957,7 +19896,7 @@ function IxoEditorContent({
|
|
|
17957
19896
|
},
|
|
17958
19897
|
editorContent
|
|
17959
19898
|
) : editorContent
|
|
17960
|
-
), isPanelVisible && /* @__PURE__ */
|
|
19899
|
+
), isPanelVisible && /* @__PURE__ */ React200.createElement(PanelContent, { theme: config.theme }));
|
|
17961
19900
|
}
|
|
17962
19901
|
function IxoEditor({
|
|
17963
19902
|
editor,
|
|
@@ -17977,6 +19916,7 @@ function IxoEditor({
|
|
|
17977
19916
|
visualizationRenderer,
|
|
17978
19917
|
getDynamicListData,
|
|
17979
19918
|
dynamicListPanelRenderer,
|
|
19919
|
+
domainCardRenderer,
|
|
17980
19920
|
onExternalDrop,
|
|
17981
19921
|
externalDropType,
|
|
17982
19922
|
dropIndicator,
|
|
@@ -17996,7 +19936,7 @@ function IxoEditor({
|
|
|
17996
19936
|
tableHandles: true
|
|
17997
19937
|
};
|
|
17998
19938
|
const isEditable = editable;
|
|
17999
|
-
const editorContent = /* @__PURE__ */
|
|
19939
|
+
const editorContent = /* @__PURE__ */ React200.createElement(
|
|
18000
19940
|
BlocknoteProvider,
|
|
18001
19941
|
{
|
|
18002
19942
|
editor,
|
|
@@ -18005,9 +19945,10 @@ function IxoEditor({
|
|
|
18005
19945
|
editable: isEditable,
|
|
18006
19946
|
visualizationRenderer,
|
|
18007
19947
|
getDynamicListData,
|
|
18008
|
-
dynamicListPanelRenderer
|
|
19948
|
+
dynamicListPanelRenderer,
|
|
19949
|
+
domainCardRenderer
|
|
18009
19950
|
},
|
|
18010
|
-
/* @__PURE__ */
|
|
19951
|
+
/* @__PURE__ */ React200.createElement(
|
|
18011
19952
|
IxoEditorContent,
|
|
18012
19953
|
{
|
|
18013
19954
|
isPanelVisible,
|
|
@@ -18031,15 +19972,15 @@ function IxoEditor({
|
|
|
18031
19972
|
)
|
|
18032
19973
|
);
|
|
18033
19974
|
if (mantineTheme) {
|
|
18034
|
-
return /* @__PURE__ */
|
|
19975
|
+
return /* @__PURE__ */ React200.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
|
|
18035
19976
|
}
|
|
18036
19977
|
return editorContent;
|
|
18037
19978
|
}
|
|
18038
19979
|
|
|
18039
19980
|
// src/mantine/components/EntitySigningSetup.tsx
|
|
18040
|
-
import
|
|
18041
|
-
import { Modal as Modal3, Stack as
|
|
18042
|
-
import { IconAlertCircle as
|
|
19981
|
+
import React201, { useState as useState71 } from "react";
|
|
19982
|
+
import { Modal as Modal3, Stack as Stack126, Text as Text100, TextInput as TextInput6, Button as Button37, Alert as Alert26, Group as Group63 } from "@mantine/core";
|
|
19983
|
+
import { IconAlertCircle as IconAlertCircle13, IconCheck as IconCheck7, IconKey as IconKey2 } from "@tabler/icons-react";
|
|
18043
19984
|
var EntitySigningSetup = ({
|
|
18044
19985
|
opened,
|
|
18045
19986
|
onClose,
|
|
@@ -18047,11 +19988,11 @@ var EntitySigningSetup = ({
|
|
|
18047
19988
|
entityName,
|
|
18048
19989
|
onSetup
|
|
18049
19990
|
}) => {
|
|
18050
|
-
const [pin, setPin] =
|
|
18051
|
-
const [confirmPin, setConfirmPin] =
|
|
18052
|
-
const [loading, setLoading] =
|
|
18053
|
-
const [error, setError] =
|
|
18054
|
-
const [success, setSuccess] =
|
|
19991
|
+
const [pin, setPin] = useState71("");
|
|
19992
|
+
const [confirmPin, setConfirmPin] = useState71("");
|
|
19993
|
+
const [loading, setLoading] = useState71(false);
|
|
19994
|
+
const [error, setError] = useState71(null);
|
|
19995
|
+
const [success, setSuccess] = useState71(false);
|
|
18055
19996
|
const handleSetup = async () => {
|
|
18056
19997
|
if (pin.length < 4) {
|
|
18057
19998
|
setError("PIN must be at least 4 characters");
|
|
@@ -18091,15 +20032,15 @@ var EntitySigningSetup = ({
|
|
|
18091
20032
|
setSuccess(false);
|
|
18092
20033
|
}
|
|
18093
20034
|
};
|
|
18094
|
-
return /* @__PURE__ */
|
|
20035
|
+
return /* @__PURE__ */ React201.createElement(
|
|
18095
20036
|
Modal3,
|
|
18096
20037
|
{
|
|
18097
20038
|
opened,
|
|
18098
20039
|
onClose: handleClose,
|
|
18099
|
-
title: /* @__PURE__ */
|
|
20040
|
+
title: /* @__PURE__ */ React201.createElement(Group63, { gap: "xs" }, /* @__PURE__ */ React201.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React201.createElement(Text100, { fw: 600 }, "Entity Signing Setup")),
|
|
18100
20041
|
size: "md"
|
|
18101
20042
|
},
|
|
18102
|
-
/* @__PURE__ */
|
|
20043
|
+
/* @__PURE__ */ React201.createElement(Stack126, { gap: "md" }, success ? /* @__PURE__ */ React201.createElement(Alert26, { color: "green", icon: /* @__PURE__ */ React201.createElement(IconCheck7, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React201.createElement(React201.Fragment, null, /* @__PURE__ */ React201.createElement(Text100, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React201.createElement(Text100, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React201.createElement(Alert26, { color: "blue", variant: "light" }, /* @__PURE__ */ React201.createElement(Text100, { size: "sm" }, "This is a ", /* @__PURE__ */ React201.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React201.createElement(Stack126, { gap: "xs" }, /* @__PURE__ */ React201.createElement(Text100, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React201.createElement(Text100, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React201.createElement(Text100, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React201.createElement(Text100, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React201.createElement(
|
|
18103
20044
|
TextInput6,
|
|
18104
20045
|
{
|
|
18105
20046
|
label: "Enter PIN to encrypt signing key",
|
|
@@ -18110,7 +20051,7 @@ var EntitySigningSetup = ({
|
|
|
18110
20051
|
onChange: (e) => setPin(e.currentTarget.value),
|
|
18111
20052
|
disabled: loading
|
|
18112
20053
|
}
|
|
18113
|
-
), /* @__PURE__ */
|
|
20054
|
+
), /* @__PURE__ */ React201.createElement(
|
|
18114
20055
|
TextInput6,
|
|
18115
20056
|
{
|
|
18116
20057
|
label: "Confirm PIN",
|
|
@@ -18120,12 +20061,12 @@ var EntitySigningSetup = ({
|
|
|
18120
20061
|
onChange: (e) => setConfirmPin(e.currentTarget.value),
|
|
18121
20062
|
disabled: loading
|
|
18122
20063
|
}
|
|
18123
|
-
), error && /* @__PURE__ */
|
|
18124
|
-
|
|
20064
|
+
), error && /* @__PURE__ */ React201.createElement(Alert26, { color: "red", icon: /* @__PURE__ */ React201.createElement(IconAlertCircle13, { size: 16 }) }, error), /* @__PURE__ */ React201.createElement(Group63, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React201.createElement(Button37, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React201.createElement(
|
|
20065
|
+
Button37,
|
|
18125
20066
|
{
|
|
18126
20067
|
onClick: handleSetup,
|
|
18127
20068
|
loading,
|
|
18128
|
-
leftSection: /* @__PURE__ */
|
|
20069
|
+
leftSection: /* @__PURE__ */ React201.createElement(IconKey2, { size: 16 })
|
|
18129
20070
|
},
|
|
18130
20071
|
"Setup Entity Signing"
|
|
18131
20072
|
))))
|
|
@@ -18133,9 +20074,9 @@ var EntitySigningSetup = ({
|
|
|
18133
20074
|
};
|
|
18134
20075
|
|
|
18135
20076
|
// src/mantine/components/FlowPermissionsPanel.tsx
|
|
18136
|
-
import
|
|
18137
|
-
import { Stack as
|
|
18138
|
-
import { IconPlus as IconPlus5, IconTrash as
|
|
20077
|
+
import React202, { useState as useState72, useEffect as useEffect56, useMemo as useMemo65 } from "react";
|
|
20078
|
+
import { Stack as Stack127, Text as Text101, Paper as Paper21, Group as Group64, Badge as Badge31, Button as Button38, ActionIcon as ActionIcon29, Loader as Loader26, Alert as Alert27, Divider as Divider12 } from "@mantine/core";
|
|
20079
|
+
import { IconPlus as IconPlus5, IconTrash as IconTrash7, IconShieldCheck as IconShieldCheck2, IconUser as IconUser4, IconRobot as IconRobot3, IconBuilding } from "@tabler/icons-react";
|
|
18139
20080
|
var FlowPermissionsPanel = ({
|
|
18140
20081
|
editor,
|
|
18141
20082
|
entityDid,
|
|
@@ -18144,11 +20085,11 @@ var FlowPermissionsPanel = ({
|
|
|
18144
20085
|
onRevokePermission,
|
|
18145
20086
|
getUserDisplayName
|
|
18146
20087
|
}) => {
|
|
18147
|
-
const [delegations, setDelegations] =
|
|
18148
|
-
const [loading, setLoading] =
|
|
18149
|
-
const [revoking, setRevoking] =
|
|
18150
|
-
const rootCapability =
|
|
18151
|
-
|
|
20088
|
+
const [delegations, setDelegations] = useState72([]);
|
|
20089
|
+
const [loading, setLoading] = useState72(true);
|
|
20090
|
+
const [revoking, setRevoking] = useState72(null);
|
|
20091
|
+
const rootCapability = useMemo65(() => editor.getRootCapability?.(), [editor]);
|
|
20092
|
+
useEffect56(() => {
|
|
18152
20093
|
const loadDelegations = async () => {
|
|
18153
20094
|
setLoading(true);
|
|
18154
20095
|
const allDelegations = editor.getAllDelegations?.() || [];
|
|
@@ -18187,11 +20128,11 @@ var FlowPermissionsPanel = ({
|
|
|
18187
20128
|
const getIcon2 = (type) => {
|
|
18188
20129
|
switch (type) {
|
|
18189
20130
|
case "oracle":
|
|
18190
|
-
return /* @__PURE__ */
|
|
20131
|
+
return /* @__PURE__ */ React202.createElement(IconRobot3, { size: 16 });
|
|
18191
20132
|
case "entity":
|
|
18192
|
-
return /* @__PURE__ */
|
|
20133
|
+
return /* @__PURE__ */ React202.createElement(IconBuilding, { size: 16 });
|
|
18193
20134
|
default:
|
|
18194
|
-
return /* @__PURE__ */
|
|
20135
|
+
return /* @__PURE__ */ React202.createElement(IconUser4, { size: 16 });
|
|
18195
20136
|
}
|
|
18196
20137
|
};
|
|
18197
20138
|
const formatCapabilities = (caps) => {
|
|
@@ -18210,8 +20151,8 @@ var FlowPermissionsPanel = ({
|
|
|
18210
20151
|
if (date < /* @__PURE__ */ new Date()) return "Expired";
|
|
18211
20152
|
return date.toLocaleDateString();
|
|
18212
20153
|
};
|
|
18213
|
-
return /* @__PURE__ */
|
|
18214
|
-
|
|
20154
|
+
return /* @__PURE__ */ React202.createElement(Stack127, { gap: "md" }, /* @__PURE__ */ React202.createElement(Stack127, { gap: "xs" }, /* @__PURE__ */ React202.createElement(Text101, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React202.createElement(Paper21, { p: "sm", withBorder: true }, /* @__PURE__ */ React202.createElement(Group64, { gap: "xs" }, /* @__PURE__ */ React202.createElement(IconShieldCheck2, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React202.createElement(Stack127, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React202.createElement(Text101, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React202.createElement(Text101, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React202.createElement(Badge31, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React202.createElement(Divider12, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React202.createElement(Group64, { justify: "center", py: "xl" }, /* @__PURE__ */ React202.createElement(Loader26, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React202.createElement(Alert27, { color: "gray", variant: "light" }, /* @__PURE__ */ React202.createElement(Text101, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React202.createElement(Stack127, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React202.createElement(Paper21, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React202.createElement(Group64, { justify: "space-between" }, /* @__PURE__ */ React202.createElement(Group64, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React202.createElement(Stack127, { gap: 2 }, /* @__PURE__ */ React202.createElement(Text101, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React202.createElement(Text101, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React202.createElement(Group64, { gap: "xs" }, /* @__PURE__ */ React202.createElement(Text101, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React202.createElement(Text101, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React202.createElement(Text101, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React202.createElement(
|
|
20155
|
+
ActionIcon29,
|
|
18215
20156
|
{
|
|
18216
20157
|
color: "red",
|
|
18217
20158
|
variant: "subtle",
|
|
@@ -18219,11 +20160,11 @@ var FlowPermissionsPanel = ({
|
|
|
18219
20160
|
loading: revoking === capability.id,
|
|
18220
20161
|
disabled: !!revoking
|
|
18221
20162
|
},
|
|
18222
|
-
/* @__PURE__ */
|
|
18223
|
-
))))), /* @__PURE__ */
|
|
18224
|
-
|
|
20163
|
+
/* @__PURE__ */ React202.createElement(IconTrash7, { size: 16 })
|
|
20164
|
+
))))), /* @__PURE__ */ React202.createElement(
|
|
20165
|
+
Button38,
|
|
18225
20166
|
{
|
|
18226
|
-
leftSection: /* @__PURE__ */
|
|
20167
|
+
leftSection: /* @__PURE__ */ React202.createElement(IconPlus5, { size: 16 }),
|
|
18227
20168
|
variant: "light",
|
|
18228
20169
|
onClick: onGrantPermission
|
|
18229
20170
|
},
|
|
@@ -18232,22 +20173,22 @@ var FlowPermissionsPanel = ({
|
|
|
18232
20173
|
};
|
|
18233
20174
|
|
|
18234
20175
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
18235
|
-
import
|
|
20176
|
+
import React203, { useState as useState73, useCallback as useCallback53 } from "react";
|
|
18236
20177
|
import {
|
|
18237
20178
|
Modal as Modal4,
|
|
18238
|
-
Stack as
|
|
18239
|
-
Text as
|
|
20179
|
+
Stack as Stack128,
|
|
20180
|
+
Text as Text102,
|
|
18240
20181
|
TextInput as TextInput7,
|
|
18241
|
-
Button as
|
|
18242
|
-
Group as
|
|
20182
|
+
Button as Button39,
|
|
20183
|
+
Group as Group65,
|
|
18243
20184
|
Radio as Radio6,
|
|
18244
20185
|
Checkbox as Checkbox12,
|
|
18245
|
-
Alert as
|
|
18246
|
-
Paper as
|
|
18247
|
-
Loader as
|
|
18248
|
-
Badge as
|
|
18249
|
-
ActionIcon as
|
|
18250
|
-
Divider as
|
|
20186
|
+
Alert as Alert28,
|
|
20187
|
+
Paper as Paper22,
|
|
20188
|
+
Loader as Loader27,
|
|
20189
|
+
Badge as Badge32,
|
|
20190
|
+
ActionIcon as ActionIcon30,
|
|
20191
|
+
Divider as Divider13,
|
|
18251
20192
|
NumberInput as NumberInput3
|
|
18252
20193
|
} from "@mantine/core";
|
|
18253
20194
|
import { IconSearch as IconSearch5, IconUser as IconUser5, IconRobot as IconRobot4, IconX as IconX8, IconShieldPlus as IconShieldPlus3 } from "@tabler/icons-react";
|
|
@@ -18264,21 +20205,21 @@ var GrantPermissionModal = ({
|
|
|
18264
20205
|
const singleBlockMode = !!targetBlockId || blocks.length === 1;
|
|
18265
20206
|
const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
|
|
18266
20207
|
const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
|
|
18267
|
-
const [recipientType, setRecipientType] =
|
|
18268
|
-
const [searchQuery, setSearchQuery] =
|
|
18269
|
-
const [searchResults, setSearchResults] =
|
|
18270
|
-
const [searching, setSearching] =
|
|
18271
|
-
const [selectedRecipient, setSelectedRecipient] =
|
|
18272
|
-
const [manualDid, setManualDid] =
|
|
18273
|
-
const [scopeType, setScopeType] =
|
|
18274
|
-
const [selectedBlocks, setSelectedBlocks] =
|
|
18275
|
-
const [expirationEnabled, setExpirationEnabled] =
|
|
18276
|
-
const [expirationDays, setExpirationDays] =
|
|
18277
|
-
const [canDelegate, setCanDelegate] =
|
|
18278
|
-
const [pin, setPin] =
|
|
18279
|
-
const [loading, setLoading] =
|
|
18280
|
-
const [error, setError] =
|
|
18281
|
-
const handleSearch =
|
|
20208
|
+
const [recipientType, setRecipientType] = useState73("user");
|
|
20209
|
+
const [searchQuery, setSearchQuery] = useState73("");
|
|
20210
|
+
const [searchResults, setSearchResults] = useState73([]);
|
|
20211
|
+
const [searching, setSearching] = useState73(false);
|
|
20212
|
+
const [selectedRecipient, setSelectedRecipient] = useState73(null);
|
|
20213
|
+
const [manualDid, setManualDid] = useState73("");
|
|
20214
|
+
const [scopeType, setScopeType] = useState73("full");
|
|
20215
|
+
const [selectedBlocks, setSelectedBlocks] = useState73([]);
|
|
20216
|
+
const [expirationEnabled, setExpirationEnabled] = useState73(false);
|
|
20217
|
+
const [expirationDays, setExpirationDays] = useState73(30);
|
|
20218
|
+
const [canDelegate, setCanDelegate] = useState73(false);
|
|
20219
|
+
const [pin, setPin] = useState73("");
|
|
20220
|
+
const [loading, setLoading] = useState73(false);
|
|
20221
|
+
const [error, setError] = useState73(null);
|
|
20222
|
+
const handleSearch = useCallback53(async () => {
|
|
18282
20223
|
if (searchQuery.length < 2) return;
|
|
18283
20224
|
setSearching(true);
|
|
18284
20225
|
try {
|
|
@@ -18365,30 +20306,30 @@ var GrantPermissionModal = ({
|
|
|
18365
20306
|
resetForm();
|
|
18366
20307
|
}
|
|
18367
20308
|
};
|
|
18368
|
-
return /* @__PURE__ */
|
|
20309
|
+
return /* @__PURE__ */ React203.createElement(
|
|
18369
20310
|
Modal4,
|
|
18370
20311
|
{
|
|
18371
20312
|
opened,
|
|
18372
20313
|
onClose: handleClose,
|
|
18373
|
-
title: /* @__PURE__ */
|
|
20314
|
+
title: /* @__PURE__ */ React203.createElement(Group65, { gap: "xs" }, /* @__PURE__ */ React203.createElement(IconShieldPlus3, { size: 20 }), /* @__PURE__ */ React203.createElement(Text102, { fw: 600 }, "Grant Permission")),
|
|
18374
20315
|
size: "lg"
|
|
18375
20316
|
},
|
|
18376
|
-
/* @__PURE__ */
|
|
20317
|
+
/* @__PURE__ */ React203.createElement(Stack128, { gap: "md" }, /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, /* @__PURE__ */ React203.createElement(Text102, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React203.createElement(Radio6.Group, { value: recipientType, onChange: (v) => {
|
|
18377
20318
|
setRecipientType(v);
|
|
18378
20319
|
setSelectedRecipient(null);
|
|
18379
20320
|
setSearchResults([]);
|
|
18380
|
-
} }, /* @__PURE__ */
|
|
20321
|
+
} }, /* @__PURE__ */ React203.createElement(Group65, null, /* @__PURE__ */ React203.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React203.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React203.createElement(Radio6, { value: "manual", label: "Enter DID" })))), recipientType !== "manual" ? /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, /* @__PURE__ */ React203.createElement(
|
|
18381
20322
|
TextInput7,
|
|
18382
20323
|
{
|
|
18383
20324
|
placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
|
|
18384
|
-
leftSection: /* @__PURE__ */
|
|
18385
|
-
rightSection: searching ? /* @__PURE__ */
|
|
20325
|
+
leftSection: /* @__PURE__ */ React203.createElement(IconSearch5, { size: 16 }),
|
|
20326
|
+
rightSection: searching ? /* @__PURE__ */ React203.createElement(Loader27, { size: 14 }) : null,
|
|
18386
20327
|
value: searchQuery,
|
|
18387
20328
|
onChange: (e) => setSearchQuery(e.currentTarget.value),
|
|
18388
20329
|
onKeyDown: (e) => e.key === "Enter" && handleSearch()
|
|
18389
20330
|
}
|
|
18390
|
-
), selectedRecipient ? /* @__PURE__ */
|
|
18391
|
-
|
|
20331
|
+
), selectedRecipient ? /* @__PURE__ */ React203.createElement(Paper22, { p: "sm", withBorder: true }, /* @__PURE__ */ React203.createElement(Group65, { justify: "space-between" }, /* @__PURE__ */ React203.createElement(Group65, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React203.createElement(IconRobot4, { size: 16 }) : /* @__PURE__ */ React203.createElement(IconUser5, { size: 16 }), /* @__PURE__ */ React203.createElement(Text102, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React203.createElement(Badge32, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React203.createElement(ActionIcon30, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React203.createElement(IconX8, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React203.createElement(Paper22, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React203.createElement(Stack128, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React203.createElement(
|
|
20332
|
+
Button39,
|
|
18392
20333
|
{
|
|
18393
20334
|
key: result.did,
|
|
18394
20335
|
variant: "subtle",
|
|
@@ -18397,7 +20338,7 @@ var GrantPermissionModal = ({
|
|
|
18397
20338
|
onClick: () => setSelectedRecipient(result)
|
|
18398
20339
|
},
|
|
18399
20340
|
result.displayName
|
|
18400
|
-
)))) : null) : /* @__PURE__ */
|
|
20341
|
+
)))) : null) : /* @__PURE__ */ React203.createElement(
|
|
18401
20342
|
TextInput7,
|
|
18402
20343
|
{
|
|
18403
20344
|
label: "Recipient DID",
|
|
@@ -18405,12 +20346,12 @@ var GrantPermissionModal = ({
|
|
|
18405
20346
|
value: manualDid,
|
|
18406
20347
|
onChange: (e) => setManualDid(e.currentTarget.value)
|
|
18407
20348
|
}
|
|
18408
|
-
), /* @__PURE__ */
|
|
20349
|
+
), /* @__PURE__ */ React203.createElement(Divider13, null), /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, /* @__PURE__ */ React203.createElement(Text102, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
|
|
18409
20350
|
// Single block mode: show fixed block info
|
|
18410
|
-
/* @__PURE__ */
|
|
20351
|
+
/* @__PURE__ */ React203.createElement(Paper22, { p: "sm", withBorder: true }, /* @__PURE__ */ React203.createElement(Group65, { gap: "xs" }, /* @__PURE__ */ React203.createElement(Badge32, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React203.createElement(Text102, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React203.createElement(Text102, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
|
|
18411
20352
|
) : (
|
|
18412
20353
|
// Multi-block mode: show scope selection
|
|
18413
|
-
/* @__PURE__ */
|
|
20354
|
+
/* @__PURE__ */ React203.createElement(React203.Fragment, null, /* @__PURE__ */ React203.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, /* @__PURE__ */ React203.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React203.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React203.createElement(Paper22, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React203.createElement(
|
|
18414
20355
|
Checkbox12,
|
|
18415
20356
|
{
|
|
18416
20357
|
key: block.id,
|
|
@@ -18425,14 +20366,14 @@ var GrantPermissionModal = ({
|
|
|
18425
20366
|
}
|
|
18426
20367
|
}
|
|
18427
20368
|
)))))
|
|
18428
|
-
)), /* @__PURE__ */
|
|
20369
|
+
)), /* @__PURE__ */ React203.createElement(Divider13, null), /* @__PURE__ */ React203.createElement(Stack128, { gap: "xs" }, /* @__PURE__ */ React203.createElement(
|
|
18429
20370
|
Checkbox12,
|
|
18430
20371
|
{
|
|
18431
20372
|
label: "Set expiration",
|
|
18432
20373
|
checked: expirationEnabled,
|
|
18433
20374
|
onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
|
|
18434
20375
|
}
|
|
18435
|
-
), expirationEnabled && /* @__PURE__ */
|
|
20376
|
+
), expirationEnabled && /* @__PURE__ */ React203.createElement(
|
|
18436
20377
|
NumberInput3,
|
|
18437
20378
|
{
|
|
18438
20379
|
label: "Expires in (days)",
|
|
@@ -18442,7 +20383,7 @@ var GrantPermissionModal = ({
|
|
|
18442
20383
|
min: 1,
|
|
18443
20384
|
max: 365
|
|
18444
20385
|
}
|
|
18445
|
-
)), /* @__PURE__ */
|
|
20386
|
+
)), /* @__PURE__ */ React203.createElement(
|
|
18446
20387
|
Checkbox12,
|
|
18447
20388
|
{
|
|
18448
20389
|
label: "Recipient can grant permissions to others",
|
|
@@ -18450,7 +20391,7 @@ var GrantPermissionModal = ({
|
|
|
18450
20391
|
checked: canDelegate,
|
|
18451
20392
|
onChange: (e) => setCanDelegate(e.currentTarget.checked)
|
|
18452
20393
|
}
|
|
18453
|
-
), /* @__PURE__ */
|
|
20394
|
+
), /* @__PURE__ */ React203.createElement(Divider13, null), /* @__PURE__ */ React203.createElement(
|
|
18454
20395
|
TextInput7,
|
|
18455
20396
|
{
|
|
18456
20397
|
label: "Enter your PIN to sign this delegation",
|
|
@@ -18459,7 +20400,7 @@ var GrantPermissionModal = ({
|
|
|
18459
20400
|
value: pin,
|
|
18460
20401
|
onChange: (e) => setPin(e.currentTarget.value)
|
|
18461
20402
|
}
|
|
18462
|
-
), error && /* @__PURE__ */
|
|
20403
|
+
), error && /* @__PURE__ */ React203.createElement(Alert28, { color: "red" }, error), /* @__PURE__ */ React203.createElement(Group65, { justify: "flex-end" }, /* @__PURE__ */ React203.createElement(Button39, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React203.createElement(Button39, { onClick: handleGrant, loading }, "Grant Permission")))
|
|
18463
20404
|
);
|
|
18464
20405
|
};
|
|
18465
20406
|
|
|
@@ -18565,4 +20506,4 @@ export {
|
|
|
18565
20506
|
ixoGraphQLClient,
|
|
18566
20507
|
getEntity
|
|
18567
20508
|
};
|
|
18568
|
-
//# sourceMappingURL=chunk-
|
|
20509
|
+
//# sourceMappingURL=chunk-AOSYWSEN.mjs.map
|