fix(psa): move CW clientId to server config, remove from user input

ClientId is a product-level GUID registered at developer.connectwise.com,
not per-MSP. Moved to settings.CW_CLIENT_ID env var. MSPs now only
provide site URL, company ID, public key, and private key.

Also added newline handling note to post_note() — CW Developer Guide
states \n is unsupported in JSON bodies. Needs sandbox testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-03-15 00:15:04 -04:00
parent db305f54e7
commit 7f3f054583
7 changed files with 26 additions and 28 deletions

View File

@@ -28,7 +28,6 @@ interface ConnectionForm {
company_id: string
public_key: string
private_key: string
client_id: string
}
const emptyForm: ConnectionForm = {
@@ -37,7 +36,6 @@ const emptyForm: ConnectionForm = {
company_id: '',
public_key: '',
private_key: '',
client_id: '',
}
type Tab = 'connection' | 'member-mapping' | 'post-history'
@@ -122,7 +120,7 @@ export function IntegrationsPage() {
if (form.company_id && form.company_id !== connection.company_id) update.company_id = form.company_id
if (form.public_key) update.public_key = form.public_key
if (form.private_key) update.private_key = form.private_key
if (form.client_id) update.client_id = form.client_id
// client_id is server-side (settings.CW_CLIENT_ID), not per-account
const updated = await integrationsApi.updateConnection(connection.id, update)
setConnection(updated)
@@ -177,7 +175,6 @@ export function IntegrationsPage() {
company_id: connection.company_id,
public_key: '',
private_key: '',
client_id: '',
})
setFormError(null)
setTestResult(null)
@@ -336,20 +333,6 @@ export function IntegrationsPage() {
/>
</div>
<div>
<label className="font-label text-[0.625rem] uppercase tracking-[0.1em] text-muted-foreground">
Client ID
</label>
<Input
type="text"
value={form.client_id}
onChange={(e) => setForm({ ...form, client_id: e.target.value })}
placeholder="ConnectWise Developer Client ID"
required={mode === 'setup'}
className="mt-1"
/>
</div>
{formError && (
<div className="flex items-center gap-2 rounded-md border border-red-400/20 bg-red-400/10 p-3 text-sm text-red-400">
<AlertCircle className="h-4 w-4 shrink-0" />

View File

@@ -20,7 +20,6 @@ export interface PsaConnectionCreate {
company_id: string
public_key: string
private_key: string
client_id: string
}
export interface PsaConnectionUpdate {
@@ -29,7 +28,6 @@ export interface PsaConnectionUpdate {
company_id?: string
public_key?: string
private_key?: string
client_id?: string
}
export interface PsaConnectionTestResponse {