@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/cjs/index.cjs CHANGED
@@ -18475,44 +18475,45 @@ 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
+
18493
+
18494
+
18495
+ console.log({GNOSIS_PAY_ACCESS});
18496
+
18497
+ const access = JSON.parse(GNOSIS_PAY_ACCESS);
18498
+
18499
+ console.log({access});
18500
+
18501
+ if(!access?.token || isExpired(access?.createdAt)){
18502
+ throw new ValidationError('Expired or invalid access token')
18486
18503
  }
18487
18504
 
18488
18505
  const url = new URL(`https://api.gnosispay.com/api/v1/transactions`);
18489
18506
  const res = await fetch(url.toString(), {
18490
18507
  headers: {
18491
- Authorization: `Bearer ${API_KEY}`,
18508
+ Authorization: `Bearer ${access.token}`,
18492
18509
  'Content-Type': 'application/json',
18493
18510
  },
18494
18511
  });
18495
18512
 
18496
- if (!res.ok) throw new NetworkError(apiKeyKey, res.status);
18513
+ if (!res.ok) throw new NetworkError('GNOSIS_PAY_ACCESS', res.status);
18497
18514
 
18498
18515
  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
- }));
18516
+ return json
18516
18517
  } catch (err) {
18517
18518
  return errorMessageHandler(err, 'GNOSISPAY')
18518
18519
  }
@@ -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,45 @@ 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
+
18491
+
18492
+
18493
+ console.log({GNOSIS_PAY_ACCESS});
18494
+
18495
+ const access = JSON.parse(GNOSIS_PAY_ACCESS);
18496
+
18497
+ console.log({access});
18498
+
18499
+ if(!access?.token || isExpired(access?.createdAt)){
18500
+ throw new ValidationError('Expired or invalid access token')
18484
18501
  }
18485
18502
 
18486
18503
  const url = new URL(`https://api.gnosispay.com/api/v1/transactions`);
18487
18504
  const res = await fetch(url.toString(), {
18488
18505
  headers: {
18489
- Authorization: `Bearer ${API_KEY}`,
18506
+ Authorization: `Bearer ${access.token}`,
18490
18507
  'Content-Type': 'application/json',
18491
18508
  },
18492
18509
  });
18493
18510
 
18494
- if (!res.ok) throw new NetworkError(apiKeyKey, res.status);
18511
+ if (!res.ok) throw new NetworkError('GNOSIS_PAY_ACCESS', res.status);
18495
18512
 
18496
18513
  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
- }));
18514
+ return json
18514
18515
  } catch (err) {
18515
18516
  return errorMessageHandler(err, 'GNOSISPAY')
18516
18517
  }
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-2",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {
@@ -1871,38 +1871,7 @@ export function GEOMEAN(...args: any[]): any;
1871
1871
  */
1872
1872
  export function GESTEP(number: any, step: any): any;
1873
1873
  export function GNOSIS(...args: any[]): Promise<any>;
1874
- export function GNOSISPAY(): Promise<{
1875
- message: string;
1876
- functionName: any;
1877
- type: string;
1878
- apiKeyName?: undefined;
1879
- reason?: undefined;
1880
- } | {
1881
- message: string;
1882
- functionName: any;
1883
- type: string;
1884
- apiKeyName: any;
1885
- reason?: undefined;
1886
- } | {
1887
- message: string;
1888
- functionName: any;
1889
- type: string;
1890
- reason: any;
1891
- apiKeyName?: undefined;
1892
- } | {
1893
- createdAt: any;
1894
- clearedAt: any;
1895
- country: any;
1896
- merchant: any;
1897
- billingAmount: any;
1898
- billingCurrency: any;
1899
- transactionAmount: any;
1900
- transactionCurrency: any;
1901
- transactionType: any;
1902
- kind: any;
1903
- status: any;
1904
- mcc: any;
1905
- }[]>;
1874
+ export function GNOSISPAY(): Promise<any>;
1906
1875
  /**
1907
1876
  * Returns values along an exponential trend.
1908
1877
  *
@@ -1871,38 +1871,7 @@ export function GEOMEAN(...args: any[]): any;
1871
1871
  */
1872
1872
  export function GESTEP(number: any, step: any): any;
1873
1873
  export function GNOSIS(...args: any[]): Promise<any>;
1874
- export function GNOSISPAY(): Promise<{
1875
- message: string;
1876
- functionName: any;
1877
- type: string;
1878
- apiKeyName?: undefined;
1879
- reason?: undefined;
1880
- } | {
1881
- message: string;
1882
- functionName: any;
1883
- type: string;
1884
- apiKeyName: any;
1885
- reason?: undefined;
1886
- } | {
1887
- message: string;
1888
- functionName: any;
1889
- type: string;
1890
- reason: any;
1891
- apiKeyName?: undefined;
1892
- } | {
1893
- createdAt: any;
1894
- clearedAt: any;
1895
- country: any;
1896
- merchant: any;
1897
- billingAmount: any;
1898
- billingCurrency: any;
1899
- transactionAmount: any;
1900
- transactionCurrency: any;
1901
- transactionType: any;
1902
- kind: any;
1903
- status: any;
1904
- mcc: any;
1905
- }[]>;
1874
+ export function GNOSISPAY(): Promise<any>;
1906
1875
  /**
1907
1876
  * Returns values along an exponential trend.
1908
1877
  *