Resolve source map issue and rename additional files.

This commit is contained in:
Patrick Fic
2025-12-11 10:52:49 -08:00
parent d0d487abe8
commit d75f8a3155
7 changed files with 97 additions and 32 deletions

View File

@@ -157,15 +157,15 @@ async function ImportJob(filepath: string): Promise<void> {
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({

View File

@@ -67,8 +67,8 @@ async function ScrubEstimate({ job }): Promise<string | undefined> {
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<string | undefined> {
`${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`;

View File

@@ -1,3 +1,4 @@
import "source-map-support/register";
import { is, optimizer, platform } from "@electron-toolkit/utils";
import Sentry from "@sentry/electron/main";
import {

View File

@@ -16,7 +16,7 @@ export async function setupKeepAliveAgent(): Promise<void> {
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.convenientbrands.bodyshop-desktop.keepalive</string>
<string>com.imex.esdp.keepalive</string>
<key>ProgramArguments</key>
<array>
<string>Shop Partner Keep Alive</string>
@@ -31,7 +31,7 @@ export async function setupKeepAliveAgent(): Promise<void> {
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<void> {
export async function isKeepAliveAgentInstalled(): Promise<boolean> {
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<boolean> {
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) {

52
src/main/util/opCodes.ts Normal file
View File

@@ -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;