@fileverse-dev/formulajs 4.4.11-mod-89-patch-1 → 4.4.11-mod-89-patch-2
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 +39 -43
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +24 -23
- package/lib/esm/crypto-constants.mjs +1 -23
- package/lib/esm/index.mjs +24 -23
- package/package.json +1 -1
- package/types/cjs/index.d.cts +1 -32
- package/types/esm/index.d.mts +1 -32
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-89-patch-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-89-patch-2 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -18275,82 +18275,78 @@ function _typeof(o) {
|
|
|
18275
18275
|
})));
|
|
18276
18276
|
return _SMARTCONTRACT.apply(this, arguments);
|
|
18277
18277
|
}
|
|
18278
|
+
function isExpired(createdAt) {
|
|
18279
|
+
if (!createdAt) return true;
|
|
18280
|
+
var expiryTs = createdAt + 60 * 60 * 1e3;
|
|
18281
|
+
return Date.now() > expiryTs;
|
|
18282
|
+
}
|
|
18278
18283
|
function GNOSISPAY() {
|
|
18279
18284
|
return _GNOSISPAY.apply(this, arguments);
|
|
18280
18285
|
}
|
|
18281
18286
|
function _GNOSISPAY() {
|
|
18282
18287
|
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
|
|
18283
|
-
var
|
|
18288
|
+
var GNOSIS_PAY_ACCESS, access, url, res, json;
|
|
18284
18289
|
return _regeneratorRuntime().wrap((function _callee28$(_context31) {
|
|
18285
18290
|
while (1) switch (_context31.prev = _context31.next) {
|
|
18286
18291
|
case 0:
|
|
18287
18292
|
_context31.prev = 0;
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
_context31.next = 5;
|
|
18293
|
+
GNOSIS_PAY_ACCESS = window.localStorage.getItem("GNOSIS_PAY_ACCESS");
|
|
18294
|
+
if (GNOSIS_PAY_ACCESS) {
|
|
18295
|
+
_context31.next = 4;
|
|
18292
18296
|
break;
|
|
18293
18297
|
}
|
|
18294
|
-
throw new MissingApiKeyError(
|
|
18298
|
+
throw new MissingApiKeyError("GNOSIS_PAY_ACCESS");
|
|
18295
18299
|
|
|
18296
|
-
case
|
|
18300
|
+
case 4:
|
|
18301
|
+
console.log({
|
|
18302
|
+
GNOSIS_PAY_ACCESS: GNOSIS_PAY_ACCESS
|
|
18303
|
+
});
|
|
18304
|
+
access = JSON.parse(GNOSIS_PAY_ACCESS);
|
|
18305
|
+
console.log({
|
|
18306
|
+
access: access
|
|
18307
|
+
});
|
|
18308
|
+
if (!(!(access !== null && access !== void 0 && access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt))) {
|
|
18309
|
+
_context31.next = 9;
|
|
18310
|
+
break;
|
|
18311
|
+
}
|
|
18312
|
+
throw new ValidationError("Expired or invalid access token");
|
|
18313
|
+
|
|
18314
|
+
case 9:
|
|
18297
18315
|
url = new URL("https://api.gnosispay.com/api/v1/transactions");
|
|
18298
|
-
_context31.next =
|
|
18316
|
+
_context31.next = 12;
|
|
18299
18317
|
return fetch(url.toString(), {
|
|
18300
18318
|
headers: {
|
|
18301
|
-
Authorization: "Bearer ".concat(
|
|
18319
|
+
Authorization: "Bearer ".concat(access.token),
|
|
18302
18320
|
"Content-Type": "application/json"
|
|
18303
18321
|
}
|
|
18304
18322
|
});
|
|
18305
18323
|
|
|
18306
|
-
case
|
|
18324
|
+
case 12:
|
|
18307
18325
|
res = _context31.sent;
|
|
18308
18326
|
if (res.ok) {
|
|
18309
|
-
_context31.next =
|
|
18327
|
+
_context31.next = 15;
|
|
18310
18328
|
break;
|
|
18311
18329
|
}
|
|
18312
|
-
throw new NetworkError(
|
|
18330
|
+
throw new NetworkError("GNOSIS_PAY_ACCESS", res.status);
|
|
18313
18331
|
|
|
18314
|
-
case
|
|
18315
|
-
_context31.next =
|
|
18332
|
+
case 15:
|
|
18333
|
+
_context31.next = 17;
|
|
18316
18334
|
return res.json();
|
|
18317
18335
|
|
|
18318
|
-
case
|
|
18336
|
+
case 17:
|
|
18319
18337
|
json = _context31.sent;
|
|
18320
|
-
|
|
18321
|
-
_context31.next = 16;
|
|
18322
|
-
break;
|
|
18323
|
-
}
|
|
18324
|
-
return _context31.abrupt("return", []);
|
|
18338
|
+
return _context31.abrupt("return", json);
|
|
18325
18339
|
|
|
18326
|
-
case
|
|
18327
|
-
|
|
18328
|
-
return {
|
|
18329
|
-
createdAt: tx.createdAt,
|
|
18330
|
-
clearedAt: tx.clearedAt,
|
|
18331
|
-
country: tx.country,
|
|
18332
|
-
merchant: tx.merchant,
|
|
18333
|
-
billingAmount: tx.billingAmount,
|
|
18334
|
-
billingCurrency: tx.billingCurrency,
|
|
18335
|
-
transactionAmount: tx.transactionAmount,
|
|
18336
|
-
transactionCurrency: tx.transactionCurrency,
|
|
18337
|
-
transactionType: tx.transactionType,
|
|
18338
|
-
kind: tx.kind,
|
|
18339
|
-
status: tx.status || null,
|
|
18340
|
-
mcc: tx.mcc
|
|
18341
|
-
};
|
|
18342
|
-
})));
|
|
18343
|
-
|
|
18344
|
-
case 19:
|
|
18345
|
-
_context31.prev = 19;
|
|
18340
|
+
case 21:
|
|
18341
|
+
_context31.prev = 21;
|
|
18346
18342
|
_context31.t0 = _context31["catch"](0);
|
|
18347
18343
|
return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
|
|
18348
18344
|
|
|
18349
|
-
case
|
|
18345
|
+
case 24:
|
|
18350
18346
|
case "end":
|
|
18351
18347
|
return _context31.stop();
|
|
18352
18348
|
}
|
|
18353
|
-
}), _callee28, null, [ [ 0,
|
|
18349
|
+
}), _callee28, null, [ [ 0, 21 ] ]);
|
|
18354
18350
|
})));
|
|
18355
18351
|
return _GNOSISPAY.apply(this, arguments);
|
|
18356
18352
|
}
|