@learncard/learn-card-plugin 1.2.25 → 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
|
@@ -1848,6 +1848,8 @@ var ERROR_LABELS = {
|
|
|
1848
1848
|
unsupported_cnf_confirmation_type: { check: "Holder Key", message: "Unsupported type" },
|
|
1849
1849
|
internal_error: { check: "Verification", message: "Something went wrong" }
|
|
1850
1850
|
};
|
|
1851
|
+
var RESOLUTION_FAILURE_RE = /unable to resolve|error sending (?:an? )?(?:http )?request|failed to fetch|well-known\/did\.json|dereferenc|network ?error/i;
|
|
1852
|
+
var RAW_DIAGNOSTIC_RE = /wasm-function|\bat https?:\/\/|\.js:\d+|\bJsValue\(|\bTypeError\b/i;
|
|
1851
1853
|
var isAlreadyPrettified = /* @__PURE__ */ __name((check) => {
|
|
1852
1854
|
if (!check) return true;
|
|
1853
1855
|
return /^[A-Z]/.test(check) || /\s/.test(check);
|
|
@@ -1881,7 +1883,26 @@ var prettifyVerificationItem = /* @__PURE__ */ __name((item) => {
|
|
|
1881
1883
|
const isFailed = item.status === VerificationStatusEnum2.Failed;
|
|
1882
1884
|
if (isFailed) {
|
|
1883
1885
|
const code = resolveErrorCode(item);
|
|
1884
|
-
if (!code)
|
|
1886
|
+
if (!code) {
|
|
1887
|
+
const raw = [item.message, item.details, item.check].filter(Boolean).join(" ");
|
|
1888
|
+
if (RESOLUTION_FAILURE_RE.test(raw)) {
|
|
1889
|
+
return {
|
|
1890
|
+
...item,
|
|
1891
|
+
check: "Issuer",
|
|
1892
|
+
message: "Could not be reached",
|
|
1893
|
+
details: void 0
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
if (RAW_DIAGNOSTIC_RE.test(raw)) {
|
|
1897
|
+
return {
|
|
1898
|
+
...item,
|
|
1899
|
+
check: "Verification",
|
|
1900
|
+
message: "Could not be verified",
|
|
1901
|
+
details: void 0
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
return item;
|
|
1905
|
+
}
|
|
1885
1906
|
const label2 = ERROR_LABELS[code];
|
|
1886
1907
|
const detailsHumanized = Boolean(item.details) && !isMessageRaw(item.details, item.check);
|
|
1887
1908
|
const messageHumanized = Boolean(item.message) && !isMessageRaw(item.message, item.check);
|