Repository navigation
feat: release 4.5.0 (graduate dev → main) - #3430
Conversation
…king Adds a CMS-configurable RecommendationShelf section that renders VTEX personalization recommendations using the shared ProductCard, plus a global useStartSession hook (mounted in Layout) that starts the anonymous personalization session once per browser session and reports PDP product views.
Codegen regenerates @generated/schema.graphql from the API plus the src/graphql customization folders, so the operations used by the RecommendationShelf (recommendations, startSession, sendProductViewEvent) must be defined as thirdParty typeDefs to be valid in CI. Adds the schema extension and the recommendation types (referencing existing Advertisement and SkuSpecification), fixing the @faststore/core#generate build failure.
Adds recommendations, startSession and sendProductViewEvent to the expected query/mutation lists in the server schema test, reflecting the new thirdParty typeDefs.
Defines the recommendations query, the startSession and sendProductViewEvent mutations and their types (RecommendationResponse, RecommendationProduct, ProductViewSource, etc.) in the VTEX platform typeDefs. These are operations shipped by @faststore/core, so they must live in @faststore/api to be part of the schema generated for any consuming store (store-level src/graphql customizations are not visible to core features). Updates the schema assertion tests accordingly.
Addresses SonarQube findings on the new recommendation code: replaces negated conditions and nested ternaries with early returns, uses optional chaining, removes a dead duplicated branch in the request helper, drops a redundant always-falsy check and uses globalThis.window for the SSR guard. No behavior change.
Adds unit and component tests for the recommendation feature (vrn parsing, utils, product mapping, request/query helpers, useRecommendations, useStartSession and the RecommendationShelf component), bringing coverage on the new code above the 80% quality gate.
Resolves the remaining SonarQube finding: globalThis.window is always a valid reference, so the typeof guard is unnecessary.
…dationShelf.jsonc Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
The recommendations query is personalized (userId + campaign context), so a public/shared cache scope could leak one shopper's response to others via a CDN. Switch it to scope "private".
- Fix malformed JSON in the RecommendationShelf CMS schema (stray brace). - Move the userId cookie retry into a useEffect so it no longer kicks off async work and setState during render. - Stop logging recommendation args (which carry the userId) on fetch errors; log only non-identifying context. - In useStartSession, only mark a product view as sent after the mutation succeeds, so a failed request isn't permanently suppressed. - Extend tests to cover the new failure paths.
Decouples the useStartSession SDK hook from a UI component module: checkIsMobile and getUserIdFromCookie now live in src/sdk/analytics/utils. The component-level utils keeps only getWithRetry. Tests updated/split accordingly.
Point useRecommendations and useStartSession at src/sdk/graphql/* (persisted-query GET allowlist, cache busting, session-aware cache keys) and drop the duplicated RecommendationShelf/queries folder. Also type the useStartSession props instead of `any`.
…urable Expose carouselConfiguration (variant, infiniteMode, controls and per-viewport itemsPerPageDesktop/itemsPerPageMobile) and productCardConfiguration (showDiscountBadge, bordered) through the CMS, and add a code-level mapProductToProductCard override (defaults to mapRecommendationToProductCard, not exposed via CMS). Regenerate cms/faststore/schema.json accordingly.
Eliminate the SendProductViewEvent mutation and its associated logic from the useStartSession hook. The product view event is now captured through meta tags on the PDP, streamlining the session management process. Update tests to reflect these changes and ensure proper functionality without the removed mutation.
- Centralize campaign-type taxonomy in a single map in vrn.ts and make getTypeFromVrn total (returns null instead of throwing during render). - Extract cookie/userId orchestration into a useRecommendationUserId hook. - Use the canonical useScreenResize hook for paging instead of a bespoke checkIsMobile helper. - Unify the two ad-hoc retry mechanisms into a single src/utils/retry util (with backoff and AbortSignal support). - Document why the recommendations query fetches the full product shape (mapProductToProductCard is overridable).
…n and update related logic - Updated GraphQL schema and mutation definitions to reflect the renaming of `startSession` to `startRecommendationSession`. - Adjusted integration tests and hooks to utilize the new mutation name. - Introduced a new hook, `useStartRecommendationSession`, to manage the session initiation process. - Updated the `Layout` component to call the new hook, ensuring the recommendation session starts correctly per browser session.
…ent interface Resolve recommendations in @faststore/api (recommendations query and startRecommendationSession mutation) and map the BFF payload straight to the normalized StoreProduct shape via pickBestSku + enhanceSku, so recommendation shelves expose the same product interface as the rest of the storefront. Update RecommendationShelf and useRecommendations to consume StoreProduct directly, with a configurable product card component and mapper, and drop the now-unused RecommendationProduct mapper.
…nResult and update related logic - Renamed `startSession` to `startRecommendationSession` in the recommendation client and updated the corresponding types. - Adjusted the resolver to call the new session initiation method. - Removed the now-unnecessary `useStartSession` hook to streamline the session management process.
…xt and carousel settings - Introduced `itemsContext` prop to allow selection between 'PDP' and 'CART' for product context in recommendations. - Updated `RecommendationShelf` to utilize the new `itemsContext` for fetching recommendations based on the selected context. - Refactored carousel configuration to directly accept `itemsPerPageDesktop`, `itemsPerPageMobile`, `variant`, `infiniteMode`, and `controls` as props, improving customization options. - Adjusted related types and documentation to reflect these changes.
Co-authored-by: Felipe Sales <[email protected]>
… and enable opt-in feature - Added server-side validation for `campaignVrn`, `userId`, and `products` in the recommendations resolver to ensure clean input. - Introduced an opt-in flag `enableRecommendations` in the discovery configuration to control the initiation of recommendation sessions and API calls. - Updated `RecommendationShelf` and related components to respect the opt-in flag, preventing unnecessary API calls when recommendations are disabled. - Enhanced tests to cover scenarios for the new validation and opt-in feature.
Extend scripts/verify-publish-manifests.mjs to fail the build when a publishable package is missing/mismatched on repository.url (compared to the root repo) or has a repository.directory that does not point at the package. A missing repository.url fails npm provenance with E422 — the exact failure that hit @faststore/diagnostics during the v4 launch.
In fixed-version mode all packages must move together. Use --force-conventional-graduate on `release` (plain --force-publish is ignored when combined with --conventional-graduate) and --force-publish on `release:v3`, so the latest / v3-latest tags never end up with a partially published set of packages.
Add a non-blocking diagnostic (scripts/diagnose-changed.mjs) wired into the release workflow that runs `lerna changed` and emits a warning explaining the "No changed packages to version" situation, instead of a silent no-op that reads like a broken release.
Add an informational, non-blocking CI job (scripts/check-provenance.mjs) that inspects each published package's latest version and warns when it lacks a provenance attestation — the symptom of a manual publish instead of the CD OIDC Trusted Publisher, which broke @faststore/diagnostics in the v4 launch.
Add a workflow_run-triggered workflow that opens a PR back-merging main into dev after every release (push cannot be used because the release commit is `[no ci] Release: x.y.z`). Deterministic conflicts (version fields and CHANGELOGs) are resolved by scripts/back-merge-resolve.mjs and generated files/lockfile are regenerated; anything else is auto-resolved to the dev side and the PR opens as a draft flagged for manual review.
Updated the ProductGallerySection component to explicitly cast the context to PLPContext when accessing the SEO title from the collection data. This change ensures type safety and prevents potential runtime errors.
Added a new test case to verify the functionality of requesting shopper contract fields from the sessions API in the VTEX Commerce test suite. This enhances test coverage for session-related API interactions.
Updated the release workflow to install npm version 11.x, ensuring compatibility with the current Node.js runtime and OIDC Trusted Publishing requirements. This change prevents potential issues that arise from using npm@latest, which requires a higher Node version.
Enable Recommendations opt-in via CMS by adding StartRecommendationSession to Global Sections, removing the experimental.enableRecommendations flag and Layout wiring so merchants can set up shelves without code changes.
## What's the purpose of this pull request? Stores couldn't self-host fonts: `.woff`/`.woff2` files placed in `public/` were dropped during `@faststore/cli`'s generate step and returned 404 in production. This blocks GDPR-sensitive (EU) stores and hurts Core Web Vitals, forcing merchants to inline fonts as base64. ## How it works? `copyPublicFiles` in `packages/cli/src/utils/generate.ts` used a fragile filter that matched extensions as a substring (`endsWith`) and cut whole subdirectories. It now: - Always allows directories, so nested assets (e.g. `public/fonts/`) are traversed instead of being skipped. - Matches the **real** file extension via `path.extname().toLowerCase()`, fixing false matches (e.g. `basico` matching `ico`). - Expands the allowlist with font formats: `.woff`, `.woff2`, `.ttf`, `.otf`, `.eot`. The decision logic was extracted into a pure, exported `isPublicFileAllowed(src, isDirectory)` and covered by unit tests. ## How to test it? - Add a font under `public/fonts/` (e.g. `public/fonts/inter.woff2`) in a store. - Run the generate step and confirm the file is copied to `.faststore/public/fonts/`. - Confirm the font resolves (no 404) in the built store. - Unit tests: `pnpm turbo run test --filter=@faststore/cli`. ## References - Jira: [SO-640](https://vtex-dev.atlassian.net/browse/SO-640) - Related issue: #3332 [SO-640]: https://vtex-dev.atlassian.net/browse/SO-640?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved build copying for the public assets directory using an explicit, case-insensitive extension allowlist (including self-hosted font files). * Prevented unsupported or misleading filenames/extensions from being copied. * Ensured directories are always included, and the copy process skips entries that can’t be inspected instead of failing. * **Tests** * Expanded coverage for public asset filtering and copying behavior, including nested font assets and scenarios like dangling/unstat’able entries. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…rate session start into RecommendationShelf Eliminate the StartRecommendationSession component, shifting its functionality to the RecommendationShelf. Introduce an `enableRecommendations` prop to control the personalization session initiation directly from the shelf, streamlining the setup process for merchants. Update related documentation and tests accordingly.
- Localized Slugs Links Feature - PDP localized slugs #3352 - PLP localized slugs #3401 ## Behavioral changes Retiring `pagetype` on the collection path in favor of the typed `by-linkid` cascade changes two observable behaviors. Neither is a schema change — no query breaks — but both are worth calling out for stores that rely on them. **1. `StoreCollection.type` no longer returns `Cluster` or `SubCategory`.** The old resolver passed the Catalog `pageType` string through verbatim, so it could return any of six values. The new resolution infers the entity type from *which* `by-linkid` endpoint answered, which yields three buckets (category / brand / collection), refined to four by `fatherCategoryId`: - **Clusters now report as `Collection`.** Clusters and curated collections are both served by `collection/by-linkid`, and its response carries no discriminator between them. - **Third-level categories now report as `Category`.** The category response exposes only `fatherCategoryId`, which distinguishes root from non-root but not tree depth. Recovering `SubCategory` would require an extra parent lookup on the PLP hot path. Both enum values remain declared for backward compatibility and their descriptions now document that they are no longer returned. Nothing in `@faststore/core` selects or branches on `type`, so only stores that explicitly query `collection { type }` are affected — and they fail silently (a conditional stops matching) rather than erroring. Enum cleanup is tracked for the next major in SFS-3291. **2. Slugs that exhaust the cascade now return 404 instead of falling back to full-text search.** `pagetype` implicitly promoted unmatched single-segment slugs to a full-text search. The cascade returns `NotFoundError` when category, brand and collection all miss. This is a deliberate deferral (spec Decision 3) and can be revisited behind an explicit flag. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added VTEX locale-specific product, category, brand, and collection lookups to power localized URLs, breadcrumbs, and SEO (including `hreflang` alternate links). * Introduced `otherLocales` for product and collection GraphQL responses, surfaced through new localized product page/PLP context. * **Bug Fixes** * Improved locale selection and fallback behavior for both localized and non-localized stores. * Enhanced multi-segment collection handling via by-linkid resolution, plus more reliable error “back” URLs and breadcrumb link rendering. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <[email protected]>
## What's the purpose of this pull request? Pricing is a single point of failure in VTEX's sales flow. Pricing Fallback lets the storefront forward a **signed price** (JWT) so Checkout can trust the shelf price and keep closing orders even when the Pricing System is down. This PR makes FastStore forward the `priceToken` that Intelligent Search now emits, all the way into Checkout's add-to-cart. ## How it works? The signed token (`commertialOffer.PriceToken` from Intelligent Search) is piped through the existing offer → cart → `validateCart` path, no new operations: - **`@faststore/api`**: expose `priceToken` on `StoreOffer`/`IStoreOffer`, resolve it from the search offer, and map it to Checkout's `OrderFormInputItem.priceToken` (only when present). - **`@faststore/core`**: request `priceToken` in the offer/cart fragments and send it on `ValidateCartMutation`. With `enableClientOffer`, the PDP prefers a fresh token from `useOffer` (IS fetched client-side) since the token is short-lived (~30 min). - **`@faststore/components`**: optional `priceToken` on SKU Matrix / Product Comparison offer types (typing only). The field is fully optional: when Intelligent Search omits it (flag off / signing failure / non-IS offer), behavior is identical to today. Invalid/expired tokens are treated as unsigned by Checkout, with no storefront error. Also fixes a cart validation loop: `equals()` in `validateCart` was comparing the full offer, so the browser-only `priceToken` (absent on the orderForm response) made carts never match, looping `ValidateCartMutation`. It now ignores `priceToken`. ## How to test it? - Use an account with the Intelligent Search Pricing Fallback flag enabled. - Open a PDP and confirm the product query returns `offers.offers[].priceToken`. - Add to cart and check the `ValidateCartMutation` request: `acceptedOffer[].priceToken` carries the JWT. - Confirm the cart syncs and `ValidateCartMutation` does **not** loop. - On an account without the flag, confirm add-to-cart works with no `priceToken` sent. ### Starters Deploy Preview <!-- TODO: preview link --> ## References - Jira: <!-- TODO: Jira link --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added pricing token support across product offers, carts, checkout payloads, and buy-button flows. * Updated PDP, product cards/details, search results, comparisons, and SKU matrix UI to fetch and forward pricing tokens. * Enhanced offer fetching so client results can refresh the active pricing token for add-to-cart. * **Bug Fixes** * Prevented pricing-token-only changes from causing false “cart changed” detections during cart validation. * Improved GraphQL/schema and resolver behavior when tokens are unavailable, ensuring consistent null handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…MS content (#3417) ## What's the purpose of this pull request? My Account routes (`pvt/account/*`, `pvt/organization-account/*`) can return HTTP 500 store-wide. Two independent triggers cause it: (1) a representative session whose VTEX `profile` namespace comes back empty, making `accountProfile` call `getContractById('')` and throw a 400; (2) a My Account content type without a published CMS document, which resolves to `undefined` and is dereferenced. The `/pvt/account/404` fallback runs the same queries, so it also 500s and there is no graceful degradation. ## How it works? - `@faststore/api` `accountProfile`: aligns with `validateSession` — resolves the contract id via `resolveActiveContractIdFromSession` with a `jwt.customerId` fallback, only calls `getContractById` when an id exists, and wraps it in `try/catch`. Name/email/id fall back to the `shopper`/`authentication` namespaces and the JWT. - `@faststore/core` My Account SSR: defaults CMS content to empty sections when no document is published, and stops dereferencing `account.data.accountProfile.name` / `page` without guarding `null`/`undefined` (including the `/404` fallback page). ## How to test it? - Sign in to a B2B storefront as a **representative** user and navigate to any My Account page (e.g. `/pvt/account/profile`); it should render instead of 500, even when the session `profile` namespace is empty. - Unpublish a My Account content type (e.g. `myAccountProfile`) in the CMS and open the page; it should render default sections instead of 500. - `cd packages/api && pnpm test:unit` (new `accountProfile` cases covering empty/all-null sessions). ### Starters Deploy Preview N/A ## References - Slack thread: https://vtex.slack.com/archives/C08QH7W3C2Y/p1784313602904399 - [jira task](https://vtex-dev.atlassian.net/jira/software/c/projects/SFS/boards/1051?selectedIssue=SFS-3293) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved representative account profile resolution by deriving name/email/id from VTEX session data when profile fields are missing, and making contract lookup conditional and more fault-tolerant. * Hardened My Account server-side props and the account 404 page, plus CMS page content loading, with safe fallbacks when data is missing. * **Tests** * Added unit coverage for representative account profile resolution, including missing contract IDs, lookup failures, and session profile precedence. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request? After the My Account CMS migration, **new** account pages created by a store were still code-only — merchants could not author/edit them in CMS Admin. This PR closes that gap ([SFS-3250](https://vtex-dev.atlassian.net/jira/software/c/projects/SFS/boards/1051?selectedIssue=SFS-3250)): stores can declare a My Account route bound to a CMS content-type and render it SSR like native pages. ## How it works? - Opt-in: optional `contentType` on `Route` in `navigation.ts` (no separate `source` flag). - **Mode A:** `contentType` + no `.tsx` → body 100% from CMS (CLI generates the page). - **Mode B:** `contentType` + `.tsx` → CMS sections + code body (+ optional before/after). - No `contentType` → legacy code-only wrap (unchanged). - **core:** widened `MyAccountContentType`; new `myAccountCmsServerSideProps` (same auth as native pages). - **cli:** parses `navigation.ts`, generates pages via `myAccountCmsPageTemplate`; skips native collisions and routes outside `/pvt/account`. ## How to test it? - Unit tests in `@faststore/core` and `@faststore/cli` (CMS SSR, routes, page generation). - In a store (e.g. b2bfaststoredev): add `contentType` on a route, add content-type under `cms/faststore/pages/`, `cms-sync`, publish sections in Admin, open the route logged in. - Regression: routes without `contentType` and existing before/after still work. - See also: `specs/007-myaccount-cms-custom-pages/quickstart.md`. ## References - [SFS-3250](https://vtex-dev.atlassian.net/jira/software/c/projects/SFS/boards/1051?selectedIssue=SFS-3250) - Spec/RFC: `specs/007-myaccount-cms-custom-pages/` [SFS-3250]: https://vtex-dev.atlassian.net/browse/SFS-3250?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [SFS-3250]: https://vtex-dev.atlassian.net/browse/SFS-3250?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added CMS-driven “My Account” page generation for routes under `/pvt/account` using an optional content type. * Supports hybrid pages with customization code and optional before/after sections. * Supports custom CMS content types and preserves existing native pages. * Added routing safeguards to prevent invalid or conflicting page generation. * **Tests** * Expanded coverage for CMS route parsing, page generation, templates, redirects, and server-side data loading. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
Important Review skippedToo many files! This PR contains 188 files, which is 38 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to Pro+ to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (17)
📒 Files selected for processing (188)
You can disable this status message by setting the Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage (29.30% Estimated after merge)
Summary
Graduation of the
devprerelease cycle (4.5.0-dev.7) into a stable4.5.0release onmain. Merging this PR triggers thereleaseCD workflow, which runslerna version --conventional-graduate --force-conventional-graduateand publishes all 8@faststore/*packages under thelatestdist-tag.The bump is decided by the Conventional Commits accumulated on
dev(multiplefeat:present → minor4.5.0).Highlights (features)
Fixes
Packages published (latest)
@faststore/{api,cli,components,core,diagnostics,lighthouse,sdk,ui}→4.5.0Test plan
releaseworkflow succeeds onmain4.5.0under thelatestdist-tag on npmmain→devto open the next dev cycleMade with Cursor