@learncard/learn-card-plugin 1.2.26 → 1.2.27
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/learn-card-plugin.cjs.development.cjs +22 -1
- package/dist/learn-card-plugin.cjs.development.cjs.map +2 -2
- package/dist/learn-card-plugin.cjs.production.min.cjs +1 -1
- package/dist/learn-card-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/learn-card-plugin.esm.js +22 -1
- package/dist/learn-card-plugin.esm.js.map +2 -2
- package/dist/verificationPrettifier.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/test/verificationPrettifier.test.ts +76 -0
- package/src/verificationPrettifier.ts +38 -1
|
@@ -1872,6 +1872,8 @@ var ERROR_LABELS = {
|
|
|
1872
1872
|
unsupported_cnf_confirmation_type: { check: "Holder Key", message: "Unsupported type" },
|
|
1873
1873
|
internal_error: { check: "Verification", message: "Something went wrong" }
|
|
1874
1874
|
};
|
|
1875
|
+
var RESOLUTION_FAILURE_RE = /unable to resolve|error sending (?:an? )?(?:http )?request|failed to fetch|well-known\/did\.json|dereferenc|network ?error/i;
|
|
1876
|
+
var RAW_DIAGNOSTIC_RE = /wasm-function|\bat https?:\/\/|\.js:\d+|\bJsValue\(|\bTypeError\b/i;
|
|
1875
1877
|
var isAlreadyPrettified = /* @__PURE__ */ __name((check) => {
|
|
1876
1878
|
if (!check) return true;
|
|
1877
1879
|
return /^[A-Z]/.test(check) || /\s/.test(check);
|
|
@@ -1905,7 +1907,26 @@ var prettifyVerificationItem = /* @__PURE__ */ __name((item) => {
|
|
|
1905
1907
|
const isFailed = item.status === import_types2.VerificationStatusEnum.Failed;
|
|
1906
1908
|
if (isFailed) {
|
|
1907
1909
|
const code = resolveErrorCode(item);
|
|
1908
|
-
if (!code)
|
|
1910
|
+
if (!code) {
|
|
1911
|
+
const raw = [item.message, item.details, item.check].filter(Boolean).join(" ");
|
|
1912
|
+
if (RESOLUTION_FAILURE_RE.test(raw)) {
|
|
1913
|
+
return {
|
|
1914
|
+
...item,
|
|
1915
|
+
check: "Issuer",
|
|
1916
|
+
message: "Could not be reached",
|
|
1917
|
+
details: void 0
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
if (RAW_DIAGNOSTIC_RE.test(raw)) {
|
|
1921
|
+
return {
|
|
1922
|
+
...item,
|
|
1923
|
+
check: "Verification",
|
|
1924
|
+
message: "Could not be verified",
|
|
1925
|
+
details: void 0
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
return item;
|
|
1929
|
+
}
|
|
1909
1930
|
const label2 = ERROR_LABELS[code];
|
|
1910
1931
|
const detailsHumanized = Boolean(item.details) && !isMessageRaw(item.details, item.check);
|
|
1911
1932
|
const messageHumanized = Boolean(item.message) && !isMessageRaw(item.message, item.check);
|