diff --git a/package-lock.json b/package-lock.json index 3d922c6..05f5f09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "dayjs": "^1.11.19", "electron-log": "^5.4.3", "electron-updater": "^6.6.2", + "source-map-support": "^0.5.21", "winax": "^3.6.2" }, "devDependencies": { @@ -34,6 +35,7 @@ "@types/node-cron": "^3.0.11", "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", + "@types/source-map-support": "^0.5.10", "@types/xml2js": "^0.4.14", "@vitejs/plugin-react": "^5.1.2", "antd": "^6.1.0", @@ -5427,6 +5429,16 @@ "@types/node": "*" } }, + "node_modules/@types/source-map-support": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.10.tgz", + "integrity": "sha512-tgVP2H469x9zq34Z0m/fgPewGhg/MLClalNOiPIzQlXrSS2YrKu/xCdSCKnEDwkFha51VKEKB6A9wW26/ZNwzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "^0.6.0" + } + }, "node_modules/@types/tedious": { "version": "4.0.14", "resolved": "https://registry.npmjs.org/@types/tedious/-/tedious-4.0.14.tgz", @@ -6804,7 +6816,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, "license": "MIT" }, "node_modules/builder-util": { @@ -13895,7 +13906,6 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -13915,7 +13925,6 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", diff --git a/package.json b/package.json index 013b854..adc3dca 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "dayjs": "^1.11.19", "electron-log": "^5.4.3", "electron-updater": "^6.6.2", + "source-map-support": "^0.5.21", "winax": "^3.6.2" }, "devDependencies": { @@ -47,6 +48,7 @@ "@types/node-cron": "^3.0.11", "@types/react": "^19.2.7", "@types/react-dom": "^19.2.3", + "@types/source-map-support": "^0.5.10", "@types/xml2js": "^0.4.14", "@vitejs/plugin-react": "^5.1.2", "antd": "^6.1.0", diff --git a/src/main/decoder/decoder.ts b/src/main/decoder/decoder.ts index 6f8cd58..c9943ee 100644 --- a/src/main/decoder/decoder.ts +++ b/src/main/decoder/decoder.ts @@ -157,15 +157,15 @@ async function ImportJob(filepath: string): Promise { uploadNotification.show(); //Scrub the estimate - const scrubResults = ScrubEstimate({ job: jobObject }); - - UploadEmsToS3({ - extensionlessFilePath, - bodyshopid: newAvailableJob.bodyshopid, - ciecaid: jobObject.ciecaid ?? "", - clm_no: jobObject.clm_no ?? "", - ownr_ln: jobObject.ownr_ln ?? "", - }); + const scrubResults = await ScrubEstimate({ job: jobObject }); + console.log("Scrub Results:", scrubResults); + // UploadEmsToS3({ + // extensionlessFilePath, + // bodyshopid: newAvailableJob.bodyshopid, + // ciecaid: jobObject.ciecaid ?? "", + // clm_no: jobObject.clm_no ?? "", + // ownr_ln: jobObject.ownr_ln ?? "", + // }); } catch (error) { log.error("Error encountered while decoding job. ", errorTypeCheck(error)); const uploadNotificationFailure = new Notification({ diff --git a/src/main/estimate-scrubber/estimate-scrubber.ts b/src/main/estimate-scrubber/estimate-scrubber.ts index 732053e..329d589 100644 --- a/src/main/estimate-scrubber/estimate-scrubber.ts +++ b/src/main/estimate-scrubber/estimate-scrubber.ts @@ -67,8 +67,8 @@ async function ScrubEstimate({ job }): Promise { job.sending_entity_id = sendingEntityId; job.sending_entity_accept_terms_of_use = true; job.association_switch = "ATAM"; - job.rf_zip = job.bodyshop.zip_post; - job.rf_ph1 = job.bodyshop.phone; + job.rf_zip = "R0G 1Z0" || job.bodyshop?.zip_post; //TODO: REPLACE WITH BODYSHOP ZIP IF AVAILABLE + job.rf_ph1 = "2043792253" || job.bodyshop?.phone; //TODO: REPLACE WITH BODYSHOP PHONE IF AVAILABLE job.g_ttl_amt = job.clm_total; job.source_system = "M"; //Requested by Steven. job.v_mileage = job.v_mileage?.toString() || ""; //Requested by Steven to be a string. @@ -125,20 +125,21 @@ async function ScrubEstimate({ job }): Promise { `${fileName}.json`, ); - const result = await axios.post( - `${estimateScrubberUrl}/api/sendems`, - formData, - { - auth: { - username: basicAuthUser, - password: basicAuthpassword, - }, - headers: { - ...(formData.getHeaders ? formData.getHeaders() : {}), - APIkey: esApiKey, - }, - }, - ); + // const result = await axios.post( + // `${estimateScrubberUrl}/api/sendems`, + // formData, + // { + // auth: { + // username: basicAuthUser, + // password: basicAuthpassword, + // }, + // headers: { + // ...(formData.getHeaders ? formData.getHeaders() : {}), + // APIkey: esApiKey, + // }, + // }, + // ); + const result = null; const resultPDFUrl = result?.data?.report_link; const reportIssueUrl = `https://insurtechtoolkit.com/pcontactUs.aspx?apiKey=${esApiKey}&file=${fileName}.json`; diff --git a/src/main/index.ts b/src/main/index.ts index da1d177..beee400 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,3 +1,4 @@ +import "source-map-support/register"; import { is, optimizer, platform } from "@electron-toolkit/utils"; import Sentry from "@sentry/electron/main"; import { diff --git a/src/main/setup-keep-alive-agent.ts b/src/main/setup-keep-alive-agent.ts index 1f924c0..ea71cc0 100644 --- a/src/main/setup-keep-alive-agent.ts +++ b/src/main/setup-keep-alive-agent.ts @@ -16,7 +16,7 @@ export async function setupKeepAliveAgent(): Promise { Label - com.convenientbrands.bodyshop-desktop.keepalive + com.imex.esdp.keepalive ProgramArguments Shop Partner Keep Alive @@ -31,7 +31,7 @@ export async function setupKeepAliveAgent(): Promise { const plistPath = join( homedir(), - "/Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", + "/Library/LaunchAgents/com.imex.esdp.keepalive.plist", ); try { @@ -50,7 +50,7 @@ export async function setupKeepAliveAgent(): Promise { export async function isKeepAliveAgentInstalled(): Promise { const plistPath = join( homedir(), - "/Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", + "/Library/LaunchAgents/com.imex.esdp.keepalive.plist", ); const maxRetries = 3; const retryDelay = 500; // 500ms delay between retries @@ -59,7 +59,7 @@ export async function isKeepAliveAgentInstalled(): Promise { try { await fs.access(plistPath, fs.constants.F_OK); const { stdout } = await execPromise( - `launchctl list | grep com.convenientbrands.bodyshop-desktop.keepalive`, + `launchctl list | grep com.imex.esdp.keepalive`, ); return !!stdout; // Return true if plist exists and agent is loaded } catch (error) { diff --git a/src/main/util/opCodes.ts b/src/main/util/opCodes.ts new file mode 100644 index 0000000..439f1a0 --- /dev/null +++ b/src/main/util/opCodes.ts @@ -0,0 +1,52 @@ +//Hard coded as these values don't change. +const opCodes = { + OP0: { desc: "REMOVE / REPLACE PARTIAL", opcode: "OP11", partcode: "PAA" }, + OP1: { desc: "REFINISH / REPAIR", opcode: "OP1", partcode: "PAE" }, + OP2: { desc: "REMOVE / INSTALL", opcode: "OP2", partcode: "PAE" }, + OP3: { desc: "ADDITIONAL LABOR", opcode: "OP9", partcode: "PAE" }, + OP4: { desc: "ALIGNMENT", opcode: "OP4", partcode: "PAS" }, + OP5: { desc: "OVERHAUL", opcode: "OP5", partcode: "PAE" }, + OP6: { desc: "REFINISH", opcode: "OP6", partcode: "PAE" }, + OP7: { desc: "INSPECT", opcode: "OP7", partcode: "PAE" }, + OP8: { desc: "CHECK / ADJUST", opcode: "OP8", partcode: "PAE" }, + OP9: { desc: "REPAIR", opcode: "OP9", partcode: "PAE" }, + OP10: { desc: "REPAIR , PARTIAL", opcode: "OP9", partcode: "PAE" }, + OP11: { desc: "REMOVE / REPLACE", opcode: "OP11", partcode: "PAN" }, + OP12: { desc: "REMOVE / REPLACE PARTIAL", opcode: "OP11", partcode: "PAN" }, + OP13: { desc: "ADDITIONAL COSTS", opcode: "OP13", partcode: "PAE" }, + OP14: { desc: "ADDITIONAL OPERATIONS", opcode: "OP14", partcode: "PAE" }, + OP15: { desc: "BLEND", opcode: "OP15", partcode: "PAE" }, + OP16: { desc: "SUBLET", opcode: "OP16", partcode: "PAS" }, + OP17: { desc: "POLICY LIMIT ADJUSTMENT", opcode: "OP9", partcode: "PAE" }, + OP18: { desc: "APPEAR ALLOWANCE", opcode: "OP7", partcode: "PAE" }, + OP20: { desc: "REMOVE AND REINSTALL", opcode: "OP20", partcode: "PAE" }, + OP24: { desc: "CHIPGUARD", opcode: "OP6", partcode: "PAE" }, + OP25: { desc: "TWO TONE", opcode: "OP6", partcode: "PAE" }, + OP26: { desc: "PAINTLESS DENT REPAIR", opcode: "OP16", partcode: "PAE" }, + OP100: { desc: "REPLACE PRE-PRICED", opcode: "OP11", partcode: "PAA" }, + OP101: { + desc: "REMOVE/REPLACE RECYCLED PART", + opcode: "OP11", + partcode: "PAL", + }, + OP103: { desc: "REMOVE / REPLACE PARTIAL", opcode: "OP11", partcode: "PAA" }, + OP104: { + desc: "REMOVE / REPLACE PARTIAL LABOUR", + opcode: "OP11", + partcode: "PAA", + }, + OP105: { desc: "!!ADJUST MANUALLY!!", opcode: "OP99", partcode: "PAE" }, + OP106: { desc: "REPAIR , PARTIAL", opcode: "OP9", partcode: "PAE" }, + OP107: { desc: "CHIPGUARD", opcode: "OP6", partcode: "PAE" }, + OP108: { desc: "MULTI TONE", opcode: "OP6", partcode: "PAE" }, + OP109: { desc: "REPLACE PRE-PRICED", opcode: "OP11", partcode: "PAA" }, + OP110: { desc: "REFINISH / REPAIR", opcode: "OP1", partcode: "PAE" }, + OP111: { desc: "REMOVE / REPLACE", opcode: "OP11", partcode: "PAN" }, + OP112: { desc: "REMOVE / REPLACE", opcode: "OP11", partcode: "PAA" }, + OP113: { desc: "REPLACE PRE-PRICED", opcode: "OP11", partcode: "PAA" }, + OP114: { desc: "REPLACE PRE-PRICED", opcode: "OP11", partcode: "PAA" }, + OP120: { desc: "REPAIR , PARTIAL", opcode: "OP9", partcode: "PAE" }, + OP260: { desc: "SUBLET", opcode: "OP16", partcode: "PAE" }, +}; + +export default opCodes;