@fileverse-dev/formulajs 4.4.11-mod-89-patch-1 → 4.4.11-mod-89-patch-3
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 +54 -37
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +36 -23
- package/lib/esm/crypto-constants.mjs +1 -23
- package/lib/esm/index.mjs +36 -23
- package/package.json +1 -1
- package/types/cjs/index.d.cts +4 -1
- package/types/esm/index.d.mts +4 -1
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-3 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -18275,82 +18275,99 @@ 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, result;
|
|
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
|
+
access = JSON.parse(GNOSIS_PAY_ACCESS);
|
|
18302
|
+
if (!(!(access !== null && access !== void 0 && access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt))) {
|
|
18303
|
+
_context31.next = 7;
|
|
18304
|
+
break;
|
|
18305
|
+
}
|
|
18306
|
+
throw new ValidationError("Expired or invalid access token");
|
|
18307
|
+
|
|
18308
|
+
case 7:
|
|
18297
18309
|
url = new URL("https://api.gnosispay.com/api/v1/transactions");
|
|
18298
|
-
_context31.next =
|
|
18310
|
+
_context31.next = 10;
|
|
18299
18311
|
return fetch(url.toString(), {
|
|
18300
18312
|
headers: {
|
|
18301
|
-
Authorization: "Bearer ".concat(
|
|
18313
|
+
Authorization: "Bearer ".concat(access.token),
|
|
18302
18314
|
"Content-Type": "application/json"
|
|
18303
18315
|
}
|
|
18304
18316
|
});
|
|
18305
18317
|
|
|
18306
|
-
case
|
|
18318
|
+
case 10:
|
|
18307
18319
|
res = _context31.sent;
|
|
18308
18320
|
if (res.ok) {
|
|
18309
|
-
_context31.next =
|
|
18321
|
+
_context31.next = 13;
|
|
18310
18322
|
break;
|
|
18311
18323
|
}
|
|
18312
|
-
throw new NetworkError(
|
|
18324
|
+
throw new NetworkError("GNOSIS_PAY", res.status);
|
|
18313
18325
|
|
|
18314
|
-
case
|
|
18315
|
-
_context31.next =
|
|
18326
|
+
case 13:
|
|
18327
|
+
_context31.next = 15;
|
|
18316
18328
|
return res.json();
|
|
18317
18329
|
|
|
18318
|
-
case
|
|
18330
|
+
case 15:
|
|
18319
18331
|
json = _context31.sent;
|
|
18320
18332
|
if (Array.isArray(json)) {
|
|
18321
|
-
_context31.next =
|
|
18333
|
+
_context31.next = 18;
|
|
18322
18334
|
break;
|
|
18323
18335
|
}
|
|
18324
|
-
return _context31.abrupt("return", [
|
|
18336
|
+
return _context31.abrupt("return", [ {
|
|
18337
|
+
message: "Unexpected response"
|
|
18338
|
+
} ]);
|
|
18325
18339
|
|
|
18326
|
-
case
|
|
18327
|
-
|
|
18340
|
+
case 18:
|
|
18341
|
+
result = json.map((function(transactions) {
|
|
18342
|
+
var _transactions$country, _transactions$merchan;
|
|
18328
18343
|
return {
|
|
18329
|
-
createdAt:
|
|
18330
|
-
clearedAt:
|
|
18331
|
-
country:
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18344
|
+
createdAt: transactions.createdAt,
|
|
18345
|
+
clearedAt: transactions.clearedAt,
|
|
18346
|
+
country: ((_transactions$country = transactions.country) === null || _transactions$country === void 0 ? void 0 : _transactions$country.name) || "",
|
|
18347
|
+
isPending: transactions.isPending,
|
|
18348
|
+
mcc: transactions.mcc,
|
|
18349
|
+
merchant: ((_transactions$merchan = transactions.merchant) === null || _transactions$merchan === void 0 ? void 0 : _transactions$merchan.name) || "",
|
|
18350
|
+
billingAmount: transactions.billingAmount,
|
|
18351
|
+
billingCurrency: transactions.billingCurrency,
|
|
18352
|
+
transactionAmount: transactions.transactionAmount,
|
|
18353
|
+
transactionCurrency: transactions.transactionCurrency,
|
|
18354
|
+
transactionType: transactions.transactionType,
|
|
18355
|
+
kind: transactions.kind,
|
|
18356
|
+
status: transactions.status
|
|
18341
18357
|
};
|
|
18342
|
-
}))
|
|
18358
|
+
}));
|
|
18359
|
+
return _context31.abrupt("return", result);
|
|
18343
18360
|
|
|
18344
|
-
case
|
|
18345
|
-
_context31.prev =
|
|
18361
|
+
case 22:
|
|
18362
|
+
_context31.prev = 22;
|
|
18346
18363
|
_context31.t0 = _context31["catch"](0);
|
|
18347
18364
|
return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
|
|
18348
18365
|
|
|
18349
|
-
case
|
|
18366
|
+
case 25:
|
|
18350
18367
|
case "end":
|
|
18351
18368
|
return _context31.stop();
|
|
18352
18369
|
}
|
|
18353
|
-
}), _callee28, null, [ [ 0,
|
|
18370
|
+
}), _callee28, null, [ [ 0, 22 ] ]);
|
|
18354
18371
|
})));
|
|
18355
18372
|
return _GNOSISPAY.apply(this, arguments);
|
|
18356
18373
|
}
|