@ixo/editor 5.36.0 → 5.37.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.
@@ -3852,6 +3852,11 @@ function getSelectedParentEntityDid(inputs) {
3852
3852
  if (inputs.skipped === true || inputs.parentSkipped === true) return "";
3853
3853
  return readDidInput(inputs.selectedEntityDid) || readDidInput(inputs.parentDid) || readDidInput(inputs.parentDID);
3854
3854
  }
3855
+ var MAX_PIN_ATTEMPTS = 3;
3856
+ function isInvalidPinError(err) {
3857
+ const msg = err instanceof Error ? err.message : String(err);
3858
+ return /invalid pin|could not decrypt mnemonic/i.test(msg);
3859
+ }
3855
3860
  function parseDuration(raw) {
3856
3861
  const seconds = parseInt(raw, 10) || 0;
3857
3862
  if (seconds % (7 * 86400) === 0) return { amount: seconds / (7 * 86400), unit: "weeks" };
@@ -4133,17 +4138,28 @@ registerAction({
4133
4138
  validFrom,
4134
4139
  validUntil
4135
4140
  });
4136
- const pin = await handlers.requestPin({
4137
- title: "Sign Domain Card",
4138
- description: "Enter your PIN to sign the Domain Card credential",
4139
- submitText: "Sign"
4140
- });
4141
- const { signedCredential } = await handlers.signCredential({
4142
- issuerDid,
4143
- issuerType: "user",
4144
- credential: unsignedCredential,
4145
- pin
4146
- });
4141
+ let signedCredential;
4142
+ for (let attempt = 1; attempt <= MAX_PIN_ATTEMPTS; attempt++) {
4143
+ const pin = await handlers.requestPin({
4144
+ title: "Sign Domain Card",
4145
+ description: attempt === 1 ? "Enter your PIN to sign the Domain Card credential" : "Incorrect PIN. Re-enter your PIN to sign the Domain Card credential.",
4146
+ submitText: "Sign"
4147
+ });
4148
+ if (!pin) throw new Error("PIN entry cancelled");
4149
+ try {
4150
+ ({ signedCredential } = await handlers.signCredential({
4151
+ issuerDid,
4152
+ issuerType: "user",
4153
+ credential: unsignedCredential,
4154
+ pin
4155
+ }));
4156
+ break;
4157
+ } catch (signError) {
4158
+ if (isInvalidPinError(signError) && attempt < MAX_PIN_ATTEMPTS) continue;
4159
+ throw signError;
4160
+ }
4161
+ }
4162
+ if (!signedCredential) throw new Error("Failed to sign credential");
4147
4163
  const credentialBlob = new Blob([JSON.stringify(signedCredential, null, 2)], {
4148
4164
  type: "application/json"
4149
4165
  });
@@ -10884,6 +10900,30 @@ function replaceBlockInFragment(fragment, block) {
10884
10900
  }
10885
10901
  return false;
10886
10902
  }
10903
+ function swapBlocksInFragment(fragment, idA, idB) {
10904
+ const blockGroup = getExistingBlockGroup(fragment);
10905
+ if (!blockGroup) return false;
10906
+ let ia = -1;
10907
+ let ib = -1;
10908
+ for (let i = 0; i < blockGroup.length; i++) {
10909
+ const container = blockGroup.get(i);
10910
+ if (container instanceof Y4.XmlElement) {
10911
+ const id = container.getAttribute("id");
10912
+ if (id === idA) ia = i;
10913
+ else if (id === idB) ib = i;
10914
+ }
10915
+ }
10916
+ if (ia < 0 || ib < 0 || ia === ib) return false;
10917
+ const lo = Math.min(ia, ib);
10918
+ const hi = Math.max(ia, ib);
10919
+ const loClone = blockGroup.get(lo).clone();
10920
+ const hiClone = blockGroup.get(hi).clone();
10921
+ blockGroup.delete(hi, 1);
10922
+ blockGroup.insert(hi, [loClone]);
10923
+ blockGroup.delete(lo, 1);
10924
+ blockGroup.insert(lo, [hiClone]);
10925
+ return true;
10926
+ }
10887
10927
  function applyMergeResultToFragment(fragment, mergeResult) {
10888
10928
  const documentBlockGroup = getOrCreateDocumentBlockGroup(fragment);
10889
10929
  const blockByNodeId = /* @__PURE__ */ new Map();
@@ -12851,13 +12891,17 @@ export {
12851
12891
  createInvocationStore,
12852
12892
  createMemoryInvocationStore,
12853
12893
  writeRunRecordAndReconcile,
12894
+ compileBlockProps,
12895
+ COMPILED_BLOCK_TYPE,
12854
12896
  toEvaluatorOperator,
12855
12897
  buildBlockConditionsProp,
12856
12898
  compileBaseUcanFlow,
12899
+ createYMapFromNode,
12857
12900
  writeCompiledBlocksToFragment,
12858
12901
  removeAllFlowBlocks,
12859
12902
  removeBlockFromFragment,
12860
12903
  replaceBlockInFragment,
12904
+ swapBlocksInFragment,
12861
12905
  readBlocksFromFragment,
12862
12906
  readCompiledFlowFromYDoc,
12863
12907
  mergeCompiledFlows,
@@ -12898,4 +12942,4 @@ export {
12898
12942
  executeQueuedFlowAgentCoreCommands,
12899
12943
  FlowAgentService
12900
12944
  };
12901
- //# sourceMappingURL=chunk-TK2RJ4KB.mjs.map
12945
+ //# sourceMappingURL=chunk-OOPKMGYW.mjs.map