@rebilly/instruments 3.45.2 → 3.45.6

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/jest.config.js CHANGED
@@ -6,6 +6,7 @@ module.exports = {
6
6
  ],
7
7
  moduleNameMapper: {
8
8
  "\@rebilly\/instruments": "<rootDir>/src/index",
9
+ "\@rebilly\/api-metadata": "<rootDir>/../../../libs/api-metadata/dist/umd/index.umd.cjs",
9
10
  "^tests\/(.*)$": "<rootDir>/tests/$1",
10
11
  "^\@\/(.*)$": "<rootDir>/src/$1",
11
12
  },
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.45.2",
3
+ "version": "3.45.6",
4
4
  "author": "Rebilly",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "unpkg": "dist/index.min.js",
8
8
  "scripts": {
9
- "build": "yarn prefetch && yarn rollup -c --environment NODE_ENV:production",
10
- "dev": "yarn prefetch && yarn rollup -c --watch --environment NODE_ENV:development",
9
+ "build": "yarn rollup -c --environment NODE_ENV:production",
10
+ "dev": "yarn rollup -c --watch --environment NODE_ENV:development",
11
11
  "test": "yarn jest",
12
12
  "test:unit": "yarn jest",
13
- "test:watch": "yarn jest --watchAll",
14
- "prefetch": "node --experimental-modules service/prefetch/prefetch.mjs"
13
+ "test:watch": "yarn jest --watchAll"
15
14
  },
16
15
  "dependencies": {
17
16
  "@babel/cli": "^7.21.5",
18
- "@babel/core": "^7.22.8",
19
- "@babel/preset-env": "^7.21.5",
17
+ "@babel/core": "^7.22.9",
18
+ "@babel/preset-env": "^7.22.9",
19
+ "@rebilly/api-metadata": "*",
20
20
  "@rebilly/risk-data-collector": "*",
21
21
  "@vue/reactivity": "^3.2.39",
22
22
  "ajv": "^8.12.0",
package/project.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "instruments/core",
3
3
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
4
  "projectType": "library",
5
- "sourceRoot": "packages/instruments/core",
5
+ "sourceRoot": "apps/instruments/core",
6
6
  "targets": {
7
7
  "semantic-release": {
8
8
  "executor": "@theunderscorer/nx-semantic-release:semantic-release",
@@ -19,4 +19,4 @@
19
19
  }
20
20
  }
21
21
  }
22
- }
22
+ }
@@ -1,12 +1,12 @@
1
1
  import { collectData } from '@rebilly/risk-data-collector';
2
- import paymentMethodsFile from '../data/payment-methods.json';
2
+ import { paymentMethods } from '@rebilly/api-metadata';
3
3
  import ReadyToPayModel from './models/ready-to-pay-model';
4
4
  import { Endpoint } from './index';
5
5
  import state from '../state';
6
6
  import { mapItemsQuantities } from '../utils/quantity';
7
7
 
8
8
  export function filterReadyToPay(readyToPay) {
9
- const paymentMethodsMetadata = [...paymentMethodsFile];
9
+ const paymentMethodsMetadata = [...paymentMethods];
10
10
  const EXPRESS_METHODS = [
11
11
  'Google Pay',
12
12
  'Apple Pay',
@@ -6,7 +6,7 @@ import { fetchReadyToPay } from './ready-to-pay';
6
6
  import ReadyToPayModel from './models/ready-to-pay-model';
7
7
  import { expectConfigurationError } from 'tests/async-utilities';
8
8
  import PaymentMetadataModel from './models/payment-metadata';
9
- import paymentMethodsFile from '@/data/payment-methods.json';
9
+ import { paymentMethods } from '@rebilly/api-metadata'
10
10
 
11
11
  describe('Storefront API Ready to Pay', () => {
12
12
  it('can fetch ready to pay', async () => {
@@ -28,7 +28,7 @@ describe('Storefront API Ready to Pay', () => {
28
28
  ]
29
29
  };
30
30
 
31
- const paymentCardMetadata = [...paymentMethodsFile].find(method => method.apiName === 'payment-card');
31
+ const paymentCardMetadata = [...paymentMethods].find(method => method.apiName === 'payment-card');
32
32
 
33
33
  when(post(`${storefrontURL}/ready-to-pay`)).thenReturn(
34
34
  ok(readyToPayPayload)
@@ -1,8 +0,0 @@
1
- export const fetchPaymentMethodsSettings = {
2
- apiUrl: 'https://api.rebilly.com/payment-methods',
3
- destinationFile: new URL(
4
- '../../src/data/payment-methods.json',
5
- import.meta.url
6
- ),
7
- metaType: 'payment methods metadata'
8
- };
@@ -1,35 +0,0 @@
1
- import axios from 'axios';
2
- import fs from 'fs/promises';
3
-
4
- export default class Metadata {
5
- constructor({ apiUrl, destinationFile, metaType }) {
6
- this.apiUrl = apiUrl;
7
- this.destinationFile = destinationFile;
8
- this.metaType = metaType;
9
- }
10
-
11
- async saveToDisk(results) {
12
- const prettifiedResults = JSON.stringify(results, null, 2);
13
- await fs.writeFile(this.destinationFile, prettifiedResults);
14
- }
15
-
16
- async printFetchLogMessage() {
17
- console.log(' ');
18
- console.log(`Fetching ${this.metaType}...`);
19
- console.log(' ');
20
- }
21
-
22
- async fetch() {
23
- this.printFetchLogMessage();
24
- try {
25
- const { data: results } = await axios.get(this.apiUrl);
26
- this.saveToDisk(results);
27
- } catch (error) {
28
- this.handleError(error);
29
- }
30
- }
31
-
32
- handleError(error) {
33
- console.error(error);
34
- }
35
- }
@@ -1,9 +0,0 @@
1
- import { fetchPaymentMethodsSettings } from './config.mjs';
2
- import Metadata from './metadata.mjs';
3
-
4
- async function fetchMetadata() {
5
- const paymentMethodMetadata = new Metadata(fetchPaymentMethodsSettings);
6
- await paymentMethodMetadata.fetch();
7
- }
8
-
9
- fetchMetadata();