Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
snrondina committed Oct 22, 2024
2 parents 3224308 + 3d95c94 commit 8c0c249
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 40 deletions.
21 changes: 17 additions & 4 deletions connectors/connector-qbo/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {initSDK} from '@opensdks/runtime'
import {initSDK, modifyRequest} from '@opensdks/runtime'
import type {QBOSDKTypes} from '@opensdks/sdk-qbo'
import {qboSdkDef} from '@opensdks/sdk-qbo'
import type {ConnectorServer} from '@openint/cdk'
Expand All @@ -17,7 +17,7 @@ export type QBOSDK = ReturnType<typeof initQBOSdk>

export const qboServer = {
newInstance: ({config, settings, fetchLinks}) => {
const qbo = initQBOSdk({
const qbo = initQBOSdk({
envName: config.envName,
realmId: settings.oauth.connection_config.realmId,
// Access token may be out of date, we are relying on fetchLinks to contain a middleware to
Expand All @@ -34,11 +34,24 @@ export const qboServer = {
}
return next(req)
},
(req, next) => {
if(req.url.includes('/bank-accounts') || req.url.includes('/payment-receipts')) {
const param = req.url.split("/").pop();
const newUrl = req.url.includes('/bank-accounts') ?
req.url?.replace(/intuit\.com.*/, `intuit.com/quickbooks/v4/customers/${param}/bank-accounts`) :
req.url?.replace(/intuit\.com.*/, `intuit.com/quickbooks/v4/payments/receipt/${param}`);
const newRes = modifyRequest(req, {
url: newUrl
});
return next(newRes);
}
return next(req);
},
...fetchLinks,
...defaultLinks,
...defaultLinks
],
})
return qbo
return qbo;
},

sourceSync: ({instance: qbo, streams}) => {
Expand Down
27 changes: 7 additions & 20 deletions packages/ui/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { dirname, join } = require('path')
const {dirname, join} = require('path')
const {default: svgr} = require('vite-plugin-svgr')

/**
* This function is used to resolve the absolute path of a package.
Expand All @@ -25,26 +26,12 @@ const config = {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
},
// Add the following configuration to support SVGs
viteFinal: async (config) => {
// Ensure plugins array is initialized
if (!config.plugins) {
config.plugins = [];
}

config.plugins.push({
name: 'svgr',
transform: (code, id) => {
if (/\.svg$/.test(id)) {
return {
code: `import { ReactComponent as Icon } from '${id}'; export default Icon;`,
map: null,
};
}
return null;
},
});
return config;
async viteFinal(config, {configType}) {
config.plugins = config.plugins || []
config.plugins.push(svgr())

return config
},
}

Expand Down
3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"@tanstack/react-query": "*",
"@types/react": "*",
"prop-types": "^15.8.1",
"storybook": "^8.3.5"
"storybook": "^8.3.5",
"vite-plugin-svgr": "^4.2.0"
},
"peerDependencies": {
"react": "*",
Expand Down
Loading

0 comments on commit 8c0c249

Please sign in to comment.