@ixo/editor 5.36.0 → 5.36.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.
@@ -65,7 +65,7 @@ import {
65
65
  transformSurveyToCredentialSubject,
66
66
  updateXeroWorkReviewPayloadForEditor,
67
67
  upsertXeroWorkItemForEditor
68
- } from "./chunk-TK2RJ4KB.mjs";
68
+ } from "./chunk-MCFRBVCB.mjs";
69
69
 
70
70
  // src/mantine/hooks/usePanel.ts
71
71
  import { useCallback, useMemo, useEffect, useRef } from "react";
@@ -47560,4 +47560,4 @@ export {
47560
47560
  ixoGraphQLClient,
47561
47561
  getEntity
47562
47562
  };
47563
- //# sourceMappingURL=chunk-C6KKRQW6.mjs.map
47563
+ //# sourceMappingURL=chunk-CDBCSQQA.mjs.map
@@ -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
  });
@@ -12898,4 +12914,4 @@ export {
12898
12914
  executeQueuedFlowAgentCoreCommands,
12899
12915
  FlowAgentService
12900
12916
  };
12901
- //# sourceMappingURL=chunk-TK2RJ4KB.mjs.map
12917
+ //# sourceMappingURL=chunk-MCFRBVCB.mjs.map