From d4335178ecbb1e0cbcdf7dd5830ec2dab6d152ad Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 16 Sep 2025 10:21:03 -0700 Subject: [PATCH] Add API key to estimate scrubber. --- .../estimate-scrubber/estimate-scrubber.js | 9 ++- package.json | 2 +- .../jobs-detail-description.molecule.jsx | 2 +- .../jobs-detail/jobs-detail.organism.jsx | 2 +- .../sider-menu/sider-menu.organism.jsx | 6 ++ .../pages/dashboard/dashboard.page.jsx | 61 +++++++++++++++++++ .../dashboard/dashboard.page.styles.scss | 8 +++ src/components/pages/routes/routes.page.jsx | 10 +-- src/graphql/bodyshop.queries.js | 1 + src/graphql/jobs.queries.js | 1 + src/redux/reporting/reporting.reducer.js | 1 + src/redux/reporting/reporting.types.js | 3 +- 12 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 src/components/pages/dashboard/dashboard.page.jsx create mode 100644 src/components/pages/dashboard/dashboard.page.styles.scss diff --git a/electron/estimate-scrubber/estimate-scrubber.js b/electron/estimate-scrubber/estimate-scrubber.js index 637240f..b99485d 100644 --- a/electron/estimate-scrubber/estimate-scrubber.js +++ b/electron/estimate-scrubber/estimate-scrubber.js @@ -4,6 +4,7 @@ const path = require("path"); const { BrowserWindow } = require("electron"); const { default: ipcTypes } = require("../../src/ipc.types.commonjs"); const { promises: fsPromises } = require("fs"); +const { autoUpdater } = require("electron-updater") // Function to write job object to logs subfolder async function writeJobToLogsFolder(job, fileName) { @@ -35,9 +36,11 @@ async function ScrubEstimate({ job }) { //No secret or private information is exposed. const basicAuthUser = "Imex2"; const basicAuthpassword = "Patrick"; - const estimateScrubberUrl = "https://insurtechtoolkit.com/api/sendems"; + const currentChannel = autoUpdater.channel + const estimateScrubberUrl = process.env.NODE_ENV !== undefined || currentChannel === 'alpha' ? 'https://4284-79073.el-alt.com/api/sendems' : "https://insurtechtoolkit.com/api/sendems"; + console.log("*** ~ ScrubEstimate ~ process.env.NODE_ENV:", process.env.NODE_ENV); const sendingEntityId = "87330f61-412b-4251-baaa-d026565b23c5"; - try { + try { const esApiKey = job?.bodyshop?.es_api_key //Perform data manipulation on the job object if (!job) { console.error("No job provided to ScrubEstimate"); @@ -105,7 +108,7 @@ async function ScrubEstimate({ job }) { username: basicAuthUser, password: basicAuthpassword }, - headers: formData.getHeaders ? formData.getHeaders() : {} + headers: { ...formData.getHeaders ? formData.getHeaders() : {}, 'APIkey': esApiKey } }); const resultPDFUrl = result?.data?.report_link; diff --git a/package.json b/package.json index 0f8d5bc..be2a58d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.4.2-beta.2", + "version": "1.4.2-alpha.13", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx index 500d52f..a985d55 100644 --- a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx +++ b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx @@ -97,7 +97,7 @@ export function JobsDetailDescriptionMolecule({ bodyshop, loading, job, jobDetai /> ), - bodyshop.phone && , + bodyshop.es_api_key && , ,