Skip to content

Commit 9e12982

Browse files
fix(enrichment): report rejected optional inputs
1 parent 6c54fa6 commit 9e12982

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

apps/sim/enrichments/readiness.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ describe('getEnrichmentReadiness', () => {
5151
expect(readiness.missingInputs.map((input) => input.id)).toEqual(['domain'])
5252
})
5353

54+
it('includes rejected optional values when another provider-specific input is blank', () => {
55+
const readiness = getEnrichmentReadiness(workEmailEnrichment, {
56+
fullName: 'John Doe',
57+
companyDomain: 'https://',
58+
linkedinUrl: '',
59+
})
60+
61+
expect(readiness.ready).toBe(false)
62+
expect(readiness.missingInputs.map((input) => input.id)).toEqual([
63+
'companyDomain',
64+
'linkedinUrl',
65+
])
66+
})
67+
5468
it('formats select-backed row inputs before checking provider request builders', () => {
5569
const columns: ColumnDefinition[] = [
5670
{

apps/sim/enrichments/readiness.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ export function getEnrichmentReadiness(
3838
const ready = enrichment.providers.some((provider) => provider.buildParams(inputs) !== null)
3939
if (ready) return { ready: true, missingInputs: [] }
4040

41-
const missingInputs = enrichment.inputs.filter((input) => isEmpty(inputs[input.id]))
41+
const providerSpecificInputs = enrichment.inputs.filter((input) => !input.required)
4242
return {
4343
ready: false,
44-
/** If every input is present but every provider rejects the values, surface
45-
* all fields as actionable rather than rendering a reasonless wait state. */
46-
missingInputs: missingInputs.length > 0 ? missingInputs : enrichment.inputs,
44+
missingInputs: providerSpecificInputs.length > 0 ? providerSpecificInputs : enrichment.inputs,
4745
}
4846
}
4947

0 commit comments

Comments
 (0)