@fileverse-dev/formulajs 4.4.11-mod-89-patch-3 → 4.4.11-mod-91
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/lib/browser/formula.js +133 -25
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +164 -9
- package/lib/esm/crypto-constants.mjs +143 -1
- package/lib/esm/index.mjs +164 -9
- package/package.json +2 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-91 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -18275,39 +18275,147 @@ function _typeof(o) {
|
|
|
18275
18275
|
})));
|
|
18276
18276
|
return _SMARTCONTRACT.apply(this, arguments);
|
|
18277
18277
|
}
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18278
|
+
var src = {};
|
|
18279
|
+
var lib = {
|
|
18280
|
+
exports: {}
|
|
18281
|
+
};
|
|
18282
|
+
var atob$1;
|
|
18283
|
+
var hasRequiredAtob;
|
|
18284
|
+
function requireAtob() {
|
|
18285
|
+
if (hasRequiredAtob) return atob$1;
|
|
18286
|
+
hasRequiredAtob = 1;
|
|
18287
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
18288
|
+
function InvalidCharacterError(message) {
|
|
18289
|
+
this.message = message;
|
|
18290
|
+
}
|
|
18291
|
+
InvalidCharacterError.prototype = new Error;
|
|
18292
|
+
InvalidCharacterError.prototype.name = "InvalidCharacterError";
|
|
18293
|
+
function polyfill(input) {
|
|
18294
|
+
var str = String(input).replace(/=+$/, "");
|
|
18295
|
+
if (str.length % 4 == 1) {
|
|
18296
|
+
throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
18297
|
+
}
|
|
18298
|
+
for (var bc = 0, bs, buffer, idx = 0, output = ""; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
|
|
18299
|
+
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
|
18300
|
+
buffer = chars.indexOf(buffer);
|
|
18301
|
+
}
|
|
18302
|
+
return output;
|
|
18303
|
+
}
|
|
18304
|
+
atob$1 = typeof window !== "undefined" && window.atob && window.atob.bind(window) || polyfill;
|
|
18305
|
+
return atob$1;
|
|
18306
|
+
}
|
|
18307
|
+
var base64_url_decode;
|
|
18308
|
+
var hasRequiredBase64_url_decode;
|
|
18309
|
+
function requireBase64_url_decode() {
|
|
18310
|
+
if (hasRequiredBase64_url_decode) return base64_url_decode;
|
|
18311
|
+
hasRequiredBase64_url_decode = 1;
|
|
18312
|
+
var atob = requireAtob();
|
|
18313
|
+
function b64DecodeUnicode(str) {
|
|
18314
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (function(m, p) {
|
|
18315
|
+
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
18316
|
+
if (code.length < 2) {
|
|
18317
|
+
code = "0" + code;
|
|
18318
|
+
}
|
|
18319
|
+
return "%" + code;
|
|
18320
|
+
})));
|
|
18321
|
+
}
|
|
18322
|
+
base64_url_decode = function base64_url_decode(str) {
|
|
18323
|
+
var output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
18324
|
+
switch (output.length % 4) {
|
|
18325
|
+
case 0:
|
|
18326
|
+
break;
|
|
18327
|
+
|
|
18328
|
+
case 2:
|
|
18329
|
+
output += "==";
|
|
18330
|
+
break;
|
|
18331
|
+
|
|
18332
|
+
case 3:
|
|
18333
|
+
output += "=";
|
|
18334
|
+
break;
|
|
18335
|
+
|
|
18336
|
+
default:
|
|
18337
|
+
throw "Illegal base64url string!";
|
|
18338
|
+
}
|
|
18339
|
+
try {
|
|
18340
|
+
return b64DecodeUnicode(output);
|
|
18341
|
+
} catch (err) {
|
|
18342
|
+
return atob(output);
|
|
18343
|
+
}
|
|
18344
|
+
};
|
|
18345
|
+
return base64_url_decode;
|
|
18346
|
+
}
|
|
18347
|
+
var hasRequiredLib;
|
|
18348
|
+
function requireLib() {
|
|
18349
|
+
if (hasRequiredLib) return lib.exports;
|
|
18350
|
+
hasRequiredLib = 1;
|
|
18351
|
+
var base64_url_decode = requireBase64_url_decode();
|
|
18352
|
+
function InvalidTokenError(message) {
|
|
18353
|
+
this.message = message;
|
|
18354
|
+
}
|
|
18355
|
+
InvalidTokenError.prototype = new Error;
|
|
18356
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
18357
|
+
lib.exports = function(token, options) {
|
|
18358
|
+
if (typeof token !== "string") {
|
|
18359
|
+
throw new InvalidTokenError("Invalid token specified");
|
|
18360
|
+
}
|
|
18361
|
+
options = options || {};
|
|
18362
|
+
var pos = options.header === true ? 0 : 1;
|
|
18363
|
+
try {
|
|
18364
|
+
return JSON.parse(base64_url_decode(token.split(".")[pos]));
|
|
18365
|
+
} catch (e) {
|
|
18366
|
+
throw new InvalidTokenError("Invalid token specified: " + e.message);
|
|
18367
|
+
}
|
|
18368
|
+
};
|
|
18369
|
+
lib.exports.InvalidTokenError = InvalidTokenError;
|
|
18370
|
+
return lib.exports;
|
|
18371
|
+
}
|
|
18372
|
+
var hasRequiredSrc;
|
|
18373
|
+
function requireSrc() {
|
|
18374
|
+
if (hasRequiredSrc) return src;
|
|
18375
|
+
hasRequiredSrc = 1;
|
|
18376
|
+
var jwtDecode = requireLib();
|
|
18377
|
+
var isJwtExpired = function isJwtExpired(token) {
|
|
18378
|
+
if (typeof token !== "string" || !token) throw new Error("Invalid token provided");
|
|
18379
|
+
var isJwtExpired = false;
|
|
18380
|
+
var _jwtDecode = jwtDecode(token), exp = _jwtDecode.exp;
|
|
18381
|
+
var currentTime = (new Date).getTime() / 1e3;
|
|
18382
|
+
if (currentTime > exp) isJwtExpired = true;
|
|
18383
|
+
return isJwtExpired;
|
|
18384
|
+
};
|
|
18385
|
+
src.isJwtExpired = isJwtExpired;
|
|
18386
|
+
return src;
|
|
18387
|
+
}
|
|
18388
|
+
var srcExports = requireSrc();
|
|
18389
|
+
function isExpired(access) {
|
|
18390
|
+
return srcExports.isJwtExpired(access);
|
|
18282
18391
|
}
|
|
18283
18392
|
function GNOSISPAY() {
|
|
18284
18393
|
return _GNOSISPAY.apply(this, arguments);
|
|
18285
18394
|
}
|
|
18286
18395
|
function _GNOSISPAY() {
|
|
18287
18396
|
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
|
|
18288
|
-
var
|
|
18397
|
+
var access, url, res, json, result;
|
|
18289
18398
|
return _regeneratorRuntime().wrap((function _callee28$(_context31) {
|
|
18290
18399
|
while (1) switch (_context31.prev = _context31.next) {
|
|
18291
18400
|
case 0:
|
|
18292
18401
|
_context31.prev = 0;
|
|
18293
|
-
|
|
18294
|
-
if (
|
|
18402
|
+
access = window.localStorage.getItem("GNOSIS_PAY_ACCESS");
|
|
18403
|
+
if (access) {
|
|
18295
18404
|
_context31.next = 4;
|
|
18296
18405
|
break;
|
|
18297
18406
|
}
|
|
18298
|
-
throw new
|
|
18407
|
+
throw new ValidationError("Gnosispay access is required. Grant access to query your account");
|
|
18299
18408
|
|
|
18300
18409
|
case 4:
|
|
18301
|
-
access
|
|
18302
|
-
|
|
18303
|
-
_context31.next = 7;
|
|
18410
|
+
if (!(!access || isExpired(access))) {
|
|
18411
|
+
_context31.next = 6;
|
|
18304
18412
|
break;
|
|
18305
18413
|
}
|
|
18306
18414
|
throw new ValidationError("Expired or invalid access token");
|
|
18307
18415
|
|
|
18308
|
-
case
|
|
18416
|
+
case 6:
|
|
18309
18417
|
url = new URL("https://api.gnosispay.com/api/v1/transactions");
|
|
18310
|
-
_context31.next =
|
|
18418
|
+
_context31.next = 9;
|
|
18311
18419
|
return fetch(url.toString(), {
|
|
18312
18420
|
headers: {
|
|
18313
18421
|
Authorization: "Bearer ".concat(access.token),
|
|
@@ -18315,29 +18423,29 @@ function _typeof(o) {
|
|
|
18315
18423
|
}
|
|
18316
18424
|
});
|
|
18317
18425
|
|
|
18318
|
-
case
|
|
18426
|
+
case 9:
|
|
18319
18427
|
res = _context31.sent;
|
|
18320
18428
|
if (res.ok) {
|
|
18321
|
-
_context31.next =
|
|
18429
|
+
_context31.next = 12;
|
|
18322
18430
|
break;
|
|
18323
18431
|
}
|
|
18324
18432
|
throw new NetworkError("GNOSIS_PAY", res.status);
|
|
18325
18433
|
|
|
18326
|
-
case
|
|
18327
|
-
_context31.next =
|
|
18434
|
+
case 12:
|
|
18435
|
+
_context31.next = 14;
|
|
18328
18436
|
return res.json();
|
|
18329
18437
|
|
|
18330
|
-
case
|
|
18438
|
+
case 14:
|
|
18331
18439
|
json = _context31.sent;
|
|
18332
18440
|
if (Array.isArray(json)) {
|
|
18333
|
-
_context31.next =
|
|
18441
|
+
_context31.next = 17;
|
|
18334
18442
|
break;
|
|
18335
18443
|
}
|
|
18336
18444
|
return _context31.abrupt("return", [ {
|
|
18337
18445
|
message: "Unexpected response"
|
|
18338
18446
|
} ]);
|
|
18339
18447
|
|
|
18340
|
-
case
|
|
18448
|
+
case 17:
|
|
18341
18449
|
result = json.map((function(transactions) {
|
|
18342
18450
|
var _transactions$country, _transactions$merchan;
|
|
18343
18451
|
return {
|
|
@@ -18358,16 +18466,16 @@ function _typeof(o) {
|
|
|
18358
18466
|
}));
|
|
18359
18467
|
return _context31.abrupt("return", result);
|
|
18360
18468
|
|
|
18361
|
-
case
|
|
18362
|
-
_context31.prev =
|
|
18469
|
+
case 21:
|
|
18470
|
+
_context31.prev = 21;
|
|
18363
18471
|
_context31.t0 = _context31["catch"](0);
|
|
18364
18472
|
return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
|
|
18365
18473
|
|
|
18366
|
-
case
|
|
18474
|
+
case 24:
|
|
18367
18475
|
case "end":
|
|
18368
18476
|
return _context31.stop();
|
|
18369
18477
|
}
|
|
18370
|
-
}), _callee28, null, [ [ 0,
|
|
18478
|
+
}), _callee28, null, [ [ 0, 21 ] ]);
|
|
18371
18479
|
})));
|
|
18372
18480
|
return _GNOSISPAY.apply(this, arguments);
|
|
18373
18481
|
}
|