@mattrglobal/verifier-sdk-web 1.1.1-unstable.143 → 1.1.1-unstable.144

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.
@@ -1277,39 +1277,6 @@ const assertType = (validator, message) => data => {
1277
1277
  }
1278
1278
  };
1279
1279
 
1280
- var SafeFetchCommonRespondErrorType;
1281
-
1282
- (function(SafeFetchCommonRespondErrorType) {
1283
- SafeFetchCommonRespondErrorType["UnexpectedRespond"] = "UnexpectedRespond";
1284
- })(SafeFetchCommonRespondErrorType || (SafeFetchCommonRespondErrorType = {}));
1285
-
1286
- var SafeFetchErrorType;
1287
-
1288
- (function(SafeFetchErrorType) {
1289
- SafeFetchErrorType["HttpError"] = "HttpError";
1290
- SafeFetchErrorType["UnknownError"] = "UnknownError";
1291
- })(SafeFetchErrorType || (SafeFetchErrorType = {}));
1292
-
1293
- const safeFetch = async (input, init) => {
1294
- try {
1295
- const response = await fetch(input, init);
1296
- if (response.status > 299 || response.status < 200) {
1297
- return err({
1298
- type: SafeFetchErrorType.HttpError,
1299
- message: `HTTP error, status = ${response.status}`,
1300
- status: response.status
1301
- });
1302
- }
1303
- return ok(response);
1304
- } catch (error) {
1305
- return err({
1306
- type: SafeFetchErrorType.UnknownError,
1307
- message: "Unknown error",
1308
- cause: error
1309
- });
1310
- }
1311
- };
1312
-
1313
1280
  exports.MobileCredentialVerificationReasonType = void 0;
1314
1281
 
1315
1282
  (function(MobileCredentialVerificationReasonType) {
@@ -1422,6 +1389,10 @@ var LocalStorageKey;
1422
1389
  LocalStorageKey["sessionId"] = "mattr_sid";
1423
1390
  })(LocalStorageKey || (LocalStorageKey = {}));
1424
1391
 
1392
+ const MATTR_SDK_VERSION_HEADER = "x-mattr-sdk-version";
1393
+
1394
+ const MATTR_SDK_VERSION_VALUE = "2.0.0";
1395
+
1425
1396
  exports.Mode = void 0;
1426
1397
 
1427
1398
  (function(Mode) {
@@ -1497,6 +1468,44 @@ const InitialiseOptionsValidator = object({
1497
1468
  applicationId: pipe(string(), nonEmpty("Must not be empty"))
1498
1469
  });
1499
1470
 
1471
+ var SafeFetchCommonRespondErrorType;
1472
+
1473
+ (function(SafeFetchCommonRespondErrorType) {
1474
+ SafeFetchCommonRespondErrorType["UnexpectedRespond"] = "UnexpectedRespond";
1475
+ })(SafeFetchCommonRespondErrorType || (SafeFetchCommonRespondErrorType = {}));
1476
+
1477
+ var SafeFetchErrorType;
1478
+
1479
+ (function(SafeFetchErrorType) {
1480
+ SafeFetchErrorType["HttpError"] = "HttpError";
1481
+ SafeFetchErrorType["UnknownError"] = "UnknownError";
1482
+ })(SafeFetchErrorType || (SafeFetchErrorType = {}));
1483
+
1484
+ const safeFetch = async (input, init) => {
1485
+ try {
1486
+ const headers = Object.assign(Object.assign({}, init === null || init === void 0 ? void 0 : init.headers), {
1487
+ [MATTR_SDK_VERSION_HEADER]: `verifier-sdk-web/${MATTR_SDK_VERSION_VALUE}`
1488
+ });
1489
+ const response = await fetch(input, Object.assign(Object.assign({}, init), {
1490
+ headers: headers
1491
+ }));
1492
+ if (response.status > 299 || response.status < 200) {
1493
+ return err({
1494
+ type: SafeFetchErrorType.HttpError,
1495
+ message: `HTTP error, status = ${response.status}`,
1496
+ status: response.status
1497
+ });
1498
+ }
1499
+ return ok(response);
1500
+ } catch (error) {
1501
+ return err({
1502
+ type: SafeFetchErrorType.UnknownError,
1503
+ message: "Unknown error",
1504
+ cause: error
1505
+ });
1506
+ }
1507
+ };
1508
+
1500
1509
  let initialiseOptions = undefined;
1501
1510
 
1502
1511
  var InitialiseErrorMessage;
@@ -1728,6 +1737,8 @@ const isMobileDetect = userAgent => isMobile_2({
1728
1737
  tablet: false
1729
1738
  });
1730
1739
 
1740
+ const getVersion = () => MATTR_SDK_VERSION_VALUE;
1741
+
1731
1742
  var WindowEventListenerType;
1732
1743
 
1733
1744
  (function(WindowEventListenerType) {
@@ -2060,6 +2071,7 @@ const abortCredentialRequest = async () => {
2060
2071
 
2061
2072
  const utils = {
2062
2073
  generateChallenge: generateChallenge,
2074
+ getVersion: getVersion,
2063
2075
  unwrap: unwrap
2064
2076
  };
2065
2077