feat!: faststore v4#3111
Conversation
35f28db to
4856212
Compare
Merge the changes from main
## What's the purpose of this pull request? With these changes, if merchants remove the footer logo the entire footer component will not be hid anymore, it will throw a console error but the component should be displayed with no logo.
#3077) ## What's the purpose of this pull request? This PR fixes the `border-radius` of the Slider thumb in Firefox. The current CSS rule for Mozilla uses an inexistent variable, making the browser render a square instead of a circle: <img width="1028" height="181" alt="image" src="https://github.com/user-attachments/assets/50c08d79-a6a9-4d31-b2e7-5ef9e287080f" /> ## How it works? The `--fs-slider-thumb-radius` variable is replaced by `--fs-slider-thumb-border-radius`, the one that is defined in the default thumb variables. ## How to test it? - Use the `Local Install Instructions` from the [CodeSandbox CI](https://ci.codesandbox.io/status/vtex/faststore/pr/3077) to add this version in the `package.json` of a store. - Import the `Slider` atom (and styles) in a component following the docs: https://developers.vtex.com/docs/guides/faststore/atoms-slider - Run the store in development mode and browse it in Mozilla Firefox. ### Starters Deploy Preview I'm unable to generate a preview link but here's a screenshot from localhost: <img width="1287" height="617" alt="image" src="https://github.com/user-attachments/assets/f0a5a5e9-d657-41db-9415-303b5d17fefd" /> ## Checklist **PR Title and Commit Messages** - [x] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. _(No permissions. It's a bug though.)_ **Dependencies** - [N/A] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [x] PR description - [N/A] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request)
- Add RTL Support --------- Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br> Co-authored-by: Leandro Rodrigues <leandro.swf@gmail.com> Co-authored-by: Eduardo Formiga <eduardo.formiga@gmail.com> Co-authored-by: vtexgithubbot <vtexgithubbot@github.com> Co-authored-by: Lucas Feijó <lucas.portela@vtex.com>
4856212 to
c8a37d9
Compare
## What's the purpose of this pull request? Upgrading next version to 15 --------- Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br> Co-authored-by: Matheus P. Silva <cout.matheusps@gmail.com> Co-authored-by: Leandro Rodrigues <leandro.swf@gmail.com> Co-authored-by: Eduardo Formiga <eduardo.formiga@gmail.com> Co-authored-by: vtexgithubbot <vtexgithubbot@github.com> Co-authored-by: Lucas Feijó <lucas.portela@vtex.com> Co-authored-by: Luiz Falcão <39093175+llfalcao@users.noreply.github.com> Co-authored-by: Fanny Chien <fanny.chien@vtex.com>
|
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. |
Externalizing crypto module from vite to correct import it
Added run scripts to run core package. - dev script build script cant be commited as CI would fail cause it needs the cli do be build before, and the cli only runs after the core as it is a direct dep. So turbo doesn't allow circular dependency on scripts
|
Important Review skippedToo many files! This PR contains 281 files, which is 131 over the limit of 150. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (19)
📒 Files selected for processing (281)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Updated dependencies: - "@testing-library/jest-dom" - "@lhci/cli": "^0.15.1", - "@graphql-codegen/cli": 6.1.1 - Updated to V6 as it was triggering warns in respect to their dependencies - [REMOVED] @types/cypress - Its not necessary on our current version of cypress anymore - [REMOVED] "@storybook/addon-interactions": "^8.6.14" - Is part of core storybook package now - [REMOVED] "@storybook/test": "^8.6.14" - Is part of core storybook package now - Removed unnecessary storybook addons that is part of storybook@9. - Migrate packages tests that used jest to vitest, Removed vite configurations and created vitest. - Updated pnpm to latest version stable. [NOW] <img width="1112" height="140" alt="image" src="https://github.com/user-attachments/assets/89d318b8-7ba8-49e9-b1c6-9c3a17a8ff98" /> [BEFORE] <img width="2615" height="350" alt="image" src="https://github.com/user-attachments/assets/29d1cb09-5e58-4add-85fc-e8d72ba065ea" /> - Deps unable to fix: > domexception@1.0.1, glob@7.2.3, inflight@1.0.6, node-domexception@1.0.0, rimraf@2.7.1, rimraf@3.0.2, tar@6.2.1 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Migrated component and SDK test suites from Jest to Vitest, added Vitest configs and centralized setup, and updated tests to use Vitest APIs and matchers. * **Chores** * Upgraded Storybook to 10.2.3 and simplified addons. * Updated development dependencies and package manager entries across packages. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixing sass dart deprecations usage. This Fix deprecations warnings from sass on the new dart version. Caveats: - include-media uses a lot of sass if and this is deprecated, as we cant do anything to fix it right now the warning for this deprecation only was disabled: `if-function` - Next uses a load sass ja api depracated, as we cant change it this warning was also disabled `legacy-js-api` - Before we imported the utilities in every sass file. This increased our style as we include in some files that didnt needed it. now this is not true anymore, any sass usage that require a utility must import it and prefix the mixins and variables with the module name. THIS RESULTS IN A BREAKING CHANGE FOR CLIENTS THAT PRESUME THAT UTILITIES ARE PRESENT AT ALL TIME. BEFORE vs AFTER <img width="1222" height="842" alt="image" src="https://github.com/user-attachments/assets/e371ee89-86c6-418f-8b33-138fd8c6709f" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated styling system to use the Sass module/meta loader and unified how component styles and utilities are applied, improving consistency across responsive and utility-driven styles. * Adjusted Sass importer behavior to improve import resolution and suppress certain deprecation warnings. * **Dependencies** * Upgraded Sass and include-media; reorganized dependency vs. dev/peer placements across packages for clearer runtime vs. development usage. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br>
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Session validation now keeps locale, currency and sales channel in sync for a more consistent user experience. * Made localization settings retrieval available for integrations. * **Chores** * Added diagnostic trace logging to aid debugging. * Enabled production client-side source maps and inline source maps for the SDK build. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request? This PR attempts to fix the duplicate SKU selectors when switching the locales. |before|after| |-|-| |<img width="1446" height="854" alt="image" src="https://github.com/user-attachments/assets/ca45f834-2ec3-4fe5-8167-b6c1409feeac" />|<img width="1349" height="774" alt="image" src="https://github.com/user-attachments/assets/d6ee28eb-f092-4eb1-aa45-747598550a82" />| ## How it works? `mergePdpData` uses deepmerge with overwriteMerge for arrays, then overrides `product.isVariantOf.skuVariants` with the client payload when the client sends skuVariants. That way localized keys in availableVariations are not accumulated across server and client; the client’s skuVariants wins and the UI renders a single selector block. ## How to test it? - Run the project locally, enabling the localization feature as explained [here](#3093) - Open the Nike Men's Air Max 1 G Spikeless Golf Shoes PDP - Switch the locale to pt-BR or it-IT - It should display one sku selector according to the current locale. https://github.com/user-attachments/assets/ea9f2acb-3d04-4869-b7b2-0cf024904791 ### Starters Deploy Preview [preview link](https://sfj-e5c612c--brandless.preview.vtex.app) [PR](vtex-sites/brandless.store#159) ## References https://vtex-dev.atlassian.net/browse/SFS-3094?atlOrigin=eyJpIjoiYjZmYWFkNTJhYWU2NDA5MzgxNTcyMzBjMzgwYmNlMDMiLCJwIjoiaiJ9 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved product variant data handling to ensure correct merging of SKU information from multiple sources. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Add packages/core/localization.ts and @faststore/core/localization export - Re-export LocalizationButton, LocalizationSelector, useBindingSelector and types from root index - Export LocalizationButtonProps and LocalizationSelectorProps for TypeScript consumers - Document imports in packages/core/README.md - Add public API tests and Vitest plugin for discovery.config.default.js resolution Made-with: Cursor ## What's the purpose of this pull request? <!--- Considering the context, what is the problem we'll solve? Where in VTEX's big picture our issue fits in? Write a tweet about the context and the problem itself. ---> ## How it works? <!--- Tell us the role of the new feature, or component, in its context. Provide details about what you have implemented and screenshots if applicable. ---> ## How to test it? <!--- Describe the steps with bullet points. Is there any external link that can be used to better test it or an example? ---> ### Starters Deploy Preview <!--- Add a link to a deploy preview from `starter.store` with this branch being used. ---> <!--- Tip: You can get an installable version of this branch from the CodeSandbox generated when this PR is created. ---> ## References <!--- Spread the knowledge: is there any content you used to create this PR that is worth sharing? ---> <!--- Extra tip: adding references to related issues or mentioning people important to this PR may be good for the documentation and reviewing process ---> ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Experimental localization UI components and hooks are now exposed; popover placement is configurable. * **Bug Fixes** * Improved popover positioning and placement behavior for portal and non-portal modes. * **Documentation** * Added a Localization API guide and tightened README installation snippet. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: fanny <fanny.chien@vtex.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
## What's the purpose of this pull request? Updates faststore-sdk version - improvements to identify binding errors. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated CLI package dependencies to the latest version. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request? Stores configured with i18n custom paths (e.g. `https://store.com/europe/it`) returned **404** in production whenever the URL did not match the canonical locale code (e.g. `/it-IT`). The same URLs worked locally with `yarn dev`, but failed after `yarn build && yarn start` and on the standalone production deploy. Three independent issues were colliding: 1. **`faststore start` was loading the wrong Next config.** `next start` was being spawned without the `.faststore` directory, so Next loaded a default config from the project root with `i18n = null`. Without `i18n`, the proxy threw `TypeError` on locale rewrites. 2. **Partytown was missing from production builds.** `partytown copylib` only ran via `predev`, so `/~partytown/partytown.js` was never copied into `public/` during `build` and the asset 404'd in production. 3. **Hostname validation was broken in standalone mode.** `request.nextUrl.hostname` resolves to the server bind address (`0.0.0.0` from the `HOSTNAME` env var set by the Dockerfile), not the client-facing host. The proxy compared this against binding hostnames (e.g. `brandless.fast.store`), so all binding rules were skipped and the catch-all returned 404. ## How it works? **1. `packages/cli/src/commands/start.ts`** — pass `tmpDir` (the `.faststore` directory) as a positional argument to `next start`, so it loads the correct `next.config.js` with the `i18n` config derived from `discovery.config.js`. Using a positional arg (instead of changing `cwd`) keeps `next` resolvable from the project root via workspace hoisting. ```ts return spawn(`${packageManager} next start ${tmpDir} -p ${port}`, { ... }) ``` **2. `packages/cli/src/utils/generate.ts`** — mirror `predev` with a `prebuild` hook so Partytown is copied into `public/~partytown/` before the build, ensuring it ships in the standalone output. ```ts predev: 'na run partytown', prebuild: 'na run partytown', ``` **3. `packages/core/src/proxy.ts`** — read the hostname from the `Host` header instead of `request.nextUrl.hostname`, so binding lookup works consistently in both `next start` and standalone (`node server.js`) environments. `shouldValidateHostname` stays enabled. ```ts const { pathname, search } = request.nextUrl // In standalone, request.nextUrl.hostname is the server bind address // (e.g. "0.0.0.0"), not the client-facing host. Use the Host header. const hostname = request.headers.get('host') ``` ## How to test it? The PR is already deployed on `brandless.fast.store`, where both fixes can be verified: - Open <https://brandless.fast.store/europe/it> → page renders correctly (no 404), confirming the custom path is resolved. - DevTools → Network → `GET /~partytown/partytown.js` → **200 OK**, confirming Partytown is shipped with the build. - Response of the page request includes the `x-middleware-rewrite` header pointing to the locale-prefixed path (e.g. `/it-IT/...`). <img width="469" height="134" alt="image" src="https://github.com/user-attachments/assets/49413f43-bbb5-48ba-8fba-0893d3b2bb8a" /> - Canonical locale paths (`/it-IT`, `/en-GB`, `/pt-BR`) keep returning 200 — no regression. ## References - Jira: [SFS-3110 — i18n custom paths](https://vtex-dev.atlassian.net/jira/software/c/projects/SFS/boards/1051?selectedIssue=SFS-3110) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Refactor** * Centralized hostname extraction logic across API endpoints for improved consistency and reliability. * **Tests** * Added comprehensive test suite for hostname normalization utility covering edge cases and fallback scenarios. * **Chores** * Added partytown prebuild script to the build process. * Improved CLI start command execution with better process handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request? Locale switching already worked on live pages backed by the Content Platform data plane, but preview still fetched locale-agnostic content. That made localized preview sessions fall back to default-locale content even when the route and session had already switched locale. This change threads the active Next.js locale through FastStore preview fetching so preview content can resolve the same locale-aware way as live routes. ## How it works? The preview content pipeline now accepts an optional `locale` in FastStore content params and passes it through shared CMS helpers, page loaders, and Content Platform fetches. `ContentService` now forwards locale directly in Content Platform request params, and the shared global sections, landing page, search, and my account loaders now forward `context.locale` whenever preview content is requested. The preview API also accepts an optional `locale` while validating preview content, but preview cookies remain locator-based so locale still comes from the route/request context instead of preview payload state. ## How to test it? - Start FastStore with the companion `client-cp` and `content-platform` locale-preview changes available. - To test locally, you can start start the Control Plane API and set the `controlPlaneApiUrl` in the ClientCP construction on https://github.com/vtex/faststore/blob/feat/locales-on-preview-flow/packages/core/src/server/content/service.ts to your localhost URL. - Enable preview for localized content such as `home`, `landingPage`, `plp`, or `pdp`. - Open the preview page in the default locale and confirm content renders as expected. - Switch to another locale using the locale-prefixed route or the language selector and confirm the preview content changes to the selected locale. - Verify localized preview content is applied to shared global sections as well as the main page content. - Verify preview still works for home, landing pages, PLP, PDP, search, and the account pages that reuse global sections. - Call `/api/preview` with `locale=<locale>` during preview activation and confirm preview enablement still resolves the target content correctly. ### Starters Deploy Preview ## References - [CP-1182](https://vtex-dev.atlassian.net/browse/CP-1182) - Companion `@vtex/client-cp` changes to forward `locale` on control-plane preview requests. - Companion `content-platform` control-plane changes to resolve localized preview payloads and localized preview slugs. ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) [CP-1182]: https://vtex-dev.atlassian.net/browse/CP-1182?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Locale-aware content retrieval propagated to pages, templates, and preview flows for improved multilingual rendering. * **Refactor** * Unified content request context to consolidate preview and locale handling across content fetches and helpers. * **Chores** * Updated core client dependency to a newer release. * **Tests** * Added tests for slug-to-parameter mapping and locale precedence/propagation in content option generation and preview handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request? In Next.js Version 14, domains configuration has been deprecated in favour of remotePatterns. ## How it works? Migrate from images.domains to images.remotePatterns in `next.config.js` file ## How to test it? Locally and in the preview deployment, remote images behave the same as before the images.remotePatterns change (load correctly, no regressions). ### Starters Deploy Preview https://sfj-cfc4309--brandless.preview.vtex.app/ [PR](vtex-sites/brandless.store#160) ## References https://nextjs.org/docs/messages/next-image-unconfigured-host <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated image configuration settings for enhanced compatibility and security with image serving infrastructure. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |
…alization flag (#3296) ## What's the purpose of this pull request? This pull request introduces a conditional check for localization settings in the `validateSession` function to ensure that localization-related session updates only occur when localization is enabled. This helps prevent unnecessary or incorrect modifications to session data when localization is not in use. Session validation improvements: * Added a check for `storeConfig.localization?.enabled` before updating session currency and channel based on localization settings in `validateSession` in `session/index.ts`. [[1]](diffhunk://#diff-290ea657fb800da722fad84e0fc08d57ce2ad6614f0751450af0c10f7a813ddeR143) [[2]](diffhunk://#diff-290ea657fb800da722fad84e0fc08d57ce2ad6614f0751450af0c10f7a813ddeR159) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Enhanced session validation performance by optimizing localization enrichment logic to execute conditionally based on configuration settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
New canary branch with reduced v4 scope