Skip to content

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

Open
jinidev wants to merge 8 commits intolatestfrom
ws-2209-GET-UAS-single-article-status
Open

UAS GET -Single Article status retrieval with new feature toggle#13827
jinidev wants to merge 8 commits intolatestfrom
ws-2209-GET-UAS-single-article-status

Conversation

@jinidev
Copy link
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.
  • 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

Testing

Sign in to https://account.test.bbc.com/account/settings?web=true and copy the ckns_atkn cookie value → add it localhost cookie storage

image

Enable "Access-Control-Allow-Origin" for localhost (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
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.

Comment on lines +143 to +148
{/* Temporary SaveArticleButton */}
<SaveArticleButton
isSignedIn={isSignedIn}
articleId={parseArticleID(articleId)}
service={service}
/>
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

SaveArticleButton is rendered unconditionally inside the timestamp block. On AMP/Lite/App variants (which are explicitly gated for other interactive UI like ContinueReading), this risks rendering a non-functional button or incorrect saved state because client-side hooks/fetch may not run. Consider gating this behind !isAmp && !isLite && !isApp (or moving it to a canonical-only area).

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@jinidev, as far as I remember AMP and Lite sites are our of scope, but would we good to double check with Jon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Elvinas .Yes will ask , thats why kept this suggestion open

"topBarOJs": {
"enabled": true,
},
"uasEnable": {
Copy link
Member

Choose a reason for hiding this comment

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

Normally feature toggles does not contain enable suffix, probably it could be uasPersonalization or similar?

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.

3 participants