@ixo/editor 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14438,9 +14438,12 @@ function deepEqual(a, b) {
14438
14438
  var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existingEntityDid, issuerDid: issuerDidOverride }) => {
14439
14439
  const { closePanel } = usePanelStore();
14440
14440
  const { handlers } = useBlocknoteContext();
14441
- const [flowStep, setFlowStep] = useState51("survey");
14441
+ const existingBlockEntityDid = block.props.entityDid;
14442
+ const existingBlockEntityType = block.props.entityType;
14443
+ const [flowStep, setFlowStep] = useState51(existingBlockEntityDid ? "success" : "survey");
14442
14444
  const [error, setError] = useState51(null);
14443
- const [createdEntityDid, setCreatedEntityDid] = useState51(null);
14445
+ const [createdEntityDid, setCreatedEntityDid] = useState51(existingBlockEntityDid || null);
14446
+ const [createdEntityType, setCreatedEntityType] = useState51(existingBlockEntityType || null);
14444
14447
  const isUpdatingFromProp = useRef7(false);
14445
14448
  const lastSyncedAnswers = useRef7("");
14446
14449
  const surveyModel = useMemo43(() => {
@@ -14583,14 +14586,16 @@ var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existing
14583
14586
  description: `Domain Card for ${data["schema:name"] || "Domain"}`
14584
14587
  });
14585
14588
  setFlowStep("creating");
14589
+ const entityType = data["type_2"] || data["daoType"] || "dao";
14586
14590
  const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
14587
- entityType: data["type_2"] || data["daoType"] || "dao",
14591
+ entityType,
14588
14592
  linkedResource: [domainCardLinkedResource],
14589
14593
  startDate: data["schema:validFrom"],
14590
14594
  endDate: data["schema:validUntil"]
14591
14595
  });
14592
14596
  return {
14593
14597
  entityDid: newEntityDid,
14598
+ entityType,
14594
14599
  transactionHash
14595
14600
  };
14596
14601
  },
@@ -14602,7 +14607,15 @@ var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existing
14602
14607
  try {
14603
14608
  const result = await processDomainCreation(data);
14604
14609
  setCreatedEntityDid(result.entityDid);
14610
+ setCreatedEntityType(result.entityType);
14605
14611
  setFlowStep("success");
14612
+ editor.updateBlock(block, {
14613
+ props: {
14614
+ ...block.props,
14615
+ entityDid: result.entityDid,
14616
+ entityType: result.entityType
14617
+ }
14618
+ });
14606
14619
  onComplete?.({
14607
14620
  surveyData: data,
14608
14621
  entityDid: result.entityDid,
@@ -14614,7 +14627,7 @@ var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existing
14614
14627
  setFlowStep("error");
14615
14628
  }
14616
14629
  },
14617
- [processDomainCreation, onComplete]
14630
+ [processDomainCreation, onComplete, editor, block]
14618
14631
  );
14619
14632
  useEffect39(() => {
14620
14633
  surveyModel.onComplete.add(handleSurveyComplete);
@@ -14630,6 +14643,11 @@ var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existing
14630
14643
  const handleClose = useCallback36(() => {
14631
14644
  closePanel();
14632
14645
  }, [closePanel]);
14646
+ const handleVisitEntity = useCallback36(() => {
14647
+ if (createdEntityDid && createdEntityType && handlers?.redirectToEntityOverview) {
14648
+ handlers.redirectToEntityOverview(createdEntityDid, createdEntityType);
14649
+ }
14650
+ }, [createdEntityDid, createdEntityType, handlers]);
14633
14651
  if (flowStep === "signing" || flowStep === "uploading" || flowStep === "creating") {
14634
14652
  const stepMessages = {
14635
14653
  signing: "Signing Domain Card credential...",
@@ -14639,7 +14657,7 @@ var DomainCreatorSurveyPanel = ({ editor, block, onComplete, entityDid: existing
14639
14657
  return /* @__PURE__ */ React156.createElement(Stack105, { gap: "md", p: "md", align: "center", justify: "center", style: { minHeight: 300 } }, /* @__PURE__ */ React156.createElement(Loader22, { size: "lg" }), /* @__PURE__ */ React156.createElement(Text79, { size: "sm", c: "dimmed" }, stepMessages[flowStep]));
14640
14658
  }
14641
14659
  if (flowStep === "success") {
14642
- return /* @__PURE__ */ React156.createElement(Stack105, { gap: "md", p: "md" }, /* @__PURE__ */ React156.createElement(Alert23, { icon: /* @__PURE__ */ React156.createElement(IconCheck3, { size: 16 }), title: "Domain Created Successfully", color: "green" }, /* @__PURE__ */ React156.createElement(Stack105, { gap: "xs" }, /* @__PURE__ */ React156.createElement(Text79, { size: "sm" }, "Your domain has been created and the Domain Card credential has been signed and stored."), createdEntityDid && /* @__PURE__ */ React156.createElement(Text79, { size: "xs", c: "dimmed" }, "Entity DID: ", createdEntityDid))), /* @__PURE__ */ React156.createElement(Button30, { onClick: handleClose }, "Close"));
14660
+ return /* @__PURE__ */ React156.createElement(Stack105, { gap: "md", p: "md" }, /* @__PURE__ */ React156.createElement(Alert23, { icon: /* @__PURE__ */ React156.createElement(IconCheck3, { size: 16 }), title: "Domain Created Successfully", color: "green" }, /* @__PURE__ */ React156.createElement(Stack105, { gap: "xs" }, /* @__PURE__ */ React156.createElement(Text79, { size: "sm" }, "Your domain has been created and the Domain Card credential has been signed and stored."), createdEntityDid && /* @__PURE__ */ React156.createElement(Text79, { size: "xs", c: "dimmed", style: { textTransform: "uppercase" } }, "Entity DID: ", createdEntityDid))), /* @__PURE__ */ React156.createElement(Button30, { onClick: handleVisitEntity }, "Visit Entity"));
14643
14661
  }
14644
14662
  if (flowStep === "error") {
14645
14663
  return /* @__PURE__ */ React156.createElement(Stack105, { gap: "md", p: "md" }, /* @__PURE__ */ React156.createElement(Alert23, { icon: /* @__PURE__ */ React156.createElement(IconAlertCircle9, { size: 16 }), title: "Domain Creation Failed", color: "red" }, /* @__PURE__ */ React156.createElement(Text79, { size: "sm" }, error || "An unexpected error occurred")), /* @__PURE__ */ React156.createElement(Group47, null, /* @__PURE__ */ React156.createElement(Button30, { variant: "outline", onClick: handleRetry }, "Try Again"), /* @__PURE__ */ React156.createElement(Button30, { variant: "subtle", onClick: handleClose }, "Close")));
@@ -14713,7 +14731,9 @@ var DomainCreatorBlockSpec = createReactBlockSpec11(
14713
14731
  icon: { default: "file-text" },
14714
14732
  surveySchema: { default: "" },
14715
14733
  answers: { default: "" },
14716
- lastSubmission: { default: "" }
14734
+ lastSubmission: { default: "" },
14735
+ entityDid: { default: "" },
14736
+ entityType: { default: "" }
14717
14737
  },
14718
14738
  content: "none"
14719
14739
  },
@@ -17246,4 +17266,4 @@ export {
17246
17266
  ixoGraphQLClient,
17247
17267
  getEntity
17248
17268
  };
17249
- //# sourceMappingURL=chunk-Z7FSLJDH.mjs.map
17269
+ //# sourceMappingURL=chunk-IHPJ6TAG.mjs.map