Skip to content

Feast "Saved from web" recipe state#16412

Open
andresilva-guardian wants to merge 4 commits into
afs/feast-contextual-nudge-braze-bannersfrom
afs/save-feast-recipe-from-the-web
Open

Feast "Saved from web" recipe state#16412
andresilva-guardian wants to merge 4 commits into
afs/feast-contextual-nudge-braze-bannersfrom
afs/save-feast-recipe-from-the-web

Conversation

@andresilva-guardian

@andresilva-guardian andresilva-guardian commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What does this change?

We have added support for checking and updating whether a recipe has already been saved to a reader's Feast "Saved from web" list.

On the server, we added a new proxy route (/api/saved-from-web) that forwards a reader's bearer token straight through to the Feast API's /v2/saved-from-web endpoints, via handleGetSavedFromWeb (GET, checks which recipe ids are saved) and handlePutSavedFromWebRecipe (PUT, adds a recipe to the list). We went through DCR's own server rather than calling the Feast API directly from the browser, since this sidesteps needing Feast API-side CORS configuration for browser origins.

On the client, we added src/lib/feast/savedFromWeb.ts with getFeastSavedFromTheWebRecipes and addFeastRecipeToSavedFromWebList, which call the new proxy routes. getFeastSavedFromTheWebRecipes caches in-flight and resolved requests by user id and recipe ids, so that when multiple FeastContextualNudge islands hydrate on the same page, only one network request is made for the whole batch of recipe ids rather than one per nudge.

We updated ArticleRenderer to compute the full list of recipe ids that will get a nudge on the page upfront and pass it to every FeastContextualNudge instance as allNudgeRecipeIds. Each FeastContextualNudge then uses this, together with the signed-in reader's id and access token, to fetch whether its own recipe is already saved, and passes an isRecipeSaved flag through to the Braze banner.

We also added a SaveFeastRecipeById message type to BrazeBannersSystem, so a Braze banner can ask DCR to save a Feast recipe to the reader's list on their behalf. This calls addFeastRecipeToSavedFromWebList with the reader's access token, logs the outcome, and posts the result back to the banner along with a custom Braze event (braze_banner_save_feast_recipe).

Why?

We want Feast contextual nudges (and the Braze banners they render) to reflect whether a reader has already saved a given recipe from the web, and to let readers save a recipe directly from the banner. Batching the "is this saved?" check across all nudges on a page, and caching it, avoids making a separate network request per nudge when several appear on the same article.

How has this change been tested?

Screenshots

Before After
before after

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

@andresilva-guardian
andresilva-guardian changed the base branch from main to afs/feast-contextual-nudge-braze-banners July 20, 2026 09:17
@andresilva-guardian andresilva-guardian added the feature Departmental tracking: work on a new feature label Jul 21, 2026
@andresilva-guardian andresilva-guardian changed the title Afs/save feast recipe from the web Feast "Saved from web" recipe state Jul 21, 2026
@andresilva-guardian
andresilva-guardian marked this pull request as ready for review July 21, 2026 15:06
@andresilva-guardian
andresilva-guardian requested review from a team as code owners July 21, 2026 15:06
@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

…722105844 in package.json and pnpm-lock.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant