23 Commits

Author SHA1 Message Date
Patrick Fic
83ca7a251b Final release for 1.0.6. Resolve issue with destructure on CCC PPC. 2025-09-17 12:02:57 -07:00
Patrick FIc
41caa76b28 Remove notification for update. 2025-09-10 14:59:24 -07:00
Allan Carr
45bc12a2f5 IO-3361 PPG Mix Data 2025-09-10 13:51:43 -07:00
Patrick FIc
093012c8f7 Merge branch 'main' of bitbucket.org:snaptsoft/bodyshop-desktop 2025-09-09 16:07:43 -07:00
Patrick FIc
bd9fa67087 Check release channel each time. 2025-09-09 16:07:26 -07:00
Patrick Fic
c5bdb62cb6 Merge branch '1.0.5' 2025-09-09 16:06:38 -07:00
Patrick Fic
e9dd8ff760 Finalize release. 2025-09-09 16:06:20 -07:00
Patrick FIc
1c839ee3f8 Update executable names for beta and alpha paths. 2025-09-09 15:47:31 -07:00
Patrick Fic
9fdd88526c IO-3358 Resolve update channel & null claim number. 2025-09-08 10:30:53 -07:00
Patrick FIc
d5b40ef6f4 Merge branch '1.0.3' 2025-08-28 13:01:44 -07:00
Patrick FIc
59162e3028 Increase version to 1.0.4 to prevent conflicts. 2025-08-28 13:01:30 -07:00
Patrick FIc
f41728550c Include prior 1.0.3 fix. 2025-08-28 13:01:03 -07:00
Patrick Fic
3b918d3fcb Merge branch '1.0.3' 2025-08-28 12:55:02 -07:00
Patrick Fic
cf18acc661 IO-3350 Update cors in partner to accept www. 2025-08-28 12:51:09 -07:00
Patrick Fic
be079a2e48 Merged in release/1.0.2 (pull request #4)
Release/1.0.2
2025-05-22 17:29:09 +00:00
Patrick Fic
9b90b780ef Exclude .DS_STORE Files. 2025-05-22 10:28:03 -07:00
Patrick Fic
a19026e048 Add RO icons. 2025-05-22 09:44:27 -07:00
Patrick Fic
47608a8cde Add Rome Icon, resolve translation, and set to Alpha release for testing. 2025-05-20 16:04:03 -07:00
Patrick Fic
a9fdf327b6 Updated package version for new release. 2025-05-20 15:42:36 -07:00
Patrick Fic
bd63af69e2 Merged in release/1.0.1 (pull request #3)
release/1.0.1

Approved-by: Patrick Fic
2025-05-20 22:40:41 +00:00
Patrick Fic
6fa97a081f Resolve CORS issues. 2025-05-20 15:40:15 -07:00
Patrick FIc
be0eafec7e Update artifact names. 2025-05-16 10:39:42 -07:00
Patrick Fic
6e4c8b5558 Merged in feature/IO-3066-1-scaffolding (pull request #2)
Major v1 release.
2025-05-16 17:17:38 +00:00
26 changed files with 655 additions and 104 deletions

View File

@@ -2,7 +2,7 @@ VITE_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDo
VITE_GRAPHQL_ENDPOINT=https://db.dev.imex.online/v1/graphql
VITE_FIREBASE_CONFIG_TEST={ "apiKey":"AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", "authDomain":"imex-test.firebaseapp.com", "projectId":"imex-test", "storageBucket":"imex-test.appspot.com", "messagingSenderId":"991923618608", "appId":"1:991923618608:web:633437569cdad78299bef5", "measurementId":"G-TW0XLZEH18"}
VITE_GRAPHQL_ENDPOINT_TEST=https://db.test.bodyshop.app/v1/graphql
VITE_COMPANY=IMEX
VITE_COMPANY=ROME
VITE_FE_URL=https://imex.online
VITE_FE_URL_TEST=https://test.imex.online
VITE_API_URL="http://localhost:4000"

1
.gitignore vendored
View File

@@ -14,5 +14,6 @@ out
# Build Files
macbuild.sh
deploy.ps1
# Sentry Config File
.env.sentry-build-plugin

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env node
// Cross-platform script to set artifact naming based on version
const fs = require('fs');
const path = require('path');
const { spawn } = require('child_process');
// Read the package.json to get the version
const packageJsonPath = path.join(__dirname, '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const version = packageJson.version;
console.log(`Current version: ${version}`);
// Determine the artifact suffix based on the version
let artifactSuffix = '';
if (version.includes('alpha')) {
artifactSuffix = `alpha-${version}-`;
console.log(`Detected alpha version, setting suffix to: ${artifactSuffix}`);
} else if (version.includes('beta')) {
artifactSuffix = `beta-${version}-`;
console.log(`Detected beta version, setting suffix to: ${artifactSuffix}`);
} else {
artifactSuffix = '';
console.log('Detected release version, no suffix will be added');
}
// Set the environment variable for the current process
process.env.ARTIFACT_SUFFIX = artifactSuffix;
console.log(`ARTIFACT_SUFFIX set to: '${artifactSuffix}'`);
// If arguments are passed, execute the remaining command with the environment variable set
if (process.argv.length > 2) {
const command = process.argv[2];
const args = process.argv.slice(3);
console.log(`Executing: ${command} ${args.join(' ')}`);
const child = spawn(command, args, {
stdio: 'inherit',
env: { ...process.env, ARTIFACT_SUFFIX: artifactSuffix },
shell: true
});
child.on('close', (code) => {
process.exit(code);
});
} else {
// Just setting the environment variable
console.log('Environment variable set. Use this script with additional arguments to run commands with the variable set.');
}

View File

@@ -0,0 +1,38 @@
# PowerShell script to set artifact naming based on version
param(
[string]$ConfigType = "imex"
)
# Read the package.json to get the version
$packageJsonPath = Join-Path $PSScriptRoot "..\package.json"
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
$version = $packageJson.version
Write-Host "Current version: $version"
# Determine the artifact suffix based on the version
$artifactSuffix = ""
if ($version -match "alpha") {
$artifactSuffix = "alpha-${version}-"
Write-Host "Detected alpha version, setting suffix to: $artifactSuffix"
}
elseif ($version -match "beta") {
$artifactSuffix = "beta-${version}-"
Write-Host "Detected beta version, setting suffix to: $artifactSuffix"
}
else {
$artifactSuffix = ""
Write-Host "Detected release version, no suffix will be added"
}
# Set the environment variable
$env:ARTIFACT_SUFFIX = $artifactSuffix
# Export for the current session
[Environment]::SetEnvironmentVariable("ARTIFACT_SUFFIX", $artifactSuffix, "Process")
Write-Host "ARTIFACT_SUFFIX set to: '$env:ARTIFACT_SUFFIX'"
# Return the suffix for use in other scripts
return $artifactSuffix

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Bash script to set artifact naming based on version
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Read the package.json to get the version
PACKAGE_JSON_PATH="$SCRIPT_DIR/../package.json"
VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")
echo "Current version: $VERSION"
# Determine the artifact suffix based on the version
ARTIFACT_SUFFIX=""
if [[ $VERSION == *"alpha"* ]]; then
ARTIFACT_SUFFIX="alpha-${VERSION}-"
echo "Detected alpha version, setting suffix to: $ARTIFACT_SUFFIX"
elif [[ $VERSION == *"beta"* ]]; then
ARTIFACT_SUFFIX="beta-${VERSION}-"
echo "Detected beta version, setting suffix to: $ARTIFACT_SUFFIX"
else
ARTIFACT_SUFFIX=""
echo "Detected release version, no suffix will be added"
fi
# Export the environment variable
export ARTIFACT_SUFFIX="$ARTIFACT_SUFFIX"
echo "ARTIFACT_SUFFIX set to: '$ARTIFACT_SUFFIX'"
# Also write to a temporary file for sourcing in other scripts
echo "export ARTIFACT_SUFFIX='$ARTIFACT_SUFFIX'" > "$SCRIPT_DIR/.artifact-suffix.env"

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env node
// Cross-platform test script to demonstrate artifact naming for different versions
const fs = require('fs');
const path = require('path');
console.log('=== Artifact Naming Test (Cross-Platform) ===');
console.log('');
// Get current version
const packageJsonPath = path.join(__dirname, '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const currentVersion = packageJson.version;
console.log(`Current version: ${currentVersion}`);
// Function to get artifact suffix
function getArtifactSuffix(version) {
if (version.includes('alpha')) {
return `alpha-${version}-`;
} else if (version.includes('beta')) {
return `beta-${version}-`;
} else {
return '';
}
}
// Test scenarios
const testVersions = [
'1.0.5', // Release version
'1.0.5-alpha.2', // Alpha version
'1.0.5-beta.1', // Beta version
'2.0.0-alpha.1', // Another alpha
'1.5.0-beta.3' // Another beta
];
console.log('Test scenarios:');
console.log('==================');
testVersions.forEach(version => {
const suffix = getArtifactSuffix(version);
// Different artifact names for different platforms
const windowsArtifact = `imex-partner-${suffix}x64.exe`;
const macArtifact = `imex-partner-${suffix}x64.dmg`;
const linuxArtifact = `imex-partner-${suffix}x64.AppImage`;
console.log(`Version: ${version}`);
console.log(` Suffix: '${suffix}'`);
console.log(` Windows: ${windowsArtifact}`);
console.log(` Mac: ${macArtifact}`);
console.log(` Linux: ${linuxArtifact}`);
console.log('');
});
console.log('Current configuration will produce:');
const currentSuffix = getArtifactSuffix(currentVersion);
console.log(` Windows: imex-partner-${currentSuffix}x64.exe`);
console.log(` Mac: imex-partner-${currentSuffix}x64.dmg`);
console.log(` Linux: imex-partner-${currentSuffix}x64.AppImage`);
console.log('');
console.log(`Platform detected: ${process.platform}`);
console.log(`Architecture: ${process.arch}`);

View File

@@ -0,0 +1,48 @@
# Test script to demonstrate artifact naming for different versions
Write-Host "=== Artifact Naming Test ==="
Write-Host ""
# Test current version
$packageJsonPath = ".\package.json"
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
$currentVersion = $packageJson.version
Write-Host "Current version: $currentVersion"
# Function to get artifact suffix
function Get-ArtifactSuffix($version) {
if ($version -match "alpha") {
return "alpha-${version}-"
} elseif ($version -match "beta") {
return "beta-${version}-"
} else {
return ""
}
}
# Test scenarios
$testVersions = @(
"1.0.5", # Release version
"1.0.5-alpha.2", # Alpha version
"1.0.5-beta.1", # Beta version
"2.0.0-alpha.1", # Another alpha
"1.5.0-beta.3" # Another beta
)
Write-Host "Test scenarios:"
Write-Host "=================="
foreach ($version in $testVersions) {
$suffix = Get-ArtifactSuffix $version
$artifactName = "imex-partner-${suffix}x64.exe"
Write-Host "Version: $version"
Write-Host " Suffix: '$suffix'"
Write-Host " Result: $artifactName"
Write-Host ""
}
Write-Host "Current configuration will produce:"
$currentSuffix = Get-ArtifactSuffix $currentVersion
$currentArtifact = "imex-partner-${currentSuffix}x64.exe"
Write-Host " $currentArtifact"

View File

@@ -0,0 +1,50 @@
#!/bin/bash
# Test script to demonstrate artifact naming for different versions on Mac
echo "=== Artifact Naming Test (Mac) ==="
echo ""
# Get current version
PACKAGE_JSON_PATH="./package.json"
CURRENT_VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")
echo "Current version: $CURRENT_VERSION"
# Function to get artifact suffix
get_artifact_suffix() {
local version=$1
if [[ $version == *"alpha"* ]]; then
echo "alpha-${version}-"
elif [[ $version == *"beta"* ]]; then
echo "beta-${version}-"
else
echo ""
fi
}
# Test scenarios
TEST_VERSIONS=(
"1.0.5" # Release version
"1.0.5-alpha.2" # Alpha version
"1.0.5-beta.1" # Beta version
"2.0.0-alpha.1" # Another alpha
"1.5.0-beta.3" # Another beta
)
echo "Test scenarios:"
echo "=================="
for version in "${TEST_VERSIONS[@]}"; do
suffix=$(get_artifact_suffix "$version")
artifact_name="imex-partner-${suffix}x64.dmg"
echo "Version: $version"
echo " Suffix: '$suffix'"
echo " Result: $artifact_name"
echo ""
done
echo "Current configuration will produce:"
current_suffix=$(get_artifact_suffix "$CURRENT_VERSION")
current_artifact="imex-partner-${current_suffix}x64.dmg"
echo " $current_artifact"

View File

@@ -23,7 +23,7 @@ win:
certificateProfileName: ImEXRPS
codeSigningAccountName: ImEX
nsis:
artifactName: ${name}-${arch}.${ext}
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
@@ -49,7 +49,7 @@ mac:
arch:
- x64
dmg:
artifactName: ${name}-${arch}.${ext}
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
linux:
target:
- AppImage
@@ -59,7 +59,7 @@ linux:
category: Utility
desktop: scripts/imex-shop-partner.desktop
appImage:
artifactName: ${name}-${arch}.${ext}
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
npmRebuild: false
publish:
provider: s3

View File

@@ -17,13 +17,13 @@ asarUnpack:
- resources/**
win:
executableName: ShopPartner
icon: resources/icon.png
icon: resources/ro-icon.png
azureSignOptions:
endpoint: https://eus.codesigning.azure.net
certificateProfileName: ImEXRPS
codeSigningAccountName: ImEX
nsis:
artifactName: ${name}-${arch}.${ext}
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
@@ -31,6 +31,7 @@ nsis:
mac:
entitlementsInherit: build/entitlements.mac.plist
category: public.app-category.business
icon: resources/ro-icon.png
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
@@ -49,7 +50,7 @@ mac:
arch:
- x64
dmg:
artifactName: ${name}-${arch}.${ext}
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
linux:
target:
- AppImage
@@ -59,7 +60,7 @@ linux:
category: Utility
desktop: scripts/rome-shop-partner.desktop
appImage:
artifactName: ${name}-${arch}.${ext}
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
npmRebuild: false
publish:
provider: s3

30
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "bodyshop-desktop",
"version": "0.0.1-alpha.11",
"version": "1.0.6-alpha.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "bodyshop-desktop",
"version": "0.0.1-alpha.11",
"version": "1.0.6-alpha.1",
"hasInstallScript": true,
"dependencies": {
"@apollo/client": "^3.13.6",
@@ -41,6 +41,7 @@
"archiver": "^7.0.1",
"chokidar": "^4.0.3",
"cors": "^2.8.5",
"cross-env": "^10.0.0",
"dbffile": "^1.12.0",
"electron": "^35.1.5",
"electron-builder": "^25.1.8",
@@ -1002,6 +1003,13 @@
"dev": true,
"license": "MIT"
},
"node_modules/@epic-web/invariant": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz",
"integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
"dev": true,
"license": "MIT"
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.25.2",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz",
@@ -6936,6 +6944,24 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/cross-env": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.0.0.tgz",
"integrity": "sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@epic-web/invariant": "^1.0.0",
"cross-spawn": "^7.0.6"
},
"bin": {
"cross-env": "dist/bin/cross-env.js",
"cross-env-shell": "dist/bin/cross-env-shell.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "bodyshop-desktop",
"version": "1.0.0",
"version": "1.0.6",
"description": "Shop Management System Partner",
"main": "./out/main/index.js",
"author": "Convenient Brands, LLC",
@@ -13,17 +13,17 @@
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build:imex": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml",
"build:rome": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml",
"build:imex:publish": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml --publish always",
"build:rome:publish": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml --publish always",
"build:imex:linux": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml --linux",
"build:rome:linux": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml --linux",
"build:imex": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml",
"build:rome": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml",
"build:imex:publish": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml --publish always",
"build:rome:publish": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml --publish always",
"build:imex:linux": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml --linux",
"build:rome:linux": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml --linux",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "electron-vite build --mode imex && electron-builder --dir",
"build:win": "electron-vite build --mode imex && electron-builder --win",
"build:mac": "electron-vite build --mode imex && electron-builder --mac",
"build:linux": "electron-vite build --mode imex && electron-builder --linux"
"build:unpack": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --dir",
"build:win": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --win",
"build:mac": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --mac",
"build:linux": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --linux"
},
"dependencies": {
"@apollo/client": "^3.13.6",
@@ -58,6 +58,7 @@
"archiver": "^7.0.1",
"chokidar": "^4.0.3",
"cors": "^2.8.5",
"cross-env": "^10.0.0",
"dbffile": "^1.12.0",
"electron": "^35.1.5",
"electron-builder": "^25.1.8",

BIN
resources/ro-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -182,7 +182,9 @@ const DecodeAD1 = async (
if (!rawAd1Data.ownr_ph1 || _.isEmpty(rawAd1Data.ownr_ph1)) {
rawAd1Data.ownr_ph1 = rawAd1Data.ownr_ph2;
}
if (rawAd1Data.clm_no === "") {
rawAd1Data.clm_no = undefined;
}
let ownerRecord: OwnerRecordInterface;
//Check if the owner information is there. If not, use the insured information as a fallback.
if (

View File

@@ -157,6 +157,7 @@ async function ImportJob(filepath: string): Promise<void> {
console.log("Available Job record to upload;", newAvailableJob);
setAppProgressbar(0.95);
if (jobObject.clm_no) {
const existingJobRecord: QueryJobByClmNoResult = await client.request(
QUERY_JOB_BY_CLM_NO_TYPED,
{ clm_no: jobObject.clm_no },
@@ -166,6 +167,7 @@ async function ImportJob(filepath: string): Promise<void> {
newAvailableJob.issupplement = true;
newAvailableJob.jobid = existingJobRecord.jobs[0].id;
}
}
const insertRecordResult: InsertAvailableJobResult = await client.request(
INSERT_AVAILABLE_JOB_TYPED,

View File

@@ -31,6 +31,12 @@ export default class LocalServer {
"https://localhost:3000",
"https://test.imex.online",
"https://imex.online",
"https://test.romeonline.io",
"https://romeonline.io",
"https://www.test.imex.online",
"https://www.imex.online",
"https://www.test.romeonline.io",
"https://www.romeonline.io",
];
this.app.use(

View File

@@ -13,7 +13,9 @@ import {
import log from "electron-log/main";
import { autoUpdater } from "electron-updater";
import path, { join } from "path";
import appIcon from "../../resources/icon.png?asset";
import imexAppIcon from "../../resources/icon.png?asset";
import romeAppIcon from "../../resources/ro-icon.png?asset";
import {
default as ErrorTypeCheck,
default as errorTypeCheck,
@@ -35,6 +37,9 @@ import {
} from "./setup-keep-alive-task";
import ensureWindowOnScreen from "./util/ensureWindowOnScreen";
const appIconToUse =
import.meta.env.VITE_COMPANY === "IMEX" ? imexAppIcon : romeAppIcon;
Sentry.init({
dsn: "https://ba41d22656999a8c1fd63bcb7df98650@o492140.ingest.us.sentry.io/4509074139447296",
});
@@ -69,7 +74,11 @@ function createWindow(): void {
minWidth: 600,
minHeight: 400,
//autoHideMenuBar: true,
...(process.platform === "linux" ? { icon: appIcon } : {}),
...(process.platform === "linux"
? {
icon: appIconToUse,
}
: {}),
title: "Shop Partner",
webPreferences: {
preload: join(__dirname, "../preload/index.js"),
@@ -497,7 +506,7 @@ app.whenReady().then(async () => {
}
//Create Tray
const trayicon = nativeImage.createFromPath(appIcon);
const trayicon = nativeImage.createFromPath(appIconToUse);
const tray = new Tray(trayicon.resize({ width: 16 }));
const contextMenu = Menu.buildFromTemplate([
{
@@ -522,7 +531,7 @@ app.whenReady().then(async () => {
//Check for app updates.
autoUpdater.logger = log;
autoUpdater.allowDowngrade = true;
// if (import.meta.env.DEV) {
// // Useful for some dev/debugging tasks, but download can
// // not be validated because dev app is not signed

View File

@@ -20,19 +20,26 @@ const ipcMainHandleAuthStateChanged = async (
user: User | null,
): Promise<void> => {
Store.set("user", user);
log.debug("Received authentication state change from Renderer.", user);
await setReleaseChannel();
checkForAppUpdatesContinuously();
};
async function setReleaseChannel() {
try {
//Need to query the currently active shop, and store the metadata as well.
//Also need to query the OP Codes for decoding reference.
log.debug("Received authentication state change from Renderer.", user);
handleShopMetaDataFetch();
await handleShopMetaDataFetch();
//Check for updates
const bodyshop = Store.get("app.bodyshop");
if (bodyshop?.convenient_company === "alpha") {
if (bodyshop?.convenient_company?.toLowerCase() === "alpha") {
autoUpdater.channel = "alpha";
log.debug("Setting update channel to ALPHA channel.");
} else if (bodyshop?.convenient_company === "beta") {
} else if (bodyshop?.convenient_company?.toLowerCase() === "beta") {
autoUpdater.channel = "beta";
log.debug("Setting update channel to BETA channel.");
} else {
log.debug("Setting update channel to LATEST channel.");
}
} catch (error) {
log.error(
@@ -44,8 +51,7 @@ const ipcMainHandleAuthStateChanged = async (
"Error connecting to ImEX Online servers to get shop data. Please try again.",
);
}
checkForAppUpdatesContinuously();
};
}
const handleShopMetaDataFetch = async (
reloadWindow?: boolean,
@@ -89,7 +95,8 @@ const ipMainHandleResetPassword = async (): Promise<void> => {
};
export {
handleShopMetaDataFetch,
ipcMainHandleAuthStateChanged,
ipMainHandleResetPassword,
handleShopMetaDataFetch,
setReleaseChannel,
};

View File

@@ -14,7 +14,7 @@ const handlePartsPriceChangeRequest = async (
): Promise<void> => {
//Route handler here only.
const { job } = req.body as { job: PpcJob };
const job = req.body as PpcJob;
try {
await generatePartsPriceChange(job);
res.status(200).json({ success: true });

View File

@@ -1,6 +1,7 @@
import { autoUpdater } from "electron-updater";
import { setReleaseChannel } from "../ipc/ipcMainHandler.user";
function checkForAppUpdatesContinuously(): void {
async function checkForAppUpdatesContinuously(): Promise<void> {
checkForAppUpdates();
setInterval(
() => {
@@ -9,11 +10,9 @@ function checkForAppUpdatesContinuously(): void {
1000 * 60 * 30,
);
}
function checkForAppUpdates(): void {
autoUpdater.checkForUpdatesAndNotify({
title: "Shop Partner Update",
body: "A new version of Shop Partner is available. Click to update.",
});
async function checkForAppUpdates(): Promise<void> {
await setReleaseChannel();
autoUpdater.checkForUpdates();
}
export { checkForAppUpdatesContinuously, checkForAppUpdates };
export { checkForAppUpdates, checkForAppUpdatesContinuously };

View File

@@ -42,7 +42,10 @@ async function StartWatcher(): Promise<boolean> {
watcher = chokidar.watch(filePaths, {
ignored: (filepath, stats) => {
const p = path.parse(filepath);
return !stats?.isFile() && p.ext !== "" && p.ext.toUpperCase() !== ".ENV"; //Only watch for .ENV files.
return (
(!stats?.isFile() && p.ext !== "" && p.ext.toUpperCase() !== ".ENV") ||
p.name?.toUpperCase() === ".DS_STORE"
); //Only watch for .ENV files.
},
usePolling: pollingSettings.enabled || false,
interval: pollingSettings.interval || 30000,

View File

@@ -1,25 +1,33 @@
import { useState, useEffect } from 'react';
import ipcTypes from '../../../../../util/ipcTypes.json';
import { PaintScaleConfig, PaintScaleType } from '../../../../../util/types/paintScale';
import { useState, useEffect } from "react";
import ipcTypes from "../../../../../util/ipcTypes.json";
import {
PaintScaleConfig,
PaintScaleType,
} from "../../../../../util/types/paintScale";
import { message } from "antd";
import {useTranslation} from "react-i18next";
import { useTranslation } from "react-i18next";
type ConfigType = 'input' | 'output';
type ConfigType = "input" | "output";
export const usePaintScaleConfig = (configType: ConfigType) => {
const [paintScaleConfigs, setPaintScaleConfigs] = useState<PaintScaleConfig[]>([]);
const [paintScaleConfigs, setPaintScaleConfigs] = useState<
PaintScaleConfig[]
>([]);
const { t } = useTranslation();
// Get the appropriate IPC methods based on config type
const getConfigsMethod = configType === 'input'
const getConfigsMethod =
configType === "input"
? ipcTypes.toMain.settings.paintScale.getInputConfigs
: ipcTypes.toMain.settings.paintScale.getOutputConfigs;
const setConfigsMethod = configType === 'input'
const setConfigsMethod =
configType === "input"
? ipcTypes.toMain.settings.paintScale.setInputConfigs
: ipcTypes.toMain.settings.paintScale.setOutputConfigs;
const setPathMethod = configType === 'input'
const setPathMethod =
configType === "input"
? ipcTypes.toMain.settings.paintScale.setInputPath
: ipcTypes.toMain.settings.paintScale.setOutputPath;
@@ -29,15 +37,19 @@ export const usePaintScaleConfig = (configType: ConfigType) => {
.invoke(getConfigsMethod)
.then((configs: PaintScaleConfig[]) => {
// Ensure all configs have a pollingInterval and type (for backward compatibility)
const updatedConfigs = configs.map(config => ({
const defaultPolling = configType === "input" ? 1440 : 60;
const updatedConfigs = configs.map((config) => ({
...config,
pollingInterval: config.pollingInterval || 1440, // Default to 1440 seconds
pollingInterval: config.pollingInterval || defaultPolling, // Default to 1440 for input, 60 for output
type: config.type || PaintScaleType.PPG, // Default type if missing
}));
setPaintScaleConfigs(updatedConfigs || []);
})
.catch((error) => {
console.error(`Failed to load paint scale ${configType} configs:`, error);
console.error(
`Failed to load paint scale ${configType} configs:`,
error,
);
});
}, [getConfigsMethod]);
@@ -47,25 +59,40 @@ export const usePaintScaleConfig = (configType: ConfigType) => {
.invoke(setConfigsMethod, configs)
.then(() => {
// Notify main process to update cron job
if (configType === 'input') {
window.electron.ipcRenderer.send(ipcTypes.toMain.settings.paintScale.updateInputCron, configs);
} else if (configType === 'output') {
window.electron.ipcRenderer.send(ipcTypes.toMain.settings.paintScale.updateOutputCron, configs);
if (configType === "input") {
window.electron.ipcRenderer.send(
ipcTypes.toMain.settings.paintScale.updateInputCron,
configs,
);
} else if (configType === "output") {
window.electron.ipcRenderer.send(
ipcTypes.toMain.settings.paintScale.updateOutputCron,
configs,
);
}
})
.catch((error) => {
console.error(`Failed to save paint scale ${configType} configs:`, error);
console.error(
`Failed to save paint scale ${configType} configs:`,
error,
);
});
};
// New helper to check if a path is unique across input and output configs
const checkPathUnique = async (newPath: string): Promise<boolean> => {
try {
const inputConfigs: PaintScaleConfig[] = await window.electron.ipcRenderer.invoke(ipcTypes.toMain.settings.paintScale.getInputConfigs);
const outputConfigs: PaintScaleConfig[] = await window.electron.ipcRenderer.invoke(ipcTypes.toMain.settings.paintScale.getOutputConfigs);
const inputConfigs: PaintScaleConfig[] =
await window.electron.ipcRenderer.invoke(
ipcTypes.toMain.settings.paintScale.getInputConfigs,
);
const outputConfigs: PaintScaleConfig[] =
await window.electron.ipcRenderer.invoke(
ipcTypes.toMain.settings.paintScale.getOutputConfigs,
);
const allConfigs = [...inputConfigs, ...outputConfigs];
// Allow updating the current config even if its current value equals newPath.
return !allConfigs.some(config => config.path === newPath);
return !allConfigs.some((config) => config.path === newPath);
} catch (error) {
console.error("Failed to check unique path:", error);
return false;
@@ -74,10 +101,11 @@ export const usePaintScaleConfig = (configType: ConfigType) => {
// Handle adding a new paint scale config
const handleAddConfig = (type: PaintScaleType) => {
const defaultPolling = configType === "input" ? 1440 : 60;
const newConfig: PaintScaleConfig = {
id: Date.now().toString(),
type,
pollingInterval: 1440, // Default to 1440 seconds
pollingInterval: defaultPolling, // Default to 1440 for input, 60 for output
};
const updatedConfigs = [...paintScaleConfigs, newConfig];
setPaintScaleConfigs(updatedConfigs);
@@ -86,7 +114,9 @@ export const usePaintScaleConfig = (configType: ConfigType) => {
// Handle removing a config
const handleRemoveConfig = (id: string) => {
const updatedConfigs = paintScaleConfigs.filter((config) => config.id !== id);
const updatedConfigs = paintScaleConfigs.filter(
(config) => config.id !== id,
);
setPaintScaleConfigs(updatedConfigs);
saveConfigs(updatedConfigs);
};
@@ -94,7 +124,10 @@ export const usePaintScaleConfig = (configType: ConfigType) => {
// Handle path selection (modified to check directory uniqueness)
const handlePathChange = async (id: string) => {
try {
const path: string | null = await window.electron.ipcRenderer.invoke(setPathMethod, id);
const path: string | null = await window.electron.ipcRenderer.invoke(
setPathMethod,
id,
);
if (path) {
const isUnique = await checkPathUnique(path);
if (!isUnique) {

View File

@@ -35,7 +35,7 @@ const SettingsPaintScaleInputPaths = (): JSX.Element => {
handleRemoveConfig,
handlePathChange,
handlePollingIntervalChange,
} = usePaintScaleConfig("input");
} = usePaintScaleConfig("output");
const [isModalVisible, setIsModalVisible] = useState(false);
const [selectedType, setSelectedType] = useState<PaintScaleType | null>(null);

View File

@@ -33,7 +33,7 @@ const SettingsPaintScaleOutputPaths = (): JSX.Element => {
handleRemoveConfig,
handlePathChange,
handlePollingIntervalChange,
} = usePaintScaleConfig("output");
} = usePaintScaleConfig("input");
const [isModalVisible, setIsModalVisible] = useState(false);
const [selectedType, setSelectedType] = useState<PaintScaleType | null>(null);

View File

@@ -29,26 +29,26 @@
"duplicatePath": "The selected directory is already used in another configuration."
},
"labels": {
"actions": "Actions",
"addPaintScalePath": "Add Paint Scale Path",
"emsOutFilePath": "EMS Out File Path (Parts Order, etc.)",
"invalidPath": "Path not set or invalid",
"paintScalePath": "Paint Scale Path",
"paintScaleSettingsInput": "BSMS To Paint Scale",
"paintScaleSettingsOutput": "Paint Scale To BSMS",
"paintScaleType": "Paint Scale Type",
"pollingInterval": "Polling Interval (m)",
"pollinginterval": "Polling Interval (ms)",
"ppcfilepath": "Parts Price Change File Path",
"remove": "Remove",
"selectPaintScaleType": "Select Paint Scale Type",
"started": "Started",
"stopped": "Stopped",
"validPath": "Valid path",
"watchedpaths": "Watched Paths",
"watchermodepolling": "Polling",
"watchermoderealtime": "Real Time",
"watcherstatus": "Watcher Status",
"paintScaleSettingsInput": "BSMS To Paint Scale",
"paintScaleSettingsOutput": "Paint Scale To BSMS",
"paintScalePath": "Paint Scale Path",
"paintScaleType": "Paint Scale Type",
"addPaintScalePath": "Add Paint Scale Path",
"remove": "Remove",
"actions": "Actions",
"pollingInterval": "Polling Interval (m)",
"validPath": "Valid path",
"invalidPath": "Path not set or invalid",
"selectPaintScaleType": "Select Paint Scale Type"
"watcherstatus": "Watcher Status"
}
},
"title": {
@@ -57,6 +57,7 @@
},
"updates": {
"apply": "Apply Update",
"applying": "Applying update",
"available": "An update is available.",
"download": "Download Update",
"downloading": "An update is downloading."

View File

@@ -234,9 +234,53 @@
</concept_node>
</children>
</folder_node>
<folder_node>
<name>errors</name>
<children>
<concept_node>
<name>duplicatePath</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
<folder_node>
<name>labels</name>
<children>
<concept_node>
<name>actions</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>addPaintScalePath</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>emsOutFilePath</name>
<definition_loaded>false</definition_loaded>
@@ -250,6 +294,84 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>invalidPath</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>paintScalePath</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>paintScaleSettingsInput</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>paintScaleSettingsOutput</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>paintScaleType</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>pollingInterval</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>pollinginterval</name>
<definition_loaded>false</definition_loaded>
@@ -276,6 +398,32 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>remove</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>selectPaintScaleType</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>started</name>
<definition_loaded>false</definition_loaded>
@@ -302,6 +450,19 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>validPath</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>watchedpaths</name>
<definition_loaded>false</definition_loaded>
@@ -405,6 +566,19 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>applying</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>available</name>
<definition_loaded>false</definition_loaded>