@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/cjs/index.cjs CHANGED
@@ -18475,44 +18475,57 @@ async function SMARTCONTRACT() {
18475
18475
  }
18476
18476
  }
18477
18477
 
18478
+ function isExpired(createdAt) {
18479
+ if(!createdAt)return true
18480
+ const expiryTs = createdAt + 60 * 60 * 1000;
18481
+ return Date.now() > expiryTs;
18482
+ }
18483
+
18478
18484
  async function GNOSISPAY() {
18479
18485
 
18480
18486
  try {
18481
- const apiKeyKey = SERVICES_API_KEY.GnosisPay;
18482
- const API_KEY = window.localStorage.getItem(apiKeyKey);
18487
+ const GNOSIS_PAY_ACCESS = window.localStorage.getItem('GNOSIS_PAY_ACCESS');
18483
18488
 
18484
- if(!API_KEY){
18485
- throw new MissingApiKeyError(apiKeyKey)
18489
+ if(!GNOSIS_PAY_ACCESS){
18490
+ throw new MissingApiKeyError('GNOSIS_PAY_ACCESS')
18491
+ }
18492
+ const access = JSON.parse(GNOSIS_PAY_ACCESS);
18493
+ if(!access?.token || isExpired(access?.createdAt)){
18494
+ throw new ValidationError('Expired or invalid access token')
18486
18495
  }
18487
18496
 
18488
18497
  const url = new URL(`https://api.gnosispay.com/api/v1/transactions`);
18489
18498
  const res = await fetch(url.toString(), {
18490
18499
  headers: {
18491
- Authorization: `Bearer ${API_KEY}`,
18500
+ Authorization: `Bearer ${access.token}`,
18492
18501
  'Content-Type': 'application/json',
18493
18502
  },
18494
18503
  });
18495
18504
 
18496
- if (!res.ok) throw new NetworkError(apiKeyKey, res.status);
18505
+ if (!res.ok) throw new NetworkError('GNOSIS_PAY', res.status);
18497
18506
 
18498
18507
  const json = await res.json();
18499
-
18500
- if (!Array.isArray(json)) return [];
18501
-
18502
- return json.map(tx => ({
18503
- createdAt: tx.createdAt,
18504
- clearedAt: tx.clearedAt,
18505
- country: tx.country,
18506
- merchant: tx.merchant,
18507
- billingAmount: tx.billingAmount,
18508
- billingCurrency: tx.billingCurrency,
18509
- transactionAmount: tx.transactionAmount,
18510
- transactionCurrency: tx.transactionCurrency,
18511
- transactionType: tx.transactionType,
18512
- kind: tx.kind,
18513
- status: tx.status || null,
18514
- mcc: tx.mcc,
18515
- }));
18508
+ if(!Array.isArray(json)){
18509
+ return [{message: 'Unexpected response'}]
18510
+ }
18511
+ const result = json.map((transactions) => {
18512
+ return {
18513
+ createdAt: transactions.createdAt,
18514
+ clearedAt: transactions.clearedAt,
18515
+ country: transactions.country?.name || '',
18516
+ isPending: transactions.isPending,
18517
+ mcc: transactions.mcc,
18518
+ merchant: transactions.merchant?.name || '',
18519
+ billingAmount: transactions.billingAmount,
18520
+ billingCurrency: transactions.billingCurrency,
18521
+ transactionAmount: transactions.transactionAmount,
18522
+ transactionCurrency: transactions.transactionCurrency,
18523
+ transactionType: transactions.transactionType,
18524
+ kind: transactions.kind,
18525
+ status: transactions.status
18526
+ }
18527
+ });
18528
+ return result
18516
18529
  } catch (err) {
18517
18530
  return errorMessageHandler(err, 'GNOSISPAY')
18518
18531
  }
@@ -717,33 +717,11 @@ var GNOSISPAY_metadata = {
717
717
  LOGO: "https://gnosisscan.io/assets/generic/html/favicon-light.ico",
718
718
  BRAND_COLOR: "#F6F7F6",
719
719
  BRAND_SECONDARY_COLOR: "#84968f",
720
- ACTION: [
721
- {
722
- name: "Access required",
723
- message: "To access your Gnosis Pay account, please grant permission. Your dSheet account should be created via the same wallet ss your Gnosis Pay.",
724
- buttonText: "Grand access"
725
- }
726
- ],
727
720
  n: "GNOSISPAY",
728
721
  t: 20,
729
722
  d: "Get any data from your Gnosis Pay account.",
730
723
  a: "Get any data from your Gnosis Pay account",
731
- p: [
732
- {
733
- name: "address",
734
- detail: "Wallet address for which you want grab information e.g. [Traffic],[Volume]",
735
- example: `"0x1D1479C185d32EB90533a08b36B3CFa5F84A0E6B"`,
736
- require: "m",
737
- type: "string"
738
- },
739
- {
740
- name: "txns",
741
- detail: "Additional numbers or ranges to add to \u201Cvalue1\u201D",
742
- example: `"posts"`,
743
- require: "m",
744
- type: "string"
745
- }
746
- ]
724
+ p: []
747
725
  };
748
726
 
749
727
  // src/crypto/crypto-metadata.js
package/lib/esm/index.mjs CHANGED
@@ -18473,44 +18473,57 @@ async function SMARTCONTRACT() {
18473
18473
  }
18474
18474
  }
18475
18475
 
18476
+ function isExpired(createdAt) {
18477
+ if(!createdAt)return true
18478
+ const expiryTs = createdAt + 60 * 60 * 1000;
18479
+ return Date.now() > expiryTs;
18480
+ }
18481
+
18476
18482
  async function GNOSISPAY() {
18477
18483
 
18478
18484
  try {
18479
- const apiKeyKey = SERVICES_API_KEY.GnosisPay;
18480
- const API_KEY = window.localStorage.getItem(apiKeyKey);
18485
+ const GNOSIS_PAY_ACCESS = window.localStorage.getItem('GNOSIS_PAY_ACCESS');
18481
18486
 
18482
- if(!API_KEY){
18483
- throw new MissingApiKeyError(apiKeyKey)
18487
+ if(!GNOSIS_PAY_ACCESS){
18488
+ throw new MissingApiKeyError('GNOSIS_PAY_ACCESS')
18489
+ }
18490
+ const access = JSON.parse(GNOSIS_PAY_ACCESS);
18491
+ if(!access?.token || isExpired(access?.createdAt)){
18492
+ throw new ValidationError('Expired or invalid access token')
18484
18493
  }
18485
18494
 
18486
18495
  const url = new URL(`https://api.gnosispay.com/api/v1/transactions`);
18487
18496
  const res = await fetch(url.toString(), {
18488
18497
  headers: {
18489
- Authorization: `Bearer ${API_KEY}`,
18498
+ Authorization: `Bearer ${access.token}`,
18490
18499
  'Content-Type': 'application/json',
18491
18500
  },
18492
18501
  });
18493
18502
 
18494
- if (!res.ok) throw new NetworkError(apiKeyKey, res.status);
18503
+ if (!res.ok) throw new NetworkError('GNOSIS_PAY', res.status);
18495
18504
 
18496
18505
  const json = await res.json();
18497
-
18498
- if (!Array.isArray(json)) return [];
18499
-
18500
- return json.map(tx => ({
18501
- createdAt: tx.createdAt,
18502
- clearedAt: tx.clearedAt,
18503
- country: tx.country,
18504
- merchant: tx.merchant,
18505
- billingAmount: tx.billingAmount,
18506
- billingCurrency: tx.billingCurrency,
18507
- transactionAmount: tx.transactionAmount,
18508
- transactionCurrency: tx.transactionCurrency,
18509
- transactionType: tx.transactionType,
18510
- kind: tx.kind,
18511
- status: tx.status || null,
18512
- mcc: tx.mcc,
18513
- }));
18506
+ if(!Array.isArray(json)){
18507
+ return [{message: 'Unexpected response'}]
18508
+ }
18509
+ const result = json.map((transactions) => {
18510
+ return {
18511
+ createdAt: transactions.createdAt,
18512
+ clearedAt: transactions.clearedAt,
18513
+ country: transactions.country?.name || '',
18514
+ isPending: transactions.isPending,
18515
+ mcc: transactions.mcc,
18516
+ merchant: transactions.merchant?.name || '',
18517
+ billingAmount: transactions.billingAmount,
18518
+ billingCurrency: transactions.billingCurrency,
18519
+ transactionAmount: transactions.transactionAmount,
18520
+ transactionCurrency: transactions.transactionCurrency,
18521
+ transactionType: transactions.transactionType,
18522
+ kind: transactions.kind,
18523
+ status: transactions.status
18524
+ }
18525
+ });
18526
+ return result
18514
18527
  } catch (err) {
18515
18528
  return errorMessageHandler(err, 'GNOSISPAY')
18516
18529
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/formulajs",
3
- "version": "4.4.11-mod-89-patch-1",
3
+ "version": "4.4.11-mod-89-patch-3",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {
@@ -1893,6 +1893,8 @@ export function GNOSISPAY(): Promise<{
1893
1893
  createdAt: any;
1894
1894
  clearedAt: any;
1895
1895
  country: any;
1896
+ isPending: any;
1897
+ mcc: any;
1896
1898
  merchant: any;
1897
1899
  billingAmount: any;
1898
1900
  billingCurrency: any;
@@ -1901,7 +1903,8 @@ export function GNOSISPAY(): Promise<{
1901
1903
  transactionType: any;
1902
1904
  kind: any;
1903
1905
  status: any;
1904
- mcc: any;
1906
+ }[] | {
1907
+ message: string;
1905
1908
  }[]>;
1906
1909
  /**
1907
1910
  * Returns values along an exponential trend.
@@ -1893,6 +1893,8 @@ export function GNOSISPAY(): Promise<{
1893
1893
  createdAt: any;
1894
1894
  clearedAt: any;
1895
1895
  country: any;
1896
+ isPending: any;
1897
+ mcc: any;
1896
1898
  merchant: any;
1897
1899
  billingAmount: any;
1898
1900
  billingCurrency: any;
@@ -1901,7 +1903,8 @@ export function GNOSISPAY(): Promise<{
1901
1903
  transactionType: any;
1902
1904
  kind: any;
1903
1905
  status: any;
1904
- mcc: any;
1906
+ }[] | {
1907
+ message: string;
1905
1908
  }[]>;
1906
1909
  /**
1907
1910
  * Returns values along an exponential trend.