@ixo/editor 7.11.0 → 7.11.1

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.
@@ -20018,6 +20018,35 @@ function formatTimestamp2(iso) {
20018
20018
 
20019
20019
  // src/mantine/blocks/action/useExecuteActionBlock.ts
20020
20020
  import { useCallback as useCallback70, useMemo as useMemo87, useState as useState81 } from "react";
20021
+
20022
+ // src/core/lib/ucan/editorUcanService.ts
20023
+ function ensureUcanServiceAccessor(editor) {
20024
+ if (!editor.getUcanService) {
20025
+ editor.getUcanService = () => null;
20026
+ }
20027
+ }
20028
+ async function waitForUcanService(editor, { pollMs = 100, warnAfterMs = 5e3 } = {}) {
20029
+ const current = editor.getUcanService?.();
20030
+ if (current) return current;
20031
+ const startedAt = Date.now();
20032
+ let warned = false;
20033
+ return new Promise((resolve) => {
20034
+ const timer = setInterval(() => {
20035
+ const service = editor.getUcanService?.();
20036
+ if (service) {
20037
+ clearInterval(timer);
20038
+ resolve(service);
20039
+ return;
20040
+ }
20041
+ if (!warned && Date.now() - startedAt >= warnAfterMs) {
20042
+ warned = true;
20043
+ console.error("[ixo-editor] No UCAN service attached to the editor; waiting to run the step. Check that the host passes signing handlers.");
20044
+ }
20045
+ }, pollMs);
20046
+ });
20047
+ }
20048
+
20049
+ // src/mantine/blocks/action/useExecuteActionBlock.ts
20021
20050
  function executionNeedsPin(params) {
20022
20051
  return (params.policyRequiresPin || params.actionRequiresSignedInvocation) && !params.suppliedPin && !params.hasActiveSignerSession;
20023
20052
  }
@@ -20182,13 +20211,14 @@ function useExecuteActionBlock({ editor, block: block2 }) {
20182
20211
  flowManagerDid: actionHandlers?.getFlowManagerDid?.(),
20183
20212
  getPin: async () => effectivePin
20184
20213
  });
20214
+ const ucanService = await waitForUcanService(editor);
20185
20215
  const outcome = await executeActionBlock({
20186
20216
  editorOrYDoc: editor,
20187
20217
  block: block2,
20188
20218
  blockId: block2.id,
20189
20219
  actorDid: getActorDid(actionHandlers),
20190
20220
  actorType: "user",
20191
- ucanService: editor?.getUcanService?.() || void 0,
20221
+ ucanService,
20192
20222
  invocationStore: editor?._invocationStore,
20193
20223
  services: { ...actionServices, flowRuns },
20194
20224
  handlers: actionHandlers,
@@ -27809,9 +27839,7 @@ function useCreateCollaborativeIxoEditor(options) {
27809
27839
  ixoEditor._runEventLog = runEventLog;
27810
27840
  ixoEditor._yXeroWorkItems = xeroWorkItemsMap;
27811
27841
  ixoEditor._yXeroConnection = xeroConnectionMap;
27812
- ixoEditor.getUcanService = () => {
27813
- return null;
27814
- };
27842
+ ensureUcanServiceAccessor(ixoEditor);
27815
27843
  ixoEditor.getDelegation = (cid) => {
27816
27844
  return ucanDelegationStore.get(cid);
27817
27845
  };
@@ -30800,4 +30828,4 @@ export {
30800
30828
  ixoGraphQLClient,
30801
30829
  getEntity
30802
30830
  };
30803
- //# sourceMappingURL=chunk-Z2FOJ3BW.js.map
30831
+ //# sourceMappingURL=chunk-CNDHCKUS.js.map