Skip to content

feat: update consumers for new input setting#21

Open
ahasseyp-paragon wants to merge 10 commits intomainfrom
feat/set-data-sources
Open

feat: update consumers for new input setting#21
ahasseyp-paragon wants to merge 10 commits intomainfrom
feat/set-data-sources

Conversation

@ahasseyp-paragon
Copy link
Contributor

@ahasseyp-paragon ahasseyp-paragon commented Mar 4, 2026

Issues Closed

  • PARA-18633
  • PARA-19271

Brief Summary

adopt setDataSources api and typed source objects across inputs

Detailed Summary

This PR migrates the headless connect example app to use the new paragon.setDataSources() API and the paragon.getSourcesForInput() resolver. Previously, input components fetched data source configurations via useDataSourceOptions using string-based sourceType cache keys. Now, a centralized setDataSources call in app.tsx configures all dropdowns, field mapping sources, and integration-specific overrides upfront, and each component resolves its typed source objects through the new useSourcesForInput hook.

This aligns the example app with the updated @useparagon/connect SDK, which introduces typed source discriminators (SingleSource, DefaultFieldValueSources, FieldMapperSources) and a source-first overload for getFieldOptions.

Changes

  • Added paragon.setDataSources() call in app.tsx configuring static dropdowns (priority-level), dynamic dropdowns (pokemon-picker via PokeAPI), static field mappings (Test), dynamic field mappings with object types (Task via PokeAPI), and integration-specific source overrides (jira)
  • Introduced useSourcesForInput hook in hooks.ts that wraps paragon.getSourcesForInput() with memoization
  • Updated useFieldOptions in hooks.ts to accept an optional source: DynamicDataSource alongside the existing sourceType: string, with source taking priority when provided
  • Migrated combo-input.tsx and dynamic-combo-input.tsx from useDataSourceOptions<ComboInputDataSource> to useSourcesForInput with DefaultFieldValueSources type
  • Migrated dynamic-enum.tsx from useDataSourceOptions to useSourcesForInput with SingleSource type
  • Migrated field-mapper.tsx from useDataSourceOptions<FieldMapperDataSource> to useSourcesForInput with FieldMapperSources type; added fieldMappingEntries computed property supporting mapObjectFieldOptions; extracted renderMainInputOptions helper to deduplicate JSX
  • Refactored field-mapper.tsx search logic to use early returns and for..of instead of indexed loops
  • Extracted CustomDropdownInput component in serialized-connect-input-picker.tsx that resolves source type at runtime and renders either a ComboboxField (dynamic) or SelectField (static)
  • Updated variable-input.tsx props from string-based keys (sourceType, mainInputKey, dependantInputKey) to typed DynamicDataSource objects (variableInputSource, mainInputSource, dependantInputSource)

Future Work

  • Remove the legacy sourceType: string path from useFieldOptions once all consumers have migrated to the source object pattern
  • Add error boundaries or fallback UI for when useSourcesForInput returns null (no matching data source configured)
  • Consider paginated support for the CustomDropdownInput dynamic path (cursor-based loading)

Steps to Test

  1. Run the headless connect example app locally
  2. Authenticate and open an integration's workflow settings
  3. Verify CustomDropdown inputs render correctly — static dropdowns should show flat options, dynamic dropdowns (e.g., pokemon-picker) should fetch and display options from the API with search support
  4. Verify DynamicEnum inputs still load options and support local filtering for non-paginated sources
  5. Verify ComboInput and DynamicComboInput fields resolve main/dependent inputs and variable inputs correctly
  6. Verify FieldMapper loads object types, dependent inputs, and field mapping entries — test both static (Test) and dynamic (Task) configurations
  7. Test the jira integration specifically to confirm integration-specific source overrides apply (e.g., priority-level should show 5 options instead of 3)

QA Notes

  • The setDataSources call uses PokeAPI as a demo data source — this is for example/testing purposes only
  • The sourceType string fallback path is still present in useFieldOptions for backward compatibility — both paths should be exercised

Deployment Notes

  • No configuration changes, migrations, or environment variable updates required
  • Requires the @useparagon/connect SDK version that exposes setDataSources, getSourcesForInput, and the typed source interfaces (SingleSource, DefaultFieldValueSources, FieldMapperSources, DynamicDataSource, StaticEnumDataSource)

Screenshots

N/A — headless (non-visual) integration changes; UI behavior unchanged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant