Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the embedded React SDK’s ConnectDialog/workflow-input rendering to support a new field_mapping workflow input type, including client-side JWT sub extraction and a new action-execution hook used by mapping callbacks.
Changes:
- Add
field_mappingas a supportedWorkflowInputTypeplus exported mapping-related types. - Introduce action execution support (
useExecuteAction) and JWTsubdecoding for embedded action endpoints. - Add a new
FieldMappingFieldUI + tests, and threadexecuteAction/mapObjectFieldsthrough ConnectDialog.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/frontend/embedded/library/react/src/main.ts | Re-export mapping-related public types from the SDK entrypoint. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/utils.ts | Add decodeJwtSubject helper used to derive external user id from JWT. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/utils.test.ts | Add unit tests for decodeJwtSubject. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/useExecuteAction.ts | New hook that POSTs to embedded generic action execution endpoint. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/useExecuteAction.test.ts | Add hook tests for request shape and missing-user behavior. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/types.ts | Extend workflow input types with field_mapping and introduce mapping config/value types. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/index.tsx | Compute externalUserId, create executeAction, and pass mapping props into ConnectDialog. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/FieldMappingField.tsx | New field-mapping input UI component with async option loading and custom field creation. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/FieldMappingField.test.tsx | Tests for object type loading, integration-field loading, and emitted mapping value shape. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/ConnectDialog.tsx | Thread executeAction/mapObjectFields and render FieldMappingField for field_mapping inputs. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/ConnectDialog.internalOnly.test.tsx | Test that internalOnly inputs are hidden in workflows view. |
| sdks/frontend/embedded/library/react/src/components/connect-dialog/ConnectDialog.dynamic.test.tsx | Tests around dynamic options fetching, dependency handling, and cache key behavior. |
Comments suppressed due to low confidence (1)
sdks/frontend/embedded/library/react/src/components/connect-dialog/types.ts:133
WorkflowInputType.valuedoesn't include theFieldMappingValueTypeshape even thoughtype: 'field_mapping'expects that value. Including it in the union improves type-safety and avoids downstream casts inConnectDialog.
export interface WorkflowInputType {
name: string;
label: string;
objectName?: string;
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'field_mapping';
componentReference?: ComponentInputReferenceType;
defaultValue?: unknown;
internalOnly?: boolean;
required?: boolean;
value?: string | number | readonly string[] | Record<string, unknown> | undefined;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- decodeJwtSubject: restore base64url padding before atob so valid tokens no longer throw when the payload length is not a multiple of 4 - FieldMappingField: derive HTML ids from a sanitized label base plus row index so labels/custom fields with spaces cannot break label-for association or collide on DOM ids - FieldMappingField: trim prompted custom-field names and reject duplicates to avoid silently overwriting rows/mappings - ConnectDialog: only pass executeAction once externalUserId and the integration instance id exist, so FieldMappingField does not mount and fetch empty options before its prerequisites are ready Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…latten SDK layout
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.