Skip to content

@W-20784635@ Productize base paths#3614

Open
vcua-mobify wants to merge 14 commits intodevelopfrom
feature/productize-path-prefixes
Open

@W-20784635@ Productize base paths#3614
vcua-mobify wants to merge 14 commits intodevelopfrom
feature/productize-path-prefixes

Conversation

@vcua-mobify
Copy link
Contributor

@vcua-mobify vcua-mobify commented Jan 28, 2026

This feature branch contains the work for productizing base path prefixes in PWA and is the amalgamation of the following:

#3590 - Move envBasePath into ssrParameters
#3615 - Support adding base paths to shopper facing urls
#3666 - Storefront preview support / address base path duplication in preview url

Aside from the above 3 PRs, this PR contains an update to the Refresh component that was missed in #3666 .

vcua-mobify and others added 2 commits January 23, 2026 11:24
* Move envBasePath into ssrParameters

* Apply MRT restrictions on supported base paths

* Update changelogs

* one more changelog

* Update express.test.js

* Remove whitespace trimming

* Remove test base path

* Add comment
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jan 28, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@vcua-mobify vcua-mobify changed the title @W-20784635@ Support adding base paths to shopper facing URLs @W-20784635@ Productize base paths Jan 28, 2026
vcua-mobify and others added 8 commits January 30, 2026 13:55
* Add base path to react router routes

* Handle basename for urls that bypass react router

* Add a feature toggle for app base names

* Add tests

* Update config templates

* Rename getBasename to getRouterBasePath

* Update changelogs

* Test fixes

* Remove unused import and cleanup comments

* Apply suggestions

* Clean up redundant code
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
…ed urls (#3666)

* Address base path duplication

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Apply suggestions

* Fix unwanted basePath removal if base path is a substring

* Lint

* Add console warn
Copy link
Contributor Author

@vcua-mobify vcua-mobify Mar 7, 2026

Choose a reason for hiding this comment

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

Being a bit naughty here. The changes in this file should've been a part of #3666 but was missed. Since this is a feature branch and a really tiny change, I just merged it in rather than opening a new PR.

The changes here mirror the changes that #3666 made to the storefront preview component

vcua-mobify and others added 3 commits March 6, 2026 17:24
Signed-off-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com>
@vcua-mobify vcua-mobify requested a review from adamraya March 9, 2026 22:04
history[action](path, ...args)
const basePath = getBasePath?.() ?? ''
const pathWithoutBase = removeBasePathFromLocation(path, basePath)
history[action](pathWithoutBase, ...args)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to exclude basePath in this navigate? (I probably missed the context of this)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was a part of #3666 .

The history API is a part of react router so when it is invoked with a path, react router will automatically append the base path (set as the basename prop on the Router).

If we don't remove the base path, then react router will add a duplicate base path.

It's the same issue that we fixed in sf-next in this PR: https://github.com/commerce-emu/storefront-next/pull/1050

## v5.2.0-dev
- Update storefront preview to support base paths [#3666](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3666)

## v5.1.0-dev
Copy link
Contributor

Choose a reason for hiding this comment

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

Two -dev versions? Does not seem right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was because 5.1.0-dev corresponds with 3.17.0. Since this is not aimed at the 3.17 release, it's a separate version.

- Move envBasePath into ssrParameters [#3590](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3590)
- Support adding base paths to shopper facing URLs [#3615](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3615)

## v3.17.0-dev
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have two -dev changelog here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm getting a bit ahead of the versioning since 3.17.0 is now in preview. This change isn't making the 3.17 release so it's under a new version.

unandyala
unandyala previously approved these changes Mar 9, 2026
@vcua-mobify vcua-mobify marked this pull request as ready for review March 9, 2026 22:41
@vcua-mobify vcua-mobify requested a review from a team as a code owner March 9, 2026 22:41

useEffect(() => {
if (enabled && isHostTrusted) {
if (process.env.NODE_ENV !== 'production' && !getBasePath) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add a guard to check if basePath is enabled showBasePath so we avoid printing the warning on all sites that don't use basePath

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.

5 participants