@fileverse-dev/formulajs 4.4.11-mod-93 → 4.4.11-mod-89-tally-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.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-93 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-89-tally-2 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -18275,209 +18275,66 @@ function _typeof(o) {
18275
18275
  })));
18276
18276
  return _SMARTCONTRACT.apply(this, arguments);
18277
18277
  }
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);
18391
- }
18392
- function GNOSISPAY() {
18393
- return _GNOSISPAY.apply(this, arguments);
18278
+ var tallyParamsSchema = objectType({
18279
+ query: enumType([ "organisation" ]),
18280
+ slug: stringType()
18281
+ });
18282
+ function TALLY() {
18283
+ return _TALLY.apply(this, arguments);
18394
18284
  }
18395
- function _GNOSISPAY() {
18396
- _GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
18397
- var access, url, res, json, result;
18285
+ function _TALLY() {
18286
+ _TALLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
18287
+ var _argsToArray29, _argsToArray30, query, slug, baseUrl, url, res, _data5, _args31 = arguments;
18398
18288
  return _regeneratorRuntime().wrap((function _callee28$(_context31) {
18399
18289
  while (1) switch (_context31.prev = _context31.next) {
18400
18290
  case 0:
18401
18291
  _context31.prev = 0;
18402
- access = window.localStorage.getItem("GNOSIS_PAY_ACCESS");
18403
- if (access) {
18404
- _context31.next = 4;
18405
- break;
18406
- }
18407
- throw new ValidationError("Gnosispay access is required. Grant access to query your account");
18408
-
18409
- case 4:
18410
- if (!(!access || isExpired(access))) {
18411
- _context31.next = 6;
18412
- break;
18413
- }
18414
- throw new ValidationError("Expired or invalid access token");
18415
-
18416
- case 6:
18417
- url = new URL("https://api.gnosispay.com/api/v1/transactions");
18418
- _context31.next = 9;
18419
- return fetch(url.toString(), {
18420
- headers: {
18421
- Authorization: "Bearer ".concat(access.token),
18422
- "Content-Type": "application/json"
18423
- }
18292
+ _argsToArray29 = argsToArray(_args31), _argsToArray30 = _slicedToArray(_argsToArray29, 2),
18293
+ query = _argsToArray30[0], slug = _argsToArray30[1];
18294
+ validateParams(tallyParamsSchema, {
18295
+ query: query,
18296
+ slug: slug
18424
18297
  });
18298
+ baseUrl = "http://localhost:3008/third-party";
18299
+ url = "".concat(baseUrl) + "?service=tally" + "&input1=".concat(encodeURIComponent(query)) + "&input2=".concat(encodeURIComponent(slug));
18300
+ _context31.next = 7;
18301
+ return fetch(url);
18425
18302
 
18426
- case 9:
18303
+ case 7:
18427
18304
  res = _context31.sent;
18428
18305
  if (res.ok) {
18429
- _context31.next = 12;
18306
+ _context31.next = 10;
18430
18307
  break;
18431
18308
  }
18432
- throw new NetworkError("GNOSIS_PAY", res.status);
18309
+ throw new NetworkError("TALLY", res.status);
18433
18310
 
18434
- case 12:
18435
- _context31.next = 14;
18311
+ case 10:
18312
+ _context31.next = 12;
18436
18313
  return res.json();
18437
18314
 
18438
- case 14:
18439
- json = _context31.sent;
18440
- if (Array.isArray(json)) {
18441
- _context31.next = 17;
18315
+ case 12:
18316
+ _data5 = _context31.sent;
18317
+ if (!_data5.organisation) {
18318
+ _context31.next = 15;
18442
18319
  break;
18443
18320
  }
18444
- return _context31.abrupt("return", [ {
18445
- message: "Unexpected response"
18446
- } ]);
18321
+ return _context31.abrupt("return", [ _data5.organisation ]);
18447
18322
 
18448
- case 17:
18449
- result = json.map((function(transactions) {
18450
- var _transactions$country, _transactions$merchan;
18451
- return {
18452
- createdAt: transactions.createdAt,
18453
- clearedAt: transactions.clearedAt,
18454
- country: ((_transactions$country = transactions.country) === null || _transactions$country === void 0 ? void 0 : _transactions$country.name) || "",
18455
- isPending: transactions.isPending,
18456
- mcc: transactions.mcc,
18457
- merchant: ((_transactions$merchan = transactions.merchant) === null || _transactions$merchan === void 0 ? void 0 : _transactions$merchan.name) || "",
18458
- billingAmount: transactions.billingAmount,
18459
- billingCurrency: transactions.billingCurrency,
18460
- transactionAmount: transactions.transactionAmount,
18461
- transactionCurrency: transactions.transactionCurrency,
18462
- transactionType: transactions.transactionType,
18463
- kind: transactions.kind,
18464
- status: transactions.status
18465
- };
18466
- }));
18467
- return _context31.abrupt("return", result);
18323
+ case 15:
18324
+ return _context31.abrupt("return", _data5);
18468
18325
 
18469
- case 21:
18470
- _context31.prev = 21;
18326
+ case 18:
18327
+ _context31.prev = 18;
18471
18328
  _context31.t0 = _context31["catch"](0);
18472
- return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
18329
+ return _context31.abrupt("return", errorMessageHandler(_context31.t0, "TALLY"));
18473
18330
 
18474
- case 24:
18331
+ case 21:
18475
18332
  case "end":
18476
18333
  return _context31.stop();
18477
18334
  }
18478
- }), _callee28, null, [ [ 0, 21 ] ]);
18335
+ }), _callee28, null, [ [ 0, 18 ] ]);
18479
18336
  })));
18480
- return _GNOSISPAY.apply(this, arguments);
18337
+ return _TALLY.apply(this, arguments);
18481
18338
  }
18482
18339
  function FLVURL() {
18483
18340
  return _FLVURL.apply(this, arguments);
@@ -18518,9 +18375,6 @@ function _typeof(o) {
18518
18375
  function ARTEMIS() {
18519
18376
  return "Coming Soon";
18520
18377
  }
18521
- function TALLY() {
18522
- return "Coming Soon";
18523
- }
18524
18378
  function MYANIMELIST() {
18525
18379
  return "Coming Soon";
18526
18380
  }
@@ -18692,7 +18546,6 @@ function _typeof(o) {
18692
18546
  exports.GEOMEAN = GEOMEAN;
18693
18547
  exports.GESTEP = GESTEP;
18694
18548
  exports.GNOSIS = GNOSIS;
18695
- exports.GNOSISPAY = GNOSISPAY;
18696
18549
  exports.GROWTH = GROWTH;
18697
18550
  exports.HARMEAN = HARMEAN;
18698
18551
  exports.HEX2BIN = HEX2BIN;