Redirect Reconnect Flow To Successor Provider When Configured#604
Redirect Reconnect Flow To Successor Provider When Configured#604boris-careev wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the external account reconnect experience so that when an external account provider is configured with a successorID, reconnect silently targets the successor provider instead of the legacy provider.
Changes:
- Hide Refresh and show Reconnect for accounts whose provider has a
successorID(with an exception for delete-in-progress). - Update reconnect behavior to call
connectExternalAccount(successorID ?? id). - Add Storybook preview data/stories to exercise successor-provider scenarios.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/presentational/SingleExternalAccount/SingleExternalAccount.tsx | Adjusts Refresh/Reconnect visibility rules, including successor-provider behavior. |
| src/components/presentational/SingleExternalAccount/SingleExternalAccount.stories.tsx | Adds successor-provider Storybook scenarios for the presentational component. |
| src/components/container/ExternalAccountList/ExternalAccountList.tsx | Reconnect now targets successorID ?? id; adds preview state for successor demo data. |
| src/components/container/ExternalAccountList/ExternalAccountList.stories.tsx | Adds a successor-provider story (but currently has issues with args wiring / previewState values). |
| src/components/container/ExternalAccountList/ExternalAccountList.previewdata.tsx | Adds preview data including providers with successorID. |
| package.json | Bumps version to a prerelease identifier for this change set. |
| package-lock.json | Keeps lockfile version in sync with package.json version change. |
Comments suppressed due to low confidence (2)
src/components/container/ExternalAccountList/ExternalAccountList.stories.tsx:70
- The
Livestory is not configuring its own args: it declaresexport const Live = ...but then assigns toDefault.args, overwriting the Default story instead. Update this to setLive.args(and keepDefault.argsintact) so Storybook renders both stories as intended.
export const Live = Template.bind({});
Default.args = {
externalAccountProviderCategories: ["Provider", "Health Plan", "Device Manufacturer"]
};
src/components/presentational/SingleExternalAccount/SingleExternalAccount.tsx:88
- Using
href="javascript:{}"for the Reconnect control is brittle (can be blocked by CSP) and is not ideal for accessibility/semantics. Prefer rendering this as a<button type="button">(or the existingUnstyledButton) so it behaves like an action rather than a navigation link.
<p>
<a href="javascript:{}" onClick={() => props.onReconnectAccount(props.externalAccount)}>
<FontAwesomeSvgIcon icon={faRepeat} /> {language("external-account-reconnect")}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const WithSuccessorProvider = Template.bind({}); | ||
| WithSuccessorProvider.args = { | ||
| previewState: "withSuccessor", | ||
| externalAccountProviderCategories: ["Provider"] | ||
| }; |
| {(getStatus() === "unauthorized" || (!!props.externalAccount.provider.successorID && getStatus() !== "deleting")) && | ||
| getStatus() !== "fetchingData" && getStatus() !== "deleting" && | ||
| <p> |
| <p> | ||
| <a href="javascript:{}" onClick={refresh}> | ||
| <FontAwesomeSvgIcon icon={faRepeat} /> {language("external-account-refresh")} |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Overview
When a provider has a
successorIDconfigured, the existing Reconnect button now silently targets the successor provider instead of the legacy one - no additional UI or user-facing wording is introduced.Changes:
SingleExternalAccount: Only the Reconnect link is shown for accounts whose provider has asuccessorID, regardless of the account's sync status (except while the account is being deleted or refreshed). Previously it only appeared onunauthorizedaccounts.ExternalAccountList:reconnectAccountnow resolves the provider ID assuccessorID ?? id, so theconnectExternalAccountcall targets the successor when one is configured. The backend is then responsible for detecting the predecessor account and cleaning it up after the successor connection succeeds.Security
These changes only alter which provider ID is passed to the existing
connectExternalAccountAPI call. No new endpoints, no credentials, no data exposure. The successor ID comes from the provider model already returned by the API.Testing
To test, configure a provider with a
successorIDin the backend and verify:externalaccountproviders/{successorID}/connect).successorIDretain existing reconnect behavior unchanged.Documentation
@CareEvolution/api-docs.Reviewers
Assign to the appropriate reviewer(s). Minimally, a second set of eyes is needed ensure no non-public information is published. Consider also including:
Consider "Squash and merge" as needed to keep the commit history reasonable on
main.