Skip to content

WS-2209-UAS GET -Single Article status retrieval with new feature toggle#13827

Merged
jinidev merged 32 commits intolatestfrom
ws-2209-GET-UAS-single-article-status
Mar 31, 2026
Merged

WS-2209-UAS GET -Single Article status retrieval with new feature toggle#13827
jinidev merged 32 commits intolatestfrom
ws-2209-GET-UAS-single-article-status

Conversation

@jinidev
Copy link
Copy Markdown
Contributor

@jinidev jinidev commented Mar 24, 2026

Resolves JIRA: https://bbc.atlassian.net/browse/WS-2209

Summary

GET UAS API integration for fetching single article's Save status

Code changes

  • New feature toggle called "uasEnable" is introduced to safely enable or disable the functionality.
  • Adds useUASButton hook to determine if the “Save for later” button should be shown and fetch the article’s saved status, respecting the uasEnable feature toggle and if user is signed in (RN isSignedin is hardcoded for testing purpose).
  • Fetches the saved status of an article via UAS Activity integration using useUASFetchSaveStatus hook
  • Adds SaveArticleButton component allows users to save an article for later reading /remove it later
  • Renamed UAS API key env variable

Testing

image

  • Enable "Access-Control-Allow-Origin" for localhost using ModHeader extension (to avoid CORS issues)
image
  • Open any Hindi article page → with feature toggle ON, verify “Save for later” button is visible

Note: The “Save for later” button design is not yet finalized by UX; this PR focuses only on the API integration and logic for fetching saved status. UI/UX work will follow in a separate PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial “Save for later” integration against the UAS Activity API, gated behind a new uasEnable feature toggle, so article pages can fetch and reflect a single article’s saved status.

Changes:

  • Introduces uasEnable toggle (enabled in local for hindi, disabled in test/live).
  • Adds UAS utilities + hooks (useUASButton, useUASFetchSaveStatus) to decide visibility and fetch saved status.
  • Adds a temporary SaveArticleButton and wires it into ArticlePage.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/app/pages/ArticlePage/ArticlePage.tsx Adds SaveArticleButton into the timestamp area and passes article/service/auth state.
src/app/lib/uasApi/uasUtility.ts Adds shared UAS constants and helpers (globalId builder, article id parsing).
src/app/lib/uasApi/index.ts Switches activity type allow-list import to the new utility module.
src/app/lib/uasApi/activityTypes.ts Removes the old activityTypes module (moved to uasUtility).
src/app/lib/config/toggles/testConfig.js Adds uasEnable toggle (off).
src/app/lib/config/toggles/localConfig.js Adds uasEnable toggle (on for hindi).
src/app/lib/config/toggles/liveConfig.js Adds uasEnable toggle (off).
src/app/hooks/useUASFetchSaveStatus/index.ts New hook to fetch saved status via UAS GET.
src/app/hooks/useUASFetchSaveStatus/index.test.tsx Tests for the saved-status fetch hook.
src/app/hooks/useUASButton/index.ts New hook to gate/show the button and fetch saved status based on toggle/env/sign-in.
src/app/hooks/useUASButton/index.test.tsx Tests for the gating/show logic hook.
src/app/components/SaveArticleButton/index.tsx New temporary button component (logic only; UI TBD).
src/app/components/SaveArticleButton/index.test.tsx Tests for the new button component.
src/app/components/SaveArticleButton/index.styles.ts Temporary styles for the button.

@jinidev jinidev changed the title UAS GET -Single Article status retrieval with new feature toggle WS-2209-UAS GET -Single Article status retrieval with new feature toggle Mar 26, 2026
@amoore108
Copy link
Copy Markdown
Contributor

I notice the Save button flashes for a second and then disappears when visiting this article: http://localhost:7081/hindi/articles/crmxzlpygjpo?renderer_env=live

Is that expected? I think it should operate the other way around if that is the case, being hidden initially and then showing after hydration.

@jinidev
Copy link
Copy Markdown
Contributor Author

jinidev commented Mar 27, 2026

I notice the Save button flashes for a second and then disappears when visiting this article: http://localhost:7081/hindi/articles/crmxzlpygjpo?renderer_env=live

Is that expected? I think it should operate the other way around if that is the case, being hidden initially and then showing after hydration.

So debugged on this .
Confirmed that this only occurs when there’s an error while fetching the GET API. In that case, there’s a brief flash where the button shows its default state.
Currently, the flow is:

  • Show a loading state while the fetch is in progress
  • If there’s an error, hide the button

We will handle this flashing in future tickets by providing a placeholder skeleton and proper error handling.
This ticket doesnt have that scope

@jinidev jinidev merged commit cb350de into latest Mar 31, 2026
13 checks passed
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.

6 participants