SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 124 forks source link

[FEATURE] Support multiple `siteAliases` for a B2C Commerce Site #1816

Open johnboxall opened 1 month ago

johnboxall commented 1 month ago

The PWA Kit's support for Multiple B2C Commerce sites could be improved by allowing sites to define an array of aliases rather than one:

TODAY

// config/default.js
modules.exports {
  siteAliases: {
    RefArchGlobal: 'global'
  }
}

TOMORROW

// config/default.js
modules.exports {
  siteAliases: {
    RefArchGlobal: ['de', 'mx', 'fr']
  }
}

This approach is common when using a international B2C Commerce site to serve a number of different countries.

It would likely also be nessecary to add additional metadata to site.js to allow the correct locacle to be selected, though perhaps that could also live in a more complex "alias".

https://github.com/SalesforceCommerceCloud/pwa-kit/blob/develop/packages/template-retail-react-app/config/default.js https://github.com/SalesforceCommerceCloud/pwa-kit/blob/develop/packages/template-retail-react-app/config/sites.js

alexvuong commented 1 month ago

@johnboxall In pwa-kit we do have util to build the url based on this settings, I am wondering if we allow this settings, how should we know which alias to choose from this list to build the urls here? E.g When the site is RefArchGlobal, how can we determine which aliases ('de', 'mx', or 'fr')to pick here? 🤔